Date: Wed, 3 Aug 2022 10:18:53 +0100 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: Cy Schubert <Cy.Schubert@cschubert.com> Cc: "Alexander V. Chernikov" <melifaro@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: 29029b06a6f7 - main - routing: remove info argument from add/change_route_nhop(). Message-ID: <E8FB4630-270C-4842-B538-1A2EEA22E8B5@ipfw.ru> In-Reply-To: <20220802194127.3D45EC4@slippy.cwsent.com> References: <202208010853.2718rMqh090712@gitrepo.freebsd.org> <20220802194127.3D45EC4@slippy.cwsent.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> On 2 Aug 2022, at 20:41, Cy Schubert <Cy.Schubert@cschubert.com> = 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 <melifaro@FreeBSD.org> >> AuthorDate: 2022-07-28 13:41:11 +0000 >> Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> >> 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<optimized out>, > ap=3Dap@entry=3D0xfffffe00c4338600) > at /opt/src/git-src/sys/kern/kern_shutdown.c:979 > #6 0xffffffff806bea53 in panic (fmt=3D<unavailable>) > 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<optimized out>, ucode=3D<optimized out>) > at /opt/src/git-src/sys/amd64/amd64/trap.c:761 > #9 <signal handler called> > #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<optimized out>) > 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<optimized out>, 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<optimized out>, ia=3D<optimized out>, > ifra=3D<optimized out>, hostIsNew=3D<optimized out>) > at /opt/src/git-src/sys/netinet6/in6.c:1518 > #21 in6_update_ifa_internal (ifp=3D0xfffff80022721800,=20 > ifra=3D0xfffff8000799e400, > ia=3D0xfffff80022887480, hostIsNew=3D<optimized out>, flags=3D<optimized= out>) > 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<optimized out>, > cmd=3D<optimized out>, data=3D<optimized out>, ifp=3D<optimized out>, > td=3D<optimized out>) at /opt/src/git-src/sys/netinet6/in6.c:572 > #24 0xffffffff807e465c in ifioctl (so=3D0xfffff80016ffa000, = cmd=3D2156423451, > data=3D<optimized out>, 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<optimized= out>, > com=3D18446741877978007604, com@entry=3D2156423451, > data=3D0x100004 <error: Cannot access memory at address 0x100004>, > 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 <signal handler called> > #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 <Cy.Schubert@cschubert.com> > FreeBSD UNIX: <cy@FreeBSD.org> Web: http://www.FreeBSD.org > NTP: <cy@nwtime.org> Web: https://nwtime.org >=20 > e**(i*pi)+1=3D0
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E8FB4630-270C-4842-B538-1A2EEA22E8B5>