netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* sysctl variable to force IGMP version [PATCH]
@ 2004-01-27 21:13 David Stevens
  2004-01-28 20:00 ` David S. Miller
  2004-02-13  4:50 ` Takashi Hibi
  0 siblings, 2 replies; 8+ messages in thread
From: David Stevens @ 2004-01-27 21:13 UTC (permalink / raw)
  To: davem, netdev


[-- Attachment #1.1: Type: text/plain, Size: 3740 bytes --]





Below is a patch that allows forcing of the IGMP version. The primary
use would be with an IGMP-snooping switch that doesn't grok IGMPv3
packet formats and when there are no IGMPv2 or IGMPv1 multicast
routers on the network. By forcing the IGMP reports to version 2 (or
version 1, for really old switches), Linux would send reports that the
switch can understand for multicast forwarding to the port.

                        +-DLS

in-line and attached, for whitespace issues.

diff -ruN linux-2.6.2-rc1/include/linux/inetdevice.h linux-2.6.2-rc1F2/include/linux/inetdevice.h
--- linux-2.6.2-rc1/include/linux/inetdevice.h  2004-01-08 22:59:45.000000000 -0800
+++ linux-2.6.2-rc1F2/include/linux/inetdevice.h      2004-01-23 14:55:52.000000000 -0800
@@ -21,6 +21,7 @@
      int   medium_id;
      int   no_xfrm;
      int   no_policy;
+     int   force_igmp_version;
      void  *sysctl;
 };

diff -ruN linux-2.6.2-rc1/include/linux/sysctl.h linux-2.6.2-rc1F2/include/linux/sysctl.h
--- linux-2.6.2-rc1/include/linux/sysctl.h      2004-01-21 14:03:34.000000000 -0800
+++ linux-2.6.2-rc1F2/include/linux/sysctl.h    2004-01-23 14:55:52.000000000 -0800
@@ -360,6 +360,7 @@
      NET_IPV4_CONF_MEDIUM_ID=14,
      NET_IPV4_CONF_NOXFRM=15,
      NET_IPV4_CONF_NOPOLICY=16,
+     NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
 };

 /* /proc/sys/net/ipv4/netfilter */
diff -ruN linux-2.6.2-rc1/net/ipv4/devinet.c linux-2.6.2-rc1F2/net/ipv4/devinet.c
--- linux-2.6.2-rc1/net/ipv4/devinet.c    2004-01-21 14:03:35.000000000 -0800
+++ linux-2.6.2-rc1F2/net/ipv4/devinet.c  2004-01-26 16:34:31.000000000 -0800
@@ -1132,7 +1132,7 @@

 static struct devinet_sysctl_table {
      struct ctl_table_header *sysctl_header;
-     ctl_table         devinet_vars[17];
+     ctl_table         devinet_vars[18];
      ctl_table         devinet_dev[2];
      ctl_table         devinet_conf_dir[2];
      ctl_table         devinet_proto_dir[2];
@@ -1269,6 +1269,15 @@
                  .proc_handler     = &ipv4_doint_and_flush,
                  .strategy   = &ipv4_doint_and_flush_strategy,
            },
+           {
+                 .ctl_name   = NET_IPV4_CONF_FORCE_IGMP_VERSION,
+                 .procname   = "force_igmp_version",
+                 .data       = &ipv4_devconf.force_igmp_version,
+                 .maxlen           = sizeof(int),
+                 .mode       = 0644,
+                 .proc_handler     = &ipv4_doint_and_flush,
+                 .strategy   = &ipv4_doint_and_flush_strategy,
+           },
      },
      .devinet_dev = {
            {
diff -ruN linux-2.6.2-rc1/net/ipv4/igmp.c linux-2.6.2-rc1F2/net/ipv4/igmp.c
--- linux-2.6.2-rc1/net/ipv4/igmp.c 2004-01-21 14:03:35.000000000 -0800
+++ linux-2.6.2-rc1F2/net/ipv4/igmp.c     2004-01-26 17:18:28.000000000 -0800
@@ -126,10 +126,14 @@
  * contradict to specs provided this delay is small enough.
  */

-#define IGMP_V1_SEEN(in_dev) ((in_dev)->mr_v1_seen && \
-           time_before(jiffies, (in_dev)->mr_v1_seen))
-#define IGMP_V2_SEEN(in_dev) ((in_dev)->mr_v2_seen && \
-           time_before(jiffies, (in_dev)->mr_v2_seen))
+#define IGMP_V1_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 1 || \
+           (in_dev)->cnf.force_igmp_version == 1 || \
+           ((in_dev)->mr_v1_seen && \
+           time_before(jiffies, (in_dev)->mr_v1_seen)))
+#define IGMP_V2_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 2 || \
+           (in_dev)->cnf.force_igmp_version == 2 || \
+           ((in_dev)->mr_v2_seen && \
+           time_before(jiffies, (in_dev)->mr_v2_seen)))

 static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
 static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr);

(See attached file: igmpsysctl.patch)

[-- Attachment #1.2: Type: text/html, Size: 3789 bytes --]

[-- Attachment #2: igmpsysctl.patch --]
[-- Type: application/octet-stream, Size: 2821 bytes --]

diff -ruN linux-2.6.2-rc1/include/linux/inetdevice.h linux-2.6.2-rc1F2/include/linux/inetdevice.h
--- linux-2.6.2-rc1/include/linux/inetdevice.h	2004-01-08 22:59:45.000000000 -0800
+++ linux-2.6.2-rc1F2/include/linux/inetdevice.h	2004-01-23 14:55:52.000000000 -0800
@@ -21,6 +21,7 @@
 	int	medium_id;
 	int	no_xfrm;
 	int	no_policy;
+	int	force_igmp_version;
 	void	*sysctl;
 };
 
diff -ruN linux-2.6.2-rc1/include/linux/sysctl.h linux-2.6.2-rc1F2/include/linux/sysctl.h
--- linux-2.6.2-rc1/include/linux/sysctl.h	2004-01-21 14:03:34.000000000 -0800
+++ linux-2.6.2-rc1F2/include/linux/sysctl.h	2004-01-23 14:55:52.000000000 -0800
@@ -360,6 +360,7 @@
 	NET_IPV4_CONF_MEDIUM_ID=14,
 	NET_IPV4_CONF_NOXFRM=15,
 	NET_IPV4_CONF_NOPOLICY=16,
+	NET_IPV4_CONF_FORCE_IGMP_VERSION=17,
 };
 
 /* /proc/sys/net/ipv4/netfilter */
diff -ruN linux-2.6.2-rc1/net/ipv4/devinet.c linux-2.6.2-rc1F2/net/ipv4/devinet.c
--- linux-2.6.2-rc1/net/ipv4/devinet.c	2004-01-21 14:03:35.000000000 -0800
+++ linux-2.6.2-rc1F2/net/ipv4/devinet.c	2004-01-26 16:34:31.000000000 -0800
@@ -1132,7 +1132,7 @@
 
 static struct devinet_sysctl_table {
 	struct ctl_table_header *sysctl_header;
-	ctl_table		devinet_vars[17];
+	ctl_table		devinet_vars[18];
 	ctl_table		devinet_dev[2];
 	ctl_table		devinet_conf_dir[2];
 	ctl_table		devinet_proto_dir[2];
@@ -1269,6 +1269,15 @@
 			.proc_handler	= &ipv4_doint_and_flush,
 			.strategy	= &ipv4_doint_and_flush_strategy,
 		},
+		{
+			.ctl_name	= NET_IPV4_CONF_FORCE_IGMP_VERSION,
+			.procname	= "force_igmp_version",
+			.data		= &ipv4_devconf.force_igmp_version,
+			.maxlen		= sizeof(int),
+			.mode		= 0644,
+			.proc_handler	= &ipv4_doint_and_flush,
+			.strategy	= &ipv4_doint_and_flush_strategy,
+		},
 	},
 	.devinet_dev = {
 		{
diff -ruN linux-2.6.2-rc1/net/ipv4/igmp.c linux-2.6.2-rc1F2/net/ipv4/igmp.c
--- linux-2.6.2-rc1/net/ipv4/igmp.c	2004-01-21 14:03:35.000000000 -0800
+++ linux-2.6.2-rc1F2/net/ipv4/igmp.c	2004-01-26 17:18:28.000000000 -0800
@@ -126,10 +126,14 @@
  * contradict to specs provided this delay is small enough.
  */
 
-#define IGMP_V1_SEEN(in_dev) ((in_dev)->mr_v1_seen && \
-		time_before(jiffies, (in_dev)->mr_v1_seen))
-#define IGMP_V2_SEEN(in_dev) ((in_dev)->mr_v2_seen && \
-		time_before(jiffies, (in_dev)->mr_v2_seen))
+#define IGMP_V1_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 1 || \
+		(in_dev)->cnf.force_igmp_version == 1 || \
+		((in_dev)->mr_v1_seen && \
+		time_before(jiffies, (in_dev)->mr_v1_seen)))
+#define IGMP_V2_SEEN(in_dev) (ipv4_devconf.force_igmp_version == 2 || \
+		(in_dev)->cnf.force_igmp_version == 2 || \
+		((in_dev)->mr_v2_seen && \
+		time_before(jiffies, (in_dev)->mr_v2_seen)))
 
 static void igmpv3_add_delrec(struct in_device *in_dev, struct ip_mc_list *im);
 static void igmpv3_del_delrec(struct in_device *in_dev, __u32 multiaddr);

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-02-17  6:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-27 21:13 sysctl variable to force IGMP version [PATCH] David Stevens
2004-01-28 20:00 ` David S. Miller
2004-02-13  4:50 ` Takashi Hibi
2004-02-13 18:31   ` David Stevens
2004-02-14  0:15     ` YOSHIFUJI Hideaki / 吉藤英明
2004-02-14 13:10     ` Yuji Sekiya
2004-02-17  5:14       ` sysctl variable to force MLD " David Stevens
2004-02-17  6:52         ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).