From owner-freebsd-net@freebsd.org Thu Feb 25 15:39:43 2021 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E45F566E3A for ; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4DmcRM3vrxz4tSr for ; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 8614F566E39; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) Delivered-To: net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84515567021 for ; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DmcRM3HDxz4tmC for ; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6326919EAE for ; Thu, 25 Feb 2021 15:39:43 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 11PFdhdh052062 for ; Thu, 25 Feb 2021 15:39:43 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 11PFdhiE052061 for net@FreeBSD.org; Thu, 25 Feb 2021 15:39:43 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f 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 Date: Thu, 25 Feb 2021 15:39:43 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: denny@geekhold.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: net@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2021 15:39:43 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D218508 Denton Gentry changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |denny@geekhold.com --- Comment #2 from Denton Gentry --- 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.=