Commit 6f9a35d6 authored by Dmitry Smirnov's avatar Dmitry Smirnov

Imported Upstream version 0.2.3+dfsg

parent 3995f3d7
......@@ -238,14 +238,29 @@ func cmdDel(args *skel.CmdArgs) error {
return err
}
err = ipam.ExecDel(n.IPAM.Type, args.StdinData)
if err != nil {
if err := ipam.ExecDel(n.IPAM.Type, args.StdinData); err != nil {
return err
}
return ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
return ip.DelLinkByName(args.IfName)
var ipn *net.IPNet
err = ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
var err error
ipn, err = ip.DelLinkByNameAddr(args.IfName, netlink.FAMILY_V4)
return err
})
if err != nil {
return err
}
if n.IPMasq {
chain := utils.FormatChainName(n.Name, args.ContainerID)
comment := utils.FormatComment(n.Name, args.ContainerID)
if err = ip.TeardownIPMasq(ipn, chain, comment); err != nil {
return err
}
}
return nil
}
func main() {
......
......@@ -195,6 +195,10 @@ func cmdDel(args *skel.CmdArgs) error {
return fmt.Errorf("failed to load netconf: %v", err)
}
if err := ipam.ExecDel(conf.IPAM.Type, args.StdinData); err != nil {
return err
}
var ipn *net.IPNet
err := ns.WithNetNSPath(args.Netns, false, func(hostNS *os.File) error {
var err error
......@@ -213,7 +217,7 @@ func cmdDel(args *skel.CmdArgs) error {
}
}
return ipam.ExecDel(conf.IPAM.Type, args.StdinData)
return nil
}
func main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment