aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index ee144a4fca41..90389281d97a 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1102,6 +1102,21 @@ static inline bool inetdev_valid_mtu(unsigned mtu)
1102 return mtu >= 68; 1102 return mtu >= 68;
1103} 1103}
1104 1104
1105static void inetdev_send_gratuitous_arp(struct net_device *dev,
1106 struct in_device *in_dev)
1107
1108{
1109 struct in_ifaddr *ifa = in_dev->ifa_list;
1110
1111 if (!ifa)
1112 return;
1113
1114 arp_send(ARPOP_REQUEST, ETH_P_ARP,
1115 ifa->ifa_address, dev,
1116 ifa->ifa_address, NULL,
1117 dev->dev_addr, NULL);
1118}
1119
1105/* Called only under RTNL semaphore */ 1120/* Called only under RTNL semaphore */
1106 1121
1107static int inetdev_event(struct notifier_block *this, unsigned long event, 1122static int inetdev_event(struct notifier_block *this, unsigned long event,
@@ -1155,18 +1170,13 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
1155 } 1170 }
1156 ip_mc_up(in_dev); 1171 ip_mc_up(in_dev);
1157 /* fall through */ 1172 /* fall through */
1158 case NETDEV_NOTIFY_PEERS:
1159 case NETDEV_CHANGEADDR: 1173 case NETDEV_CHANGEADDR:
1174 if (!IN_DEV_ARP_NOTIFY(in_dev))
1175 break;
1176 /* fall through */
1177 case NETDEV_NOTIFY_PEERS:
1160 /* Send gratuitous ARP to notify of link change */ 1178 /* Send gratuitous ARP to notify of link change */
1161 if (IN_DEV_ARP_NOTIFY(in_dev)) { 1179 inetdev_send_gratuitous_arp(dev, in_dev);
1162 struct in_ifaddr *ifa = in_dev->ifa_list;
1163
1164 if (ifa)
1165 arp_send(ARPOP_REQUEST, ETH_P_ARP,
1166 ifa->ifa_address, dev,
1167 ifa->ifa_address, NULL,
1168 dev->dev_addr, NULL);
1169 }
1170 break; 1180 break;
1171 case NETDEV_DOWN: 1181 case NETDEV_DOWN:
1172 ip_mc_down(in_dev); 1182 ip_mc_down(in_dev);