Changeset View
Changeset View
Standalone View
Standalone View
head/sys/net/if_vxlan.c
Show First 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | #define VXLAN_FLAG_LEARN 0x0004 | ||||
volatile u_int vxl_refcnt; | volatile u_int vxl_refcnt; | ||||
int vxl_unit; | int vxl_unit; | ||||
int vxl_vso_mc_index; | int vxl_vso_mc_index; | ||||
struct vxlan_statistics vxl_stats; | struct vxlan_statistics vxl_stats; | ||||
struct sysctl_oid *vxl_sysctl_node; | struct sysctl_oid *vxl_sysctl_node; | ||||
struct sysctl_ctx_list vxl_sysctl_ctx; | struct sysctl_ctx_list vxl_sysctl_ctx; | ||||
struct callout vxl_callout; | struct callout vxl_callout; | ||||
uint8_t vxl_hwaddr[ETHER_ADDR_LEN]; | struct ether_addr vxl_hwaddr; | ||||
int vxl_mc_ifindex; | int vxl_mc_ifindex; | ||||
struct ifnet *vxl_mc_ifp; | struct ifnet *vxl_mc_ifp; | ||||
struct ifmedia vxl_media; | struct ifmedia vxl_media; | ||||
char vxl_mc_ifname[IFNAMSIZ]; | char vxl_mc_ifname[IFNAMSIZ]; | ||||
LIST_ENTRY(vxlan_softc) vxl_entry; | LIST_ENTRY(vxlan_softc) vxl_entry; | ||||
LIST_ENTRY(vxlan_softc) vxl_ifdetach_list; | LIST_ENTRY(vxlan_softc) vxl_ifdetach_list; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | |||||
static void vxlan_set_default_config(struct vxlan_softc *); | static void vxlan_set_default_config(struct vxlan_softc *); | ||||
static int vxlan_set_user_config(struct vxlan_softc *, | static int vxlan_set_user_config(struct vxlan_softc *, | ||||
struct ifvxlanparam *); | struct ifvxlanparam *); | ||||
static int vxlan_clone_create(struct if_clone *, int, caddr_t); | static int vxlan_clone_create(struct if_clone *, int, caddr_t); | ||||
static void vxlan_clone_destroy(struct ifnet *); | static void vxlan_clone_destroy(struct ifnet *); | ||||
static uint32_t vxlan_mac_hash(struct vxlan_softc *, const uint8_t *); | static uint32_t vxlan_mac_hash(struct vxlan_softc *, const uint8_t *); | ||||
static void vxlan_fakeaddr(struct vxlan_softc *); | |||||
static int vxlan_media_change(struct ifnet *); | static int vxlan_media_change(struct ifnet *); | ||||
static void vxlan_media_status(struct ifnet *, struct ifmediareq *); | static void vxlan_media_status(struct ifnet *, struct ifmediareq *); | ||||
static int vxlan_sockaddr_cmp(const union vxlan_sockaddr *, | static int vxlan_sockaddr_cmp(const union vxlan_sockaddr *, | ||||
const struct sockaddr *); | const struct sockaddr *); | ||||
static void vxlan_sockaddr_copy(union vxlan_sockaddr *, | static void vxlan_sockaddr_copy(union vxlan_sockaddr *, | ||||
const struct sockaddr *); | const struct sockaddr *); | ||||
static int vxlan_sockaddr_in_equal(const union vxlan_sockaddr *, | static int vxlan_sockaddr_in_equal(const union vxlan_sockaddr *, | ||||
▲ Show 20 Lines • Show All 2,393 Lines • ▼ Show 20 Lines | vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) | ||||
ifp->if_qflush = vxlan_qflush; | ifp->if_qflush = vxlan_qflush; | ||||
ifp->if_capabilities |= IFCAP_LINKSTATE; | ifp->if_capabilities |= IFCAP_LINKSTATE; | ||||
ifp->if_capenable |= IFCAP_LINKSTATE; | ifp->if_capenable |= IFCAP_LINKSTATE; | ||||
ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status); | ifmedia_init(&sc->vxl_media, 0, vxlan_media_change, vxlan_media_status); | ||||
ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ifmedia_add(&sc->vxl_media, IFM_ETHER | IFM_AUTO, 0, NULL); | ||||
ifmedia_set(&sc->vxl_media, IFM_ETHER | IFM_AUTO); | ifmedia_set(&sc->vxl_media, IFM_ETHER | IFM_AUTO); | ||||
vxlan_fakeaddr(sc); | ether_fakeaddr(&sc->vxl_hwaddr); | ||||
ether_ifattach(ifp, sc->vxl_hwaddr); | ether_ifattach(ifp, sc->vxl_hwaddr.octet); | ||||
ifp->if_baudrate = 0; | ifp->if_baudrate = 0; | ||||
ifp->if_hdrlen = 0; | ifp->if_hdrlen = 0; | ||||
return (0); | return (0); | ||||
fail: | fail: | ||||
free(sc, M_VXLAN); | free(sc, M_VXLAN); | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | do { \ | ||||
c -= a; c -= b; c ^= (b >> 15); \ | c -= a; c -= b; c ^= (b >> 15); \ | ||||
} while (0) | } while (0) | ||||
mix(a, b, c); | mix(a, b, c); | ||||
#undef mix | #undef mix | ||||
return (c); | return (c); | ||||
} | |||||
static void | |||||
vxlan_fakeaddr(struct vxlan_softc *sc) | |||||
{ | |||||
/* | |||||
* Generate a non-multicast, locally administered address. | |||||
* | |||||
* BMV: Should we use the FreeBSD OUI range instead? | |||||
*/ | |||||
arc4rand(sc->vxl_hwaddr, ETHER_ADDR_LEN, 1); | |||||
sc->vxl_hwaddr[0] &= ~1; | |||||
sc->vxl_hwaddr[0] |= 2; | |||||
} | } | ||||
static int | static int | ||||
vxlan_media_change(struct ifnet *ifp) | vxlan_media_change(struct ifnet *ifp) | ||||
{ | { | ||||
/* Ignore. */ | /* Ignore. */ | ||||
return (0); | return (0); | ||||
▲ Show 20 Lines • Show All 342 Lines • Show Last 20 Lines |