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

Function vxlan_init

freebsd/net/if_vxlan.c:1708–1755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1706}
1707
1708static void
1709vxlan_init(void *xsc)
1710{
1711 static const uint8_t empty_mac[ETHER_ADDR_LEN];
1712 struct vxlan_softc *sc;
1713 struct ifnet *ifp;
1714
1715 sc = xsc;
1716 ifp = sc->vxl_ifp;
1717
1718 sx_xlock(&vxlan_sx);
1719 VXLAN_WLOCK(sc);
1720 if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
1721 VXLAN_WUNLOCK(sc);
1722 sx_xunlock(&vxlan_sx);
1723 return;
1724 }
1725 sc->vxl_flags |= VXLAN_FLAG_INIT;
1726 VXLAN_WUNLOCK(sc);
1727
1728 if (vxlan_valid_init_config(sc) != 0)
1729 goto out;
1730
1731 if (vxlan_setup_socket(sc) != 0)
1732 goto out;
1733
1734#ifdef INET6
1735 vxlan_setup_zero_checksum_port(sc);
1736#endif
1737
1738 /* Initialize the default forwarding entry. */
1739 vxlan_ftable_entry_init(sc, &sc->vxl_default_fe, empty_mac,
1740 &sc->vxl_dst_addr.sa, VXLAN_FE_FLAG_STATIC);
1741
1742 VXLAN_WLOCK(sc);
1743 ifp->if_drv_flags |= IFF_DRV_RUNNING;
1744 callout_reset(&sc->vxl_callout, vxlan_ftable_prune_period * hz,
1745 vxlan_timer, sc);
1746 VXLAN_WUNLOCK(sc);
1747
1748 if_link_state_change(ifp, LINK_STATE_UP);
1749
1750 EVENTHANDLER_INVOKE(vxlan_start, ifp, sc->vxl_src_addr.in4.sin_family,
1751 ntohs(sc->vxl_src_addr.in4.sin_port));
1752out:
1753 vxlan_init_complete(sc);
1754 sx_xunlock(&vxlan_sx);
1755}
1756
1757static void
1758vxlan_release(struct vxlan_softc *sc)

Callers 1

vxlan_ioctl_ifflagsFunction · 0.85

Calls 6

vxlan_valid_init_configFunction · 0.85
vxlan_setup_socketFunction · 0.85
vxlan_ftable_entry_initFunction · 0.85
if_link_state_changeFunction · 0.85
vxlan_init_completeFunction · 0.85

Tested by

no test coverage detected