summaryrefslogtreecommitdiffstats
path: root/sys/net/rtsock.c
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1997-01-13 21:26:53 +0000
committerwollman <wollman@FreeBSD.org>1997-01-13 21:26:53 +0000
commit19e2ac904f46e8d37d7cd3d2b1186258b4e8f73b (patch)
tree910b1426d4c193f9ebe781e273cdb61d4b1ee1fd /sys/net/rtsock.c
parent52ec48faa0c0c800965bfbe06fa3f8869f922d41 (diff)
downloadFreeBSD-src-19e2ac904f46e8d37d7cd3d2b1186258b4e8f73b.zip
FreeBSD-src-19e2ac904f46e8d37d7cd3d2b1186258b4e8f73b.tar.gz
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).
Diffstat (limited to 'sys/net/rtsock.c')
-rw-r--r--sys/net/rtsock.c41
1 files changed, 40 insertions, 1 deletions
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 <sys/param.h>
@@ -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().
OpenPOWER on IntegriCloud