From nobody Wed Aug 3 09:18:53 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4LyRBC4QnSz4Y3qP; Wed, 3 Aug 2022 09:18:59 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward501p.mail.yandex.net (forward501p.mail.yandex.net [77.88.28.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4LyRBC2d4Pz3G0B; Wed, 3 Aug 2022 09:18:59 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from sas2-cc22fd2335f8.qloud-c.yandex.net (sas2-cc22fd2335f8.qloud-c.yandex.net [IPv6:2a02:6b8:c08:6c82:0:640:cc22:fd23]) by forward501p.mail.yandex.net (Yandex) with ESMTP id 91BF3621313F; Wed, 3 Aug 2022 12:18:56 +0300 (MSK) Received: by sas2-cc22fd2335f8.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id W9wJr66kON-IsiW834H; Wed, 03 Aug 2022 12:18:55 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1659518335; bh=7VkTaOV27It7gYxkJRN9V+Zd1NaKdzGf8eVKYqvkoNw=; h=Message-Id:To:Date:References:Cc:In-Reply-To:From:Subject; b=mWYhMR939KEcJdbYP3W6VTD8CvUphUo4eWQ27UixkcnQDEzKu9JhOJj2UxADdi9Gh pkgNvKuqzbxQEV39gWHhbkPmA4GGzk4sFSPoQqnBbu+HafnUYddauKhJfpXTl3Mm8f X8YFZ5H38m3V1cQPVNJ/b+W7ZzPQIBRLRRitY1o4= Content-Type: text/plain; charset=us-ascii List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: git: 29029b06a6f7 - main - routing: remove info argument from add/change_route_nhop(). From: "Alexander V. Chernikov" In-Reply-To: <20220802194127.3D45EC4@slippy.cwsent.com> Date: Wed, 3 Aug 2022 10:18:53 +0100 Cc: "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <202208010853.2718rMqh090712@gitrepo.freebsd.org> <20220802194127.3D45EC4@slippy.cwsent.com> To: Cy Schubert X-Mailer: Apple Mail (2.3696.100.31) X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Rspamd-Queue-Id: 4LyRBC2d4Pz3G0B X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N > On 2 Aug 2022, at 20:41, Cy Schubert = wrote: >=20 > In message <202208010853.2718rMqh090712@gitrepo.freebsd.org>, = "Alexander V.=20 > Che > rnikov" writes: >> The branch main has been updated by melifaro: >>=20 >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D29029b06a6f7fd51c34c9db88cc98a66= >> 53ee5046 >>=20 >> commit 29029b06a6f7fd51c34c9db88cc98a6653ee5046 >> Author: Alexander V. Chernikov >> AuthorDate: 2022-07-28 13:41:11 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2022-08-01 07:41:07 +0000 >>=20 >> routing: remove info argument from add/change_route_nhop(). >>=20 >> Currently, rt_addrinfo(info) serves as a main "transport" moving >> state between various functions inside the routing subsystem. >> As all of the fields are filled in directly by the customers, it >> is problematic to maintain consistency, resulting in repeated checks >> inside many functions. Additionally, there are multiple ways of >> specifying the same value (RTAX_IFP vs rti_ifp / rti_ifa) and so on. >> With the upcoming nhop(9) kpi it is possible to store all of the >> required state in the nexthops in the consistent fashion, reducing = the >> need to use "info" in the KPI calls. >> Finally, rt_addrinfo structure format was derived from the rtsock = wire >> format, which is different from other kernel routing users or = netlink. >>=20 >> This cleanup simplifies upcoming nhop(9) kpi and netlink = introduction. >>=20 >> Reviewed by: zlei.huang@gmail.com >> Differential Revision: https://reviews.freebsd.org/D35972 >> MFC after: 2 weeks >=20 > Hi, >=20 > Just picking this commit: >=20 > One of these routing commits has caused a panic during setup of gif(4) = to=20 > Tunnelbroker. Sorry for the breakage, should be fixed by 08bb0873ca88. >=20 > <118>Created clone interfaces: gif0 bridge0. > <6>lo0: link state changed to UP > <6>sk0: link state changed to DOWN > <6>xl0: link state changed to DOWN > <6>fxp0: link state changed to DOWN > <6>nfe0: link state changed to DOWN > <6>nfe1: link state changed to DOWN >=20 >=20 > Fatal trap 12: page fault while in kernel mode > cpuid =3D 1; apic id =3D 01 > fault virtual address =3D 0x70 > fault code =3D supervisor read data, page not present > instruction pointer =3D 0x20:0xffffffff80806c66 > stack pointer =3D 0x28:0xfffffe00c43387b0 > frame pointer =3D 0x28:0xfffffe00c4338810 > code segment =3D base 0x0, limit 0xfffff, type 0x1b > =3D DPL 0, pres 1, long 1, def32 0, gran 1 > processor eflags =3D interrupt enabled, resume, IOPL =3D 0 > current process =3D 513 (ifconfig) > trap number =3D 12 > panic: page fault > cpuid =3D 1 > time =3D 1659466745 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame=20 > 0xfffffe00c4338570 > vpanic() at vpanic+0x151/frame 0xfffffe00c43385c0 > panic() at panic+0x43/frame 0xfffffe00c4338620 > trap_fatal() at trap_fatal+0x387/frame 0xfffffe00c4338680 > trap_pfault() at trap_pfault+0x4f/frame 0xfffffe00c43386e0 > calltrap() at calltrap+0x8/frame 0xfffffe00c43386e0 > --- trap 0xc, rip =3D 0xffffffff80806c66, rsp =3D 0xfffffe00c43387b0, = rbp =3D=20 > 0xfffffe > 00c4338810 --- > nhop_get_nhop() at nhop_get_nhop+0x26/frame 0xfffffe00c4338810 > nhop_create_from_info() at nhop_create_from_info+0x20c/frame=20 > 0xfffffe00c4338860 > rib_add_route() at rib_add_route+0x1e9/frame 0xfffffe00c43388e0 > rib_handle_ifaddr_info() at rib_handle_ifaddr_info+0xd7/frame=20 > 0xfffffe00c4338950 > in6_update_ifa() at in6_update_ifa+0xb6d/frame 0xfffffe00c4338ad0 > in6_control() at in6_control+0x83c/frame 0xfffffe00c4338bc0 > ifioctl() at ifioctl+0x7bc/frame 0xfffffe00c4338cc0 > kern_ioctl() at kern_ioctl+0x26d/frame 0xfffffe00c4338d30 > sys_ioctl() at sys_ioctl+0x100/frame 0xfffffe00c4338e00 > amd64_syscall() at amd64_syscall+0x10c/frame 0xfffffe00c4338f30 > fast_syscall_common() at fast_syscall_common+0xf8/frame = 0xfffffe00c4338f30 > --- syscall (54, FreeBSD ELF64, sys_ioctl), rip =3D 0x640bee2d97a, rsp = =3D=20 > 0x640bb37 > 3718, rbp =3D 0x640bb373760 --- > Uptime: 22s > Dumping 370 out of 5089 = MB:..5%..13%..22%..31%..44%..52%..61%..74%..83%..91% >=20 > __curthread () at /opt/src/git-src/sys/amd64/include/pcpu_aux.h:59 > 59 __asm("movq %%gs:%P1,%0" : "=3Dr" (td) : "n" (offsetof(struct=20 > pcpu > , > (kgdb) #0 __curthread () at = /opt/src/git-src/sys/amd64/include/pcpu_aux.h:5 > 9 > #1 dump_savectx () at /opt/src/git-src/sys/kern/kern_shutdown.c:405 > #2 0xffffffff806be738 in dumpsys (di=3D0x0) > at /opt/src/git-src/sys/x86/include/dump.h:87 > #3 doadump (textdump=3D1) at = /opt/src/git-src/sys/kern/kern_shutdown.c:434 > #4 kern_reboot (howto=3D260) at = /opt/src/git-src/sys/kern/kern_shutdown.c:541 > #5 0xffffffff806bec1e in vpanic (fmt=3D, > ap=3Dap@entry=3D0xfffffe00c4338600) > at /opt/src/git-src/sys/kern/kern_shutdown.c:979 > #6 0xffffffff806bea53 in panic (fmt=3D) > at /opt/src/git-src/sys/kern/kern_shutdown.c:903 > #7 0xffffffff80a34bb7 in trap_fatal (frame=3D0xfffffe00c43386f0, = eva=3D112) > at /opt/src/git-src/sys/amd64/amd64/trap.c:942 > #8 0xffffffff80a34c0f in trap_pfault (frame=3D0xfffffe00c43386f0, > usermode=3Dfalse, signo=3D, ucode=3D) > at /opt/src/git-src/sys/amd64/amd64/trap.c:761 > #9 > #10 0xffffffff80806c66 in get_aifp (nh=3D0xfffff8002291a200) > at /opt/src/git-src/sys/net/route/nhop_ctl.c:138 > #11 nhop_get_nhop (nh=3Dnh@entry=3D0xfffff8002291a200, > perror=3Dperror@entry=3D0xfffffe00c4338834) > at /opt/src/git-src/sys/net/route/nhop_ctl.c:319 > #12 0xffffffff8080680c in nhop_create_from_info ( > rnh=3Drnh@entry=3D0xfffff80004924400, = info=3Dinfo@entry=3D0xfffffe00c4338a20, > nh_ret=3Dnh_ret@entry=3D0xfffffe00c4338890) > at /opt/src/git-src/sys/net/route/nhop_ctl.c:299 > #13 0xffffffff8080c6a9 in create_rtentry (rnh=3D0xfffff80004924400, > info=3D0xfffffe00c4338a20, prt=3D) > at /opt/src/git-src/sys/net/route/route_ctl.c:661 > #14 add_route (rnh=3D0xfffff80004924400, info=3D0xfffffe00c4338a20, > rc=3D0xfffffe00c43388f8) at = /opt/src/git-src/sys/net/route/route_ctl.c:713 > #15 rib_add_route (fibnum=3D, info=3D0xfffffe00c4338a20, > rc=3D0xfffffe00c43388f8) at = /opt/src/git-src/sys/net/route/route_ctl.c:586 > #16 0xffffffff8080d4bf in rib_action (fibnum=3D579969536,=20 > action=3Daction@entry=3D1, > info=3D0xfffffe00c4338834, rc=3D0xfffff8002291a280, > rc@entry=3D0xfffffe00c43388f8) > at /opt/src/git-src/sys/net/route/route_ctl.c:1257 > #17 0xffffffff8080f3d7 in rib_handle_ifaddr_one (fibnum=3D0, cmd=3D1, > info=3D0xfffffe00c4338a20) > at /opt/src/git-src/sys/net/route/route_ifaddrs.c:81 > #18 rib_handle_ifaddr_info (fibnum=3D579969536, cmd=3Dcmd@entry=3D1,=20= > info=3D0x100004, > info@entry=3D0xfffffe00c4338a20) > at /opt/src/git-src/sys/net/route/route_ifaddrs.c:107 > #19 0xffffffff8087001d in in6_handle_dstaddr_rtrequest (cmd=3D1, > ia=3D0xfffff80022887480) at /opt/src/git-src/sys/netinet6/in6.c:1307 > #20 in6_notify_ifa (ifp=3D, ia=3D, > ifra=3D, hostIsNew=3D) > at /opt/src/git-src/sys/netinet6/in6.c:1518 > #21 in6_update_ifa_internal (ifp=3D0xfffff80022721800,=20 > ifra=3D0xfffff8000799e400, > ia=3D0xfffff80022887480, hostIsNew=3D, flags=3D) > at /opt/src/git-src/sys/netinet6/in6.c:1196 > #22 in6_update_ifa (ifp=3D0xfffff80022721800, ifra=3D0xfffff8000799e400,= > ia=3D0xfffff80022887480, flags=3Dflags@entry=3D0) > at /opt/src/git-src/sys/netinet6/in6.c:899 > #23 0xffffffff8086effc in in6_control (so=3D, > cmd=3D, data=3D, ifp=3D, > td=3D) at /opt/src/git-src/sys/netinet6/in6.c:572 > #24 0xffffffff807e465c in ifioctl (so=3D0xfffff80016ffa000, = cmd=3D2156423451, > data=3D, td=3D0x0) at = /opt/src/git-src/sys/net/if.c:3189 > #25 0xffffffff807310ad in fo_ioctl (fp=3D0xfffff8000775cc80, > com=3D18446741877978007604, data=3D0x100004, = active_cred=3D0xfffff8002291a280, > td=3D0xfffffe00c44acac0) at /opt/src/git-src/sys/sys/file.h:365 > #26 kern_ioctl (td=3D0x0, td@entry=3D0xfffffe00c44acac0, fd=3D, > com=3D18446741877978007604, com@entry=3D2156423451, > data=3D0x100004 , > data@entry=3D0xfffff8000799e400 "gif0") > at /opt/src/git-src/sys/kern/sys_generic.c:803 > #27 0xffffffff80730d90 in sys_ioctl (td=3D0xfffffe00c44acac0, > uap=3D0xfffffe00c44aceb0) at = /opt/src/git-src/sys/kern/sys_generic.c:711 > #28 0xffffffff80a354ac in syscallenter (td=3D0xfffffe00c44acac0) > at /opt/src/git-src/sys/amd64/amd64/../../kern/subr_syscall.c:189 > #29 amd64_syscall (td=3D0xfffffe00c44acac0, traced=3D0) > at /opt/src/git-src/sys/amd64/amd64/trap.c:1187 > #30 > #31 0x00000640bee2d97a in ?? () > Backtrace stopped: Cannot access memory at address 0x640bb373718 > (kgdb) >=20 >=20 > At the point of panic we see: >=20 > (kgdb) l > 133 * the packet back to ourselves, the ifp would be the = loopback > 134 * interface. However, we'd rather know the interface = associated > 135 * to the destination address (which should probably be = one of > 136 * our own addresses). > 137 */ > 138 if ((nh->nh_ifp->if_flags & IFF_LOOPBACK) && > 139 nh->gw_sa.sa_family =3D=3D AF_LINK) { > 140 aifp =3D ifnet_byindex(nh->gwl_sa.sdl_index); > 141 if (aifp =3D=3D NULL) { > 142 FIB_NH_LOG(LOG_WARNING, nh, "unable to = get aifp for %s index %d", > (kgdb) p nh > $1 =3D (const struct nhop_object *) 0xfffff8002291a200 > (kgdb) p nh->nh_ifp > $2 =3D (struct ifnet *) 0x0 >=20 >=20 > My relevant rc.conf lines are: >=20 > if kqcheckyesno use_tunnelbroker; then > # tunnelbroker > tunnel_broker=3D"gif0" > create_args_gif0=3D"tunnel MY_IPv4_ADDR REMOTE_IPv4_ADDR" > ifconfig_gif0_ipv6=3D"inet6 MY_ASSIGNED_IPv6_TUNNEL_ENDPOINT_ADDR=20 > prefixlen 128 mtu 1480" > ipv6_defaultrouter=3D"MY_IPv6_REMOTE_TUNNEL_ENDPOINT_ADDR" > ipv6_gateway_enable=3D"YES" > rtsold_enable=3D"YES" # Set to YES to enable an IPv6=20 > router > rtsold_flags=3D"-F -m gif0" # Flags to an IPv6 router=20 > solicitation > else > rtsold_enable=3D"NO" # Set to YES to enable an IPv6=20 > router > tunnel_broker=3D'' > fi >=20 >=20 >=20 > --=20 > Cheers, > Cy Schubert > FreeBSD UNIX: Web: http://www.FreeBSD.org > NTP: Web: https://nwtime.org >=20 > e**(i*pi)+1=3D0