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; 12+ 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] 12+ messages in thread
* Re: sysctl variable to force IGMP version [PATCH]
@ 2004-01-29  4:51 David Stevens
  2004-01-29 22:36 ` David S. Miller
  0 siblings, 1 reply; 12+ messages in thread
From: David Stevens @ 2004-01-29  4:51 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]





Dave,
      As it is, it doesn't hurt anything if you set it to "47"-- it'll use
IGMPv1 if it's
set to "1", IGMPv2 if it's set to "2" and IGMPv3 (default) for all other
values. It may
look odd in "sysctl -a" output, but it'll behave reasonably.
      I can add new handler functions used only by this that restrict the
values
(unless there's an easier way using some existing method I don't know
about),
if you think it's worth it, but it won't actually cause any problem if it's
set to any
value out of range.

                        +-DLS


"David S. Miller" <davem@redhat.com>@oss.sgi.com on 01/28/2004 12:00:03 PM

Sent by:    netdev-bounce@oss.sgi.com


To:    David Stevens/Beaverton/IBM@IBMUS
cc:    netdev@oss.sgi.com
Subject:    Re: sysctl variable to force IGMP version [PATCH]



On Tue, 27 Jan 2004 14:13:41 -0700
David Stevens <dlstevens@us.ibm.com> wrote:

> 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.

Perhaps some sanity to prevent values other than 1 or 2 from being
set?


[-- Attachment #2: Type: text/html, Size: 1748 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: sysctl variable to force IGMP version [PATCH]
@ 2004-01-30 20:49 David Stevens
  2004-01-30 20:52 ` David S. Miller
  0 siblings, 1 reply; 12+ messages in thread
From: David Stevens @ 2004-01-30 20:49 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev


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






Dave,
      Here's the 2.4.x version of the "force IGMP version" sysctl patch.

                        +-DLS

diff -ruN linux-2.4.25-pre8/include/linux/inetdevice.h linux-2.4.25-pre8F1/include/linux/inetdevice.h
--- linux-2.4.25-pre8/include/linux/inetdevice.h      2003-08-25 04:44:44.000000000 -0700
+++ linux-2.4.25-pre8F1/include/linux/inetdevice.h    2004-01-29 16:24:53.000000000 -0800
@@ -19,6 +19,7 @@
      int   tag;
      int     arp_filter;
      int   medium_id;
+     int   force_igmp_version;
      void  *sysctl;
 };

diff -ruN linux-2.4.25-pre8/include/linux/sysctl.h linux-2.4.25-pre8F1/include/linux/sysctl.h
--- linux-2.4.25-pre8/include/linux/sysctl.h    2004-01-29 16:21:28.000000000 -0800
+++ linux-2.4.25-pre8F1/include/linux/sysctl.h  2004-01-29 16:39:42.000000000 -0800
@@ -359,6 +359,7 @@
      NET_IPV4_CONF_TAG=12,
      NET_IPV4_CONF_ARPFILTER=13,
      NET_IPV4_CONF_MEDIUM_ID=14,
+     NET_IPV4_CONF_FORCE_IGMP_VERSION=15,
 };

 /* /proc/sys/net/ipv4/netfilter */
diff -ruN linux-2.4.25-pre8/net/ipv4/devinet.c linux-2.4.25-pre8F1/net/ipv4/devinet.c
--- linux-2.4.25-pre8/net/ipv4/devinet.c  2003-11-28 10:26:21.000000000 -0800
+++ linux-2.4.25-pre8F1/net/ipv4/devinet.c      2004-01-29 16:33:23.000000000 -0800
@@ -1057,7 +1057,7 @@
 static struct devinet_sysctl_table
 {
      struct ctl_table_header *sysctl_header;
-     ctl_table devinet_vars[15];
+     ctl_table devinet_vars[16];
      ctl_table devinet_dev[2];
      ctl_table devinet_conf_dir[2];
      ctl_table devinet_proto_dir[2];
@@ -1106,6 +1106,9 @@
      {NET_IPV4_CONF_ARPFILTER, "arp_filter",
       &ipv4_devconf.arp_filter, sizeof(int), 0644, NULL,
       &proc_dointvec},
+     {NET_IPV4_CONF_FORCE_IGMP_VERSION, "force_igmp_version",
+      &ipv4_devconf.force_igmp_version, sizeof(int), 0644, NULL,
+      &proc_dointvec},
       {0}},

      {{NET_PROTO_CONF_ALL, "all", NULL, 0, 0555, devinet_sysctl.devinet_vars},{0}},
diff -ruN linux-2.4.25-pre8/net/ipv4/igmp.c linux-2.4.25-pre8F1/net/ipv4/igmp.c
--- linux-2.4.25-pre8/net/ipv4/igmp.c     2004-01-29 16:21:28.000000000 -0800
+++ linux-2.4.25-pre8F1/net/ipv4/igmp.c   2004-01-29 16:22:55.000000000 -0800
@@ -122,10 +122,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: 2.4igmpsysctl.patch)

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

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

diff -ruN linux-2.4.25-pre8/include/linux/inetdevice.h linux-2.4.25-pre8F1/include/linux/inetdevice.h
--- linux-2.4.25-pre8/include/linux/inetdevice.h	2003-08-25 04:44:44.000000000 -0700
+++ linux-2.4.25-pre8F1/include/linux/inetdevice.h	2004-01-29 16:24:53.000000000 -0800
@@ -19,6 +19,7 @@
 	int	tag;
 	int     arp_filter;
 	int	medium_id;
+	int	force_igmp_version;
 	void	*sysctl;
 };
 
diff -ruN linux-2.4.25-pre8/include/linux/sysctl.h linux-2.4.25-pre8F1/include/linux/sysctl.h
--- linux-2.4.25-pre8/include/linux/sysctl.h	2004-01-29 16:21:28.000000000 -0800
+++ linux-2.4.25-pre8F1/include/linux/sysctl.h	2004-01-29 16:39:42.000000000 -0800
@@ -359,6 +359,7 @@
 	NET_IPV4_CONF_TAG=12,
 	NET_IPV4_CONF_ARPFILTER=13,
 	NET_IPV4_CONF_MEDIUM_ID=14,
+	NET_IPV4_CONF_FORCE_IGMP_VERSION=15,
 };
 
 /* /proc/sys/net/ipv4/netfilter */
diff -ruN linux-2.4.25-pre8/net/ipv4/devinet.c linux-2.4.25-pre8F1/net/ipv4/devinet.c
--- linux-2.4.25-pre8/net/ipv4/devinet.c	2003-11-28 10:26:21.000000000 -0800
+++ linux-2.4.25-pre8F1/net/ipv4/devinet.c	2004-01-29 16:33:23.000000000 -0800
@@ -1057,7 +1057,7 @@
 static struct devinet_sysctl_table
 {
 	struct ctl_table_header *sysctl_header;
-	ctl_table devinet_vars[15];
+	ctl_table devinet_vars[16];
 	ctl_table devinet_dev[2];
 	ctl_table devinet_conf_dir[2];
 	ctl_table devinet_proto_dir[2];
@@ -1106,6 +1106,9 @@
 	{NET_IPV4_CONF_ARPFILTER, "arp_filter",
 	 &ipv4_devconf.arp_filter, sizeof(int), 0644, NULL,
 	 &proc_dointvec},
+	{NET_IPV4_CONF_FORCE_IGMP_VERSION, "force_igmp_version",
+	 &ipv4_devconf.force_igmp_version, sizeof(int), 0644, NULL,
+	 &proc_dointvec},
 	 {0}},
 
 	{{NET_PROTO_CONF_ALL, "all", NULL, 0, 0555, devinet_sysctl.devinet_vars},{0}},
diff -ruN linux-2.4.25-pre8/net/ipv4/igmp.c linux-2.4.25-pre8F1/net/ipv4/igmp.c
--- linux-2.4.25-pre8/net/ipv4/igmp.c	2004-01-29 16:21:28.000000000 -0800
+++ linux-2.4.25-pre8F1/net/ipv4/igmp.c	2004-01-29 16:22:55.000000000 -0800
@@ -122,10 +122,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] 12+ messages in thread

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

Thread overview: 12+ 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
  -- strict thread matches above, loose matches on Subject: below --
2004-01-29  4:51 sysctl variable to force IGMP " David Stevens
2004-01-29 22:36 ` David S. Miller
2004-01-30 20:49 David Stevens
2004-01-30 20: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).