mirror of
https://github.com/cloudnativelabs/kube-router.git
synced 2025-11-19 12:01:17 +01:00
skip binding device to ipip tunnel if node's interface is loopback
This commit is contained in:
parent
184976a536
commit
1db19931a2
@ -666,9 +666,14 @@ func (nrc *NetworkRoutingController) setupOverlayTunnel(tunnelName string, nextH
|
|||||||
// an error here indicates that the the tunnel didn't exist, so we need to create it, if it already exists there's
|
// an error here indicates that the the tunnel didn't exist, so we need to create it, if it already exists there's
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out, err = exec.Command(
|
cmdArgs := []string{"tunnel", "add", tunnelName, "mode", "ipip", "local", nrc.nodeIP.String(), "remote",
|
||||||
"ip", "tunnel", "add", tunnelName, "mode", "ipip", "local", nrc.nodeIP.String(), "remote",
|
nextHop.String()}
|
||||||
nextHop.String(), "dev", nrc.nodeInterface).CombinedOutput()
|
// need to skip binding device if nrc.nodeInterface is loopback, otherwise packets never leave
|
||||||
|
// from egress interface to the tunnel peer.
|
||||||
|
if nrc.nodeInterface != "lo" {
|
||||||
|
cmdArgs = append(cmdArgs, []string{"dev", nrc.nodeInterface}...)
|
||||||
|
}
|
||||||
|
out, err := exec.Command("ip", cmdArgs...).CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("route not injected for the route advertised by the node %s "+
|
return nil, fmt.Errorf("route not injected for the route advertised by the node %s "+
|
||||||
"Failed to create tunnel interface %s. error: %s, output: %s",
|
"Failed to create tunnel interface %s. error: %s, output: %s",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user