From a612829dc95a30df9210c9888671d3a6b2610808 Mon Sep 17 00:00:00 2001 From: hangzhouwanjun <44429696+hangzhouwanjun@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:50:21 +0800 Subject: [PATCH 1/3] Update host-device.go fix issue https://github.com/containernetworking/plugins/issues/1196 --- plugins/main/host-device/host-device.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/plugins/main/host-device/host-device.go b/plugins/main/host-device/host-device.go index 8a101fe03..76fc1bea3 100644 --- a/plugins/main/host-device/host-device.go +++ b/plugins/main/host-device/host-device.go @@ -211,6 +211,14 @@ func cmdDel(args *skel.CmdArgs) error { if err != nil { return err } + + // reboot node no containerNs, first ipam del avoid ip leak + if cfg.IPAM.Type != "" { + if err := ipam.ExecDel(cfg.IPAM.Type, args.StdinData); err != nil { + return err + } + } + if args.Netns == "" { return nil } @@ -220,12 +228,6 @@ func cmdDel(args *skel.CmdArgs) error { } defer containerNs.Close() - if cfg.IPAM.Type != "" { - if err := ipam.ExecDel(cfg.IPAM.Type, args.StdinData); err != nil { - return err - } - } - if !cfg.DPDKMode { if err := moveLinkOut(containerNs, args.IfName); err != nil { return err From 12be742454f5029f33948a1b3604aff868463fd7 Mon Sep 17 00:00:00 2001 From: hangzhouwanjun <44429696+hangzhouwanjun@users.noreply.github.com> Date: Thu, 7 Aug 2025 16:08:08 +0800 Subject: [PATCH 2/3] Update host-device.go format --- plugins/main/host-device/host-device.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/host-device/host-device.go b/plugins/main/host-device/host-device.go index 76fc1bea3..8b87a3988 100644 --- a/plugins/main/host-device/host-device.go +++ b/plugins/main/host-device/host-device.go @@ -214,7 +214,7 @@ func cmdDel(args *skel.CmdArgs) error { // reboot node no containerNs, first ipam del avoid ip leak if cfg.IPAM.Type != "" { - if err := ipam.ExecDel(cfg.IPAM.Type, args.StdinData); err != nil { + if err := ipam.ExecDel(cfg.IPAM.Type, args.StdinData); err != nil { return err } } From e515107a2beb2260e75d3515c6aa456e371b0af7 Mon Sep 17 00:00:00 2001 From: hangzhouwanjun <44429696+hangzhouwanjun@users.noreply.github.com> Date: Mon, 11 Aug 2025 08:26:08 +0000 Subject: [PATCH 3/3] host-device causes ip leak after reboot node Fixes #1196 --- plugins/main/host-device/host-device.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/main/host-device/host-device.go b/plugins/main/host-device/host-device.go index 8b87a3988..2d515d572 100644 --- a/plugins/main/host-device/host-device.go +++ b/plugins/main/host-device/host-device.go @@ -212,7 +212,7 @@ func cmdDel(args *skel.CmdArgs) error { return err } - // reboot node no containerNs, first ipam del avoid ip leak + // reboot node there no containerNs, first ipam del avoid ip leak if cfg.IPAM.Type != "" { if err := ipam.ExecDel(cfg.IPAM.Type, args.StdinData); err != nil { return err