if_vxlan(4): Allow netmap_generic to intercept RX packets.

Netmap (generic) intercepts the if_input method to handle RX packets.

Call ifp->if_input() instead of netisr_dispatch().
Add stricter check for incoming packet length.

This change is very useful with bhyve + vale + if_vxlan.

Reviewed by:	vmaffione (mentor), kib, np, donner
Approved by:	vmaffione (mentor), kib, np, donner
MFC after:	2 weeks
Sponsored by:	vstack.com
Differential Revision:	https://reviews.freebsd.org/D30638
This commit is contained in:
Aleksandr Fedorov 2022-02-06 15:27:46 +03:00
parent 42cf33dd1a
commit ceaf442ff2

View File

@ -2814,12 +2814,16 @@ vxlan_input(struct vxlan_socket *vso, uint32_t vni, struct mbuf **m0,
struct ether_header *eh;
int error;
m = *m0;
if (m->m_pkthdr.len < ETHER_HDR_LEN)
return (EINVAL);
sc = vxlan_socket_lookup_softc(vso, vni);
if (sc == NULL)
return (ENOENT);
ifp = sc->vxl_ifp;
m = *m0;
eh = mtod(m, struct ether_header *);
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
@ -2859,8 +2863,9 @@ vxlan_input(struct vxlan_socket *vso, uint32_t vni, struct mbuf **m0,
m->m_pkthdr.csum_data = 0;
}
error = netisr_dispatch(NETISR_ETHER, m);
(*ifp->if_input)(ifp, m);
*m0 = NULL;
error = 0;
out:
vxlan_release(sc);