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

IPv6: hardcoded address fd00::2 violates RFC 4193 #259

Open
AkihiroSuda opened this issue Mar 2, 2021 · 16 comments
Open

IPv6: hardcoded address fd00::2 violates RFC 4193 #259

AkihiroSuda opened this issue Mar 2, 2021 · 16 comments
Labels
area/ipv6 IPv6 bug Something isn't working help wanted Extra attention is needed

Comments

@AkihiroSuda
Copy link
Member

https://github.com/rootless-containers/slirp4netns/blob/v1.1.9/slirp4netns.1.md

Default configuration:

* MTU:               1500
* CIDR:              10.0.2.0/24
* Gateway/Host:      10.0.2.2    (network address + 2)
* DNS:               10.0.2.3    (network address + 3)
* IPv6 CIDR:         fd00::/64
* IPv6 Gateway/Host: fd00::2
* IPv6 DNS:          fd00::3

According to RFC 4193, the addresses in fd00::/8 seems to need to be random

https://tools.ietf.org/html/rfc4193
https://networkengineering.stackexchange.com/questions/30128/ipv6-ula-vs-link-local

(slirp4netns --enable-ipv6 is still experimental and we can have breaking changes)

@AkihiroSuda AkihiroSuda added the bug Something isn't working label Mar 2, 2021
@AkihiroSuda AkihiroSuda changed the title IPv6: hardcoded address fd00:2 violates RFC 4193 IPv6: hardcoded address fd00::2 violates RFC 4193 Mar 2, 2021
@AkihiroSuda AkihiroSuda added the help wanted Extra attention is needed label Mar 2, 2021
@AkihiroSuda
Copy link
Member Author

@giuseppe Could you take a look? What should we do with this?

@AkihiroSuda AkihiroSuda added the area/ipv6 IPv6 label Mar 2, 2021
@giuseppe
Copy link
Collaborator

giuseppe commented Mar 2, 2021

is it really a risk for slirp4netns though? IPv6 is not routed so there is not really risk of collisions, or do you think we should just pick a random IP to honor the RFC? I am fine if we go this way (and if any problem arises users of slirp4netns can force the IP addr)

@AkihiroSuda
Copy link
Member Author

I think honoring RFC is not necessarily, but probably we will eventually need to support specifying random addr.
Not an urgent task.

pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Apr 12, 2021
pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Apr 16, 2021
- fix listen address;
- list addresses in api call;
- --cidr6 parameter;
- add test;

- fix api test script;
@Luap99
Copy link

Luap99 commented Aug 26, 2021

I think it should pick a random one. For users who want a fixed subnet, a --cidr6 option should be added.

@AkihiroSuda
Copy link
Member Author

@pfandl @Luap99 Anybody of you interested in opening a PR?

@Luap99
Copy link

Luap99 commented Aug 26, 2021

If I can find some time, sure, but probably not in the next few weeks.

@pfandl
Copy link

pfandl commented Aug 26, 2021

@AkihiroSuda do you want just commit pfandl@8cc216f ?

@AkihiroSuda
Copy link
Member Author

Thanks @pfandl for working on this!

  • For compatibility, can we keep the current wrong behavior by default, and opt-in to the correct behavior with a new flag like --ipv6-random? I guess this will help Podman to support older version of slirp4netns and the new version simultaneously (cc @rhatdan)
  • Could you update the man page?
  • Could you use strncpy family rather than strcpy family?
  • Would it be possible to drop dependency on libcrypt?

@pfandl
Copy link

pfandl commented Aug 26, 2021

Thanks @pfandl for working on this!

* For compatibility, can we keep the current wrong behavior by default, and opt-in to the correct behavior with a new flag like `--ipv6-random`? I guess this will help Podman to support older version of slirp4netns and the new version simultaneously (cc @rhatdan)

yes

* Could you update the man page?

yes

* Could you use `strncpy` family rather than `strcpy` family?

yes

* Would it be possible to drop dependency on libcrypt?

Not too sure about that, I tried to mimic the sample code from the RFC
It is not clear to me if this is just a recommendation (at step 4 to compute a SHA1 hash) rather than a requirement. If it is a requirement and somebody knows how to compute the hash without libcrypt i guess we can drop the library, yes.

Can we take the necessary bits from here? https://code.woboq.org/gcc/libiberty/sha1.c.html

Also @AkihiroSuda as stated here #253 (comment) I took the mac of the lo device, which is zero, do you have any idea what we should take instead? See step 2 from the RFC .

@pfandl
Copy link

pfandl commented Aug 29, 2021

@AkihiroSuda can we bump libslirp version? I am already using the hostx_fwd functions and we need a fix there for IPv6 forwarding anyway and I think it would be less work for me to bring all in at once?

@AkihiroSuda
Copy link
Member Author

Yes.

Using #if directive is more preferable, but not necessary if it too much complicates the code.

#if SLIRP_CONFIG_VERSION_MAX >= 3

@AkihiroSuda
Copy link
Member Author

SHA1

Dependency on libcrypt is fine, as it should be available on all distros.

I took the mac of the lo device, which is zero, do you have any idea what we should take instead? See step 2 from the RFC .

Why not take the MAC of tap0?
If the MAC cannot be take, we can just use /dev/urandom.

@pfandl
Copy link

pfandl commented Aug 29, 2021

I think #if will work, thanks for the info. I guess it should be ready coming weekend.

pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
@pfandl
Copy link

pfandl commented Sep 11, 2021

@AkihiroSuda with man page, do you mean README.md?

@AkihiroSuda
Copy link
Member Author

pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- fix listen address;
- list addresses in api call;
- --cidr6 parameter;
- add test;

- fix api test script;

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>

IPv6 test ref rootless-containers#253

Signed-off-by: fassl <[email protected]>

IPv6: pseudo random id generator rootless-containers#259 rootless-containers#253

Signed-off-by: fassl <[email protected]>

IPv6 port forwarding: rootless-containers#259 rootless-containers#253
- fix listen address;
- list addresses in api call;
- --cidr6 parameter;
- add test;

- fix api test script;

Signed-off-by: fassl <[email protected]>

handle protocol version in api: rootless-containers#253 rootless-containers#259

Signed-off-by: fassl <[email protected]>

add --ipv6-random flag: rootless-containers#259

Signed-off-by: fassl <[email protected]>

use strnXXX functions: rootless-containers#259

Signed-off-by: fassl <[email protected]>

try read mac of tap0 and fallback to /dev/Xrandom: rootless-containers#259

Signed-off-by: fassl <[email protected]>

man page and bump libslirp veresion: rootless-containers#259

Signed-off-by: fassl <[email protected]>

fix Docker builds: rootless-containers#259

Signed-off-by: fassl <[email protected]>
pfandl pushed a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- skip ipv6 tests on old libslirp versions
- install openssl-devel on centos box
- use *hostfwd functions on old libslirp versions

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- fix missing SLIRP_CONFIG_VERSION_MAX in test scripts
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 11, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 12, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: fassl <[email protected]>
pfandl added a commit to pfandl/slirp4netns that referenced this issue Sep 12, 2021
- implement forwarding
- implement random CIDR

Signed-off-by: Jasmin Fazlic <[email protected]>
@lel-amri
Copy link

lel-amri commented Dec 4, 2022

I'm late to the party. I prefer slirp4netns to support the RFC.

Thanks for your work, @pfandl. Note that the sample code for generating random Global IDs is just a sample. The minimal requirement is for the number to be pseudo-random. I believe getrandom(2) should answer this need.

Here is the current PR for this issue: #276 (It seems that GitHub did not link them when the new PR was created)

DigitalDJ pushed a commit to DigitalDJ/slirp4netns that referenced this issue Mar 3, 2024
- implement forwarding
- implement random CIDR

Signed-off-by: Jasmin Fazlic <[email protected]>
DigitalDJ pushed a commit to DigitalDJ/slirp4netns that referenced this issue Mar 3, 2024
- implement forwarding
- implement random CIDR

Signed-off-by: Jasmin Fazlic <[email protected]>
DigitalDJ pushed a commit to DigitalDJ/slirp4netns that referenced this issue Apr 26, 2024
- implement forwarding
- implement random CIDR

Signed-off-by: Jasmin Fazlic <[email protected]>
DigitalDJ pushed a commit to DigitalDJ/slirp4netns that referenced this issue May 12, 2024
- implement forwarding
- implement random CIDR

Signed-off-by: Jasmin Fazlic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ipv6 IPv6 bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants