|
@@ -773,7 +773,7 @@ static void neigh_periodic_work(struct work_struct *work)
|
|
|
if (time_after(jiffies, tbl->last_rand + 300 * HZ)) {
|
|
|
struct neigh_parms *p;
|
|
|
tbl->last_rand = jiffies;
|
|
|
- for (p = &tbl->parms; p; p = p->next)
|
|
|
+ list_for_each_entry(p, &tbl->parms_list, list)
|
|
|
p->reachable_time =
|
|
|
neigh_rand_reach_time(NEIGH_VAR(p, BASE_REACHABLE_TIME));
|
|
|
}
|
|
@@ -1446,7 +1446,7 @@ static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl,
|
|
|
{
|
|
|
struct neigh_parms *p;
|
|
|
|
|
|
- for (p = &tbl->parms; p; p = p->next) {
|
|
|
+ list_for_each_entry(p, &tbl->parms_list, list) {
|
|
|
if ((p->dev && p->dev->ifindex == ifindex && net_eq(neigh_parms_net(p), net)) ||
|
|
|
(!p->dev && !ifindex && net_eq(net, &init_net)))
|
|
|
return p;
|
|
@@ -1481,8 +1481,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
|
|
|
}
|
|
|
|
|
|
write_lock_bh(&tbl->lock);
|
|
|
- p->next = tbl->parms.next;
|
|
|
- tbl->parms.next = p;
|
|
|
+ list_add(&p->list, &tbl->parms.list);
|
|
|
write_unlock_bh(&tbl->lock);
|
|
|
|
|
|
neigh_parms_data_state_cleanall(p);
|
|
@@ -1501,24 +1500,15 @@ static void neigh_rcu_free_parms(struct rcu_head *head)
|
|
|
|
|
|
void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms)
|
|
|
{
|
|
|
- struct neigh_parms **p;
|
|
|
-
|
|
|
if (!parms || parms == &tbl->parms)
|
|
|
return;
|
|
|
write_lock_bh(&tbl->lock);
|
|
|
- for (p = &tbl->parms.next; *p; p = &(*p)->next) {
|
|
|
- if (*p == parms) {
|
|
|
- *p = parms->next;
|
|
|
- parms->dead = 1;
|
|
|
- write_unlock_bh(&tbl->lock);
|
|
|
- if (parms->dev)
|
|
|
- dev_put(parms->dev);
|
|
|
- call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
+ list_del(&parms->list);
|
|
|
+ parms->dead = 1;
|
|
|
write_unlock_bh(&tbl->lock);
|
|
|
- neigh_dbg(1, "%s: not found\n", __func__);
|
|
|
+ if (parms->dev)
|
|
|
+ dev_put(parms->dev);
|
|
|
+ call_rcu(&parms->rcu_head, neigh_rcu_free_parms);
|
|
|
}
|
|
|
EXPORT_SYMBOL(neigh_parms_release);
|
|
|
|
|
@@ -1535,6 +1525,8 @@ static void neigh_table_init_no_netlink(struct neigh_table *tbl)
|
|
|
unsigned long now = jiffies;
|
|
|
unsigned long phsize;
|
|
|
|
|
|
+ INIT_LIST_HEAD(&tbl->parms_list);
|
|
|
+ list_add(&tbl->parms.list, &tbl->parms_list);
|
|
|
write_pnet(&tbl->parms.net, &init_net);
|
|
|
atomic_set(&tbl->parms.refcnt, 1);
|
|
|
tbl->parms.reachable_time =
|
|
@@ -2154,7 +2146,9 @@ static int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb)
|
|
|
NLM_F_MULTI) <= 0)
|
|
|
break;
|
|
|
|
|
|
- for (nidx = 0, p = tbl->parms.next; p; p = p->next) {
|
|
|
+ nidx = 0;
|
|
|
+ p = list_next_entry(&tbl->parms, list);
|
|
|
+ list_for_each_entry_from(p, &tbl->parms_list, list) {
|
|
|
if (!net_eq(neigh_parms_net(p), net))
|
|
|
continue;
|
|
|
|