Skip to content

Commit

Permalink
pkg/sensors: TcUnloader do not detach on unpin false
Browse files Browse the repository at this point in the history
Same as previous commit for tc unloader.

Signed-off-by: Mahe Tardy <[email protected]>
  • Loading branch information
mtardy committed Jan 29, 2025
1 parent b4815d7 commit b02c598
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions pkg/sensors/unloader/unloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,15 @@ type TcAttachment struct {
IsIngress bool
}

func (tu TcUnloader) Unload(_ bool) error {
for _, att := range tu.Attachments {
if err := detachTC(att.LinkName, att.IsIngress); err != nil {
return err
func (tu TcUnloader) Unload(unpin bool) error {
// PROG_ATTACH does not return any link, so there's nothing to unpin,
// but we must skip the detach operation for 'unpin == false' otherwise
// the pinned program will be un-attached
if unpin {
for _, att := range tu.Attachments {
if err := detachTC(att.LinkName, att.IsIngress); err != nil {
return err
}
}
}
return nil
Expand Down

0 comments on commit b02c598

Please sign in to comment.