summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@kernel.bkbits.net>2003-09-03 15:27:24 -0700
committerDavid S. Miller <davem@kernel.bkbits.net>2003-09-03 15:27:24 -0700
commita587017c337cc45fbb4eee26a80656af37150c19 (patch)
treecc7597e0b03e8e1a9f21e140272053d77d17c95d /net
parent6cea4e9ecabb8f3f07cdb60b17054549e591bc30 (diff)
parent874610601f16fa55e49ffc218e60c22aa42f759d (diff)
Merge nuts.ninka.net:/disk1/davem/BK/net-2.5
into kernel.bkbits.net:/home/davem/net-2.5
Diffstat (limited to 'net')
-rw-r--r--net/Kconfig1
-rw-r--r--net/atm/addr.c29
-rw-r--r--net/bluetooth/l2cap.c1
-rw-r--r--net/bluetooth/rfcomm/core.c2
-rw-r--r--net/bluetooth/rfcomm/sock.c1
-rw-r--r--net/bluetooth/sco.c1
-rw-r--r--net/core/Makefile1
-rw-r--r--net/core/dev.c82
-rw-r--r--net/core/link_watch.c1
-rw-r--r--net/core/netfilter.c4
-rw-r--r--net/core/profile.c294
-rw-r--r--net/decnet/dn_dev.c1
-rw-r--r--net/ipv4/ipvs/ip_vs_ctl.c1
-rw-r--r--net/ipv4/netfilter/ip_conntrack_standalone.c5
-rw-r--r--net/ipv4/netfilter/ip_nat_core.c4
-rw-r--r--net/ipv4/netfilter/ip_nat_snmp_basic.c1
-rw-r--r--net/ipv4/netfilter/ip_nat_standalone.c2
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c1
-rw-r--r--net/ipv4/udp.c75
-rw-r--r--net/ipv6/addrconf.c1
-rw-r--r--net/ipv6/af_inet6.c1
-rw-r--r--net/ipv6/ah6.c1
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/rxrpc/sysctl.c1
-rw-r--r--net/sunrpc/stats.c1
25 files changed, 65 insertions, 451 deletions
diff --git a/net/Kconfig b/net/Kconfig
index 4c3474604a0c..7d76574a9cc3 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -676,7 +676,6 @@ config NET_SCHED
source "net/sched/Kconfig"
-#bool 'Network code profiler' CONFIG_NET_PROFILE
endmenu
menu "Network testing"
diff --git a/net/atm/addr.c b/net/atm/addr.c
index 5974a1876116..459bdeed05f9 100644
--- a/net/atm/addr.c
+++ b/net/atm/addr.c
@@ -118,23 +118,24 @@ int atm_get_addr(struct atm_dev *dev,struct sockaddr_atmsvc *u_buf,int size)
{
unsigned long flags;
struct atm_dev_addr *walk;
- int total;
+ int total = 0, error;
+ struct sockaddr_atmsvc *tmp_buf, *tmp_bufp;
+
spin_lock_irqsave(&dev->lock, flags);
- total = 0;
- for (walk = dev->local; walk; walk = walk->next) {
+ for (walk = dev->local; walk; walk = walk->next)
total += sizeof(struct sockaddr_atmsvc);
- if (total > size) {
- spin_unlock_irqrestore(&dev->lock, flags);
- return -E2BIG;
- }
- if (copy_to_user(u_buf,&walk->addr,
- sizeof(struct sockaddr_atmsvc))) {
- spin_unlock_irqrestore(&dev->lock, flags);
- return -EFAULT;
- }
- u_buf++;
+ tmp_buf = tmp_bufp = kmalloc(total, GFP_ATOMIC);
+ if (!tmp_buf) {
+ spin_unlock_irqrestore(&dev->lock, flags);
+ return -ENOMEM;
}
+ for (walk = dev->local; walk; walk = walk->next)
+ memcpy(tmp_bufp++, &walk->addr, sizeof(struct sockaddr_atmsvc));
spin_unlock_irqrestore(&dev->lock, flags);
- return total;
+ error = total > size ? -E2BIG : total;
+ if (copy_to_user(u_buf, tmp_buf, total < size ? total : size))
+ error = -EFAULT;
+ kfree(tmp_buf);
+ return error;
}
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index b1d5fff0d872..1292e56f3ce6 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -41,7 +41,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
-#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 4b7c3315ff89..f62df6a7d153 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -1794,7 +1794,7 @@ static void *rfcomm_seq_next(struct seq_file *seq, void *e, loff_t *pos)
if (p->next != &s->dlcs)
return p->next;
- for (p = s->list.next; p != &session_list; p = p->next) {
+ list_for_each(p, &session_list) {
s = list_entry(p, struct rfcomm_session, list);
__list_for_each(pp, &s->dlcs) {
seq->private = s;
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c
index 04dc0898ad1c..99aa7e32a695 100644
--- a/net/bluetooth/rfcomm/sock.c
+++ b/net/bluetooth/rfcomm/sock.c
@@ -39,7 +39,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
-#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index b1ef7c76663d..f277bd75de7a 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -41,7 +41,6 @@
#include <linux/poll.h>
#include <linux/fcntl.h>
#include <linux/init.h>
-#include <linux/skbuff.h>
#include <linux/interrupt.h>
#include <linux/socket.h>
#include <linux/skbuff.h>
diff --git a/net/core/Makefile b/net/core/Makefile
index 28ec942019e8..22e715cbdeb2 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -11,6 +11,5 @@ obj-y += flow.o dev.o ethtool.o net-sysfs.o dev_mcast.o dst.o \
obj-$(CONFIG_NETFILTER) += netfilter.o
obj-$(CONFIG_NET_DIVERT) += dv.o
-obj-$(CONFIG_NET_PROFILE) += profile.o
obj-$(CONFIG_NET_PKTGEN) += pktgen.o
obj-$(CONFIG_NET_RADIO) += wireless.o
diff --git a/net/core/dev.c b/net/core/dev.c
index fe8976f4e757..2cf887cee6d7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -99,7 +99,6 @@
#include <linux/divert.h>
#include <net/dst.h>
#include <net/pkt_sched.h>
-#include <net/profile.h>
#include <net/checksum.h>
#include <linux/highmem.h>
#include <linux/init.h>
@@ -128,9 +127,6 @@ extern int plip_init(void);
*/
#undef OFFLINE_SAMPLE
-NET_PROFILE_DEFINE(dev_queue_xmit)
-NET_PROFILE_DEFINE(softnet_process)
-
/*
* The list of packet types we will receive (as opposed to discard)
* and the routines to invoke.
@@ -2981,7 +2977,6 @@ int unregister_netdevice(struct net_device *dev)
*/
static int __init net_dev_init(void)
{
- struct net_device *dev, **dp;
int i, rc = -ENOMEM;
BUG_ON(!dev_boot_phase);
@@ -3016,88 +3011,15 @@ static int __init net_dev_init(void)
atomic_set(&queue->backlog_dev.refcnt, 1);
}
-#ifdef CONFIG_NET_PROFILE
- net_profile_init();
- NET_PROFILE_REGISTER(dev_queue_xmit);
- NET_PROFILE_REGISTER(softnet_process);
-#endif
-
#ifdef OFFLINE_SAMPLE
samp_timer.expires = jiffies + (10 * HZ);
add_timer(&samp_timer);
#endif
- /*
- * Add the devices.
- * If the call to dev->init fails, the dev is removed
- * from the chain disconnecting the device until the
- * next reboot.
- *
- * NB At boot phase networking is dead. No locking is required.
- * But we still preserve dev_base_lock for sanity.
- */
-
- dp = &dev_base;
- while ((dev = *dp) != NULL) {
- spin_lock_init(&dev->queue_lock);
- spin_lock_init(&dev->xmit_lock);
-#ifdef CONFIG_NET_FASTROUTE
- dev->fastpath_lock = RW_LOCK_UNLOCKED;
-#endif
- dev->xmit_lock_owner = -1;
- dev->iflink = -1;
- dev_hold(dev);
-
- /*
- * Allocate name. If the init() fails
- * the name will be reissued correctly.
- */
- if (strchr(dev->name, '%'))
- dev_alloc_name(dev, dev->name);
-
- /*
- * Check boot time settings for the device.
- */
- netdev_boot_setup_check(dev);
-
- if ( (dev->init && dev->init(dev)) ||
- netdev_register_sysfs(dev) ) {
- /*
- * It failed to come up. It will be unhooked later.
- * dev_alloc_name can now advance to next suitable
- * name that is checked next.
- */
- dp = &dev->next;
- } else {
- dp = &dev->next;
- dev->ifindex = dev_new_index();
- dev->reg_state = NETREG_REGISTERED;
- if (dev->iflink == -1)
- dev->iflink = dev->ifindex;
- if (!dev->rebuild_header)
- dev->rebuild_header = default_rebuild_header;
- dev_init_scheduler(dev);
- set_bit(__LINK_STATE_PRESENT, &dev->state);
- }
- }
-
- /*
- * Unhook devices that failed to come up
- */
- dp = &dev_base;
- while ((dev = *dp) != NULL) {
- if (dev->reg_state != NETREG_REGISTERED) {
- write_lock_bh(&dev_base_lock);
- *dp = dev->next;
- write_unlock_bh(&dev_base_lock);
- dev_put(dev);
- } else {
- dp = &dev->next;
- }
- }
-
dev_boot_phase = 0;
+ probe_old_netdevs();
+
open_softirq(NET_TX_SOFTIRQ, net_tx_action, NULL);
open_softirq(NET_RX_SOFTIRQ, net_rx_action, NULL);
diff --git a/net/core/link_watch.c b/net/core/link_watch.c
index 958385890b79..ae21f8932e45 100644
--- a/net/core/link_watch.c
+++ b/net/core/link_watch.c
@@ -11,7 +11,6 @@
*
*/
-#include <linux/workqueue.h>
#include <linux/config.h>
#include <linux/netdevice.h>
#include <linux/if.h>
diff --git a/net/core/netfilter.c b/net/core/netfilter.c
index ffb6a4471e85..07cbaf6b3c1e 100644
--- a/net/core/netfilter.c
+++ b/net/core/netfilter.c
@@ -101,7 +101,7 @@ int nf_register_sockopt(struct nf_sockopt_ops *reg)
if (down_interruptible(&nf_sockopt_mutex) != 0)
return -EINTR;
- for (i = nf_sockopts.next; i != &nf_sockopts; i = i->next) {
+ list_for_each(i, &nf_sockopts) {
struct nf_sockopt_ops *ops = (struct nf_sockopt_ops *)i;
if (ops->pf == reg->pf
&& (overlap(ops->set_optmin, ops->set_optmax,
@@ -296,7 +296,7 @@ static int nf_sockopt(struct sock *sk, int pf, int val,
if (down_interruptible(&nf_sockopt_mutex) != 0)
return -EINTR;
- for (i = nf_sockopts.next; i != &nf_sockopts; i = i->next) {
+ list_for_each(i, &nf_sockopts) {
ops = (struct nf_sockopt_ops *)i;
if (ops->pf == pf) {
if (get) {
diff --git a/net/core/profile.c b/net/core/profile.c
deleted file mode 100644
index 0caedda13842..000000000000
--- a/net/core/profile.c
+++ /dev/null
@@ -1,294 +0,0 @@
-#include <linux/config.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/jiffies.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/netdevice.h>
-#include <linux/string.h>
-#include <linux/skbuff.h>
-#include <linux/proc_fs.h>
-#include <linux/init.h>
-#include <linux/ip.h>
-#include <linux/inet.h>
-#include <net/checksum.h>
-
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-
-#include <net/profile.h>
-
-#ifdef CONFIG_NET_PROFILE
-
-atomic_t net_profile_active;
-struct timeval net_profile_adjust;
-
-NET_PROFILE_DEFINE(total);
-
-struct net_profile_slot *net_profile_chain = &net_prof_total;
-
-#ifdef __alpha__
-__u32 alpha_lo;
-long alpha_hi;
-
-static void alpha_tick(unsigned long);
-
-static struct timer_list alpha_timer = TIMER_INITIALIZER(alpha_tick, 0, 0);
-
-void alpha_tick(unsigned long dummy)
-{
- struct timeval dummy_stamp;
- net_profile_stamp(&dummy_stamp);
- alpha_timer.expires = jiffies + 4*HZ;
- add_timer(&alpha_timer);
-}
-
-#endif
-
-void net_profile_irq_adjust(struct timeval *entered, struct timeval* leaved)
-{
- struct net_profile_slot *s;
-
- net_profile_sub(entered, leaved);
- for (s = net_profile_chain; s; s = s->next) {
- if (s->active)
- net_profile_add(leaved, &s->irq);
- }
-}
-
-
-#ifdef CONFIG_PROC_FS
-static int profile_read_proc(char *buffer, char **start, off_t offset,
- int length, int *eof, void *data)
-{
- off_t pos=0;
- off_t begin=0;
- int len=0;
- struct net_profile_slot *s;
-
- len+= sprintf(buffer, "Slot Hits Hi Lo OnIrqHi OnIrqLo Ufl\n");
-
- if (offset == 0) {
- cli();
- net_prof_total.active = 1;
- atomic_inc(&net_profile_active);
- NET_PROFILE_LEAVE(total);
- sti();
- }
- for (s = net_profile_chain; s; s = s->next) {
- struct net_profile_slot tmp;
-
- cli();
- tmp = *s;
-
- /* Wrong, but pretty close to truth */
-
- s->accumulator.tv_sec = 0;
- s->accumulator.tv_usec = 0;
- s->irq.tv_sec = 0;
- s->irq.tv_usec = 0;
- s->hits = 0;
- s->underflow = 0;
- /* Repair active count, it is possible, only if code has a bug */
- if (s->active) {
- s->active = 0;
- atomic_dec(&net_profile_active);
- }
- sti();
-
- net_profile_sub(&tmp.irq, &tmp.accumulator);
-
- len += sprintf(buffer+len,"%-15s %-10d %-10ld %-10lu %-10lu %-10lu %d/%d",
- tmp.id,
- tmp.hits,
- tmp.accumulator.tv_sec,
- tmp.accumulator.tv_usec,
- tmp.irq.tv_sec,
- tmp.irq.tv_usec,
- tmp.underflow, tmp.active);
-
- buffer[len++]='\n';
-
- pos=begin+len;
- if(pos<offset) {
- len=0;
- begin=pos;
- }
- if(pos>offset+length)
- goto done;
- }
- *eof = 1;
-
-done:
- *start=buffer+(offset-begin);
- len-=(offset-begin);
- if(len>length)
- len=length;
- if (len < 0)
- len = 0;
- if (offset == 0) {
- cli();
- net_prof_total.active = 0;
- net_prof_total.hits = 0;
- net_profile_stamp(&net_prof_total.entered);
- sti();
- }
- return len;
-}
-#endif
-
-struct iphdr whitehole_iph;
-int whitehole_count;
-
-static int whitehole_xmit(struct sk_buff *skb, struct net_device *dev)
-{
- struct net_device_stats *stats;
-
- stats = (struct net_device_stats *)dev->priv;
- stats->tx_packets++;
- stats->tx_bytes+=skb->len;
-
- dev_kfree_skb(skb);
- return 0;
-}
-
-static void whitehole_inject(unsigned long);
-int whitehole_init(struct net_device *dev);
-
-static struct timer_list whitehole_timer =
- TIMER_INITIALIZER(whitehole_inject, 0, 0);
-
-static struct net_device whitehole_dev = {
- .name = "whitehole",
- .init = whitehole_init,
-};
-
-static int whitehole_open(struct net_device *dev)
-{
- whitehole_count = 100000;
- whitehole_timer.expires = jiffies + 5*HZ;
- add_timer(&whitehole_timer);
- return 0;
-}
-
-static int whitehole_close(struct net_device *dev)
-{
- del_timer(&whitehole_timer);
- return 0;
-}
-
-static void whitehole_inject(unsigned long dummy)
-{
- struct net_device_stats *stats = (struct net_device_stats *)whitehole_dev.priv;
- extern int netdev_dropping;
-
- do {
- struct iphdr *iph;
- struct sk_buff *skb = alloc_skb(128, GFP_ATOMIC);
- if (!skb)
- break;
- skb_reserve(skb, 32);
- iph = (struct iphdr*)skb_put(skb, sizeof(*iph));
- skb->mac.raw = ((u8*)iph) - 14;
- memcpy(iph, &whitehole_iph, sizeof(*iph));
- skb->protocol = __constant_htons(ETH_P_IP);
- skb->dev = &whitehole_dev;
- skb->pkt_type = PACKET_HOST;
- stats->rx_packets++;
- stats->rx_bytes += skb->len;
- netif_rx(skb);
- whitehole_count--;
- } while (netdev_dropping == 0 && whitehole_count>0);
- if (whitehole_count > 0) {
- whitehole_timer.expires = jiffies + 1;
- add_timer(&whitehole_timer);
- }
-}
-
-static struct net_device_stats *whitehole_get_stats(struct net_device *dev)
-{
- struct net_device_stats *stats = (struct net_device_stats *) dev->priv;
- return stats;
-}
-
-int __init whitehole_init(struct net_device *dev)
-{
- dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
- if (dev->priv == NULL)
- return -ENOBUFS;
- memset(dev->priv, 0, sizeof(struct net_device_stats));
- dev->get_stats = whitehole_get_stats;
- dev->hard_start_xmit = whitehole_xmit;
- dev->open = whitehole_open;
- dev->stop = whitehole_close;
- ether_setup(dev);
- dev->tx_queue_len = 0;
- dev->flags |= IFF_NOARP;
- dev->flags &= ~(IFF_BROADCAST|IFF_MULTICAST);
- dev->iflink = 0;
- whitehole_iph.ihl = 5;
- whitehole_iph.version = 4;
- whitehole_iph.ttl = 2;
- whitehole_iph.saddr = in_aton("193.233.7.21");
- whitehole_iph.daddr = in_aton("193.233.7.10");
- whitehole_iph.tot_len = htons(20);
- whitehole_iph.check = ip_compute_csum((void *)&whitehole_iph, 20);
- return 0;
-}
-
-int net_profile_register(struct net_profile_slot *slot)
-{
- cli();
- slot->next = net_profile_chain;
- net_profile_chain = slot;
- sti();
- return 0;
-}
-
-int net_profile_unregister(struct net_profile_slot *slot)
-{
- struct net_profile_slot **sp, *s;
-
- for (sp = &net_profile_chain; (s = *sp) != NULL; sp = &s->next) {
- if (s == slot) {
- cli();
- *sp = s->next;
- sti();
- return 0;
- }
- }
- return -ESRCH;
-}
-
-
-int __init net_profile_init(void)
-{
- int i;
-
-#ifdef CONFIG_PROC_FS
- create_proc_read_entry("net/profile", 0, 0, profile_read_proc, NULL);
-#endif
-
- register_netdevice(&whitehole_dev);
-
- printk("Evaluating net profiler cost ...");
-#ifdef __alpha__
- alpha_tick(0);
-#endif
- for (i=0; i<1024; i++) {
- NET_PROFILE_ENTER(total);
- NET_PROFILE_LEAVE(total);
- }
- if (net_prof_total.accumulator.tv_sec) {
- printk(" too high!\n");
- } else {
- net_profile_adjust.tv_usec = net_prof_total.accumulator.tv_usec>>10;
- printk("%ld units\n", net_profile_adjust.tv_usec);
- }
- net_prof_total.hits = 0;
- net_profile_stamp(&net_prof_total.entered);
- return 0;
-}
-
-#endif
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 52a0c5f688ff..918505be8ea7 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -35,7 +35,6 @@
#include <linux/string.h>
#include <linux/if_arp.h>
#include <linux/if_ether.h>
-#include <linux/init.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
#include <linux/sysctl.h>
diff --git a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
index ac3aafd9aa82..166e3be72987 100644
--- a/net/ipv4/ipvs/ip_vs_ctl.c
+++ b/net/ipv4/ipvs/ip_vs_ctl.c
@@ -31,7 +31,6 @@
#include <linux/proc_fs.h>
#include <linux/timer.h>
#include <linux/swap.h>
-#include <linux/proc_fs.h>
#include <linux/netfilter.h>
#include <linux/netfilter_ipv4.h>
diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c
index d6e5f3bcb7f4..6dc8fd2a065b 100644
--- a/net/ipv4/netfilter/ip_conntrack_standalone.c
+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c
@@ -150,8 +150,7 @@ list_conntracks(char *buffer, char **start, off_t offset, int length)
}
/* Now iterate through expecteds. */
- for (e = ip_conntrack_expect_list.next;
- e != &ip_conntrack_expect_list; e = e->next) {
+ list_for_each(e, &ip_conntrack_expect_list) {
unsigned int last_len;
struct ip_conntrack_expect *expect
= (struct ip_conntrack_expect *)e;
@@ -319,7 +318,7 @@ int ip_conntrack_protocol_register(struct ip_conntrack_protocol *proto)
struct list_head *i;
WRITE_LOCK(&ip_conntrack_lock);
- for (i = protocol_list.next; i != &protocol_list; i = i->next) {
+ list_for_each(i, &protocol_list) {
if (((struct ip_conntrack_protocol *)i)->proto
== proto->proto) {
ret = -EBUSY;
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
index a9f726b10a46..249c8e66f5aa 100644
--- a/net/ipv4/netfilter/ip_nat_core.c
+++ b/net/ipv4/netfilter/ip_nat_core.c
@@ -157,8 +157,8 @@ in_range(const struct ip_conntrack_tuple *tuple,
continue;
}
- if ((mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
- && proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
+ if (!(mr->range[i].flags & IP_NAT_RANGE_PROTO_SPECIFIED)
+ || proto->in_range(&newtuple, IP_NAT_MANIP_SRC,
&mr->range[i].min, &mr->range[i].max))
return 1;
}
diff --git a/net/ipv4/netfilter/ip_nat_snmp_basic.c b/net/ipv4/netfilter/ip_nat_snmp_basic.c
index 75df6c8222bb..0e3028dcb176 100644
--- a/net/ipv4/netfilter/ip_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/ip_nat_snmp_basic.c
@@ -50,7 +50,6 @@
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv4/ip_nat.h>
#include <linux/netfilter_ipv4/ip_nat_helper.h>
-#include <linux/types.h>
#include <linux/ip.h>
#include <net/udp.h>
#include <asm/uaccess.h>
diff --git a/net/ipv4/netfilter/ip_nat_standalone.c b/net/ipv4/netfilter/ip_nat_standalone.c
index 825ae9ffef36..bd014b74571f 100644
--- a/net/ipv4/netfilter/ip_nat_standalone.c
+++ b/net/ipv4/netfilter/ip_nat_standalone.c
@@ -271,7 +271,7 @@ int ip_nat_protocol_register(struct ip_nat_protocol *proto)
struct list_head *i;
WRITE_LOCK(&ip_nat_lock);
- for (i = protos.next; i != &protos; i = i->next) {
+ list_for_each(i, &protos) {
if (((struct ip_nat_protocol *)i)->protonum
== proto->protonum) {
ret = -EBUSY;
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index 6374bdd52780..1398b8590dba 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -45,7 +45,6 @@
#include <linux/netlink.h>
#include <linux/netdevice.h>
#include <linux/mm.h>
-#include <linux/socket.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_ULOG.h>
#include <linux/netfilter_ipv4/lockhelp.h>
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 08c3a40a4bd2..1746eae040b3 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1349,64 +1349,65 @@ struct proto udp_prot = {
/* ------------------------------------------------------------------------ */
#ifdef CONFIG_PROC_FS
-static __inline__ struct sock *udp_get_bucket(struct seq_file *seq, loff_t *pos)
+static struct sock *udp_get_first(struct seq_file *seq)
{
- int i;
struct sock *sk;
- struct hlist_node *node;
- loff_t l = *pos;
struct udp_iter_state *state = seq->private;
- for (; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
- i = 0;
+ for (state->bucket = 0; state->bucket < UDP_HTABLE_SIZE; ++state->bucket) {
+ struct hlist_node *node;
sk_for_each(sk, node, &udp_hash[state->bucket]) {
- if (sk->sk_family != state->family) {
- ++i;
- continue;
- }
- if (l--) {
- ++i;
- continue;
- }
- *pos = i;
- goto out;
+ if (sk->sk_family == state->family)
+ goto found;
}
}
sk = NULL;
-out:
+found:
return sk;
}
+static struct sock *udp_get_next(struct seq_file *seq, struct sock *sk)
+{
+ struct udp_iter_state *state = seq->private;
+
+ do {
+ sk = sk_next(sk);
+try_again:
+ ;
+ } while (sk && sk->sk_family != state->family);
+
+ if (!sk && ++state->bucket < UDP_HTABLE_SIZE) {
+ sk = sk_head(&udp_hash[state->bucket]);
+ goto try_again;
+ }
+ return sk;
+}
+
+static struct sock *udp_get_idx(struct seq_file *seq, loff_t pos)
+{
+ struct sock *sk = udp_get_first(seq);
+
+ if (sk)
+ while(pos && (sk = udp_get_next(seq, sk)) != NULL)
+ --pos;
+ return pos ? NULL : sk;
+}
+
static void *udp_seq_start(struct seq_file *seq, loff_t *pos)
{
read_lock(&udp_hash_lock);
- return *pos ? udp_get_bucket(seq, pos) : (void *)1;
+ return *pos ? udp_get_idx(seq, *pos-1) : (void *)1;
}
static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct sock *sk;
- struct hlist_node *node;
- struct udp_iter_state *state;
-
- if (v == (void *)1) {
- sk = udp_get_bucket(seq, pos);
- goto out;
- }
-
- state = seq->private;
-
- sk = v;
- sk_for_each_continue(sk, node)
- if (sk->sk_family == state->family)
- goto out;
- if (++state->bucket >= UDP_HTABLE_SIZE)
- goto out;
+ if (v == (void *)1)
+ sk = udp_get_idx(seq, 0);
+ else
+ sk = udp_get_next(seq, v);
- *pos = 0;
- sk = udp_get_bucket(seq, pos);
-out:
++*pos;
return sk;
}
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index c6246d0fc1d6..150089e25d2c 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -57,7 +57,6 @@
#include <linux/delay.h>
#include <linux/notifier.h>
-#include <linux/proc_fs.h>
#include <net/sock.h>
#include <net/snmp.h>
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 6289170cb341..e55d83a6f14d 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -40,7 +40,6 @@
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
-#include <linux/version.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 358b3f3f3d18..a97c931c5549 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -28,7 +28,6 @@
#include <linux/module.h>
#include <net/inet_ecn.h>
#include <net/ip.h>
-#include <net/xfrm.h>
#include <net/ah.h>
#include <linux/crypto.h>
#include <linux/pfkeyv2.h>
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index fed773b5f439..3347859a1665 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -968,7 +968,7 @@ int netlink_post(int unit, struct sk_buff *skb)
#ifdef CONFIG_PROC_FS
static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos)
{
- int i;
+ long i;
struct sock *s;
struct hlist_node *node;
loff_t off = 0;
@@ -1002,7 +1002,7 @@ static void *netlink_seq_next(struct seq_file *seq, void *v, loff_t *pos)
s = sk_next(v);
if (!s) {
- int i = (int) seq->private;
+ long i = (long)seq->private;
while (++i < MAX_LINKS) {
s = sk_head(&nl_table[i]);
diff --git a/net/rxrpc/sysctl.c b/net/rxrpc/sysctl.c
index ada78e6532ba..08df88fcd643 100644
--- a/net/rxrpc/sysctl.c
+++ b/net/rxrpc/sysctl.c
@@ -14,7 +14,6 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/sysctl.h>
-#include <linux/config.h>
#include <rxrpc/types.h>
#include <rxrpc/rxrpc.h>
#include <asm/errno.h>
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 4ba7f3d5c2e4..67a13170c6d7 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -20,7 +20,6 @@
#include <linux/proc_fs.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/svcsock.h>
-#include <linux/init.h>
#define RPCDBG_FACILITY RPCDBG_MISC