This is a patch to join the "all routers" multicast group when forwarding
is
turned on for an interface, and to leave it when forwarding is turned off.
It
requires the addrconf_sysctl_forward() patch I posted previously, as well.
Patch is relative to 2.4.9.
+-DLS
--- linux-2.4.9P1/net/ipv6/addrconf.c Tue Aug 28 15:05:54 2001
+++ linux-2.4.9NEW/net/ipv6/addrconf.c Tue Aug 28 15:45:45 2001
@@ -298,12 +298,33 @@
return idev;
}
+static void dev_forward_change(struct inet6_dev *idev)
+{
+ struct net_device *dev;
+ struct in6_addr addr;
+
+ if (!idev)
+ return;
+ dev = idev->dev;
+ if (!dev || !(dev->flags & IFF_MULTICAST))
+ return;
+
+ ipv6_addr_all_routers(&addr);
+
+ if (idev->cnf.forwarding)
+ ipv6_dev_mc_inc(dev, &addr);
+ else
+ ipv6_dev_mc_dec(dev, &addr);
+}
+
static void addrconf_forward_change(struct inet6_dev *idev)
{
struct net_device *dev;
- if (idev)
+ if (idev) {
+ dev_forward_change(idev);
return;
+ }
read_lock(&dev_base_lock);
for (dev=dev_base; dev; dev=dev->next) {
@@ -312,6 +333,7 @@
if (idev)
idev->cnf.forwarding = ipv6_devconf.forwarding;
read_unlock(&addrconf_lock);
+ dev_forward_change(idev);
}
read_unlock(&dev_base_lock);
}
|