From nobody Mon Jul 11 20:27:38 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 AF84817FEAD0; Mon, 11 Jul 2022 20:27:38 +0000 (UTC) (envelope-from git@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 4Lhb6L4bwCz3qY0; Mon, 11 Jul 2022 20:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657571258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ct4LqDkmDz6Tj3cXAP/XKWqsMMAttaqKWLKMr/kqK+Y=; b=SYPMKZ6Vgq9g6yT0XKCwJr8VI30Ihs7U+/n0IJF2P6T6slU0AE8PIkh85Q1+MMmO90GI3o ZTETC0NOyOnblnYez72sx5UbP6QiQwbv/h58TY2hFtEpwJ5er5sAwULEL/iny5+SBnFLbQ L9cwgnPjP3PhSWOdoBJZHKXR3hSpu2zJH5bm9R0QGer81X9E35emY19CyxwqbV31tNe7VS jx/dGXTcjX4HZqnwdmvO1WahqfkBmmc+6BbpX7gHemFOw2rAeRTaluFZC20OYHhGV6pbMI lGdsZKzTUSvMrqo4GiZ2L98EY0h3l7N5/mW811Uuh1FXZO5rL39DuceFzTENDg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4Lhb6L3RJqzHDC; Mon, 11 Jul 2022 20:27:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 26BKRcjl044314; Mon, 11 Jul 2022 20:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26BKRcnV044313; Mon, 11 Jul 2022 20:27:38 GMT (envelope-from git) Date: Mon, 11 Jul 2022 20:27:38 GMT Message-Id: <202207112027.26BKRcnV044313@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 16899291de68 - main - dummynet: check for ifp on all PROTO_LAYER2 packets 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16899291de68a1ae157e19b19b283ecf43e42f55 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1657571258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ct4LqDkmDz6Tj3cXAP/XKWqsMMAttaqKWLKMr/kqK+Y=; b=DrVw3emDPzQy1MSp2venxssf1BOG0bRc6UlLXwZx0iQwy5CNfzrGtN2ncCI6rwEUq9Py2v ko+jueY+GKjtAukIxzKtCrrVFC/51+rCXg3mwJsNY5kDMX0BV4V4PKt0voqWm7CedU0xu2 3T4C3RsRYyFdSNAOHzOdkUvaA73+DPd4WYuYpDeI/aLK3voCtntxX3nM31djDW1oCVzVF1 CzfxhHsCptdLziUV6MLiF1QKdLvZJnFeSFl20BnNc43QUIpkG1q21qoavdIkpsFsSmhL+j CLF7nBPjoCEV4KQjfwfJedJZYaPLponei2ZpICERsr2bvcowPx0q6juTIHU+RQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1657571258; a=rsa-sha256; cv=none; b=EWwAFvLjfBXBU4uxS7iXXAtZPI9q8X0huj0kn/d3M2TRj+N371q+GcNAQHt5/6qKolbNdo LiOR5iMyLquvDxFt28gvjgcBpW0fW0kvf8Tim3oA/Dc0yc43INoatuDB1KiDO/d3p4Gm5+ YaCa/OaqQNR9MGGaSosL4kWvDUeRtz7alhO5J/SeCX7dQkHlNCNRsdWjMhC0JhnPgUXcmV /UaSBUtZHn5NrzvUMdxp6dyJD9ztYYLtwi1I7zVtSUXcUjJLkad9S8inHW/iRIjMWxfv69 NOmXSJ6luSMxs7yD27kylghcvXo8Qux4Msn5vW7Lqxvr5d28fTwDxNgFa/byFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=16899291de68a1ae157e19b19b283ecf43e42f55 commit 16899291de68a1ae157e19b19b283ecf43e42f55 Author: Kristof Provost AuthorDate: 2022-07-11 19:59:23 +0000 Commit: Kristof Provost CommitDate: 2022-07-11 20:07:11 +0000 dummynet: check for ifp on all PROTO_LAYER2 packets When we extended the switch statement to allow for PROTO_LAYER2 | PROTO_IPV6 in c21cbaca2b we didn't extend the check for a non-NULL struct ifnet pointer. Happily the only PROTO_IPV6 case is pf's layer 2 support, which always provides one. Reported by: Coverity (CID 1490459) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/ipfw/ip_dn_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 7a85714fa0c6..090efd303858 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -772,7 +772,8 @@ dummynet_send(struct mbuf *m) * to carry reinject info. */ ifp = ifnet_byindexgen(pkt->if_index, pkt->if_idxgen); - if (pkt->dn_dir == (DIR_OUT | PROTO_LAYER2) && + if (((pkt->dn_dir == (DIR_OUT | PROTO_LAYER2)) || + (pkt->dn_dir == (DIR_OUT | PROTO_LAYER2 | PROTO_IPV6))) && ifp == NULL) { dst = DIR_DROP; } else { @@ -827,6 +828,7 @@ dummynet_send(struct mbuf *m) case DIR_OUT | PROTO_LAYER2 | PROTO_IPV6: case DIR_OUT | PROTO_LAYER2: /* DN_TO_ETH_OUT: */ + MPASS(ifp != NULL); ether_output_frame(ifp, m); break;