Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jul 2022 20:27:38 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 16899291de68 - main - dummynet: check for ifp on all PROTO_LAYER2 packets
Message-ID:  <202207112027.26BKRcnV044313@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=16899291de68a1ae157e19b19b283ecf43e42f55

commit 16899291de68a1ae157e19b19b283ecf43e42f55
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-07-11 19:59:23 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
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;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202207112027.26BKRcnV044313>