From owner-freebsd-bugs@freebsd.org Thu Jun 14 00:02:31 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15C7210041B1 for ; Thu, 14 Jun 2018 00:02:31 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 82AEA83DF5 for ; Thu, 14 Jun 2018 00:02:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 41DA710041B0; Thu, 14 Jun 2018 00:02:30 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15B8510041AE for ; Thu, 14 Jun 2018 00:02:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7D93883DF2 for ; Thu, 14 Jun 2018 00:02:29 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 79133892F for ; Thu, 14 Jun 2018 00:02:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w5E02SBF046186 for ; Thu, 14 Jun 2018 00:02:28 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w5E02SNN046162 for bugs@FreeBSD.org; Thu, 14 Jun 2018 00:02:28 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 229006] ipfw+nat and ng_nat Silently Drop Packets over 4k Date: Thu, 14 Jun 2018 00:02:28 +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: 11.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jeff+freebsd@wagsky.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 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.26 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2018 00:02:31 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D229006 Bug ID: 229006 Summary: ipfw+nat and ng_nat Silently Drop Packets over 4k Product: Base System Version: 11.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: jeff+freebsd@wagsky.com As discovered on 11.1-RELEASE-p9 and present on -p10, reassembled packets o= ver 4k are silently dropped by in-kernel NAT. Patch based on suggestion of Andrey V. Elsukov supplied. Cause identified by Andrey V. Elsukov on the freebsd-net and freebsd-ipfw l= ists on 2018-06-13 as being due to buffer allocation limits in the in-kernel implementation of libalias. "The kernel version of libalias uses m_megapullup() function to make single contiguous buffer. m_megapullup() uses m_get2() function to allocate mbuf of appropriate size. If size of packet greater than 4k it will fail. So, if you use MTU greater than 4k or if after fragments reassembly you get a packet with length greater than 4k, ipfw_nat() function will drop this packet." Additional communication on those lists by Andrey suggested a patch might resolve this issue. The following is his code, I take no credit for it. Tes= ted and "works for me" on kernel sources from 11.1-RELEASE-p10 and GENERIC kernconf. /usr/src/sys/netinet/libalias]$ diff -u alias.c.orig alias.c 8< --- alias.c.orig 2017-07-20 16:42:02.000000000 -0700 +++ alias.c 2018-06-13 15:41:46.862121000 -0700 @@ -1758,7 +1758,14 @@ if (m->m_next =3D=3D NULL && M_WRITABLE(m)) return (m); - mcl =3D m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR); + if (len <=3D MJUMPAGESIZE) + mcl =3D m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR); + else if (len <=3D MJUM9BYTES) + mcl =3D m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES); + else if (len <=3D MJUM16BYTES) + mcl =3D m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM16BYTES); + else + goto bad; if (mcl =3D=3D NULL) goto bad; m_align(mcl, len); >8 Additional details on the situation that highlighted this can be found at=20 https://forums.freebsd.org/threads/in-kernel-nat-dropping-large-udp-return-= packets.66262/ --=20 You are receiving this mail because: You are the assignee for the bug.=