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

Enable IPv6 support when creating Linux interfaces #1308

Closed
nickolaev opened this issue May 2, 2019 · 6 comments
Closed

Enable IPv6 support when creating Linux interfaces #1308

nickolaev opened this issue May 2, 2019 · 6 comments
Assignees
Milestone

Comments

@nickolaev
Copy link

In plugins/linux/ifplugin/descriptor/interface.go method Create the ip addresses of the injected interfaces are set in this loop:

	for _, ipAddress := range ipAddresses {
		err = d.ifHandler.AddInterfaceIP(hostName, ipAddress)
		// an attempt to add already assign IP is not considered as error
		if err != nil && syscall.EEXIST != err {
			err = errors.Errorf("failed to add IP address %v to linux interface %s: %v",
				ipAddress, linuxIf.Name, err)
			d.log.Error(err)
			return nil, err
		}
	}

However, due to containernetworking/cni#531, it is impossible to set IPv6 addresses. The problem was solved for CNI in containernetworking/plugins#113 for the IPAM CNI plugin. The essential code is here (https://github.com/containernetworking/plugins/blob/master/pkg/ipam/ipam_linux.go#L61):

		// Make sure sysctl "disable_ipv6" is 0 if we are about to add
		// an IPv6 address to the interface
		if !has_enabled_ipv6 && ipc.Version == "6" {
			// Enabled IPv6 for loopback "lo" and the interface
			// being configured
			for _, iface := range [2]string{"lo", ifName} {
				ipv6SysctlValueName := fmt.Sprintf(DisableIPv6SysctlTemplate, iface)

				// Read current sysctl value
				value, err := sysctl.Sysctl(ipv6SysctlValueName)
				if err != nil || value == "0" {
					// FIXME: log warning if unable to read sysctl value
					continue
				}

				// Write sysctl to enable IPv6
				_, err = sysctl.Sysctl(ipv6SysctlValueName, "0")
				if err != nil {
					return fmt.Errorf("failed to enable IPv6 for interface %q (%s=%s): %v", iface, ipv6SysctlValueName, value, err)
				}
			}
			has_enabled_ipv6 = true
		}

The code is pretty straightforward and can be used as an inspiration to solve the problem with VPP-agent.

@ondrej-fabry
Copy link
Member

PR #1317 should fix this, please test and close this.

@ondrej-fabry ondrej-fabry self-assigned this May 6, 2019
@rdimitrov
Copy link

hey, @ondrej-fabry: Can you share a docker image that can be used for testing or should build it from scratch? Thanks! 👍

@ondrej-fabry
Copy link
Member

Docker images are built from dev branch automatically, see https://github.com/ligato/vpp-agent/blob/master/README.md#images

Just pull from ligato/vpp-agent:dev.

@rdimitrov
Copy link

Great, thanks! 👍

@rdimitrov
Copy link

hey, @ondrej-fabry. I've tested it and so far it looks great, thanks! 👍
I'll keep an eye for when it gets merged

@ondrej-fabry
Copy link
Member

ondrej-fabry commented May 9, 2019

Okay, I will close this for now. Release v2.1.0 is planned for today, we're just finishing up.

If you run into any other problems please open new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants