* 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. */
| 1953 | * there is no route state to worry about. |
| 1954 | */ |
| 1955 | void |
| 1956 | rt_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 | |
| 1988 | static struct mbuf * |
| 1989 | rt_makeifannouncemsg(struct ifnet *ifp, int type, int what, |
no test coverage detected