git: ceaf442ff236 - main - if_vxlan(4): Allow netmap_generic to intercept RX packets.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 06 Feb 2022 12:31:47 UTC
The branch main has been updated by afedorov:
URL: https://cgit.FreeBSD.org/src/commit/?id=ceaf442ff236dd0dcd303001ff41e6c64a0cfc1f
commit ceaf442ff236dd0dcd303001ff41e6c64a0cfc1f
Author: Aleksandr Fedorov <afedorov@FreeBSD.org>
AuthorDate: 2022-02-06 12:27:46 +0000
Commit: Aleksandr Fedorov <afedorov@FreeBSD.org>
CommitDate: 2022-02-06 12:27:46 +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
---
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 b03357c30c08..107a836f91de 100644
--- a/sys/net/if_vxlan.c
+++ b/sys/net/if_vxlan.c
@@ -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);