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

autogenerated LinkLocalIPv6Address can create two containers with the same ipv6 address #13211

Closed
gissehel opened this issue May 14, 2015 · 4 comments
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.

Comments

@gissehel
Copy link

Description of problem:

When I create containers without specifying any ip or mac address, ipv4, mac address and ipv6 are autogenerated (at least since version 1.5 for ipv6).

It looks like ip v4 and mac address can't conflicts, but you can generate two containers with the same ip v6:

docker version:

Client version: 1.6.1
Client API version: 1.18
Go version (client): go1.4.2
Git commit (client): 97cd073
OS/Arch (client): linux/amd64
Server version: 1.6.1
Server API version: 1.18
Go version (server): go1.4.2
Git commit (server): 97cd073
OS/Arch (server): linux/amd64

docker info:

Containers: 11
Images: 185
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 207
Dirperm1 Supported: false
Execution Driver: native-0.2
Kernel Version: 3.13.0-39-generic
Operating System: Ubuntu 14.04.1 LTS
CPUs: 4
Total Memory: 15.59 GiB
Name: the server's name
ID: KU57:P757:EDQZ:P4Q2:6SF2:MLXX:WY2K:TW62:CX7C:EVHS:DORS:K6ZH
WARNING: No swap limit support

uname -a:

Linux the server's name 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Environment details (AWS, VirtualBox, physical, etc.):

physical server

How reproducible:

Always

Steps to Reproduce:

  • start docker daemon (because it will restart the auto assignation of ips to 172.17.0.1)
  • create 17 containers
  • create a container "test1"
  • create 238 other useless containers
  • create a container "test2"

Expected results based on how ipv6 affectation seems to work in spirit:

name IPv4 mac IPv6
test1 172.17.0.18 02:42:ac:11:00:12 fe80::42:acff:fe11:12
test2 172.17.1.2 02:42:ac:11:01:02 fe80::42:acff:fe11:102

Actual results:

name IPv4 mac IPv6
test1 172.17.0.18 02:42:ac:11:00:12 fe80::42:acff:fe11:12
test2 172.17.1.2 02:42:ac:11:01:02 fe80::42:acff:fe11:12

Additional info:

It seems to me that the problem lies in #8947 in the file daemon/networkdriver/bridge/driver.go with the line:

return fmt.Sprintf("fe80::%x%x:%xff:fe%x:%x%x/64", hw[0], hw[1], hw[2], hw[3], hw[4], hw[5]), nil

which should look like (in spirit, I don't do go):

return fmt.Sprintf("fe80::%x:%x:%x:%x/64", hw[0]*0x100+hw[1], hw[2]*0x100+0xff, 0xfe*0x100+hw[3], hw[4]*0x100+hw[5]), nil

As I never wrote a line of go, I won't create a PR: I prefer to have someone who know what he's doing to do it.

@thaJeztah thaJeztah added Networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. labels May 14, 2015
@thaJeztah
Copy link
Member

Thanks for reporting this, and researching! As you might know, networking will get a major overhaul in Docker 1.7 with the integration of libnetwork. However, we're not there yet, so I'll include people from both "old" and "new" (libnetwork) here.

ping @MalteJ @mrjana @LK4D4

MalteJ added a commit to MalteJ/docker that referenced this issue May 14, 2015
Kudos to gissehel for his great work on investigation and the fabulous bug report!

Signed-off-by: Malte Janduda <mail@janduda.net>
@MalteJ
Copy link
Contributor

MalteJ commented May 14, 2015

@gissehel thank you very much for your great work!
With your analysis I could write a fix really fast. I have opened a Pull Request.

BTW: Your code was quite good - it just has raised a type mismatch error. The hw array holds bytes (8 Bit) that cannot be multiplied with 0x100 (> 8 Bits), so I have had to cast the hw entities to int. Apart from that your code proposal is working. You really should write some Go code and contribute to Docker 😉

Thanks!

@aboch
Copy link
Contributor

aboch commented Jan 12, 2016

As explained by @mrjana in #13226 (comment), link local IPv6 generation is now left to linux (libnetwork will just construct the MAC from the IPv4) and this issue no longer exists in current docker (at least since 1.7).

See o/p from latest docker:

$ ./docker run --rm --net nw2 --ip 172.18.1.2 busybox ifconfig
eth0      Link encap:Ethernet  HWaddr 02:42:AC:12:01:02  
          inet addr:172.18.1.2  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::42:acff:fe12:102/64 Scope:Link    <===
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:180 (180.0 B)  TX bytes:168 (168.0 B)

Therefore I am suggesting to close this issue.
ping @thaJeztah

@thaJeztah
Copy link
Member

Thanks @aboch, I'll close this issue, but @gissehel feel free to comment after I've closed 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/networking kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants