@@ -230,7 +230,12 @@ func (m *FlowFetcher) AttachTCX(iface ifaces.Interface) error {
230230 Interface : iface .Index ,
231231 })
232232 if err != nil {
233- return fmt .Errorf ("failed to attach TCX egress: %w" , err )
233+ if errors .Is (err , fs .ErrExist ) {
234+ // The interface already has a TCX egress hook
235+ log .WithField ("iface" , iface .Name ).Debug ("interface already has a TCX egress hook ignore" )
236+ } else {
237+ return fmt .Errorf ("failed to attach TCX egress: %w" , err )
238+ }
234239 }
235240 m .egressTCXLink [iface ] = egrLink
236241 ilog .WithField ("interface" , iface .Name ).Debug ("successfully attach egressTCX hook" )
@@ -243,7 +248,12 @@ func (m *FlowFetcher) AttachTCX(iface ifaces.Interface) error {
243248 Interface : iface .Index ,
244249 })
245250 if err != nil {
246- return fmt .Errorf ("failed to attach TCX ingress: %w" , err )
251+ if errors .Is (err , fs .ErrExist ) {
252+ // The interface already has a TCX ingress hook
253+ log .WithField ("iface" , iface .Name ).Debug ("interface already has a TCX ingress hook ignore" )
254+ } else {
255+ return fmt .Errorf ("failed to attach TCX ingress: %w" , err )
256+ }
247257 }
248258 m .ingressTCXLink [iface ] = ingLink
249259 ilog .WithField ("interface" , iface .Name ).Debug ("successfully attach ingressTCX hook" )
@@ -928,7 +938,12 @@ func (p *PacketFetcher) AttachTCX(iface ifaces.Interface) error {
928938 Interface : iface .Index ,
929939 })
930940 if err != nil {
931- return fmt .Errorf ("failed to attach PCA TCX egress: %w" , err )
941+ if errors .Is (err , fs .ErrExist ) {
942+ // The interface already has a TCX egress hook
943+ log .WithField ("iface" , iface .Name ).Debug ("interface already has a TCX PCA egress hook ignore" )
944+ } else {
945+ return fmt .Errorf ("failed to attach PCA TCX egress: %w" , err )
946+ }
932947 }
933948 p .egressTCXLink [iface ] = egrLink
934949 ilog .WithField ("interface" , iface .Name ).Debug ("successfully attach PCA egressTCX hook" )
@@ -941,7 +956,12 @@ func (p *PacketFetcher) AttachTCX(iface ifaces.Interface) error {
941956 Interface : iface .Index ,
942957 })
943958 if err != nil {
944- return fmt .Errorf ("failed to attach PCA TCX ingress: %w" , err )
959+ if errors .Is (err , fs .ErrExist ) {
960+ // The interface already has a TCX ingress hook
961+ log .WithField ("iface" , iface .Name ).Debug ("interface already has a TCX PCA ingress hook ignore" )
962+ } else {
963+ return fmt .Errorf ("failed to attach PCA TCX ingress: %w" , err )
964+ }
945965 }
946966 p .ingressTCXLink [iface ] = ingLink
947967 ilog .WithField ("interface" , iface .Name ).Debug ("successfully attach PCA ingressTCX hook" )
0 commit comments