MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vxlan_transmit

Function vxlan_transmit

freebsd/net/if_vxlan.c:2694–2742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2692}
2693
2694static int
2695vxlan_transmit(struct ifnet *ifp, struct mbuf *m)
2696{
2697 struct rm_priotracker tracker;
2698 union vxlan_sockaddr vxlsa;
2699 struct vxlan_softc *sc;
2700 struct vxlan_ftable_entry *fe;
2701 struct ifnet *mcifp;
2702 struct ether_header *eh;
2703 int ipv4, error;
2704
2705 sc = ifp->if_softc;
2706 eh = mtod(m, struct ether_header *);
2707 fe = NULL;
2708 mcifp = NULL;
2709
2710 ETHER_BPF_MTAP(ifp, m);
2711
2712 VXLAN_RLOCK(sc, &tracker);
2713 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
2714 VXLAN_RUNLOCK(sc, &tracker);
2715 m_freem(m);
2716 return (ENETDOWN);
2717 }
2718
2719 if ((m->m_flags & (M_BCAST | M_MCAST)) == 0)
2720 fe = vxlan_ftable_entry_lookup(sc, eh->ether_dhost);
2721 if (fe == NULL)
2722 fe = &sc->vxl_default_fe;
2723 vxlan_sockaddr_copy(&vxlsa, &fe->vxlfe_raddr.sa);
2724
2725 ipv4 = VXLAN_SOCKADDR_IS_IPV4(&vxlsa) != 0;
2726 if (vxlan_sockaddr_in_multicast(&vxlsa) != 0)
2727 mcifp = vxlan_multicast_if_ref(sc, ipv4);
2728
2729 VXLAN_ACQUIRE(sc);
2730 VXLAN_RUNLOCK(sc, &tracker);
2731
2732 if (ipv4 != 0)
2733 error = vxlan_encap4(sc, &vxlsa, m);
2734 else
2735 error = vxlan_encap6(sc, &vxlsa, m);
2736
2737 vxlan_release(sc);
2738 if (mcifp != NULL)
2739 if_rele(mcifp);
2740
2741 return (error);
2742}
2743
2744static void
2745vxlan_qflush(struct ifnet *ifp __unused)

Callers

nothing calls this directly

Calls 9

vxlan_sockaddr_copyFunction · 0.85
vxlan_multicast_if_refFunction · 0.85
vxlan_encap4Function · 0.85
vxlan_encap6Function · 0.85
vxlan_releaseFunction · 0.85
if_releFunction · 0.85
m_freemFunction · 0.50

Tested by

no test coverage detected