| 2692 | } |
| 2693 | |
| 2694 | static int |
| 2695 | vxlan_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 | |
| 2744 | static void |
| 2745 | vxlan_qflush(struct ifnet *ifp __unused) |
nothing calls this directly
no test coverage detected