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

Function rt_newmaddrmsg

freebsd/net/rtsock.c:1955–1986  ·  view source on GitHub ↗

* This is the analogue to the rt_newaddrmsg which performs the same * function but for multicast group memberhips. This is easier since * there is no route state to worry about. */

Source from the content-addressed store, hash-verified

1953 * there is no route state to worry about.
1954 */
1955void
1956rt_newmaddrmsg(int cmd, struct ifmultiaddr *ifma)
1957{
1958 struct rt_addrinfo info;
1959 struct mbuf *m = NULL;
1960 struct ifnet *ifp = ifma->ifma_ifp;
1961 struct ifma_msghdr *ifmam;
1962
1963 if (V_route_cb.any_count == 0)
1964 return;
1965
1966 bzero((caddr_t)&info, sizeof(info));
1967 info.rti_info[RTAX_IFA] = ifma->ifma_addr;
1968 if (ifp && ifp->if_addr)
1969 info.rti_info[RTAX_IFP] = ifp->if_addr->ifa_addr;
1970 else
1971 info.rti_info[RTAX_IFP] = NULL;
1972 /*
1973 * If a link-layer address is present, present it as a ``gateway''
1974 * (similarly to how ARP entries, e.g., are presented).
1975 */
1976 info.rti_info[RTAX_GATEWAY] = ifma->ifma_lladdr;
1977 m = rtsock_msg_mbuf(cmd, &info);
1978 if (m == NULL)
1979 return;
1980 ifmam = mtod(m, struct ifma_msghdr *);
1981 KASSERT(ifp != NULL, ("%s: link-layer multicast address w/o ifp\n",
1982 __func__));
1983 ifmam->ifmam_index = ifp->if_index;
1984 ifmam->ifmam_addrs = info.rti_addrs;
1985 rt_dispatch(m, ifma->ifma_addr ? ifma->ifma_addr->sa_family : AF_UNSPEC);
1986}
1987
1988static struct mbuf *
1989rt_makeifannouncemsg(struct ifnet *ifp, int type, int what,

Callers 2

if_addmultiFunction · 0.85
if_delmulti_lockedFunction · 0.85

Calls 3

bzeroFunction · 0.85
rtsock_msg_mbufFunction · 0.85
rt_dispatchFunction · 0.85

Tested by

no test coverage detected