On Fri, 2023-08-25 at 20:40 +1000, David Gwynne wrote: > umb(4) is a hardware p2p driver, it just has ip coming in, so we can do > the same thing we do for the address family and input processing as > other p2p interfaces. > > the short packet check that umb_input does is already done by the ip > stacks, so we're not losing anything. > > i havent got a umb(4), so i need someone to test this. oks are nice too.
Tested download of https://ftp.hostserver.de/pub/OpenBSD/ftplist with its v4 and v6 address and it's ok. tcpdump also fine. OK gerhard@ > > Index: if_umb.c > =================================================================== > RCS file: /cvs/src/sys/dev/usb/if_umb.c,v > retrieving revision 1.51 > diff -u -p -r1.51 if_umb.c > --- if_umb.c 18 Apr 2023 22:01:23 -0000 1.51 > +++ if_umb.c 25 Aug 2023 10:36:19 -0000 > @@ -138,7 +138,6 @@ void umb_close_bulkpipes(struct umb_so > int umb_ioctl(struct ifnet *, u_long, caddr_t); > int umb_output(struct ifnet *, struct mbuf *, struct sockaddr *, > struct rtentry *); > -void umb_input(struct ifnet *, struct mbuf *); > void umb_start(struct ifnet *); > void umb_rtrequest(struct ifnet *, int, struct rtentry *); > void umb_watchdog(struct ifnet *); > @@ -610,7 +609,8 @@ umb_attach(struct device *parent, struct > sizeof (struct ncm_pointer16); > ifp->if_mtu = 1500; /* use a common default */ > ifp->if_hardmtu = sc->sc_maxpktlen; > - ifp->if_input = umb_input; > + ifp->if_bpf_mtap = p2p_bpf_mtap; > + ifp->if_input = p2p_input; > ifp->if_output = umb_output; > if_attach(ifp); > if_alloc_sadl(ifp); > @@ -910,48 +910,6 @@ umb_output(struct ifnet *ifp, struct mbu > return if_enqueue(ifp, m); > } > > -void > -umb_input(struct ifnet *ifp, struct mbuf *m) > -{ > - uint32_t af; > - > - if ((ifp->if_flags & IFF_UP) == 0) { > - m_freem(m); > - return; > - } > - if (m->m_pkthdr.len < sizeof (struct ip) + sizeof(af)) { > - ifp->if_ierrors++; > - DPRINTFN(4, "%s: dropping short packet (len %d)\n", __func__, > - m->m_pkthdr.len); > - m_freem(m); > - return; > - } > - m->m_pkthdr.ph_rtableid = ifp->if_rdomain; > - > - /* pop off DLT_LOOP header, no longer needed */ > - af = *mtod(m, uint32_t *); > - m_adj(m, sizeof (af)); > - af = ntohl(af); > - > - ifp->if_ibytes += m->m_pkthdr.len; > - switch (af) { > - case AF_INET: > - ipv4_input(ifp, m); > - return; > -#ifdef INET6 > - case AF_INET6: > - ipv6_input(ifp, m); > - return; > -#endif /* INET6 */ > - default: > - ifp->if_ierrors++; > - DPRINTFN(4, "%s: dropping packet with bad IP version (af > %d)\n", > - __func__, af); > - m_freem(m); > - return; > - } > -} > - > static inline int > umb_align(size_t bufsz, int offs, int alignment, int remainder) > { > @@ -2376,7 +2334,7 @@ umb_decap(struct umb_softc *sc, struct u > struct ifnet *ifp = GET_IFP(sc); > int s; > void *buf; > - uint32_t len, af = 0; > + uint32_t len; > char *dp; > struct ncm_header16 *hdr16; > struct ncm_header32 *hdr32; > @@ -2499,20 +2457,14 @@ umb_decap(struct umb_softc *sc, struct u > ifp->if_iqdrops++; > continue; > } > - m = m_prepend(m, sizeof(uint32_t), M_DONTWAIT); > - if (m == NULL) { > - ifp->if_iqdrops++; > - continue; > - } > switch (*dp & 0xf0) { > case 4 << 4: > - af = htonl(AF_INET); > + m->m_pkthdr.ph_family = AF_INET; > break; > case 6 << 4: > - af = htonl(AF_INET6); > + m->m_pkthdr.ph_family = AF_INET6; > break; > } > - *mtod(m, uint32_t *) = af; > ml_enqueue(&ml, m); > } > done: >
smime.p7s
Description: S/MIME cryptographic signature