Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated backport of #2651: Enable forwarding on the submariner interfaces #2655

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/cable/vxlan/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ func (v *vxlan) createVxlanInterface(activeEndPoint string, port int) error {
return errors.Wrap(err, "failed to configure vxlan interface ipaddress on the Gateway Node")
}

err = v.netLink.EnableForwarding(VxlanIface)
if err != nil {
return errors.Wrapf(err, "error enabling forwarding on the %q iface", VxlanIface)
}

return nil
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/netlink/fake/netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,10 @@ func (n *basicType) EnsureLooseModeIsConfigured(_ string) error {
return nil
}

func (n *basicType) EnableForwarding(_ string) error {
return nil
}

func (n *basicType) GetReversePathFilter(_ string) ([]byte, error) {
return []byte("2"), nil
}
Expand Down
6 changes: 6 additions & 0 deletions pkg/netlink/netlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type Basic interface {
XfrmPolicyList(family int) ([]netlink.XfrmPolicy, error)
EnableLooseModeReversePathFilter(interfaceName string) error
EnsureLooseModeIsConfigured(interfaceName string) error
EnableForwarding(interfaceName string) error
GetReversePathFilter(interfaceName string) ([]byte, error)
ConfigureTCPMTUProbe(mtuProbe, baseMss string) error
}
Expand Down Expand Up @@ -181,6 +182,11 @@ func (n *netlinkType) EnsureLooseModeIsConfigured(interfaceName string) error {
return fmt.Errorf("loose mode not configured on iface %q", interfaceName)
}

func (n *netlinkType) EnableForwarding(interfaceName string) error {
err := setSysctl("/proc/sys/net/ipv4/conf/"+interfaceName+"/forwarding", []byte("1"))
return errors.Wrapf(err, "unable to update forwarding on interface %q", interfaceName)
}

func (n *netlinkType) GetReversePathFilter(interfaceName string) ([]byte, error) {
path := "/proc/sys/net/ipv4/conf/" + interfaceName + "/rp_filter"

Expand Down
5 changes: 5 additions & 0 deletions pkg/routeagent_driver/handlers/kubeproxy/vxlan.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,10 @@ func (kp *SyncHandler) createVxLANInterface(activeEndPoint string, ifaceType int
return errors.Wrap(err, "failed to configure vxlan interface ipaddress on the Gateway Node")
}

err = kp.netLink.EnableForwarding(VxLANIface)
if err != nil {
return errors.Wrapf(err, "error enabling forwarding on the %q iface", VxLANIface)
}

return nil
}
Loading