From: Stefan Junker Date: Wed, 2 Mar 2016 11:54:43 +0000 (+0100) Subject: plugins/loopback: take lo down on CmdDel X-Git-Url: https://git.halfball.org/?a=commitdiff_plain;h=52be8aa6155854d053e272a080103ebec17dae28;p=plugins.git plugins/loopback: take lo down on CmdDel --- diff --git a/plugins/main/loopback/loopback.go b/plugins/main/loopback/loopback.go index eb02eb1..b4e06bd 100644 --- a/plugins/main/loopback/loopback.go +++ b/plugins/main/loopback/loopback.go @@ -33,7 +33,24 @@ func cmdAdd(args *skel.CmdArgs) error { } func cmdDel(args *skel.CmdArgs) error { - // del does nothing, we're going to destroy the device anyway + args.IfName = "lo" // ignore config, this only works for loopback + err := ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error { + link, err := netlink.LinkByName(args.IfName) + if err != nil { + return err // not tested + } + + err = netlink.LinkSetDown(link) + if err != nil { + return err // not tested + } + + return nil + }) + if err != nil { + return err // not tested + } + return nil }