FS#26370 - [netcfg] IPv6 SLAAC address/route bug

Attached to Project: Arch Linux
Opened by Evan Callicoat (Apsu) - Monday, 10 October 2011, 03:01 GMT
Last edited by Jouke Witteveen (jouke) - Friday, 11 May 2012, 19:44 GMT
Task Type Bug Report
Category Arch Projects
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
If you are running a dual-stack (IPv4 and IPv6) configuration through netcfg with a SLAAC router and you only specify the IP= variable, but not the IP6= variable, the code at line 141 of /usr/lib/network/connections/ethernet will set the accept_ra sysctl to 0 (off) for the interface, but this occurs *after* the interface is brought up and some other setup code is run. It turns out that the delay between those two points is sufficient for a router solicitation and router advertisement to occur, which gives the interface an IPv6 address and IPv6 default route for whatever lifetime(s) the router is configured to advertise. This will make the autoconfigured adapter work on IPv6, until the leases time out, which will occur because no new router advertisements will be processed due to the sysctl.

While the expected behavior in the case of not specifying "IP6" might make sense to disable SLAAC adverts, this bit of code needs to be moved up to occur *before* the interface is upped (line 25), so no solicitation/advertisement handshake is completed. Alternatively, perhaps this is not or shouldn't be the expected behavior and accept_ra=0 shouldn't be the default without IP6 specified, perhaps instead defaulting to the same behavior as specifying 'stateless', which is more in line with the default on other operating systems/linux distros.

Additional info:
* package version(s)
- 2.6.8-1
* config and/or log files etc.
- /usr/lib/network/connections/ethernet

Steps to reproduce:
* Copy one of the /etc/network.d/examples/ethernet-* files to /etc/network.d
* Edit the file appropriately for IPv4 config (static, dhcp, etc), but do not uncomment/set the IP6 variable
* netcfg up the profile on a network with a working SLAAC router (such as linux using radvd)
* Observe with ip -6 a/ip -6 r that the advertised prefix/route IPs are present
* Wait until lifetime expires, or monitor adverts with radvdump, observing that the prefix/route IPs don't refresh/ultimately expire.
This task depends upon

Closed by  Jouke Witteveen (jouke)
Friday, 11 May 2012, 19:44 GMT
Reason for closing:  Fixed
Additional comments about closing:  thanks
Comment by Dan McGee (toofishes) - Thursday, 13 October 2011, 22:46 GMT
+1 for not disabling RA acceptance at all; I don't think this makes much sense. I didn't even realize this is why my IPv6 addresses are disappearing until I saw this bug, totally non-intuitive.
Comment by Rémy Oudompheng (remyoudompheng) - Saturday, 15 October 2011, 11:59 GMT
I suggest that:
* empty $IP6 is a no-op and does nothing
* IP6=no sets accept_ra to 0 as well as run ip -6 addr flush dev "$INTERFACE", is it ok ?
Comment by Evan Callicoat (Apsu) - Saturday, 15 October 2011, 17:11 GMT
I think that could work, Rémy, but I think there's a better way that covers more of the behavior I would expect from setting IP6=no. There's another sysctl, net.ipv6.conf.{all,default,[ifs]}.disable_ipv6. Setting it to 1 flushes v6 addresses (including link-local) from the interface(s), stops it from gaining a link-local again, and if the sysctl is set before the interface comes up it should prevent the interface from performing *any* communication on v6, including sending router and neighbor solicitations.
Comment by Christoph Vigano (kritztopf) - Monday, 06 February 2012, 19:35 GMT
I have made the changes suggested by Remy and Evan:
- turn undefined IP6 into a nop
- before the interface is brought up, check for IP6 = "no" and if so set disable_ipv6=1

The patch is attached, I'm setting up a public repo at github for collecting patches and bugfixes as I want to revive netcfg and eventually become it's maintainer :)

Greetings,
Christoph

Loading...