Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

arp: allow to invalidate specific ARP entries

IPv4 over firewire needs to be able to remove ARP entries
from the ARP cache that belong to nodes that are removed, because
IPv4 over firewire uses ARP packets for private information
about nodes.

This information becomes invalid as soon as node drops
off the bus and when it reconnects, its only possible
to start talking to it after it responded to an ARP packet.
But ARP cache prevents such packets from being sent.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Maxim Levitsky and committed by
David S. Miller
545ecdc3 bfe0d029

+19 -11
+1
include/net/arp.h
··· 25 25 const unsigned char *src_hw, 26 26 const unsigned char *target_hw); 27 27 extern void arp_xmit(struct sk_buff *skb); 28 + int arp_invalidate(struct net_device *dev, __be32 ip); 28 29 29 30 #endif /* _ARP_H */
+18 -11
net/ipv4/arp.c
··· 1143 1143 return err; 1144 1144 } 1145 1145 1146 + int arp_invalidate(struct net_device *dev, __be32 ip) 1147 + { 1148 + struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev); 1149 + int err = -ENXIO; 1150 + 1151 + if (neigh) { 1152 + if (neigh->nud_state & ~NUD_NOARP) 1153 + err = neigh_update(neigh, NULL, NUD_FAILED, 1154 + NEIGH_UPDATE_F_OVERRIDE| 1155 + NEIGH_UPDATE_F_ADMIN); 1156 + neigh_release(neigh); 1157 + } 1158 + 1159 + return err; 1160 + } 1161 + EXPORT_SYMBOL(arp_invalidate); 1162 + 1146 1163 static int arp_req_delete_public(struct net *net, struct arpreq *r, 1147 1164 struct net_device *dev) 1148 1165 { ··· 1180 1163 { 1181 1164 int err; 1182 1165 __be32 ip; 1183 - struct neighbour *neigh; 1184 1166 1185 1167 if (r->arp_flags & ATF_PUBL) 1186 1168 return arp_req_delete_public(net, r, dev); ··· 1197 1181 if (!dev) 1198 1182 return -EINVAL; 1199 1183 } 1200 - err = -ENXIO; 1201 - neigh = neigh_lookup(&arp_tbl, &ip, dev); 1202 - if (neigh) { 1203 - if (neigh->nud_state & ~NUD_NOARP) 1204 - err = neigh_update(neigh, NULL, NUD_FAILED, 1205 - NEIGH_UPDATE_F_OVERRIDE| 1206 - NEIGH_UPDATE_F_ADMIN); 1207 - neigh_release(neigh); 1208 - } 1209 - return err; 1184 + return arp_invalidate(dev, ip); 1210 1185 } 1211 1186 1212 1187 /*