diff options
Diffstat (limited to 'pfinet/linux-src/net/ipv4/arp.c')
-rw-r--r-- | pfinet/linux-src/net/ipv4/arp.c | 97 |
1 files changed, 37 insertions, 60 deletions
diff --git a/pfinet/linux-src/net/ipv4/arp.c b/pfinet/linux-src/net/ipv4/arp.c index d81c1bee..508142d4 100644 --- a/pfinet/linux-src/net/ipv4/arp.c +++ b/pfinet/linux-src/net/ipv4/arp.c @@ -1,6 +1,6 @@ /* linux/net/inet/arp.c * - * Version: $Id: arp.c,v 1.77.2.4 1999/09/23 19:03:36 davem Exp $ + * Version: $Id: arp.c,v 1.77.2.1 1999/06/28 10:39:23 davem Exp $ * * Copyright (C) 1994 by Florian La Roche * @@ -15,9 +15,9 @@ * 2 of the License, or (at your option) any later version. * * Fixes: - * Alan Cox : Removed the Ethernet assumptions in + * Alan Cox : Removed the Ethernet assumptions in * Florian's code - * Alan Cox : Fixed some small errors in the ARP + * Alan Cox : Fixed some small errors in the ARP * logic * Alan Cox : Allow >4K in /proc * Alan Cox : Make ARP add its own protocol entry @@ -39,18 +39,18 @@ * Jonathan Naylor : Only lookup the hardware address for * the correct hardware type. * Germano Caronni : Assorted subtle races. - * Craig Schlenter : Don't modify permanent entry + * Craig Schlenter : Don't modify permanent entry * during arp_rcv. * Russ Nelson : Tidied up a few bits. * Alexey Kuznetsov: Major changes to caching and behaviour, - * eg intelligent arp probing and + * eg intelligent arp probing and * generation * of host down events. * Alan Cox : Missing unlock in device events. * Eckes : ARP ioctl control errors. * Alexey Kuznetsov: Arp free fix. * Manuel Rodriguez: Gratuitous ARP. - * Jonathan Layes : Added arpd support through kerneld + * Jonathan Layes : Added arpd support through kerneld * message queue (960314) * Mike Shaver : /proc/sys/net/ipv4/arp_* support * Mike McLagan : Routing by source @@ -65,8 +65,6 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c. - * Julian Anastasov: "hidden" flag: hide the - * interface and don't reply for it */ /* RFC1122 Status: @@ -79,7 +77,7 @@ unresolved IP address. (OK) 950727 -- MS */ - + #include <linux/types.h> #include <linux/string.h> #include <linux/kernel.h> @@ -264,7 +262,7 @@ static int arp_constructor(struct neighbour *neigh) switch (dev->type) { default: break; - case ARPHRD_ROSE: + case ARPHRD_ROSE: #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) case ARPHRD_AX25: #if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) @@ -310,15 +308,10 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb) u32 saddr; u8 *dst_ha = NULL; struct device *dev = neigh->dev; - struct device *dev2; - struct in_device *in_dev2; u32 target = *(u32*)neigh->primary_key; int probes = neigh->probes; - if (skb && - (dev2 = ip_dev_find(skb->nh.iph->saddr)) != NULL && - (in_dev2 = dev2->ip_ptr) != NULL && - !IN_DEV_HIDDEN(in_dev2)) + if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL) saddr = skb->nh.iph->saddr; else saddr = inet_select_addr(dev, target, RT_SCOPE_LINK); @@ -431,8 +424,8 @@ int arp_bind_neighbour(struct dst_entry *dst) * message. */ -void arp_send(int type, int ptype, u32 dest_ip, - struct device *dev, u32 src_ip, +void arp_send(int type, int ptype, u32 dest_ip, + struct device *dev, u32 src_ip, unsigned char *dest_hw, unsigned char *src_hw, unsigned char *target_hw) { @@ -443,14 +436,14 @@ void arp_send(int type, int ptype, u32 dest_ip, /* * No arp on this interface. */ - + if (dev->flags&IFF_NOARP) return; /* * Allocate a buffer */ - + skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4) + dev->hard_header_len + 15, GFP_ATOMIC); if (skb == NULL) @@ -556,10 +549,10 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) * of the device. Similarly, the hardware types should match. The * device should be ARP-able. Also, if pln is not 4, then the lookup * is not from an IP number. We can't currently handle this, so toss - * it. - */ + * it. + */ if (in_dev == NULL || - arp->ar_hln != dev->addr_len || + arp->ar_hln != dev->addr_len || dev->flags & IFF_NOARP || skb->pkt_type == PACKET_OTHERHOST || skb->pkt_type == PACKET_LOOPBACK || @@ -567,7 +560,7 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) goto out; switch (dev_type) { - default: + default: if (arp->ar_pro != __constant_htons(ETH_P_IP)) goto out; if (htons(dev_type) != arp->ar_hrd) @@ -634,7 +627,7 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) tha=arp_ptr; arp_ptr += dev->addr_len; memcpy(&tip, arp_ptr, 4); -/* +/* * Check for bad requests for 127.x.x.x and requests for multicast * addresses. If this is one such, delete it. */ @@ -645,29 +638,23 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) * Process entry. The idea here is we want to send a reply if it is a * request for us or if it is a request for someone else that we hold * a proxy for. We want to add an entry to our cache if it is a reply - * to us or if it is a request for our address. - * (The assumption for this last is that if someone is requesting our - * address, they are probably intending to talk to us, so it saves time - * if we cache their address. Their address is also probably not in + * to us or if it is a request for our address. + * (The assumption for this last is that if someone is requesting our + * address, they are probably intending to talk to us, so it saves time + * if we cache their address. Their address is also probably not in * our cache, since ours is not in their cache.) - * + * * Putting this another way, we only care about replies if they are to * us, in which case we add them to the cache. For requests, we care * about those for us and those for our proxies. We reply to both, - * and in the case of requests for us we add the requester to the arp + * and in the case of requests for us we add the requester to the arp * cache. */ /* Special case: IPv4 duplicate address detection packet (RFC2131) */ if (sip == 0) { - struct device *dev2; - struct in_device *in_dev2; - if (arp->ar_op == __constant_htons(ARPOP_REQUEST) && - (dev2 = ip_dev_find(tip)) != NULL && - (dev2 == dev || - ((in_dev2 = dev2->ip_ptr) != NULL && - !IN_DEV_HIDDEN(in_dev2)))) + inet_addr_type(tip) == RTN_LOCAL) arp_send(ARPOP_REPLY,ETH_P_ARP,tip,dev,tip,sha,dev->dev_addr,dev->dev_addr); goto out; } @@ -681,20 +668,6 @@ int arp_rcv(struct sk_buff *skb, struct device *dev, struct packet_type *pt) if (addr_type == RTN_LOCAL) { n = neigh_event_ns(&arp_tbl, sha, &sip, dev); if (n) { - if (ipv4_devconf.hidden && - skb->pkt_type != PACKET_HOST) { - struct device *dev2; - struct in_device *in_dev2; - - if ((dev2 = ip_dev_find(tip)) != NULL && - dev2 != dev && - (in_dev2 = dev2->ip_ptr) != NULL && - IN_DEV_HIDDEN(in_dev2)) { - neigh_release(n); - goto out; - } - } - arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); neigh_release(n); } @@ -813,7 +786,7 @@ int arp_req_set(struct arpreq *r, struct device * dev) if (!dev) return -EINVAL; } - if (r->arp_ha.sa_family != dev->type) + if (r->arp_ha.sa_family != dev->type) return -EINVAL; err = -ENOBUFS; @@ -910,6 +883,9 @@ int arp_req_delete(struct arpreq *r, struct device * dev) return err; } +#ifdef _HURD_ +#define arp_ioctl 0 +#else /* * Handle an ARP layer I/O control request. */ @@ -977,6 +953,7 @@ out: rtnl_unlock(); return err; } +#endif /* * Write the contents of the ARP cache to a PROCfs file. @@ -1030,7 +1007,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy hbuffer[k++]=':'; } hbuffer[--k]=0; - + #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) } #endif @@ -1047,7 +1024,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy "%-17s0x%-10x0x%-10x%s", in_ntoa(*(u32*)n->primary_key), hatype, - arp_state_to_flags(n), + arp_state_to_flags(n), hbuffer); size += sprintf(buffer+len+size, " %-17s %s\n", @@ -1055,7 +1032,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy len += size; pos += size; - + if (pos <= offset) len=0; if (pos >= offset+length) @@ -1081,7 +1058,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy len += size; pos += size; - + if (pos <= offset) len=0; if (pos >= offset+length) @@ -1091,7 +1068,7 @@ int arp_get_info(char *buffer, char **start, off_t offset, int length, int dummy done: neigh_table_unlock(&arp_tbl); - + *start = buffer+len-(pos-offset); /* Start of wanted data */ len = pos-offset; /* Start slop */ if (len>length) @@ -1165,14 +1142,14 @@ char *ax2asc(ax25_address *a) if (c != ' ') *s++ = c; } - + *s++ = '-'; if ((n = ((a->ax25_call[6] >> 1) & 0x0F)) > 9) { *s++ = '1'; n -= 10; } - + *s++ = n + '0'; *s++ = '\0'; |