Hi,
Oop, I am TWICE sorry ! I wrongly attached a wrong, empty file.
Attached here is the patch.
Regarding your answer; I accept it and I will soon send a revised
version of this patch (making changes to
arp_netdev_event() and ndisc_netdev_event().)
I had IPv4 in mind, there is no reason that it will no be also in IPv6.
Regads,
David Shwatrz
On Dec 23, 2007 2:11 PM, YOSHIFUJI Hideaki / 吉藤英明
<[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]> (at Sun, 23 Dec 2007 13:41:36 +0200), "David
> Shwatrz" <[EMAIL PROTECTED]> says:
>
> > I had written a small patch to neigh_changeaddr() in net/core/neighbour.c
> > against the 2.6 git net tree, which sends a gratuitous ARP to update
> > the list of
> > all the involved neighbours with the change of MAC address.
> > The patch is for neigh_changeaddr() only.
>
> Though I can see no patch, but I disagree. ;-)
> I do think you should change arp_netdev_event() and ndisc_netdev_event().
>
> --yoshfuji
>
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 29b8ee4..ddeae82 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -36,6 +36,9 @@
#include <linux/string.h>
#include <linux/log2.h>
+#include <linux/inetdevice.h>
+#include <net/arp.h>
+
#define NEIGH_DEBUG 1
#define NEIGH_PRINTK(x...) printk(x)
@@ -228,9 +231,26 @@ static void neigh_flush_dev(struct neigh_table *tbl,
struct net_device *dev)
void neigh_changeaddr(struct neigh_table *tbl, struct net_device *dev)
{
+ struct in_device *in_dev;
write_lock_bh(&tbl->lock);
neigh_flush_dev(tbl, dev);
write_unlock_bh(&tbl->lock);
+
+ /* Send a gratuitous ARP to the neighbours to update their arp tables */
+
+ rcu_read_lock();
+ in_dev = __in_dev_get_rcu(dev);
+ if (in_dev == NULL)
+ goto out;
+ if (in_dev->ifa_list)
+
+ 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);
+out:
+ rcu_read_unlock();
}
int neigh_ifdown(struct neigh_table *tbl, struct net_device *dev)