Abandon setting hairpin mode if finding the peer interface fails

Instead of setting it on every bridge-connected interface which may
have unwanted effects on unrelated things installed on the machine.
This commit is contained in:
Bryan Boreham 2016-11-17 13:53:05 +00:00 committed by Bryan Boreham
parent c3a2cc5370
commit 0cfd09e161

View File

@ -58,8 +58,7 @@ func setUpContainerInternal(containerInterfaceName, containerDesc string, nsente
e := exec.New()
hostIfName, err := findPairInterfaceOfContainerInterface(e, containerInterfaceName, containerDesc, nsenterArgs)
if err != nil {
glog.Infof("Unable to find pair interface, setting up all interfaces: %v", err)
return setUpAllInterfaces()
return err
}
return setUpInterface(hostIfName)
}
@ -95,17 +94,6 @@ func findPairInterfaceOfContainerInterface(e exec.Interface, containerInterfaceN
return iface.Name, nil
}
func setUpAllInterfaces() error {
interfaces, err := net.Interfaces()
if err != nil {
return err
}
for _, netIf := range interfaces {
setUpInterface(netIf.Name) // ignore errors
}
return nil
}
func setUpInterface(ifName string) error {
glog.V(3).Infof("Enabling hairpin on interface %s", ifName)
ifPath := path.Join(sysfsNetPath, ifName)