aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/neighbour.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 14:38:13 -0500
commitcb18eccff48ef3986d1072964590bce6fec705fb (patch)
tree777fb1d15e0281341e1e02c9803d989538d346f2 /net/core/neighbour.c
parentc827ba4cb49a30ce581201fd0ba2be77cde412c7 (diff)
parent5ef213f6842277ee1df5659f59fac0ffc9beb411 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (45 commits) [IPV4]: Restore multipath routing after rt_next changes. [XFRM] IPV6: Fix outbound RO transformation which is broken by IPsec tunnel patch. [NET]: Reorder fields of struct dst_entry [DECNET]: Convert decnet route to use the new dst_entry 'next' pointer [IPV6]: Convert ipv6 route to use the new dst_entry 'next' pointer [IPV4]: Convert ipv4 route to use the new dst_entry 'next' pointer [NET]: Introduce union in struct dst_entry to hold 'next' pointer [DECNET]: fix misannotation of linkinfo_dn [DECNET]: FRA_{DST,SRC} are le16 for decnet [UDP]: UDP can use sk_hash to speedup lookups [NET]: Fix whitespace errors. [NET] XFRM: Fix whitespace errors. [NET] X25: Fix whitespace errors. [NET] WANROUTER: Fix whitespace errors. [NET] UNIX: Fix whitespace errors. [NET] TIPC: Fix whitespace errors. [NET] SUNRPC: Fix whitespace errors. [NET] SCTP: Fix whitespace errors. [NET] SCHED: Fix whitespace errors. [NET] RXRPC: Fix whitespace errors. ...
Diffstat (limited to 'net/core/neighbour.c')
-rw-r--r--net/core/neighbour.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index efb673ad1854..c08d69650566 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -343,7 +343,7 @@ struct neighbour *neigh_lookup(struct neigh_table *tbl, const void *pkey,
343 struct neighbour *n; 343 struct neighbour *n;
344 int key_len = tbl->key_len; 344 int key_len = tbl->key_len;
345 u32 hash_val = tbl->hash(pkey, dev); 345 u32 hash_val = tbl->hash(pkey, dev);
346 346
347 NEIGH_CACHE_STAT_INC(tbl, lookups); 347 NEIGH_CACHE_STAT_INC(tbl, lookups);
348 348
349 read_lock_bh(&tbl->lock); 349 read_lock_bh(&tbl->lock);
@@ -685,9 +685,9 @@ next_elt:
685 np = &n->next; 685 np = &n->next;
686 } 686 }
687 687
688 /* Cycle through all hash buckets every base_reachable_time/2 ticks. 688 /* Cycle through all hash buckets every base_reachable_time/2 ticks.
689 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2 689 * ARP entry timeouts range from 1/2 base_reachable_time to 3/2
690 * base_reachable_time. 690 * base_reachable_time.
691 */ 691 */
692 expire = tbl->parms.base_reachable_time >> 1; 692 expire = tbl->parms.base_reachable_time >> 1;
693 expire /= (tbl->hash_mask + 1); 693 expire /= (tbl->hash_mask + 1);
@@ -742,7 +742,7 @@ static void neigh_timer_handler(unsigned long arg)
742 } 742 }
743 743
744 if (state & NUD_REACHABLE) { 744 if (state & NUD_REACHABLE) {
745 if (time_before_eq(now, 745 if (time_before_eq(now,
746 neigh->confirmed + neigh->parms->reachable_time)) { 746 neigh->confirmed + neigh->parms->reachable_time)) {
747 NEIGH_PRINTK2("neigh %p is still alive.\n", neigh); 747 NEIGH_PRINTK2("neigh %p is still alive.\n", neigh);
748 next = neigh->confirmed + neigh->parms->reachable_time; 748 next = neigh->confirmed + neigh->parms->reachable_time;
@@ -761,7 +761,7 @@ static void neigh_timer_handler(unsigned long arg)
761 notify = 1; 761 notify = 1;
762 } 762 }
763 } else if (state & NUD_DELAY) { 763 } else if (state & NUD_DELAY) {
764 if (time_before_eq(now, 764 if (time_before_eq(now,
765 neigh->confirmed + neigh->parms->delay_probe_time)) { 765 neigh->confirmed + neigh->parms->delay_probe_time)) {
766 NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh); 766 NEIGH_PRINTK2("neigh %p is now reachable.\n", neigh);
767 neigh->nud_state = NUD_REACHABLE; 767 neigh->nud_state = NUD_REACHABLE;
@@ -847,7 +847,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
847 goto out_unlock_bh; 847 goto out_unlock_bh;
848 848
849 now = jiffies; 849 now = jiffies;
850 850
851 if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) { 851 if (!(neigh->nud_state & (NUD_STALE | NUD_INCOMPLETE))) {
852 if (neigh->parms->mcast_probes + neigh->parms->app_probes) { 852 if (neigh->parms->mcast_probes + neigh->parms->app_probes) {
853 atomic_set(&neigh->probes, neigh->parms->ucast_probes); 853 atomic_set(&neigh->probes, neigh->parms->ucast_probes);
@@ -915,13 +915,13 @@ static void neigh_update_hhs(struct neighbour *neigh)
915 NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr, 915 NEIGH_UPDATE_F_OVERRIDE allows to override existing lladdr,
916 if it is different. 916 if it is different.
917 NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected" 917 NEIGH_UPDATE_F_WEAK_OVERRIDE will suspect existing "connected"
918 lladdr instead of overriding it 918 lladdr instead of overriding it
919 if it is different. 919 if it is different.
920 It also allows to retain current state 920 It also allows to retain current state
921 if lladdr is unchanged. 921 if lladdr is unchanged.
922 NEIGH_UPDATE_F_ADMIN means that the change is administrative. 922 NEIGH_UPDATE_F_ADMIN means that the change is administrative.
923 923
924 NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing 924 NEIGH_UPDATE_F_OVERRIDE_ISROUTER allows to override existing
925 NTF_ROUTER flag. 925 NTF_ROUTER flag.
926 NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as 926 NEIGH_UPDATE_F_ISROUTER indicates if the neighbour is known as
927 a router. 927 a router.
@@ -944,7 +944,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
944 old = neigh->nud_state; 944 old = neigh->nud_state;
945 err = -EPERM; 945 err = -EPERM;
946 946
947 if (!(flags & NEIGH_UPDATE_F_ADMIN) && 947 if (!(flags & NEIGH_UPDATE_F_ADMIN) &&
948 (old & (NUD_NOARP | NUD_PERMANENT))) 948 (old & (NUD_NOARP | NUD_PERMANENT)))
949 goto out; 949 goto out;
950 950
@@ -968,7 +968,7 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
968 - compare new & old 968 - compare new & old
969 - if they are different, check override flag 969 - if they are different, check override flag
970 */ 970 */
971 if ((old & NUD_VALID) && 971 if ((old & NUD_VALID) &&
972 !memcmp(lladdr, neigh->ha, dev->addr_len)) 972 !memcmp(lladdr, neigh->ha, dev->addr_len))
973 lladdr = neigh->ha; 973 lladdr = neigh->ha;
974 } else { 974 } else {
@@ -1012,8 +1012,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,
1012 neigh_del_timer(neigh); 1012 neigh_del_timer(neigh);
1013 if (new & NUD_IN_TIMER) { 1013 if (new & NUD_IN_TIMER) {
1014 neigh_hold(neigh); 1014 neigh_hold(neigh);
1015 neigh_add_timer(neigh, (jiffies + 1015 neigh_add_timer(neigh, (jiffies +
1016 ((new & NUD_REACHABLE) ? 1016 ((new & NUD_REACHABLE) ?
1017 neigh->parms->reachable_time : 1017 neigh->parms->reachable_time :
1018 0))); 1018 0)));
1019 } 1019 }
@@ -1075,7 +1075,7 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
1075 struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev, 1075 struct neighbour *neigh = __neigh_lookup(tbl, saddr, dev,
1076 lladdr || !dev->addr_len); 1076 lladdr || !dev->addr_len);
1077 if (neigh) 1077 if (neigh)
1078 neigh_update(neigh, lladdr, NUD_STALE, 1078 neigh_update(neigh, lladdr, NUD_STALE,
1079 NEIGH_UPDATE_F_OVERRIDE); 1079 NEIGH_UPDATE_F_OVERRIDE);
1080 return neigh; 1080 return neigh;
1081} 1081}
@@ -1127,7 +1127,7 @@ int neigh_compat_output(struct sk_buff *skb)
1127 1127
1128 if (dev->hard_header && 1128 if (dev->hard_header &&
1129 dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL, 1129 dev->hard_header(skb, dev, ntohs(skb->protocol), NULL, NULL,
1130 skb->len) < 0 && 1130 skb->len) < 0 &&
1131 dev->rebuild_header(skb)) 1131 dev->rebuild_header(skb))
1132 return 0; 1132 return 0;
1133 1133
@@ -1347,10 +1347,10 @@ void neigh_table_init_no_netlink(struct neigh_table *tbl)
1347 tbl->stats = alloc_percpu(struct neigh_statistics); 1347 tbl->stats = alloc_percpu(struct neigh_statistics);
1348 if (!tbl->stats) 1348 if (!tbl->stats)
1349 panic("cannot create neighbour cache statistics"); 1349 panic("cannot create neighbour cache statistics");
1350 1350
1351#ifdef CONFIG_PROC_FS 1351#ifdef CONFIG_PROC_FS
1352 tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat); 1352 tbl->pde = create_proc_entry(tbl->id, 0, proc_net_stat);
1353 if (!tbl->pde) 1353 if (!tbl->pde)
1354 panic("cannot create neighbour proc dir entry"); 1354 panic("cannot create neighbour proc dir entry");
1355 tbl->pde->proc_fops = &neigh_stat_seq_fops; 1355 tbl->pde->proc_fops = &neigh_stat_seq_fops;
1356 tbl->pde->data = tbl; 1356 tbl->pde->data = tbl;
@@ -1565,7 +1565,7 @@ int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1565 err = -ENOENT; 1565 err = -ENOENT;
1566 goto out_dev_put; 1566 goto out_dev_put;
1567 } 1567 }
1568 1568
1569 neigh = __neigh_lookup_errno(tbl, dst, dev); 1569 neigh = __neigh_lookup_errno(tbl, dst, dev);
1570 if (IS_ERR(neigh)) { 1570 if (IS_ERR(neigh)) {
1571 err = PTR_ERR(neigh); 1571 err = PTR_ERR(neigh);
@@ -1742,12 +1742,12 @@ errout:
1742 nlmsg_cancel(skb, nlh); 1742 nlmsg_cancel(skb, nlh);
1743 return -EMSGSIZE; 1743 return -EMSGSIZE;
1744} 1744}
1745 1745
1746static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl, 1746static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
1747 int ifindex) 1747 int ifindex)
1748{ 1748{
1749 struct neigh_parms *p; 1749 struct neigh_parms *p;
1750 1750
1751 for (p = &tbl->parms; p; p = p->next) 1751 for (p = &tbl->parms; p; p = p->next)
1752 if ((p->dev && p->dev->ifindex == ifindex) || 1752 if ((p->dev && p->dev->ifindex == ifindex) ||
1753 (!p->dev && !ifindex)) 1753 (!p->dev && !ifindex))
@@ -1813,7 +1813,7 @@ int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
1813 goto errout_locked; 1813 goto errout_locked;
1814 } 1814 }
1815 1815
1816 /* 1816 /*
1817 * We acquire tbl->lock to be nice to the periodic timers and 1817 * We acquire tbl->lock to be nice to the periodic timers and
1818 * make sure they always see a consistent set of values. 1818 * make sure they always see a consistent set of values.
1819 */ 1819 */
@@ -2321,7 +2321,7 @@ static void *neigh_stat_seq_start(struct seq_file *seq, loff_t *pos)
2321 2321
2322 if (*pos == 0) 2322 if (*pos == 0)
2323 return SEQ_START_TOKEN; 2323 return SEQ_START_TOKEN;
2324 2324
2325 for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) { 2325 for (cpu = *pos-1; cpu < NR_CPUS; ++cpu) {
2326 if (!cpu_possible(cpu)) 2326 if (!cpu_possible(cpu))
2327 continue; 2327 continue;
@@ -2629,7 +2629,7 @@ static struct neigh_sysctl_table {
2629}; 2629};
2630 2630
2631int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, 2631int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2632 int p_id, int pdev_id, char *p_name, 2632 int p_id, int pdev_id, char *p_name,
2633 proc_handler *handler, ctl_handler *strategy) 2633 proc_handler *handler, ctl_handler *strategy)
2634{ 2634{
2635 struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template, 2635 struct neigh_sysctl_table *t = kmemdup(&neigh_sysctl_template,
@@ -2661,7 +2661,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2661 t->neigh_vars[14].procname = NULL; 2661 t->neigh_vars[14].procname = NULL;
2662 t->neigh_vars[15].procname = NULL; 2662 t->neigh_vars[15].procname = NULL;
2663 } else { 2663 } else {
2664 dev_name_source = t->neigh_dev[0].procname; 2664 dev_name_source = t->neigh_dev[0].procname;
2665 t->neigh_vars[12].data = (int *)(p + 1); 2665 t->neigh_vars[12].data = (int *)(p + 1);
2666 t->neigh_vars[13].data = (int *)(p + 1) + 1; 2666 t->neigh_vars[13].data = (int *)(p + 1) + 1;
2667 t->neigh_vars[14].data = (int *)(p + 1) + 2; 2667 t->neigh_vars[14].data = (int *)(p + 1) + 2;
@@ -2696,7 +2696,7 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
2696 goto free; 2696 goto free;
2697 } 2697 }
2698 2698
2699 t->neigh_dev[0].procname = dev_name; 2699 t->neigh_dev[0].procname = dev_name;
2700 2700
2701 t->neigh_neigh_dir[0].ctl_name = pdev_id; 2701 t->neigh_neigh_dir[0].ctl_name = pdev_id;
2702 2702