On 18/12/17(Mon) 05:53, Jason Tubnor wrote:
> On 14 December 2017 at 22:44, Martin Pieuchot <[email protected]> wrote:
>
> >
> > Here's a diff that should fix the problem, do you confirm?
> >
> > Index: net/if_vxlan.c
> > ===================================================================
> > RCS file: /cvs/src/sys/net/if_vxlan.c,v
> >
> >
> >
> <--snip-->
>
> Hi Martin,
>
> This patch stopped traffic flow being processed on the vxlan(4) interface.
> Data goes into it but doesn't exit via the tunnel, nor data coming from the
> remote end is handled by the adapter. I reverted the patch, re-compiled
> and the traffic returned to normal. Below is some traffic dumps including
> from the remote host that doesn't get processed. This was patched
> successfully against a cvs up from 17/12/2017 AEDT. Let me know if there
> is any further tests you need me to run.
Here's a fixed diff, does it work for you?
Index: net/if_vxlan.c
===================================================================
RCS file: /cvs/src/sys/net/if_vxlan.c,v
retrieving revision 1.64
diff -u -p -r1.64 if_vxlan.c
--- net/if_vxlan.c 20 Nov 2017 10:35:24 -0000 1.64
+++ net/if_vxlan.c 9 Jan 2018 15:41:23 -0000
@@ -73,6 +73,8 @@ struct vxlan_softc {
int64_t sc_vnetid;
u_int8_t sc_ttl;
+ struct task sc_sendtask;
+
LIST_ENTRY(vxlan_softc) sc_entry;
};
@@ -91,6 +93,7 @@ int vxlan_output(struct ifnet *, struct
void vxlan_addr_change(void *);
void vxlan_if_change(void *);
void vxlan_link_change(void *);
+void vxlan_send_dispatch(void *);
int vxlan_sockaddr_cmp(struct sockaddr *, struct sockaddr *);
uint16_t vxlan_sockaddr_port(struct sockaddr *);
@@ -135,6 +138,7 @@ vxlan_clone_create(struct if_clone *ifc,
sc->sc_imo.imo_max_memberships = IP_MIN_MEMBERSHIPS;
sc->sc_dstport = htons(VXLAN_PORT);
sc->sc_vnetid = VXLAN_VNI_UNSET;
+ task_set(&sc->sc_sendtask, vxlan_send_dispatch, sc);
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "vxlan%d", unit);
@@ -189,6 +193,10 @@ vxlan_clone_destroy(struct ifnet *ifp)
ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY);
ether_ifdetach(ifp);
if_detach(ifp);
+
+ if (!task_del(net_tq(ifp->if_index), &sc->sc_sendtask))
+ taskq_barrier(net_tq(ifp->if_index));
+
free(sc->sc_imo.imo_membership, M_IPMOPTS, 0);
free(sc, M_DEVBUF, sizeof(*sc));
@@ -302,21 +310,43 @@ vxlan_multicast_join(struct ifnet *ifp,
void
vxlanstart(struct ifnet *ifp)
{
+ struct vxlan_softc *sc = (struct vxlan_softc *)ifp->if_softc;
+
+ task_add(net_tq(ifp->if_index), &sc->sc_sendtask);
+}
+
+void
+vxlan_send_dispatch(void *xsc)
+{
+ struct vxlan_softc *sc = xsc;
+ struct ifnet *ifp = &sc->sc_ac.ac_if;
struct mbuf *m;
+ struct mbuf_list ml;
+ ml_init(&ml);
for (;;) {
IFQ_DEQUEUE(&ifp->if_snd, m);
if (m == NULL)
- return;
+ break;
#if NBPFILTER > 0
if (ifp->if_bpf)
bpf_mtap(ifp->if_bpf, m, BPF_DIRECTION_OUT);
#endif
+ ml_enqueue(&ml, m);
+ }
+
+ if (ml_empty(&ml))
+ return;
+
+ NET_RLOCK();
+ while ((m = ml_dequeue(&ml)) != NULL) {
vxlan_output(ifp, m);
}
+ NET_RUNLOCK();
}
+
int
vxlan_config(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst)