Skip to content

Commit

Permalink
Abandon setting hairpin mode if finding the peer interface fails
Browse files Browse the repository at this point in the history
Instead of setting it on every bridge-connected interface which may
have unwanted effects on unrelated things installed on the machine.
  • Loading branch information
bboreham committed Dec 6, 2016
1 parent c3a2cc5 commit 0cfd09e
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions pkg/kubelet/network/hairpin/hairpin.go
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0cfd09e

Please sign in to comment.