git: 543b492fa569 - stable/13 - if_vxlan(4): Allow netmap_generic to intercept RX packets.
Date: Wed, 23 Feb 2022 11:03:04 UTC
The branch stable/13 has been updated by afedorov: URL: https://cgit.FreeBSD.org/src/commit/?id=543b492fa569cd5839657bd9f74826ef2df121fb commit 543b492fa569cd5839657bd9f74826ef2df121fb Author: Aleksandr Fedorov <afedorov@FreeBSD.org> AuthorDate: 2022-02-06 12:27:46 +0000 Commit: Aleksandr Fedorov <afedorov@FreeBSD.org> CommitDate: 2022-02-23 11:01:20 +0000 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 (cherry picked from commit ceaf442ff236dd0dcd303001ff41e6c64a0cfc1f) --- sys/net/if_vxlan.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index f56ec23540a7..972af73fb50e 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2812,12 +2812,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) { @@ -2857,8 +2861,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);