aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/arp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/arp.c')
-rw-r--r--net/ipv4/arp.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 3981e8be9ab8..a58afde4f72f 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -15,9 +15,9 @@
15 * 2 of the License, or (at your option) any later version. 15 * 2 of the License, or (at your option) any later version.
16 * 16 *
17 * Fixes: 17 * Fixes:
18 * Alan Cox : Removed the Ethernet assumptions in 18 * Alan Cox : Removed the Ethernet assumptions in
19 * Florian's code 19 * Florian's code
20 * Alan Cox : Fixed some small errors in the ARP 20 * Alan Cox : Fixed some small errors in the ARP
21 * logic 21 * logic
22 * Alan Cox : Allow >4K in /proc 22 * Alan Cox : Allow >4K in /proc
23 * Alan Cox : Make ARP add its own protocol entry 23 * Alan Cox : Make ARP add its own protocol entry
@@ -39,18 +39,18 @@
39 * Jonathan Naylor : Only lookup the hardware address for 39 * Jonathan Naylor : Only lookup the hardware address for
40 * the correct hardware type. 40 * the correct hardware type.
41 * Germano Caronni : Assorted subtle races. 41 * Germano Caronni : Assorted subtle races.
42 * Craig Schlenter : Don't modify permanent entry 42 * Craig Schlenter : Don't modify permanent entry
43 * during arp_rcv. 43 * during arp_rcv.
44 * Russ Nelson : Tidied up a few bits. 44 * Russ Nelson : Tidied up a few bits.
45 * Alexey Kuznetsov: Major changes to caching and behaviour, 45 * Alexey Kuznetsov: Major changes to caching and behaviour,
46 * eg intelligent arp probing and 46 * eg intelligent arp probing and
47 * generation 47 * generation
48 * of host down events. 48 * of host down events.
49 * Alan Cox : Missing unlock in device events. 49 * Alan Cox : Missing unlock in device events.
50 * Eckes : ARP ioctl control errors. 50 * Eckes : ARP ioctl control errors.
51 * Alexey Kuznetsov: Arp free fix. 51 * Alexey Kuznetsov: Arp free fix.
52 * Manuel Rodriguez: Gratuitous ARP. 52 * Manuel Rodriguez: Gratuitous ARP.
53 * Jonathan Layes : Added arpd support through kerneld 53 * Jonathan Layes : Added arpd support through kerneld
54 * message queue (960314) 54 * message queue (960314)
55 * Mike Shaver : /proc/sys/net/ipv4/arp_* support 55 * Mike Shaver : /proc/sys/net/ipv4/arp_* support
56 * Mike McLagan : Routing by source 56 * Mike McLagan : Routing by source
@@ -210,7 +210,7 @@ int arp_mc_map(__be32 addr, u8 *haddr, struct net_device *dev, int dir)
210 case ARPHRD_FDDI: 210 case ARPHRD_FDDI:
211 case ARPHRD_IEEE802: 211 case ARPHRD_IEEE802:
212 ip_eth_mc_map(addr, haddr); 212 ip_eth_mc_map(addr, haddr);
213 return 0; 213 return 0;
214 case ARPHRD_IEEE802_TR: 214 case ARPHRD_IEEE802_TR:
215 ip_tr_mc_map(addr, haddr); 215 ip_tr_mc_map(addr, haddr);
216 return 0; 216 return 0;
@@ -288,7 +288,7 @@ static int arp_constructor(struct neighbour *neigh)
288 switch (dev->type) { 288 switch (dev->type) {
289 default: 289 default:
290 break; 290 break;
291 case ARPHRD_ROSE: 291 case ARPHRD_ROSE:
292#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) 292#if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
293 case ARPHRD_AX25: 293 case ARPHRD_AX25:
294#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) 294#if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE)
@@ -425,18 +425,18 @@ static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
425 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip, 425 struct flowi fl = { .nl_u = { .ip4_u = { .daddr = sip,
426 .saddr = tip } } }; 426 .saddr = tip } } };
427 struct rtable *rt; 427 struct rtable *rt;
428 int flag = 0; 428 int flag = 0;
429 /*unsigned long now; */ 429 /*unsigned long now; */
430 430
431 if (ip_route_output_key(&rt, &fl) < 0) 431 if (ip_route_output_key(&rt, &fl) < 0)
432 return 1; 432 return 1;
433 if (rt->u.dst.dev != dev) { 433 if (rt->u.dst.dev != dev) {
434 NET_INC_STATS_BH(LINUX_MIB_ARPFILTER); 434 NET_INC_STATS_BH(LINUX_MIB_ARPFILTER);
435 flag = 1; 435 flag = 1;
436 } 436 }
437 ip_rt_put(rt); 437 ip_rt_put(rt);
438 return flag; 438 return flag;
439} 439}
440 440
441/* OBSOLETE FUNCTIONS */ 441/* OBSOLETE FUNCTIONS */
442 442
@@ -490,7 +490,7 @@ int arp_find(unsigned char *haddr, struct sk_buff *skb)
490 n->used = jiffies; 490 n->used = jiffies;
491 if (n->nud_state&NUD_VALID || neigh_event_send(n, skb) == 0) { 491 if (n->nud_state&NUD_VALID || neigh_event_send(n, skb) == 0) {
492 read_lock_bh(&n->lock); 492 read_lock_bh(&n->lock);
493 memcpy(haddr, n->ha, dev->addr_len); 493 memcpy(haddr, n->ha, dev->addr_len);
494 read_unlock_bh(&n->lock); 494 read_unlock_bh(&n->lock);
495 neigh_release(n); 495 neigh_release(n);
496 return 0; 496 return 0;
@@ -572,7 +572,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
572 /* 572 /*
573 * Allocate a buffer 573 * Allocate a buffer
574 */ 574 */
575 575
576 skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4) 576 skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4)
577 + LL_RESERVED_SPACE(dev), GFP_ATOMIC); 577 + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
578 if (skb == NULL) 578 if (skb == NULL)
@@ -685,7 +685,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
685 /* 685 /*
686 * No arp on this interface. 686 * No arp on this interface.
687 */ 687 */
688 688
689 if (dev->flags&IFF_NOARP) 689 if (dev->flags&IFF_NOARP)
690 return; 690 return;
691 691
@@ -725,7 +725,7 @@ static int arp_process(struct sk_buff *skb)
725 arp = skb->nh.arph; 725 arp = skb->nh.arph;
726 726
727 switch (dev_type) { 727 switch (dev_type) {
728 default: 728 default:
729 if (arp->ar_pro != htons(ETH_P_IP) || 729 if (arp->ar_pro != htons(ETH_P_IP) ||
730 htons(dev_type) != arp->ar_hrd) 730 htons(dev_type) != arp->ar_hrd)
731 goto out; 731 goto out;
@@ -792,7 +792,7 @@ static int arp_process(struct sk_buff *skb)
792 tha = arp_ptr; 792 tha = arp_ptr;
793 arp_ptr += dev->addr_len; 793 arp_ptr += dev->addr_len;
794 memcpy(&tip, arp_ptr, 4); 794 memcpy(&tip, arp_ptr, 4);
795/* 795/*
796 * Check for bad requests for 127.x.x.x and requests for multicast 796 * Check for bad requests for 127.x.x.x and requests for multicast
797 * addresses. If this is one such, delete it. 797 * addresses. If this is one such, delete it.
798 */ 798 */
@@ -809,16 +809,16 @@ static int arp_process(struct sk_buff *skb)
809 * Process entry. The idea here is we want to send a reply if it is a 809 * Process entry. The idea here is we want to send a reply if it is a
810 * request for us or if it is a request for someone else that we hold 810 * request for us or if it is a request for someone else that we hold
811 * a proxy for. We want to add an entry to our cache if it is a reply 811 * a proxy for. We want to add an entry to our cache if it is a reply
812 * to us or if it is a request for our address. 812 * to us or if it is a request for our address.
813 * (The assumption for this last is that if someone is requesting our 813 * (The assumption for this last is that if someone is requesting our
814 * address, they are probably intending to talk to us, so it saves time 814 * address, they are probably intending to talk to us, so it saves time
815 * if we cache their address. Their address is also probably not in 815 * if we cache their address. Their address is also probably not in
816 * our cache, since ours is not in their cache.) 816 * our cache, since ours is not in their cache.)
817 * 817 *
818 * Putting this another way, we only care about replies if they are to 818 * Putting this another way, we only care about replies if they are to
819 * us, in which case we add them to the cache. For requests, we care 819 * us, in which case we add them to the cache. For requests, we care
820 * about those for us and those for our proxies. We reply to both, 820 * about those for us and those for our proxies. We reply to both,
821 * and in the case of requests for us we add the requester to the arp 821 * and in the case of requests for us we add the requester to the arp
822 * cache. 822 * cache.
823 */ 823 */
824 824
@@ -845,7 +845,7 @@ static int arp_process(struct sk_buff *skb)
845 if (!dont_send) 845 if (!dont_send)
846 dont_send |= arp_ignore(in_dev,dev,sip,tip); 846 dont_send |= arp_ignore(in_dev,dev,sip,tip);
847 if (!dont_send && IN_DEV_ARPFILTER(in_dev)) 847 if (!dont_send && IN_DEV_ARPFILTER(in_dev))
848 dont_send |= arp_filter(sip,tip,dev); 848 dont_send |= arp_filter(sip,tip,dev);
849 if (!dont_send) 849 if (!dont_send)
850 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); 850 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
851 851
@@ -860,7 +860,7 @@ static int arp_process(struct sk_buff *skb)
860 if (n) 860 if (n)
861 neigh_release(n); 861 neigh_release(n);
862 862
863 if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED || 863 if (NEIGH_CB(skb)->flags & LOCALLY_ENQUEUED ||
864 skb->pkt_type == PACKET_HOST || 864 skb->pkt_type == PACKET_HOST ||
865 in_dev->arp_parms->proxy_delay == 0) { 865 in_dev->arp_parms->proxy_delay == 0) {
866 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); 866 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
@@ -1039,7 +1039,7 @@ static int arp_req_set(struct arpreq *r, struct net_device * dev)
1039 if (r->arp_flags & ATF_PERM) 1039 if (r->arp_flags & ATF_PERM)
1040 state = NUD_PERMANENT; 1040 state = NUD_PERMANENT;
1041 err = neigh_update(neigh, (r->arp_flags&ATF_COM) ? 1041 err = neigh_update(neigh, (r->arp_flags&ATF_COM) ?
1042 r->arp_ha.sa_data : NULL, state, 1042 r->arp_ha.sa_data : NULL, state,
1043 NEIGH_UPDATE_F_OVERRIDE| 1043 NEIGH_UPDATE_F_OVERRIDE|
1044 NEIGH_UPDATE_F_ADMIN); 1044 NEIGH_UPDATE_F_ADMIN);
1045 neigh_release(neigh); 1045 neigh_release(neigh);
@@ -1121,7 +1121,7 @@ static int arp_req_delete(struct arpreq *r, struct net_device * dev)
1121 neigh = neigh_lookup(&arp_tbl, &ip, dev); 1121 neigh = neigh_lookup(&arp_tbl, &ip, dev);
1122 if (neigh) { 1122 if (neigh) {
1123 if (neigh->nud_state&~NUD_NOARP) 1123 if (neigh->nud_state&~NUD_NOARP)
1124 err = neigh_update(neigh, NULL, NUD_FAILED, 1124 err = neigh_update(neigh, NULL, NUD_FAILED,
1125 NEIGH_UPDATE_F_OVERRIDE| 1125 NEIGH_UPDATE_F_OVERRIDE|
1126 NEIGH_UPDATE_F_ADMIN); 1126 NEIGH_UPDATE_F_ADMIN);
1127 neigh_release(neigh); 1127 neigh_release(neigh);
@@ -1181,7 +1181,7 @@ int arp_ioctl(unsigned int cmd, void __user *arg)
1181 1181
1182 switch(cmd) { 1182 switch(cmd) {
1183 case SIOCDARP: 1183 case SIOCDARP:
1184 err = arp_req_delete(&r, dev); 1184 err = arp_req_delete(&r, dev);
1185 break; 1185 break;
1186 case SIOCSARP: 1186 case SIOCSARP:
1187 err = arp_req_set(&r, dev); 1187 err = arp_req_set(&r, dev);
@@ -1268,14 +1268,14 @@ static char *ax2asc2(ax25_address *a, char *buf)
1268 1268
1269 if (c != ' ') *s++ = c; 1269 if (c != ' ') *s++ = c;
1270 } 1270 }
1271 1271
1272 *s++ = '-'; 1272 *s++ = '-';
1273 1273
1274 if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { 1274 if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) {
1275 *s++ = '1'; 1275 *s++ = '1';
1276 n -= 10; 1276 n -= 10;
1277 } 1277 }
1278 1278
1279 *s++ = n + '0'; 1279 *s++ = n + '0';
1280 *s++ = '\0'; 1280 *s++ = '\0';
1281 1281
@@ -1373,7 +1373,7 @@ static int arp_seq_open(struct inode *inode, struct file *file)
1373 struct seq_file *seq; 1373 struct seq_file *seq;
1374 int rc = -ENOMEM; 1374 int rc = -ENOMEM;
1375 struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL); 1375 struct neigh_seq_state *s = kzalloc(sizeof(*s), GFP_KERNEL);
1376 1376
1377 if (!s) 1377 if (!s)
1378 goto out; 1378 goto out;
1379 1379