Bug 263986 - IPv6 address gets detached when using multiple IPv6 routers
Summary: IPv6 address gets detached when using multiple IPv6 routers
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.0-RELEASE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-net (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-15 12:08 UTC by Filipe Mendonça
Modified: 2022-08-10 22:17 UTC (History)
5 users (show)

See Also:


Attachments
workaround/wild hack when using ULA (1.48 KB, patch)
2022-08-05 12:52 UTC, Frank Behrens
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Filipe Mendonça 2022-05-15 12:08:01 UTC
On my LAN, I have 2 routers sending ICMPv6 RA. One is the default gateway advertising the IPv6 global prefix. The other one advertises the IPv6 ULA prefix.

On a FreeBSD host, using the following interface configuration on /etc/rc.conf, the ULA address is marked as detached and its on-link route deleted from the routing table.

ifconfig_em0="DHCP"
ifconfig_em0_ipv6="inet6 accept_rtadv"


# ifconfig em0
em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=481009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWFILTER,NOMAP>
	ether 08:00:27:6b:a5:36
	inet6 fe80::a00:27ff:fe6b:a536%em0 prefixlen 64 scopeid 0x1
	inet6 fd09:xxxx:xxxx:xxxx:a00:27ff:fe6b:a536 prefixlen 64 detached autoconf
	inet6 2001:xxxx:xxxx:xxxx:a00:27ff:fe6b:a536 prefixlen 64 autoconf
	inet 192.168.1.20 netmask 0xffffff00 broadcast 192.168.1.255
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
	nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>


This network setup works fine with other OS.


The RA message details are the following:

# rdisc6 em0
Soliciting ff02::2 (ff02::2) on em0...

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :           No
Mobile home agent         :           No
Router preference         :       medium
Neighbor discovery proxy  :           No
Router lifetime           :            0 (0x00000000) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Prefix                   : fd09:xxxx:xxxx:xxxx::/64
  On-link                 :          Yes
  Autonomous address conf.:          Yes
  Valid time              :       180000 (0x0002bf20) seconds
  Pref. time              :        90000 (0x00015f90) seconds
 Route                    : fd09:xxxx:xxxx::/60
  Route preference        :       medium
  Route lifetime          :         1800 (0x00000708) seconds
 Source link-layer address: XX:XX:XX:B0:FA:F4
 from fe80::x:x:feb0:faf4

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :          Yes
Mobile home agent         :           No
Router preference         :          low
Neighbor discovery proxy  :           No
Router lifetime           :         1800 (0x00000708) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Prefix                   : 2001:xxxx:xxxx:xxxx::/64
  On-link                 :          Yes
  Autonomous address conf.:          Yes
  Valid time              :        90000 (0x00015f90) seconds
  Pref. time              :        90000 (0x00015f90) seconds
 Route                    : 2001:xxxx:xxxx:xxxx::/64
  Route preference        :         high
  Route lifetime          :        90000 (0x00015f90) seconds
 Source link-layer address: 00:XX:XX:9E:1D:2F
 from fe80::x:x:fe9e:1d2f
Comment 1 Tatsuki Makino 2022-05-19 21:11:54 UTC
memorandum: RFC 4861 6.3.4.
Comment 2 Frank Behrens 2022-08-05 12:52:44 UTC
Created attachment 235692 [details]
workaround/wild hack when using ULA

I confirm the bug, I detected the same. When the validity of prefix/address/router is checked, the own router advertisements and static address assignments are not considered.

The attached patch does not fix the problem, but works for me as a workaround, because I use a unique local address for the FreeBSD router. That should also work for the original bug reporter. The patch does not prevent the change of address state to "detached", but keeps the route working and allows a static address with same prefix.
Comment 3 Hiroki Sato freebsd_committer freebsd_triage 2022-08-08 02:38:02 UTC
(In reply to Filipe Mendonça from comment #0)

The router for the prefix fd09:xxxx:xxxx:xxxx::/64 has zero router lifetime.
This excludes the router from the default router list, and the advertised
prefix is marked as detached.

This should be fixed if you have non-zero lifetime RAs from
the router.  Do you intentionally configure the router so that it emits
zero-lifetime RAs?
Comment 4 Frank Behrens 2022-08-08 10:32:31 UTC
(In reply to Hiroki Sato from comment #3)
In my case I have also a router lifetime of 0.
The reason is that the FreeBSD router is only responsible for the ULA prefix and is the gateway for this and one other prefix. It is not the default router in the segment.

From RFC4861: "A Lifetime of 0 indicates that the router is not a default router and SHOULD NOT appear on the default router list. The Router Lifetime applies only to the router's usefulness as a default router; it does not apply to information contained in other message fields or options."
Comment 5 Hiroki Sato freebsd_committer freebsd_triage 2022-08-08 21:19:56 UTC
(In reply to Frank Behrens from comment #4)

Do you have a result of the "ndp -p" command when observing the detached address?  I would like to know how the prefix was recognized to narrow down the cause.  I guess it has D flag and is treated as unreachable for some reason.
Comment 6 Frank Behrens 2022-08-09 08:20:21 UTC
(In reply to Hiroki Sato from comment #5)

Your are right, (without my patch) the state switches from initial

fdxx:xxxx:xxx:xxxx::/64 if=net3
flags=LO vltime=infinity, pltime=infinity, expire=Never, ref=1
  No advertising router

to
  
fdxx:xxxx:xxx:xxxx::/64 if=net3
flags=LAD vltime=360000, pltime=36000, expire=%s, ref=2
  No advertising router
Comment 7 Filipe Mendonça 2022-08-10 22:15:01 UTC
(In reply to Hiroki Sato from comment #3)

Like Frank's cenario, my ULA prefix router has a zero Router Lifetime due not being a default router for the segment. It is only responsible for the ULA prefix.
Comment 8 Filipe Mendonça 2022-08-10 22:17:30 UTC
(In reply to Hiroki Sato from comment #5)

Here's my output of "ndp -p" command:

# ndp -p
2001:xxxx:xxxx:xxxx::/64 if=em0
flags=LAO vltime=90000, pltime=90000, expire=1d0h58m24s, ref=1
  advertised by
    fe80::x:x:fe9e:1d2f%em0 (reachable)
fd09:xxxx:xxxx:xxxx::/64 if=em0
flags=LAD vltime=180000, pltime=90000, expire=2d1h57m38s, ref=1
  No advertising router
fe80::%em0/64 if=em0
flags=LAO vltime=infinity, pltime=infinity, expire=Never, ref=1
  No advertising router
fe80::%lo0/64 if=lo0
flags=LAO vltime=infinity, pltime=infinity, expire=Never, ref=1
  No advertising router