IPv4: Send gratuitous ARP for secondary IP addresses also
authorZoltan Kiss <schaman@sch.bme.hu>
Sun, 24 Jul 2011 13:09:30 +0000 (13:09 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Jul 2011 23:16:00 +0000 (16:16 -0700)
If a device event generates gratuitous ARP messages, only primary
address is used for sending. This patch iterates through the whole
list. Tested with 2 IP addresses configuration on bonding interface.

Signed-off-by: Zoltan Kiss <schaman@sch.bme.hu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/devinet.c

index 37b3c188d8b3391db01bab97dbb9b87d8ca1efbb..bc19bd06dd006f548282e25f33c7d6ef056a54ac 100644 (file)
@@ -1134,15 +1134,15 @@ static void inetdev_send_gratuitous_arp(struct net_device *dev,
                                        struct in_device *in_dev)
 
 {
-       struct in_ifaddr *ifa = in_dev->ifa_list;
-
-       if (!ifa)
-               return;
+       struct in_ifaddr *ifa;
 
-       arp_send(ARPOP_REQUEST, ETH_P_ARP,
-                ifa->ifa_local, dev,
-                ifa->ifa_local, NULL,
-                dev->dev_addr, NULL);
+       for (ifa = in_dev->ifa_list; ifa;
+            ifa = ifa->ifa_next) {
+               arp_send(ARPOP_REQUEST, ETH_P_ARP,
+                        ifa->ifa_local, dev,
+                        ifa->ifa_local, NULL,
+                        dev->dev_addr, NULL);
+       }
 }
 
 /* Called only under RTNL semaphore */