diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-25 01:20:01 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-25 01:20:01 +0000 |
commit | 3797ba0b62debb71af4606910acacc9896a9ae3b (patch) | |
tree | 414eea76253c7871bfdf3bd9d1817771eb40917c /net | |
parent | 2b6c0c580795a4404f72d2a794214dd9e080709d (diff) |
Merge with Linux 2.4.0-test2.
Diffstat (limited to 'net')
-rw-r--r-- | net/core/profile.c | 3 | ||||
-rw-r--r-- | net/decnet/af_decnet.c | 11 | ||||
-rw-r--r-- | net/decnet/dn_neigh.c | 4 | ||||
-rw-r--r-- | net/decnet/dn_route.c | 23 | ||||
-rw-r--r-- | net/ipv4/fib_semantics.c | 4 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 4 | ||||
-rw-r--r-- | net/ipv4/igmp.c | 18 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 84 | ||||
-rw-r--r-- | net/netlink/netlink_dev.c | 6 | ||||
-rw-r--r-- | net/netsyms.c | 2 | ||||
-rw-r--r-- | net/sched/sch_api.c | 2 | ||||
-rw-r--r-- | net/unix/af_unix.c | 4 |
14 files changed, 99 insertions, 72 deletions
diff --git a/net/core/profile.c b/net/core/profile.c index 0408447cb..a3ff36417 100644 --- a/net/core/profile.c +++ b/net/core/profile.c @@ -145,11 +145,12 @@ int whitehole_count; static int whitehole_xmit(struct sk_buff *skb, struct net_device *dev) { struct net_device_stats *stats; - dev_kfree_skb(skb); + stats = (struct net_device_stats *)dev->priv; stats->tx_packets++; stats->tx_bytes+=skb->len; + dev_kfree_skb(skb); return 0; } diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index ab244350e..5322b3a89 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c @@ -285,7 +285,7 @@ int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *sdn, switch(*fmt) { case 0: - sdn->sdn_objnum = dn_htons(type); + sdn->sdn_objnum = type; return 2; case 1: namel = 16; @@ -526,10 +526,6 @@ static void dn_destroy_sock(struct sock *sk) { struct dn_scp *scp = &sk->protinfo.dn; - if (sk->dead) - return; - - sk->dead = 1; scp->nsp_rxtshift = 0; /* reset back off */ if (sk->socket) { @@ -661,11 +657,12 @@ dn_release(struct socket *sock) struct sock *sk = sock->sk; if (sk) { + sock_orphan(sk); + sock_hold(sk); lock_sock(sk); - sock->sk = NULL; - sk->socket = NULL; dn_destroy_sock(sk); release_sock(sk); + sock_put(sk); } return 0; diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c index b2c6b2051..00c27cdec 100644 --- a/net/decnet/dn_neigh.c +++ b/net/decnet/dn_neigh.c @@ -441,7 +441,7 @@ int dn_neigh_router_hello(struct sk_buff *skb) struct dn_dev *dn_db; dn_address src; - src = dn_eth2dn(msg->id); + src = dn_htons(dn_eth2dn(msg->id)); neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1); @@ -498,7 +498,7 @@ int dn_neigh_endnode_hello(struct sk_buff *skb) struct dn_neigh *dn; dn_address src; - src = dn_eth2dn(msg->id); + src = dn_htons(dn_eth2dn(msg->id)); neigh = __neigh_lookup(&dn_neigh_table, &src, skb->dev, 1); diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 11c67f0c5..5ce55ebb2 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c @@ -131,7 +131,7 @@ static __inline__ unsigned dn_hash(unsigned short src, unsigned short dst) return dn_rt_hash_mask & (unsigned)tmp; } -static void dn_dst_check_expire(unsigned long dummy) +static void SMP_TIMER_NAME(dn_dst_check_expire)(unsigned long dummy) { int i; struct dn_route *rt, **rtp; @@ -142,10 +142,12 @@ static void dn_dst_check_expire(unsigned long dummy) rtp = &dn_rt_hash_table[i].chain; write_lock(&dn_rt_hash_table[i].lock); - for(;(rt=*rtp); rtp = &rt->u.rt_next) { + while((rt=*rtp) != NULL) { if (atomic_read(&rt->u.dst.__refcnt) || - (now - rt->u.dst.lastuse) < expire) + (now - rt->u.dst.lastuse) < expire) { + rtp = &rt->u.rt_next; continue; + } *rtp = rt->u.rt_next; rt->u.rt_next = NULL; dst_free(&rt->u.dst); @@ -156,10 +158,11 @@ static void dn_dst_check_expire(unsigned long dummy) break; } - dn_route_timer.expires = now + decnet_dst_gc_interval * HZ; - add_timer(&dn_route_timer); + mod_timer(&dn_route_timer, now + decnet_dst_gc_interval * HZ); } +SMP_TIMER_DEFINE(dn_dst_check_expire, dn_dst_task); + static int dn_dst_gc(void) { struct dn_route *rt, **rtp; @@ -172,10 +175,12 @@ static int dn_dst_gc(void) write_lock_bh(&dn_rt_hash_table[i].lock); rtp = &dn_rt_hash_table[i].chain; - for(; (rt=*rtp); rtp = &rt->u.rt_next) { + while((rt=*rtp) != NULL) { if (atomic_read(&rt->u.dst.__refcnt) || - (now - rt->u.dst.lastuse) < expire) + (now - rt->u.dst.lastuse) < expire) { + rtp = &rt->u.rt_next; continue; + } *rtp = rt->u.rt_next; rt->u.rt_next = NULL; dst_free(&rt->u.dst); @@ -229,7 +234,7 @@ static void dn_insert_route(struct dn_route *rt, unsigned hash) write_unlock_bh(&dn_rt_hash_table[hash].lock); } -void dn_run_flush(unsigned long dummy) +void SMP_TIMER_NAME(dn_run_flush)(unsigned long dummy) { int i; struct dn_route *rt, *next; @@ -251,6 +256,8 @@ nothing_to_declare: } } +SMP_TIMER_DEFINE(dn_run_flush, dn_flush_task); + static spinlock_t dn_rt_flush_lock = SPIN_LOCK_UNLOCKED; void dn_rt_cache_flush(int delay) diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index bb9f81658..2601d2412 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -5,7 +5,7 @@ * * IPv4 Forwarding Information Base: semantics. * - * Version: $Id: fib_semantics.c,v 1.15 1999/08/20 11:05:07 davem Exp $ + * Version: $Id: fib_semantics.c,v 1.16 2000/06/21 17:14:50 davem Exp $ * * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru> * @@ -925,7 +925,7 @@ int fib_sync_up(struct net_device *dev) nh->nh_flags &= ~RTNH_F_DEAD; } endfor_nexthops(fi) - if (alive == fi->fib_nhs) { + if (alive > 0) { fi->fib_flags &= ~RTNH_F_DEAD; ret++; } diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index f15d94388..6cac59c91 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -3,7 +3,7 @@ * * Alan Cox, <alan@redhat.com> * - * Version: $Id: icmp.c,v 1.69 2000/04/15 01:48:10 davem Exp $ + * Version: $Id: icmp.c,v 1.70 2000/06/21 17:16:21 davem Exp $ * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -669,7 +669,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, unsigned long info) room -= sizeof(struct iphdr) + icmp_param.replyopts.optlen; room -= sizeof(struct icmphdr); - icmp_param.data_len=(iph->ihl<<2)+skb_in->len; + icmp_param.data_len=(iph->ihl<<2)+(skb_in->tail-(u8*)iph); if (icmp_param.data_len > room) icmp_param.data_len = room; diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index c93da55f9..aed0945c5 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -8,7 +8,7 @@ * the older version didn't come out right using gcc 2.5.8, the newer one * seems to fall out with gcc 2.6.2. * - * Version: $Id: igmp.c,v 1.38 2000/02/27 01:20:02 davem Exp $ + * Version: $Id: igmp.c,v 1.39 2000/06/21 17:17:32 davem Exp $ * * Authors: * Alan Cox <Alan.Cox@linux.org> @@ -150,15 +150,14 @@ static __inline__ void igmp_stop_timer(struct ip_mc_list *im) spin_unlock_bh(&im->lock); } -static __inline__ void igmp_start_timer(struct ip_mc_list *im, int max_delay) +/* It must be called with locked im->lock */ +static void igmp_start_timer(struct ip_mc_list *im, int max_delay) { int tv=net_random() % max_delay; - spin_lock_bh(&im->lock); im->tm_running=1; if (!mod_timer(&im->timer, jiffies+tv+2)) atomic_inc(&im->refcnt); - spin_unlock_bh(&im->lock); } static void igmp_mod_timer(struct ip_mc_list *im, int max_delay) @@ -174,9 +173,8 @@ static void igmp_mod_timer(struct ip_mc_list *im, int max_delay) } atomic_dec(&im->refcnt); } - spin_unlock_bh(&im->lock); - igmp_start_timer(im, max_delay); + spin_unlock_bh(&im->lock); } @@ -259,6 +257,7 @@ static void igmp_timer_expire(unsigned long data) struct in_device *in_dev = im->interface; int err; + spin_lock(&im->lock); im->tm_running=0; if (IGMP_V1_SEEN(in_dev)) @@ -270,8 +269,7 @@ static void igmp_timer_expire(unsigned long data) if (err) { if (!in_dev->dead) igmp_start_timer(im, IGMP_Unsolicited_Report_Interval); - ip_ma_put(im); - return; + goto out; } if (im->unsolicit_count) { @@ -279,6 +277,8 @@ static void igmp_timer_expire(unsigned long data) igmp_start_timer(im, IGMP_Unsolicited_Report_Interval); } im->reporter = 1; +out: + spin_unlock(&im->lock); ip_ma_put(im); } @@ -455,7 +455,9 @@ static void igmp_group_added(struct ip_mc_list *im) if (im->multiaddr == IGMP_ALL_HOSTS) return; + spin_lock_bh(&im->lock); igmp_start_timer(im, IGMP_Initial_Report_Delay); + spin_unlock_bh(&im->lock); #endif } diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index cf82c1623..f34fa37d2 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -1,5 +1,5 @@ /* - * $Id: ipconfig.c,v 1.32 2000/06/19 06:24:59 davem Exp $ + * $Id: ipconfig.c,v 1.33 2000/06/21 17:21:43 davem Exp $ * * Automatic Configuration of IP -- use BOOTP or RARP or user-supplied * information to configure own IP address and routes. diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 4d124d558..b1e7e7dc5 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -5,7 +5,7 @@ * Authors: * Pedro Roque <roque@di.fc.ul.pt> * - * $Id: ip6_output.c,v 1.26 2000/03/01 02:58:12 davem Exp $ + * $Id: ip6_output.c,v 1.27 2000/06/21 17:18:40 davem Exp $ * * Based on linux/net/ipv4/ip_output.c * @@ -200,7 +200,7 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, if (skb_headroom(skb) < head_room) { struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); - kfree(skb); + kfree_skb(skb); skb = skb2; if (skb == NULL) return -ENOBUFS; diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 053db0c72..dd4b55b0f 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -5,7 +5,7 @@ * Authors: * Pedro Roque <roque@di.fc.ul.pt> * - * $Id: mcast.c,v 1.30 2000/02/08 21:27:23 davem Exp $ + * $Id: mcast.c,v 1.31 2000/06/21 17:23:54 davem Exp $ * * Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c * @@ -196,16 +196,26 @@ int inet6_mc_check(struct sock *sk, struct in6_addr *addr) return 0; } +static void ma_put(struct ifmcaddr6 *mc) +{ + if (atomic_dec_and_test(&mc->mca_refcnt)) { + in6_dev_put(mc->idev); + kfree_s(mc, sizeof(*mc)); + } +} + static int igmp6_group_added(struct ifmcaddr6 *mc) { struct net_device *dev = mc->idev->dev; char buf[MAX_ADDR_LEN]; + spin_lock_bh(&mc->mca_lock); if (!(mc->mca_flags&MAF_LOADED)) { mc->mca_flags |= MAF_LOADED; if (ndisc_mc_map(&mc->mca_addr, buf, dev, 0) == 0) dev_mc_add(dev, buf, dev->addr_len, 0); } + spin_unlock_bh(&mc->mca_lock); if (dev->flags&IFF_UP) igmp6_join_group(mc); @@ -217,11 +227,13 @@ static int igmp6_group_dropped(struct ifmcaddr6 *mc) struct net_device *dev = mc->idev->dev; char buf[MAX_ADDR_LEN]; + spin_lock_bh(&mc->mca_lock); if (mc->mca_flags&MAF_LOADED) { mc->mca_flags &= ~MAF_LOADED; if (ndisc_mc_map(&mc->mca_addr, buf, dev, 0) == 0) dev_mc_delete(dev, buf, dev->addr_len, 0); } + spin_unlock_bh(&mc->mca_lock); if (dev->flags&IFF_UP) igmp6_leave_group(mc); @@ -251,7 +263,7 @@ int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr) for (mc = idev->mc_list; mc; mc = mc->next) { if (ipv6_addr_cmp(&mc->mca_addr, addr) == 0) { - atomic_inc(&mc->mca_users); + mc->mca_users++; write_unlock_bh(&idev->lock); in6_dev_put(idev); return 0; @@ -276,15 +288,16 @@ int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr) memcpy(&mc->mca_addr, addr, sizeof(struct in6_addr)); mc->idev = idev; - atomic_set(&mc->mca_users, 1); + mc->mca_users = 1; + atomic_set(&mc->mca_refcnt, 2); + mc->mca_lock = SPIN_LOCK_UNLOCKED; mc->next = idev->mc_list; idev->mc_list = mc; - - igmp6_group_added(mc); - write_unlock_bh(&idev->lock); + igmp6_group_added(mc); + ma_put(mc); return 0; } @@ -303,16 +316,13 @@ int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr) write_lock_bh(&idev->lock); for (map = &idev->mc_list; (ma=*map) != NULL; map = &ma->next) { if (ipv6_addr_cmp(&ma->mca_addr, addr) == 0) { - if (atomic_dec_and_test(&ma->mca_users)) { + if (--ma->mca_users == 0) { *map = ma->next; write_unlock_bh(&idev->lock); igmp6_group_dropped(ma); - if (ma->idev) - __in6_dev_put(ma->idev); - - kfree(ma); + ma_put(ma); in6_dev_put(idev); return 0; } @@ -363,8 +373,11 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime) if (ipv6_addr_type(&ma->mca_addr)&(IPV6_ADDR_LINKLOCAL|IPV6_ADDR_LOOPBACK)) return; - if (del_timer(&ma->mca_timer)) + spin_lock(&ma->mca_lock); + if (del_timer(&ma->mca_timer)) { + atomic_dec(&ma->mca_refcnt); delay = ma->mca_timer.expires - jiffies; + } if (delay >= resptime) { if (resptime) @@ -373,9 +386,10 @@ static void igmp6_group_queried(struct ifmcaddr6 *ma, unsigned long resptime) delay = 1; } - ma->mca_flags |= MAF_TIMER_RUNNING; ma->mca_timer.expires = jiffies + delay; - add_timer(&ma->mca_timer); + if (!mod_timer(&ma->mca_timer, jiffies + delay)) + atomic_inc(&ma->mca_refcnt); + spin_unlock(&ma->mca_lock); } int igmp6_event_query(struct sk_buff *skb, struct icmp6hdr *hdr, int len) @@ -453,12 +467,11 @@ int igmp6_event_report(struct sk_buff *skb, struct icmp6hdr *hdr, int len) read_lock(&idev->lock); for (ma = idev->mc_list; ma; ma=ma->next) { if (ipv6_addr_cmp(&ma->mca_addr, addrp) == 0) { - if (ma->mca_flags & MAF_TIMER_RUNNING) { - del_timer(&ma->mca_timer); - ma->mca_flags &= ~MAF_TIMER_RUNNING; - } - - ma->mca_flags &= ~MAF_LAST_REPORTER; + spin_lock(&ma->mca_lock); + if (del_timer(&ma->mca_timer)) + atomic_dec(&ma->mca_refcnt); + ma->mca_flags &= ~(MAF_LAST_REPORTER|MAF_TIMER_RUNNING); + spin_unlock(&ma->mca_lock); break; } } @@ -552,13 +565,17 @@ static void igmp6_join_group(struct ifmcaddr6 *ma) igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT); delay = net_random() % IGMP6_UNSOLICITED_IVAL; - if (del_timer(&ma->mca_timer)) - delay = ma->mca_timer.expires - jiffies; - ma->mca_timer.expires = jiffies + delay; + spin_lock_bh(&ma->mca_lock); + if (del_timer(&ma->mca_timer)) { + atomic_dec(&ma->mca_refcnt); + delay = ma->mca_timer.expires - jiffies; + } - add_timer(&ma->mca_timer); + if (!mod_timer(&ma->mca_timer, jiffies + delay)) + atomic_inc(&ma->mca_refcnt); ma->mca_flags |= MAF_TIMER_RUNNING | MAF_LAST_REPORTER; + spin_unlock_bh(&ma->mca_lock); } static void igmp6_leave_group(struct ifmcaddr6 *ma) @@ -573,17 +590,23 @@ static void igmp6_leave_group(struct ifmcaddr6 *ma) if (ma->mca_flags & MAF_LAST_REPORTER) igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REDUCTION); - if (ma->mca_flags & MAF_TIMER_RUNNING) - del_timer(&ma->mca_timer); + spin_lock_bh(&ma->mca_lock); + if (del_timer(&ma->mca_timer)) + atomic_dec(&ma->mca_refcnt); + spin_unlock_bh(&ma->mca_lock); } void igmp6_timer_handler(unsigned long data) { struct ifmcaddr6 *ma = (struct ifmcaddr6 *) data; - ma->mca_flags |= MAF_LAST_REPORTER; igmp6_send(&ma->mca_addr, ma->idev->dev, ICMPV6_MGM_REPORT); + + spin_lock(&ma->mca_lock); + ma->mca_flags |= MAF_LAST_REPORTER; ma->mca_flags &= ~MAF_TIMER_RUNNING; + spin_unlock(&ma->mca_lock); + ma_put(ma); } /* Device going down */ @@ -640,10 +663,7 @@ void ipv6_mc_destroy_dev(struct inet6_dev *idev) write_unlock_bh(&idev->lock); igmp6_group_dropped(i); - - if (i->idev) - in6_dev_put(i->idev); - kfree(i); + ma_put(i); write_lock_bh(&idev->lock); } @@ -677,7 +697,7 @@ static int igmp6_read_proc(char *buffer, char **start, off_t offset, len+=sprintf(buffer+len, " %5d %08X %ld\n", - atomic_read(&im->mca_users), + im->mca_users, im->mca_flags, (im->mca_flags&MAF_TIMER_RUNNING) ? im->mca_timer.expires-jiffies : 0); diff --git a/net/netlink/netlink_dev.c b/net/netlink/netlink_dev.c index b0eb9788e..4da257555 100644 --- a/net/netlink/netlink_dev.c +++ b/net/netlink/netlink_dev.c @@ -178,9 +178,9 @@ static devfs_handle_t devfs_handle = NULL; static void __init make_devfs_entries (const char *name, int minor) { - devfs_register (devfs_handle, name, 0, DEVFS_FL_DEFAULT, + devfs_register (devfs_handle, name, DEVFS_FL_DEFAULT, NETLINK_MAJOR, minor, - S_IFCHR | S_IRUSR | S_IWUSR, 0, 0, + S_IFCHR | S_IRUSR | S_IWUSR, &netlink_fops, NULL); } @@ -201,7 +201,7 @@ int __init init_netlink(void) make_devfs_entries ("IP6_FW", 13); devfs_register_series (devfs_handle, "tap%u", 16, DEVFS_FL_DEFAULT, NETLINK_MAJOR, 16, - S_IFCHR | S_IRUSR | S_IWUSR, 0, 0, + S_IFCHR | S_IRUSR | S_IWUSR, &netlink_fops, NULL); return 0; } diff --git a/net/netsyms.c b/net/netsyms.c index cd4a2bdb9..c209ff991 100644 --- a/net/netsyms.c +++ b/net/netsyms.c @@ -196,7 +196,7 @@ EXPORT_SYMBOL(__scm_send); /* Needed by unix.o */ EXPORT_SYMBOL(scm_fp_dup); -EXPORT_SYMBOL(files_stat); +EXPORT_SYMBOL(max_files); EXPORT_SYMBOL(memcpy_toiovec); EXPORT_SYMBOL(csum_partial); diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 9da8dcdcd..8a046514f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1111,7 +1111,7 @@ PSCHED_WATCHER psched_time_mark; static void psched_tick(unsigned long); static struct timer_list psched_timer = - { NULL, NULL, 0, 0L, psched_tick }; + { function: psched_tick }; static void psched_tick(unsigned long dummy) { diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 926f64f2b..d71a527fe 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -8,7 +8,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * - * Version: $Id: af_unix.c,v 1.98 2000/06/19 06:24:59 davem Exp $ + * Version: $Id: af_unix.c,v 1.99 2000/06/22 11:42:32 davem Exp $ * * Fixes: * Linus Torvalds : Assorted bug cures. @@ -445,7 +445,7 @@ static struct sock * unix_create1(struct socket *sock) { struct sock *sk; - if (atomic_read(&unix_nr_socks) >= 2*files_stat.max_files) + if (atomic_read(&unix_nr_socks) >= 2*max_files) return NULL; MOD_INC_USE_COUNT; |