From owner-freebsd-bugs@freebsd.org Sat Jan 4 20:54:50 2020 Return-Path: Delivered-To: freebsd-bugs@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 431E01D1131 for ; Sat, 4 Jan 2020 20:54:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 47qvCt0ydZz4cs7 for ; Sat, 4 Jan 2020 20:54:50 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 20B7A1D1130; Sat, 4 Jan 2020 20:54:50 +0000 (UTC) Delivered-To: bugs@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 207971D112F for ; Sat, 4 Jan 2020 20:54:50 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47qvCs5d6Rz4cs6 for ; Sat, 4 Jan 2020 20:54:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A284A1AC8B for ; Sat, 4 Jan 2020 20:54:49 +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 004KsnZN031562 for ; Sat, 4 Jan 2020 20:54:49 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 004KsnRI031561 for bugs@FreeBSD.org; Sat, 4 Jan 2020 20:54:49 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: bugs@FreeBSD.org Subject: [Bug 243096] netgraph ng_nat example causes panic on CURRENT Date: Sat, 04 Jan 2020 20:54:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: rob@sarcasticadmin.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: 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-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2020 20:54:50 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D243096 Bug ID: 243096 Summary: netgraph ng_nat example causes panic on CURRENT Product: Base System Version: CURRENT Hardware: amd64 OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rob@sarcasticadmin.com Created attachment 210453 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D210453&action= =3Dedit core.txt from panic Overview: Im seeing a consistent panic on CURRENT r356261 when following an example t= aken from `man ng_nat`: The ng_nat node can also be attached directly to the physical interface via ng_ether(4) node in the graph. In the following example, we perform masquerading on a Ethernet interface connected to a public network. ifconfig igb0 inet x.y.8.35 netmask 0xfffff000 route add default x.y.0.1 /usr/sbin/ngctl -f- <<-SEQ mkpeer igb0: nat lower in name igb0:lower igb0_NAT connect igb0: igb0_NAT: upper out msg igb0_NAT: setdlt 1 msg igb0_NAT: setaliasaddr x.y.8.35 SEQ Im not very familar with netgraph so its been a little difficult for me to investigate and understand what might be wrong with the above example. /usr/share/examples/netgraph didnt seem to have a ng_nat example either. Essentially Im looking to create a NAT with the "wan" side being a physical interface and the "lan" being a bridge. Steps to Reproduce: Im testing on a x230 with em0 instead of igb0 and using DHCP: $ ifconfig em0 em0: flags=3D8843 metric 0 mtu 1500 =20=20=20=20=20=20=20 options=3D481249b ether 3c:97:0e:21:cf:52 inet 192.168.88.85 netmask 0xffffff00 broadcast 192.168.88.255 media: Ethernet autoselect (1000baseT ) status: active nd6 options=3D29 $ netstat -rn Routing tables Internet: Destination Gateway Flags Netif Expire default 192.168.88.1 UGS em0 127.0.0.1 link#2 UH lo0 192.168.88.0/24 link#1 U em0 192.168.88.85 link#1 UHS lo0 Internet6: Destination Gateway Flags N= etif Expire ::/96 ::1 UGRS = lo0 ::1 link#2 UH = lo0 ::ffff:0.0.0.0/96 ::1 UGRS = lo0 fe80::/10 ::1 UGRS = lo0 fe80::%lo0/64 link#2 U = lo0 fe80::1%lo0 link#2 UHS = lo0 ff02::/16 ::1 UGRS = lo0 With the physical interface up the following snippet causes the system to p= anic (again borrowed from the ng_nat manpage above): $ /usr/sbin/ngctl -f- <<-SEQ mkpeer em0: nat lower in name em0:lower em0_NAT connect em0: em0_NAT: upper out msg em0_NAT: setdlt 1 msg em0_NAT: setaliasaddr 192.168.88.85 SEQ Actual Results: After a few seconds the system then panics: Unread portion of the kernel message buffer: panic: ng_nat: ip_len !=3D m_pkthdr.len cpuid =3D 3 time =3D 1578139602 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe004b4bd= 690 vpanic() at vpanic+0x17e/frame 0xfffffe004b4bd6f0 panic() at panic+0x43/frame 0xfffffe004b4bd750 ng_nat_rcvdata() at ng_nat_rcvdata+0x3d5/frame 0xfffffe004b4bd7a0 ng_apply_item() at ng_apply_item+0xa3/frame 0xfffffe004b4bd820 ng_snd_item() at ng_snd_item+0x2b0/frame 0xfffffe004b4bd860 ng_ether_input() at ng_ether_input+0x4c/frame 0xfffffe004b4bd890 ether_nh_input() at ether_nh_input+0x24a/frame 0xfffffe004b4bd8f0 netisr_dispatch_src() at netisr_dispatch_src+0xb1/frame 0xfffffe004b4bd970 ether_input() at ether_input+0x9d/frame 0xfffffe004b4bd9d0 iflib_rxeof() at iflib_rxeof+0xbcd/frame 0xfffffe004b4bdae0 _task_fn_rx() at _task_fn_rx+0x7d/frame 0xfffffe004b4bdb20 gtaskqueue_run_locked() at gtaskqueue_run_locked+0x155/frame 0xfffffe004b4b= db80 gtaskqueue_thread_loop() at gtaskqueue_thread_loop+0xc2/frame 0xfffffe004b4bdbb0 fork_exit() at fork_exit+0x80/frame 0xfffffe004b4bdbf0 fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe004b4bdbf0 --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- KDB: enter: panic See core.txt attached from panic for more info In my testing it seems to be the last command thats the problematic one: msg em0_NAT: setaliasaddr 192.168.88.85 Expected Results: em0_NAT interface to be available If theres anything else that would be helpful for me to include just let me know. System Info: $ uname -a FreeBSD test 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r356261: Thu Jan 2 04:59= :38 UTC 2020=20=20=20=20 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 --=20 You are receiving this mail because: You are the assignee for the bug.=