The branch main has been updated by kp:

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

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

Reply via email to