Date: Thu, 25 Feb 2021 15:39:43 +0000 From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 218508] Tunneling and aliases using the tun device, reusing a destination address works with IPv4, but not IPv6 Message-ID: <bug-218508-7501-o1eYR1WIcc@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-218508-7501@https.bugs.freebsd.org/bugzilla/> References: <bug-218508-7501@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218508 Denton Gentry <denny@geekhold.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |denny@geekhold.com --- Comment #2 from Denton Gentry <denny@geekhold.com> --- We've been encountering this in https://github.com/tailscale/tailscale/issues/1307 The problem occurs because rtrequest1_fib returns EEXIST. root@freebsd12:~ # dtrace -n 'fbt:::return /(int)arg1 =3D=3D EEXIST / { sta= ck(); }' -c "ifconfig tun0 inet6 fd7a:115c:a1e0:ab12:4843:cd96:625c:1f1b fd7a:115c:a1e0:ab12:4843:cd96:625c:1f1b prefixlen 128" dtrace: description 'fbt:::return ' matched 29364 probes ifconfig: ioctl (SIOCAIFADDR): File exists dtrace: pid 1175 exited with status 1 CPU ID FUNCTION:NAME 1 52657 rtrequest1_fib:return kernel`rtinit+0x421 kernel`in6_update_ifa+0xc6b kernel`in6_control+0x96f kernel`ifioctl+0x47f kernel`kern_ioctl+0x2b7 kernel`sys_ioctl+0xfa kernel`amd64_syscall+0x387 kernel`0xffffffff8106785e That happens because rn_addroute returns NULL: rn_addroute(void *v_arg, void *n_arg, struct radix_head *head, struct radix_node treenodes[2]) ... /* * Deal with duplicated keys: attach node to previous instance */ saved_tt =3D tt =3D rn_insert(v, head, &keyduplicated, treenodes); if (keyduplicated) { for (t =3D tt; tt; t =3D tt, tt =3D tt->rn_dupedkey) { #ifdef RADIX_MPATH /* permit multipath, if enabled for the family */ ... #endif if (tt->rn_mask =3D=3D netmask) return (0); There is a bunch of code within the #ifdef RADIX_MPATH block above. Enabling RADIX_MPATH in the kernel config does allow the tun0 address assignment to succeed, though I haven't fully tested if it works as expected. It looks like this behavior was understood, in a comment in sys/netinet6/in6.c:in6_notify_ifa from 2004: /* * If a new destination address is specified for a point-to-point * interface, install a route to the destination as an interface * direct route. * XXX: the logic below rejects assigning multiple addresses on a p= 2p. * interface that share the same destination. */ plen =3D in6_mask2len(&ia->ia_prefixmask.sin6_addr, NULL); /* XXX */ if (!(ia->ia_flags & IFA_ROUTE) && plen =3D=3D 128 && ia->ia_dstaddr.sin6_family =3D=3D AF_INET6) { --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-218508-7501-o1eYR1WIcc>