patch-2.1.89 linux/net/ipv4/ipmr.c

Next file: linux/net/ipv4/rarp.c
Previous file: linux/net/ipv4/ipip.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.88/linux/net/ipv4/ipmr.c linux/net/ipv4/ipmr.c
@@ -15,6 +15,7 @@
  *	Michael Chastain	:	Incorrect size of copying.
  *	Alan Cox		:	Added the cache manager code
  *	Alan Cox		:	Fixed the clone/copy bug and device race.
+ *	Mike McLagan		:	Routing by source
  *	Malcolm Beattie		:	Buffer handling fixes.
  *	Alexey Kuznetsov	:	Double buffer free and other fixes.
  *	SVR Anand		:	Fixed several multicast bugs and problems.
@@ -113,6 +114,7 @@
 			in_dev = dev->ip_ptr;
 			if (in_dev == NULL && (in_dev = inetdev_init(dev)) == NULL)
 				goto failure;
+			in_dev->cnf.rp_filter = 0;
 
 			if (dev_open(dev))
 				goto failure;
@@ -181,6 +183,8 @@
 	if ((in_dev = inetdev_init(dev)) == NULL)
 		goto failure;
 
+	in_dev->cnf.rp_filter = 0;
+
 	if (dev_open(dev))
 		goto failure;
 
@@ -216,7 +220,7 @@
 	vifc_map &= ~(1<<vifi);
 
 	if ((in_dev = dev->ip_ptr) != NULL)
-		in_dev->flags &= ~IFF_IP_MFORWARD;
+		in_dev->cnf.mc_forwarding = 0;
 
 	dev_set_allmulti(dev, -1);
 	ip_rt_multicast_event(in_dev);
@@ -652,7 +656,7 @@
 static void mrtsock_destruct(struct sock *sk)
 {
 	if (sk == mroute_socket) {
-		ipv4_config.multicast_route = 0;
+		ipv4_devconf.mc_forwarding = 0;
 		mroute_socket=NULL;
 		mroute_close(sk);
 	}
@@ -693,7 +697,7 @@
 			if(mroute_socket)
 				return -EADDRINUSE;
 			mroute_socket=sk;
-			ipv4_config.multicast_route = 1;
+			ipv4_devconf.mc_forwarding = 1;
 			if (ip_ra_control(sk, 1, mrtsock_destruct) == 0)
 				return 0;
 			mrtsock_destruct(sk);
@@ -754,9 +758,9 @@
 
 				if ((in_dev = dev->ip_ptr) == NULL)
 					return -EADDRNOTAVAIL;
-				if (in_dev->flags & IFF_IP_MFORWARD)
+				if (in_dev->cnf.mc_forwarding)
 					return -EADDRINUSE;
-				in_dev->flags |= IFF_IP_MFORWARD;
+				in_dev->cnf.mc_forwarding = 1;
 				dev_set_allmulti(dev, +1);
 				ip_rt_multicast_event(in_dev);
 
@@ -1348,11 +1352,20 @@
 	struct rtnexthop *nhp;
 	struct device *dev = vif_table[c->mfc_parent].dev;
 
+#ifdef CONFIG_RTNL_OLD_IFINFO
 	if (dev) {
 		u8 *o = skb->tail;
 		RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex);
 		rtm->rtm_optlen += skb->tail - o;
 	}
+#else
+	struct rtattr *mp_head;
+
+	if (dev)
+		RTA_PUT(skb, RTA_IIF, 4, &dev->ifindex);
+
+	mp_head = (struct rtattr*)skb_put(skb, RTA_LENGTH(0));
+#endif
 
 	for (ct = c->mfc_minvif; ct < c->mfc_maxvif; ct++) {
 		if (c->mfc_ttls[ct] < 255) {
@@ -1363,9 +1376,15 @@
 			nhp->rtnh_hops = c->mfc_ttls[ct];
 			nhp->rtnh_ifindex = vif_table[ct].dev->ifindex;
 			nhp->rtnh_len = sizeof(*nhp);
+#ifdef CONFIG_RTNL_OLD_IFINFO
 			rtm->rtm_nhs++;
+#endif
 		}
 	}
+#ifndef CONFIG_RTNL_OLD_IFINFO
+	mp_head->rta_type = RTA_MULTIPATH;
+	mp_head->rta_len = skb->tail - (u8*)mp_head;
+#endif
 	rtm->rtm_type = RTN_MULTICAST;
 	return 1;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov