Skip to content

Commit d11327a

Browse files
Ian Campbelldavem330
authored andcommitted
arp_notify: unconditionally send gratuitous ARP for NETDEV_NOTIFY_PEERS.
NETDEV_NOTIFY_PEER is an explicit request by the driver to send a link notification while NETDEV_UP/NETDEV_CHANGEADDR generate link notifications as a sort of side effect. In the later cases the sysctl option is present because link notification events can have undesired effects e.g. if the link is flapping. I don't think this applies in the case of an explicit request from a driver. This patch makes NETDEV_NOTIFY_PEER unconditional, if preferred we could add a new sysctl for this case which defaults to on. This change causes Xen post-migration ARP notifications (which cause switches to relearn their MAC tables etc) to be sent by default. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0550769 commit d11327a

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

net/ipv4/devinet.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,21 @@ static inline bool inetdev_valid_mtu(unsigned mtu)
10301030
return mtu >= 68;
10311031
}
10321032

1033+
static void inetdev_send_gratuitous_arp(struct net_device *dev,
1034+
struct in_device *in_dev)
1035+
1036+
{
1037+
struct in_ifaddr *ifa = in_dev->ifa_list;
1038+
1039+
if (!ifa)
1040+
return;
1041+
1042+
arp_send(ARPOP_REQUEST, ETH_P_ARP,
1043+
ifa->ifa_address, dev,
1044+
ifa->ifa_address, NULL,
1045+
dev->dev_addr, NULL);
1046+
}
1047+
10331048
/* Called only under RTNL semaphore */
10341049

10351050
static int inetdev_event(struct notifier_block *this, unsigned long event,
@@ -1082,18 +1097,13 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
10821097
}
10831098
ip_mc_up(in_dev);
10841099
/* fall through */
1085-
case NETDEV_NOTIFY_PEERS:
10861100
case NETDEV_CHANGEADDR:
1101+
if (!IN_DEV_ARP_NOTIFY(in_dev))
1102+
break;
1103+
/* fall through */
1104+
case NETDEV_NOTIFY_PEERS:
10871105
/* Send gratuitous ARP to notify of link change */
1088-
if (IN_DEV_ARP_NOTIFY(in_dev)) {
1089-
struct in_ifaddr *ifa = in_dev->ifa_list;
1090-
1091-
if (ifa)
1092-
arp_send(ARPOP_REQUEST, ETH_P_ARP,
1093-
ifa->ifa_address, dev,
1094-
ifa->ifa_address, NULL,
1095-
dev->dev_addr, NULL);
1096-
}
1106+
inetdev_send_gratuitous_arp(dev, in_dev);
10971107
break;
10981108
case NETDEV_DOWN:
10991109
ip_mc_down(in_dev);

0 commit comments

Comments
 (0)