Re: bpf_mtap_ether doesnt need to encode packet priority
ok mvs@ > On 15 Jan 2021, at 04:14, David Gwynne wrote: > > bpf should be showing what will be or has been on the wire, which is > what the ether_vtag in the mbuf has. the prio is either about to be > decoded from the tag on the wya into the stack, or has been encoded by > vlan(4) on the way out of the stack. > > ok? > > Index: bpf.c > === > RCS file: /cvs/src/sys/net/bpf.c,v > retrieving revision 1.201 > diff -u -p -r1.201 bpf.c > --- bpf.c 2 Jan 2021 07:25:42 - 1.201 > +++ bpf.c 15 Jan 2021 01:12:31 - > @@ -1444,7 +1444,6 @@ bpf_mtap_ether(caddr_t arg, const struct > #if NVLAN > 0 > struct ether_vlan_header evh; > struct m_hdr mh, md; > - uint8_t prio; > > if ((m->m_flags & M_VLANTAG) == 0) > #endif > @@ -1455,15 +1454,10 @@ bpf_mtap_ether(caddr_t arg, const struct > #if NVLAN > 0 > KASSERT(m->m_len >= ETHER_HDR_LEN); > > - prio = m->m_pkthdr.pf.prio; > - if (prio <= 1) > - prio = !prio; > - > memcpy(&evh, mtod(m, char *), ETHER_HDR_LEN); > evh.evl_proto = evh.evl_encap_proto; > evh.evl_encap_proto = htons(ETHERTYPE_VLAN); > - evh.evl_tag = htons(m->m_pkthdr.ether_vtag | > - (prio << EVL_PRIO_BITS)); > + evh.evl_tag = htons(m->m_pkthdr.ether_vtag); > > mh.mh_flags = 0; > mh.mh_data = (caddr_t)&evh; >
Re: bpf_mtap_ether doesnt need to encode packet priority
On Fri, Jan 15, 2021 at 11:14:17AM +1000, David Gwynne wrote: > bpf should be showing what will be or has been on the wire, which is > what the ether_vtag in the mbuf has. the prio is either about to be > decoded from the tag on the wya into the stack, or has been encoded by > vlan(4) on the way out of the stack. Yes, OK kn.
bpf_mtap_ether doesnt need to encode packet priority
bpf should be showing what will be or has been on the wire, which is what the ether_vtag in the mbuf has. the prio is either about to be decoded from the tag on the wya into the stack, or has been encoded by vlan(4) on the way out of the stack. ok? Index: bpf.c === RCS file: /cvs/src/sys/net/bpf.c,v retrieving revision 1.201 diff -u -p -r1.201 bpf.c --- bpf.c 2 Jan 2021 07:25:42 - 1.201 +++ bpf.c 15 Jan 2021 01:12:31 - @@ -1444,7 +1444,6 @@ bpf_mtap_ether(caddr_t arg, const struct #if NVLAN > 0 struct ether_vlan_header evh; struct m_hdr mh, md; - uint8_t prio; if ((m->m_flags & M_VLANTAG) == 0) #endif @@ -1455,15 +1454,10 @@ bpf_mtap_ether(caddr_t arg, const struct #if NVLAN > 0 KASSERT(m->m_len >= ETHER_HDR_LEN); - prio = m->m_pkthdr.pf.prio; - if (prio <= 1) - prio = !prio; - memcpy(&evh, mtod(m, char *), ETHER_HDR_LEN); evh.evl_proto = evh.evl_encap_proto; evh.evl_encap_proto = htons(ETHERTYPE_VLAN); - evh.evl_tag = htons(m->m_pkthdr.ether_vtag | - (prio << EVL_PRIO_BITS)); + evh.evl_tag = htons(m->m_pkthdr.ether_vtag); mh.mh_flags = 0; mh.mh_data = (caddr_t)&evh;