From 19e2ac904f46e8d37d7cd3d2b1186258b4e8f73b Mon Sep 17 00:00:00 2001 From: wollman Date: Mon, 13 Jan 1997 21:26:53 +0000 Subject: Use the new if_multiaddrs list for multicast addresses rather than the previous hackery involving struct in_ifaddr and arpcom. Get rid of the abominable multi_kludge. Update all network interfaces to use the new machanism. Distressingly few Ethernet drivers program the multicast filter properly (assuming the hardware has one, which it usually does). --- sys/net/rtsock.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'sys/net/rtsock.c') diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index eb786fa..e831d67 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)rtsock.c 8.5 (Berkeley) 11/2/94 - * $Id: rtsock.c,v 1.21 1996/12/11 20:38:16 wollman Exp $ + * $Id: rtsock.c,v 1.22 1996/12/13 21:28:41 wollman Exp $ */ #include @@ -416,6 +416,11 @@ rt_msg1(type, rtinfo) len = sizeof(struct ifa_msghdr); break; + case RTM_DELMADDR: + case RTM_NEWMADDR: + len = sizeof(struct ifma_msghdr); + break; + case RTM_IFINFO: len = sizeof(struct if_msghdr); break; @@ -637,6 +642,40 @@ rt_newaddrmsg(cmd, ifa, error, rt) } } +/* + * 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. + */ +void +rt_newmaddrmsg(cmd, ifma) + int cmd; + struct ifmultiaddr *ifma; +{ + struct rt_addrinfo info; + struct mbuf *m = 0; + struct ifnet *ifp = ifma->ifma_ifp; + struct ifma_msghdr *ifmam; + + if (route_cb.any_count == 0) + return; + + bzero((caddr_t)&info, sizeof(info)); + ifaaddr = ifma->ifma_addr; + ifpaddr = ifp->if_addrhead.tqh_first->ifa_addr; + /* + * If a link-layer address is present, present it as a ``gateway'' + * (similarly to how ARP entries, e.g., are presented). + */ + gate = ifma->ifma_lladdr; + if ((m = rt_msg1(cmd, &info)) == NULL) + return; + ifmam = mtod(m, struct ifma_msghdr *); + ifmam->ifmam_index = ifp->if_index; + ifmam->ifmam_addrs = info.rti_addrs; + route_proto.sp_protocol = ifma->ifma_addr->sa_family; + raw_input(m, &route_proto, &route_src, &route_dst); +} /* * This is used in dumping the kernel table via sysctl(). -- cgit v1.1