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

Function vxlan_setup_multicast

freebsd/net/if_vxlan.c:1473–1508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473static int
1474vxlan_setup_multicast(struct vxlan_softc *sc)
1475{
1476 const union vxlan_sockaddr *group;
1477 int error;
1478
1479 group = &sc->vxl_dst_addr;
1480 error = 0;
1481
1482 if (sc->vxl_mc_ifname[0] != '\0') {
1483 error = vxlan_setup_multicast_interface(sc);
1484 if (error)
1485 return (error);
1486 }
1487
1488 /*
1489 * Initialize an multicast options structure that is sufficiently
1490 * populated for use in the respective IP output routine. This
1491 * structure is typically stored in the socket, but our sockets
1492 * may be shared among multiple interfaces.
1493 */
1494 if (VXLAN_SOCKADDR_IS_IPV4(group)) {
1495 sc->vxl_im4o = malloc(sizeof(struct ip_moptions), M_VXLAN,
1496 M_ZERO | M_WAITOK);
1497 sc->vxl_im4o->imo_multicast_ifp = sc->vxl_mc_ifp;
1498 sc->vxl_im4o->imo_multicast_ttl = sc->vxl_ttl;
1499 sc->vxl_im4o->imo_multicast_vif = -1;
1500 } else if (VXLAN_SOCKADDR_IS_IPV6(group)) {
1501 sc->vxl_im6o = malloc(sizeof(struct ip6_moptions), M_VXLAN,
1502 M_ZERO | M_WAITOK);
1503 sc->vxl_im6o->im6o_multicast_ifp = sc->vxl_mc_ifp;
1504 sc->vxl_im6o->im6o_multicast_hlim = sc->vxl_ttl;
1505 }
1506
1507 return (error);
1508}
1509
1510static int
1511vxlan_setup_socket(struct vxlan_softc *sc)

Callers 1

vxlan_setup_socketFunction · 0.85

Calls 2

mallocFunction · 0.85

Tested by

no test coverage detected