All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ian Pratt <Ian.Pratt@cl.cam.ac.uk>
Cc: "Graham, Simon" <Simon.Graham@stratus.com>,
	xen-devel@lists.xensource.com,
	Ian Campbell <Ian.Campbell@xensource.com>
Subject: Re: Stimulating domains to send gratuitous ARPs
Date: Fri, 06 Jul 2007 11:51:23 -0700	[thread overview]
Message-ID: <468E8F2B.9050701@goop.org> (raw)
In-Reply-To: <8A87A9A84C201449A0C56B728ACF491E25FD87@liverpoolst.ad.cl.cam.ac.uk>

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

Ian Pratt wrote:
>> Whilst I might agree that from a purist point of view having netfront do
>> this is a violation of layering, it's already accepted in some other
>> upstream drivers 
>>     
>
> It's pretty clear it's not going to be accepted in the netfront that goes into upstream Linux, at least not without sedating various LKML folk first :)
>   

Stephen Hemminger posted a patch to add this capability generically so 
it wouldn't be a netfront-specific piece of behaviour.  I have not 
submitted it for upstream yet, mainly because nobody has 
confirmed/tested that it really does what we need.  But it looks 
reasonable, and it should be accepted once we confirm its correct.

    J

[-- Attachment #2: ARP-notify-option.patch --]
[-- Type: text/x-patch, Size: 3093 bytes --]

Subject: ARP notify option

This adds another inet device option to enable gratuitous ARP
when device is brought up or address change. This is handy for
clusters or virtualization.

Tested on a normal device (not Xen).

Signed-off-by: Stephen Hemminger <shemminge@linux-foundation.org>

---
 Documentation/networking/ip-sysctl.txt |    6 ++++++
 include/linux/inetdevice.h             |    2 ++
 include/linux/sysctl.h                 |    1 +
 net/ipv4/devinet.c                     |   16 ++++++++++++++++
 4 files changed, 25 insertions(+)

===================================================================
--- net-2.6.22.orig/Documentation/networking/ip-sysctl.txt
+++ net-2.6.22/Documentation/networking/ip-sysctl.txt
@@ -732,6 +732,12 @@
 	The max value from conf/{all,interface}/arp_ignore is used
 	when ARP request is received on the {interface}
 
+arp_notify - BOOLEAN
+	Define mode for notification of address and device changes.
+	0 - (default): do nothing
+	1 - Generate gratuitous arp replies when device is brought up
+	    or hardware address changes.
+
 arp_accept - BOOLEAN
 	Define behavior when gratuitous arp replies are received:
 	0 - drop gratuitous arp frames
===================================================================
--- net-2.6.22.orig/include/linux/inetdevice.h
+++ net-2.6.22/include/linux/inetdevice.h
@@ -26,6 +26,7 @@
 	int	arp_announce;
 	int	arp_ignore;
 	int	arp_accept;
+	int	arp_notify;
 	int	medium_id;
 	int	no_xfrm;
 	int	no_policy;
@@ -84,6 +85,7 @@
 #define IN_DEV_ARPFILTER(in_dev)	(ipv4_devconf.arp_filter || (in_dev)->cnf.arp_filter)
 #define IN_DEV_ARP_ANNOUNCE(in_dev)	(max(ipv4_devconf.arp_announce, (in_dev)->cnf.arp_announce))
 #define IN_DEV_ARP_IGNORE(in_dev)	(max(ipv4_devconf.arp_ignore, (in_dev)->cnf.arp_ignore))
+#define IN_DEV_ARP_NOTIFY(in_dev)	(ipv4_devconf.arp_notify || (in_dev)->cnf.arp_notify)
 
 struct in_ifaddr
 {
===================================================================
--- net-2.6.22.orig/include/linux/sysctl.h
+++ net-2.6.22/include/linux/sysctl.h
@@ -495,6 +495,7 @@
 	NET_IPV4_CONF_ARP_IGNORE=19,
 	NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
 	NET_IPV4_CONF_ARP_ACCEPT=21,
+	NET_IPV4_CONF_ARP_NOTIFY=22,
 	__NET_IPV4_CONF_MAX
 };
 
===================================================================
--- net-2.6.22.orig/net/ipv4/devinet.c
+++ net-2.6.22/net/ipv4/devinet.c
@@ -1089,6 +1089,14 @@
 			}
 		}
 		ip_mc_up(in_dev);
+		/* fall through */
+	case NETDEV_CHANGEADDR:
+		if (IN_DEV_ARP_NOTIFY(in_dev))
+			arp_send(ARPOP_REQUEST, ETH_P_ARP,
+				 in_dev->ifa_list->ifa_address,
+				 dev,
+				 in_dev->ifa_list->ifa_address,
+				 NULL, dev->dev_addr, NULL);
 		break;
 	case NETDEV_DOWN:
 		ip_mc_down(in_dev);
@@ -1495,6 +1503,14 @@
 			.proc_handler	= &proc_dointvec,
 		},
 		{
+			.ctl_name	= NET_IPV4_CONF_ARP_NOTIFY,
+			.procname	= "arp_notify",
+			.data		= &ipv4_devconf.arp_notify,
+			.maxlen		= sizeof(int),
+			.mode		= 0644,
+			.proc_handler	= &proc_dointvec,
+		},
+		{
 			.ctl_name	= NET_IPV4_CONF_NOXFRM,
 			.procname	= "disable_xfrm",
 			.data		= &ipv4_devconf.no_xfrm,

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2007-07-06 18:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-05 18:41 Stimulating domains to send gratuitous ARPs Graham, Simon
2007-07-05 19:45 ` Ian Campbell
2007-07-05 19:52   ` Graham, Simon
2007-07-05 20:22     ` Ian Pratt
2007-07-05 21:08       ` Zhu Han
2007-07-05 22:18       ` Graham, Simon
2007-07-05 22:25         ` Ian Pratt
2007-07-06 18:51       ` Jeremy Fitzhardinge [this message]
2007-07-06 20:17         ` Graham, Simon
2007-07-05 21:03     ` Zhu Han
     [not found] ` <4e777ed10707051251k74b95c67h6a20aa1b432af567@mail.gmail.com>
     [not found]   ` <342BAC0A5467384983B586A6B0B3767105FCE6E3@EXNA.corp.stratus.com>
2007-07-05 20:54     ` Zhu Han

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=468E8F2B.9050701@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Campbell@xensource.com \
    --cc=Ian.Pratt@cl.cam.ac.uk \
    --cc=Simon.Graham@stratus.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.