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

Check parameter --ip --ip6 --link-local-ip in `docker network connect` #30807

Merged
merged 1 commit into from Mar 6, 2017

Conversation

@chchliang
Contributor

chchliang commented Feb 8, 2017

Signed-off-by: chchliang chen.chuanliang@zte.com.cn

- What I did
Execute docker network connect --ip=aa network1 xxx but successful,i think ip address invalid,should be failure. like --ip6 --link-local-ip
image

- How I did it
To add check code in container/container.go

if epConfig != nil {
ipam := epConfig.IPAMConfig

	if ipam != nil {
		var (
			ipList          []net.IP
			ip, ip6, linkip net.IP
		)

		for _, ips := range ipam.LinkLocalIPs {
			if linkip = net.ParseIP(ips); linkip == nil && ips != "" {
				return nil, fmt.Errorf("Invalid link-local IP address:%s", ipam.LinkLocalIPs)
			}
			ipList = append(ipList, linkip)

		}

		if ip = net.ParseIP(ipam.IPv4Address); ip == nil && ipam.IPv4Address != "" {
			return nil, fmt.Errorf("Invalid IPv4 address:%s)", ipam.IPv4Address)
		}

		if ip6 = net.ParseIP(ipam.IPv6Address); ip6 == nil && ipam.IPv6Address != "" {
			return nil, fmt.Errorf("Invalid IPv6 address:%s)", ipam.IPv6Address)
		}

		createOptions = append(createOptions,
			libnetwork.CreateOptionIpam(ip, ip6, ipList, nil))

	}

	for _, alias := range epConfig.Aliases {
		createOptions = append(createOptions, libnetwork.CreateOptionMyAlias(alias))
	}
}

*- How to verify it
docker network connect --ip=aa network1 59bb1359f671
Error response from daemon: Invalid IPv4 address:aa

@chchliang

This comment has been minimized.

Show comment
Hide comment
@chchliang

chchliang Feb 15, 2017

Contributor

@aboch @mavenugo
This error messages are time out.

Contributor

chchliang commented Feb 15, 2017

@aboch @mavenugo
This error messages are time out.

@tiborvass

This comment has been minimized.

Show comment
Hide comment
@tiborvass

tiborvass Feb 22, 2017

Collaborator

I think this makes sense.

Collaborator

tiborvass commented Feb 22, 2017

I think this makes sense.

Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Show outdated Hide outdated container/container.go Outdated
Check parameter --ip --ip6 --link-local-ip in
Signed-off-by: chchliang <chen.chuanliang@zte.com.cn>
@aboch

This comment has been minimized.

Show comment
Hide comment
@aboch

aboch Feb 23, 2017

Contributor

Looks good to me.

Contributor

aboch commented Feb 23, 2017

Looks good to me.

@tiborvass

This comment has been minimized.

Show comment
Hide comment
@tiborvass

tiborvass Mar 6, 2017

Collaborator

LGTM

Collaborator

tiborvass commented Mar 6, 2017

LGTM

@vdemeester

This comment has been minimized.

Show comment
Hide comment
@vdemeester

vdemeester Mar 6, 2017

Member

LGTM 💃

Member

vdemeester commented Mar 6, 2017

LGTM 💃

@vdemeester vdemeester merged commit de5ca68 into moby:master Mar 6, 2017

4 checks passed

dco-signed All commits are signed
experimental Jenkins build Docker-PRs-experimental 31072 has succeeded
Details
janky Jenkins build Docker-PRs 39685 has succeeded
Details
windowsRS1 Jenkins build Docker-PRs-WoW-RS1 10751 has succeeded
Details

@GordonTheTurtle GordonTheTurtle added this to the 17.04.0 milestone Mar 6, 2017

@chchliang chchliang deleted the chchliang:networkproject branch Sep 16, 2017

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