git: c21cbaca2b0d - main - dummynet: handle IPV6 layer 2 traffic

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 30 Jun 2022 12:43:16 UTC
The branch main has been updated by kp:

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

commit c21cbaca2b0db4eb6988da5c470cb520d82b17eb
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-06-30 11:34:53 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-06-30 11:36:26 +0000

    dummynet: handle IPV6 layer 2 traffic
    
    When pf sends layer 2 traffic into dummynet it still marks IPv6 with
    IPFW_ARGS_IPV6 (which dummynet translates to PROTO_V6). That in turn
    results in it not matching the 'DIR_IN | PROTO_LAYER2' case, and
    triggering the 'bad switch' error message.
    
    Add extra cases for LAYER2 | PROTO_IPV6.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/ipfw/ip_dn_io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c
index 98f9d08495df..deeb3d9325de 100644
--- a/sys/netpfil/ipfw/ip_dn_io.c
+++ b/sys/netpfil/ipfw/ip_dn_io.c
@@ -804,6 +804,7 @@ dummynet_send(struct mbuf *m)
 
 			break;
 
+		case DIR_IN | PROTO_LAYER2 | PROTO_IPV6:
 		case DIR_IN | PROTO_LAYER2: /* DN_TO_ETH_DEMUX: */
 			/*
 			 * The Ethernet code assumes the Ethernet header is
@@ -819,6 +820,7 @@ dummynet_send(struct mbuf *m)
 			ether_demux(m->m_pkthdr.rcvif, m);
 			break;
 
+		case DIR_OUT | PROTO_LAYER2 | PROTO_IPV6:
 		case DIR_OUT | PROTO_LAYER2: /* DN_TO_ETH_OUT: */
 			ether_output_frame(ifp, m);
 			break;