diff options
| author | David S. Miller <davem@nuts.ninka.net> | 2002-05-05 09:25:25 -0700 |
|---|---|---|
| committer | David S. Miller <davem@nuts.ninka.net> | 2002-05-05 09:25:25 -0700 |
| commit | 87477c8b07f935f331524f2cecccc628ac0aaf73 (patch) | |
| tree | 892066732a46307dbbffb1e328c233c05e0ddadc | |
| parent | 702d27c75ce9c624d4015ea61d1cec85e9d140a9 (diff) | |
| parent | 916db246b47a25a8d8c783998a922a5c3a2cf4f6 (diff) | |
Merge nuts.ninka.net:/home/davem/src/BK/BAK-net-2.5
into nuts.ninka.net:/home/davem/src/BK/net-2.5
| -rw-r--r-- | drivers/char/random.c | 2 | ||||
| -rw-r--r-- | net/core/neighbour.c | 11 | ||||
| -rw-r--r-- | net/ipv4/arp.c | 217 | ||||
| -rw-r--r-- | net/ipv6/Makefile | 4 | ||||
| -rw-r--r-- | net/ipv6/ipv6_syms.c | 12 | ||||
| -rw-r--r-- | net/netsyms.c | 14 |
6 files changed, 103 insertions, 157 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c index 436e48ed79d4..d91445f62fd2 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2068,6 +2068,7 @@ __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, seq += tv.tv_usec + tv.tv_sec*1000000; return seq; } +EXPORT_SYMBOL(secure_tcpv6_sequence_number); __u32 secure_ipv6_id(__u32 *daddr) { @@ -2088,6 +2089,7 @@ __u32 secure_ipv6_id(__u32 *daddr) return twothirdsMD4Transform(daddr, secret); } +EXPORT_SYMBOL(secure_ipv6_id); #endif diff --git a/net/core/neighbour.c b/net/core/neighbour.c index e1329d03182a..e946af4fba3b 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -54,12 +54,6 @@ static int pneigh_ifdown(struct neigh_table *tbl, struct net_device *dev); static int neigh_glbl_allocs; static struct neigh_table *neigh_tables; -#if defined(__i386__) && defined(CONFIG_SMP) -#define ASSERT_WL(n) if ((int)((n)->lock.lock) > 0) { printk("WL assertion failed at " __FILE__ "(%d):" __FUNCTION__ "\n", __LINE__); } -#else -#define ASSERT_WL(n) do { } while(0) -#endif - /* Neighbour hash table buckets are protected with rwlock tbl->lock. @@ -484,8 +478,6 @@ static void neigh_suspect(struct neighbour *neigh) NEIGH_PRINTK2("neigh %p is suspecteded.\n", neigh); - ASSERT_WL(neigh); - neigh->output = neigh->ops->output; for (hh = neigh->hh; hh; hh = hh->hh_next) @@ -503,8 +495,6 @@ static void neigh_connect(struct neighbour *neigh) NEIGH_PRINTK2("neigh %p is connected.\n", neigh); - ASSERT_WL(neigh); - neigh->output = neigh->ops->connected_output; for (hh = neigh->hh; hh; hh = hh->hh_next) @@ -529,7 +519,6 @@ static void neigh_sync(struct neighbour *n) unsigned long now = jiffies; u8 state = n->nud_state; - ASSERT_WL(n); if (state&(NUD_NOARP|NUD_PERMANENT)) return; if (state&NUD_REACHABLE) { diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c index dd26ec77a82f..f66b8220474b 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -513,7 +513,7 @@ void arp_send(int type, int ptype, u32 dest_ip, skb->nh.raw = skb->data; arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4)); skb->dev = dev; - skb->protocol = __constant_htons (ETH_P_ARP); + skb->protocol = htons(ETH_P_ARP); if (src_hw == NULL) src_hw = dev->dev_addr; if (dest_hw == NULL) @@ -539,33 +539,33 @@ void arp_send(int type, int ptype, u32 dest_ip, switch (dev->type) { default: arp->ar_hrd = htons(dev->type); - arp->ar_pro = __constant_htons(ETH_P_IP); + arp->ar_pro = htons(ETH_P_IP); break; #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) case ARPHRD_AX25: - arp->ar_hrd = __constant_htons(ARPHRD_AX25); - arp->ar_pro = __constant_htons(AX25_P_IP); + arp->ar_hrd = htons(ARPHRD_AX25); + arp->ar_pro = htons(AX25_P_IP); break; #if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) case ARPHRD_NETROM: - arp->ar_hrd = __constant_htons(ARPHRD_NETROM); - arp->ar_pro = __constant_htons(AX25_P_IP); + arp->ar_hrd = htons(ARPHRD_NETROM); + arp->ar_pro = htons(AX25_P_IP); break; #endif #endif #ifdef CONFIG_FDDI case ARPHRD_FDDI: - arp->ar_hrd = __constant_htons(ARPHRD_ETHER); - arp->ar_pro = __constant_htons(ETH_P_IP); + arp->ar_hrd = htons(ARPHRD_ETHER); + arp->ar_pro = htons(ETH_P_IP); break; #endif #ifdef CONFIG_TR case ARPHRD_IEEE802_TR: - arp->ar_hrd = __constant_htons(ARPHRD_IEEE802); - arp->ar_pro = __constant_htons(ETH_P_IP); + arp->ar_hrd = htons(ARPHRD_IEEE802); + arp->ar_pro = htons(ETH_P_IP); break; #endif } @@ -629,77 +629,49 @@ int arp_process(struct sk_buff *skb) switch (dev_type) { default: - if (arp->ar_pro != __constant_htons(ETH_P_IP)) - goto out; - if (htons(dev_type) != arp->ar_hrd) + if (arp->ar_pro != htons(ETH_P_IP) || + htons(dev_type) != arp->ar_hrd) goto out; break; #ifdef CONFIG_NET_ETHERNET case ARPHRD_ETHER: - /* - * ETHERNET devices will accept ARP hardware types of either - * 1 (Ethernet) or 6 (IEEE 802.2). - */ - if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) && - arp->ar_hrd != __constant_htons(ARPHRD_IEEE802)) - goto out; - if (arp->ar_pro != __constant_htons(ETH_P_IP)) - goto out; - break; #endif #ifdef CONFIG_TR case ARPHRD_IEEE802_TR: - /* - * Token ring devices will accept ARP hardware types of either - * 1 (Ethernet) or 6 (IEEE 802.2). - */ - if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) && - arp->ar_hrd != __constant_htons(ARPHRD_IEEE802)) - goto out; - if (arp->ar_pro != __constant_htons(ETH_P_IP)) - goto out; - break; #endif #ifdef CONFIG_FDDI case ARPHRD_FDDI: - /* - * According to RFC 1390, FDDI devices should accept ARP hardware types - * of 1 (Ethernet). However, to be more robust, we'll accept hardware - * types of either 1 (Ethernet) or 6 (IEEE 802.2). - */ - if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) && - arp->ar_hrd != __constant_htons(ARPHRD_IEEE802)) - goto out; - if (arp->ar_pro != __constant_htons(ETH_P_IP)) - goto out; - break; #endif #ifdef CONFIG_NET_FC case ARPHRD_IEEE802: +#endif +#if defined(CONFIG_NET_ETHERNET) || defined(CONFIG_TR) || \ + defined(CONFIG_FDDI) || defined(CONFIG_NET_FC) /* - * According to RFC 2625, Fibre Channel devices (which are IEEE - * 802 devices) should accept ARP hardware types of 6 (IEEE 802) - * and 1 (Ethernet). + * ETHERNET, Token Ring and Fibre Channel (which are IEEE 802 + * devices, according to RFC 2625) devices will accept ARP + * hardware types of either 1 (Ethernet) or 6 (IEEE 802.2). + * This is the case also of FDDI, where the RFC 1390 says that + * FDDI devices should accept ARP hardware of (1) Ethernet, + * however, to be more robust, we'll accept both 1 (Ethernet) + * or 6 (IEEE 802.2) */ - if (arp->ar_hrd != __constant_htons(ARPHRD_ETHER) && - arp->ar_hrd != __constant_htons(ARPHRD_IEEE802)) - goto out; - if (arp->ar_pro != __constant_htons(ETH_P_IP)) + if ((arp->ar_hrd != htons(ARPHRD_ETHER) && + arp->ar_hrd != htons(ARPHRD_IEEE802)) || + arp->ar_pro != htons(ETH_P_IP)) goto out; break; #endif #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) case ARPHRD_AX25: - if (arp->ar_pro != __constant_htons(AX25_P_IP)) - goto out; - if (arp->ar_hrd != __constant_htons(ARPHRD_AX25)) + if (arp->ar_pro != htons(AX25_P_IP) || + arp->ar_hrd != htons(ARPHRD_AX25)) goto out; break; #if defined(CONFIG_NETROM) || defined(CONFIG_NETROM_MODULE) case ARPHRD_NETROM: - if (arp->ar_pro != __constant_htons(AX25_P_IP)) - goto out; - if (arp->ar_hrd != __constant_htons(ARPHRD_NETROM)) + if (arp->ar_pro != htons(AX25_P_IP) || + arp->ar_hrd != htons(ARPHRD_NETROM)) goto out; break; #endif @@ -708,18 +680,18 @@ int arp_process(struct sk_buff *skb) /* Understand only these message types */ - if (arp->ar_op != __constant_htons(ARPOP_REPLY) && - arp->ar_op != __constant_htons(ARPOP_REQUEST)) + if (arp->ar_op != htons(ARPOP_REPLY) && + arp->ar_op != htons(ARPOP_REQUEST)) goto out; /* * Extract fields */ - sha=arp_ptr; + sha = arp_ptr; arp_ptr += dev->addr_len; memcpy(&sip, arp_ptr, 4); arp_ptr += 4; - tha=arp_ptr; + tha = arp_ptr; arp_ptr += dev->addr_len; memcpy(&tip, arp_ptr, 4); /* @@ -754,13 +726,13 @@ int arp_process(struct sk_buff *skb) /* Special case: IPv4 duplicate address detection packet (RFC2131) */ if (sip == 0) { - if (arp->ar_op == __constant_htons(ARPOP_REQUEST) && + if (arp->ar_op == htons(ARPOP_REQUEST) && 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; } - if (arp->ar_op == __constant_htons(ARPOP_REQUEST) && + if (arp->ar_op == htons(ARPOP_REQUEST) && ip_route_input(skb, tip, sip, 0, dev) == 0) { rt = (struct rtable*)skb->dst; @@ -810,7 +782,7 @@ int arp_process(struct sk_buff *skb) devices (strip is candidate) */ if (n == NULL && - arp->ar_op == __constant_htons(ARPOP_REPLY) && + arp->ar_op == htons(ARPOP_REPLY) && inet_addr_type(sip) == RTN_UNICAST) n = __neigh_lookup(&arp_tbl, &sip, dev, -1); #endif @@ -830,7 +802,7 @@ int arp_process(struct sk_buff *skb) /* Broadcast replies and request packets do not assert neighbour reachability. */ - if (arp->ar_op != __constant_htons(ARPOP_REPLY) || + if (arp->ar_op != htons(ARPOP_REPLY) || skb->pkt_type != PACKET_HOST) state = NUD_STALE; neigh_update(n, sha, state, override, 1); @@ -983,7 +955,8 @@ int arp_req_delete(struct arpreq *r, struct net_device * dev) struct neighbour *neigh; if (r->arp_flags & ATF_PUBL) { - u32 mask = ((struct sockaddr_in *) &r->arp_netmask)->sin_addr.s_addr; + u32 mask = + ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr; if (mask == 0xFFFFFFFF) return pneigh_delete(&arp_tbl, &ip, dev); if (mask == 0) { @@ -1027,9 +1000,9 @@ int arp_ioctl(unsigned int cmd, void *arg) { int err; struct arpreq r; - struct net_device * dev = NULL; + struct net_device *dev = NULL; - switch(cmd) { + switch (cmd) { case SIOCDARP: case SIOCSARP: if (!capable(CAP_NET_ADMIN)) @@ -1050,8 +1023,8 @@ int arp_ioctl(unsigned int cmd, void *arg) (r.arp_flags & (ATF_NETMASK|ATF_DONTPUB))) return -EINVAL; if (!(r.arp_flags & ATF_NETMASK)) - ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr=__constant_htonl(0xFFFFFFFFUL); - + ((struct sockaddr_in *)&r.arp_netmask)->sin_addr.s_addr = + htonl(0xFFFFFFFFUL); rtnl_lock(); if (r.arp_dev[0]) { err = -ENODEV; @@ -1091,7 +1064,10 @@ out: * Write the contents of the ARP cache to a PROCfs file. */ #ifndef CONFIG_PROC_FS -static int arp_get_info(char *buffer, char **start, off_t offset, int length) { return 0; } +static int arp_get_info(char *buffer, char **start, off_t offset, int length) +{ + return 0; +} #else #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) static char *ax2asc2(ax25_address *a, char *buf); @@ -1100,70 +1076,57 @@ static char *ax2asc2(ax25_address *a, char *buf); static int arp_get_info(char *buffer, char **start, off_t offset, int length) { - int len=0; - off_t pos=0; - int size; char hbuffer[HBUFFERLEN]; int i,j,k; - const char hexbuf[] = "0123456789ABCDEF"; + const char hexbuf[] = "0123456789ABCDEF"; + int size = sprintf(buffer, "IP address HW type Flags " + "HW address Mask Device\n"); + int len = size; + off_t pos = size; - size = sprintf(buffer,"IP address HW type Flags HW address Mask Device\n"); - - pos+=size; - len+=size; - - for(i=0; i<=NEIGH_HASHMASK; i++) { + for (i = 0; i <= NEIGH_HASHMASK; i++) { struct neighbour *n; read_lock_bh(&arp_tbl.lock); - for (n=arp_tbl.hash_buckets[i]; n; n=n->next) { + for (n = arp_tbl.hash_buckets[i]; n; n = n->next) { + char tbuf[16]; struct net_device *dev = n->dev; int hatype = dev->type; /* Do not confuse users "arp -a" with magic entries */ - if (!(n->nud_state&~NUD_NOARP)) + if (!(n->nud_state & ~NUD_NOARP)) continue; read_lock(&n->lock); - -/* - * Convert hardware address to XX:XX:XX:XX ... form. - */ + /* Convert hardware address to XX:XX:XX:XX ... form. */ #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) if (hatype == ARPHRD_AX25 || hatype == ARPHRD_NETROM) ax2asc2((ax25_address *)n->ha, hbuffer); else { #endif - for (k=0,j=0;k<HBUFFERLEN-3 && j<dev->addr_len;j++) { - hbuffer[k++]=hexbuf[(n->ha[j]>>4)&15 ]; - hbuffer[k++]=hexbuf[n->ha[j]&15 ]; - hbuffer[k++]=':'; + for (k = 0, j = 0; k < HBUFFERLEN - 3 && + j < dev->addr_len; j++) { + hbuffer[k++] = hexbuf[(n->ha[j] >> 4) & 15]; + hbuffer[k++] = hexbuf[n->ha[j] & 15]; + hbuffer[k++] = ':'; } - hbuffer[--k]=0; - + hbuffer[--k] = 0; #if defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE) - } -#endif - - { - char tbuf[16]; - sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->primary_key)); - size = sprintf(buffer+len, "%-16s 0x%-10x0x%-10x%s" - " * %s\n", - tbuf, - hatype, - arp_state_to_flags(n), - hbuffer, - dev->name); } - +#endif + sprintf(tbuf, "%u.%u.%u.%u", + NIPQUAD(*(u32*)n->primary_key)); + size = sprintf(buffer + len, "%-16s 0x%-10x0x%-10x%s" + " * %s\n", + tbuf, hatype, arp_state_to_flags(n), + hbuffer, dev->name); read_unlock(&n->lock); len += size; pos += size; if (pos <= offset) - len=0; - if (pos >= offset+length) { + len = 0; + if (pos >= offset + length) { read_unlock_bh(&arp_tbl.lock); goto done; } @@ -1171,41 +1134,32 @@ static int arp_get_info(char *buffer, char **start, off_t offset, int length) read_unlock_bh(&arp_tbl.lock); } - for (i=0; i<=PNEIGH_HASHMASK; i++) { + for (i = 0; i <= PNEIGH_HASHMASK; i++) { struct pneigh_entry *n; - for (n=arp_tbl.phash_buckets[i]; n; n=n->next) { + for (n = arp_tbl.phash_buckets[i]; n; n = n->next) { struct net_device *dev = n->dev; int hatype = dev ? dev->type : 0; - - { - char tbuf[16]; - sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->key)); - size = sprintf(buffer+len, "%-16s 0x%-10x0x%-10x%s" - " * %s\n", - tbuf, - hatype, - ATF_PUBL|ATF_PERM, + char tbuf[16]; + sprintf(tbuf, "%u.%u.%u.%u", NIPQUAD(*(u32*)n->key)); + size = sprintf(buffer + len, "%-16s 0x%-10x0x%-10x%s" + " * %s\n", + tbuf, hatype, ATF_PUBL | ATF_PERM, "00:00:00:00:00:00", dev ? dev->name : "*"); - } - len += size; pos += size; if (pos <= offset) - len=0; + len = 0; if (pos >= offset+length) goto done; } } - -done: - - *start = buffer+len-(pos-offset); /* Start of wanted data */ - len = pos-offset; /* Start slop */ - if (len>length) +done: *start = buffer + len - (pos - offset); /* Start of wanted data */ + len = pos - offset; /* Start slop */ + if (len > length) len = length; /* Ending slop */ - if (len<0) + if (len < 0) len = 0; return len; } @@ -1240,7 +1194,8 @@ void __init arp_init (void) proc_net_create ("arp", 0, arp_get_info); #ifdef CONFIG_SYSCTL - neigh_sysctl_register(NULL, &arp_tbl.parms, NET_IPV4, NET_IPV4_NEIGH, "ipv4"); + neigh_sysctl_register(NULL, &arp_tbl.parms, NET_IPV4, + NET_IPV4_NEIGH, "ipv4"); #endif } diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile index f9964e08562b..796b227aecb3 100644 --- a/net/ipv6/Makefile +++ b/net/ipv6/Makefile @@ -9,11 +9,13 @@ O_TARGET := ipv6.o +export-objs := ipv6_syms.o + obj-y := af_inet6.o ip6_output.o ip6_input.o addrconf.o sit.o \ route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o raw.o \ protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \ exthdrs.o sysctl_net_ipv6.o datagram.o proc.o \ - ip6_flowlabel.o + ip6_flowlabel.o ipv6_syms.o obj-m := $(O_TARGET) diff --git a/net/ipv6/ipv6_syms.c b/net/ipv6/ipv6_syms.c new file mode 100644 index 000000000000..4b98f52e6864 --- /dev/null +++ b/net/ipv6/ipv6_syms.c @@ -0,0 +1,12 @@ + +#include <linux/module.h> +#include <net/ipv6.h> +#include <net/addrconf.h> +#include <net/ip6_route.h> + +EXPORT_SYMBOL(ipv6_addr_type); +EXPORT_SYMBOL(icmpv6_send); +EXPORT_SYMBOL(ndisc_mc_map); +EXPORT_SYMBOL(register_inet6addr_notifier); +EXPORT_SYMBOL(unregister_inet6addr_notifier); +EXPORT_SYMBOL(ip6_route_output); diff --git a/net/netsyms.c b/net/netsyms.c index b70eac90223a..f27ec8319217 100644 --- a/net/netsyms.c +++ b/net/netsyms.c @@ -286,15 +286,6 @@ EXPORT_SYMBOL(dlci_ioctl_hook); #endif -#ifdef CONFIG_IPV6 -EXPORT_SYMBOL(ipv6_addr_type); -EXPORT_SYMBOL(icmpv6_send); -EXPORT_SYMBOL(ndisc_mc_map); -EXPORT_SYMBOL(register_inet6addr_notifier); -EXPORT_SYMBOL(unregister_inet6addr_notifier); -#include <net/ip6_route.h> -EXPORT_SYMBOL(ip6_route_output); -#endif #if defined (CONFIG_IPV6_MODULE) || defined (CONFIG_KHTTPD) || defined (CONFIG_KHTTPD_MODULE) /* inet functions common to v4 and v6 */ EXPORT_SYMBOL(inet_release); @@ -401,11 +392,6 @@ EXPORT_SYMBOL(sysctl_tcp_tw_recycle); EXPORT_SYMBOL(sysctl_max_syn_backlog); #endif -#if defined (CONFIG_IPV6_MODULE) -EXPORT_SYMBOL(secure_tcpv6_sequence_number); -EXPORT_SYMBOL(secure_ipv6_id); -#endif - #endif EXPORT_SYMBOL(tcp_read_sock); |
