@@ -206,24 +206,18 @@ func (b *BPF) AttachKprobes() error {
206
206
return fmt .Errorf (": %w" , err )
207
207
}
208
208
209
- if b .skipAttachCgroup {
210
- err = b .attachFentryOrKprobe ("tcp_sendmsg" ,
211
- b .objs .FentryTcpSendmsg , b .objs .KprobeTcpSendmsg )
212
- if err != nil {
213
- return fmt .Errorf (": %w" , err )
214
- }
215
-
216
- err = b .attachFentryOrKprobe ("udp_send_skb" , b .objs .FentryUdpSendSkb , b .objs .KprobeUdpSendSkb )
217
- if err != nil {
218
- log .Infof ("%+v" , err )
219
- if isProbeNotSupportErr (err ) {
220
- err = b .attachFentryOrKprobe ("udp_sendmsg" , b .objs .FentryUdpSendmsg , b .objs .KprobeUdpSendmsg )
221
- if err != nil {
222
- return fmt .Errorf (": %w" , err )
223
- }
224
- } else {
209
+ if err := b .attachFentryOrKprobe ("tcp_sendmsg" , b .objs .FentryTcpSendmsg , b .objs .KprobeTcpSendmsg ); err != nil {
210
+ return fmt .Errorf (": %w" , err )
211
+ }
212
+ if err := b .attachFentryOrKprobe ("udp_send_skb" , b .objs .FentryUdpSendSkb , b .objs .KprobeUdpSendSkb ); err != nil {
213
+ log .Infof ("%+v" , err )
214
+ if isProbeNotSupportErr (err ) {
215
+ err = b .attachFentryOrKprobe ("udp_sendmsg" , b .objs .FentryUdpSendmsg , b .objs .KprobeUdpSendmsg )
216
+ if err != nil {
225
217
return fmt .Errorf (": %w" , err )
226
218
}
219
+ } else {
220
+ return fmt .Errorf (": %w" , err )
227
221
}
228
222
}
229
223
0 commit comments