Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122582
b: refs/heads/master
c: 4045e57
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Thery authored and David S. Miller committed Dec 11, 2008
1 parent ec6f2b3 commit e3d7964
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4a6258a0e33d042e4c84d9dec25d45ddb40a70b3
refs/heads/master: 4045e57c19bee150370390545ee8a933b3f7a18d
1 change: 1 addition & 0 deletions trunk/include/net/netns/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct netns_ipv6 {
struct mfc6_cache **mfc6_cache_array;
struct mif_device *vif6_table;
int maxvif;
atomic_t cache_resolve_queue_len;
#endif
};
#endif
40 changes: 21 additions & 19 deletions trunk/net/ipv6/ip6mr.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static int mroute_do_pim;
#endif

static struct mfc6_cache *mfc_unres_queue; /* Queue of unresolved entries */
static atomic_t cache_resolve_queue_len; /* Size of unresolved */

/* Special spinlock for queue of unresolved entries */
static DEFINE_SPINLOCK(mfc_unres_lock);
Expand Down Expand Up @@ -519,7 +518,7 @@ static void ip6mr_destroy_unres(struct mfc6_cache *c)
{
struct sk_buff *skb;

atomic_dec(&cache_resolve_queue_len);
atomic_dec(&init_net.ipv6.cache_resolve_queue_len);

while((skb = skb_dequeue(&c->mfc_un.unres.unresolved)) != NULL) {
if (ipv6_hdr(skb)->version == 0) {
Expand Down Expand Up @@ -561,7 +560,7 @@ static void ipmr_do_expire_process(unsigned long dummy)
ip6mr_destroy_unres(c);
}

if (atomic_read(&cache_resolve_queue_len))
if (mfc_unres_queue != NULL)
mod_timer(&ipmr_expire_timer, jiffies + expires);
}

Expand All @@ -572,7 +571,7 @@ static void ipmr_expire_process(unsigned long dummy)
return;
}

if (atomic_read(&cache_resolve_queue_len))
if (mfc_unres_queue != NULL)
ipmr_do_expire_process(dummy);

spin_unlock(&mfc_unres_lock);
Expand Down Expand Up @@ -852,7 +851,8 @@ ip6mr_cache_unresolved(mifi_t mifi, struct sk_buff *skb)

spin_lock_bh(&mfc_unres_lock);
for (c = mfc_unres_queue; c; c = c->next) {
if (ipv6_addr_equal(&c->mf6c_mcastgrp, &ipv6_hdr(skb)->daddr) &&
if (net_eq(mfc6_net(c), &init_net) &&
ipv6_addr_equal(&c->mf6c_mcastgrp, &ipv6_hdr(skb)->daddr) &&
ipv6_addr_equal(&c->mf6c_origin, &ipv6_hdr(skb)->saddr))
break;
}
Expand All @@ -862,7 +862,7 @@ ip6mr_cache_unresolved(mifi_t mifi, struct sk_buff *skb)
* Create a new entry if allowable
*/

if (atomic_read(&cache_resolve_queue_len) >= 10 ||
if (atomic_read(&init_net.ipv6.cache_resolve_queue_len) >= 10 ||
(c = ip6mr_cache_alloc_unres(&init_net)) == NULL) {
spin_unlock_bh(&mfc_unres_lock);

Expand Down Expand Up @@ -891,7 +891,7 @@ ip6mr_cache_unresolved(mifi_t mifi, struct sk_buff *skb)
return err;
}

atomic_inc(&cache_resolve_queue_len);
atomic_inc(&init_net.ipv6.cache_resolve_queue_len);
c->next = mfc_unres_queue;
mfc_unres_queue = c;

Expand Down Expand Up @@ -1119,14 +1119,16 @@ static int ip6mr_mfc_add(struct mf6cctl *mfc, int mrtsock)
spin_lock_bh(&mfc_unres_lock);
for (cp = &mfc_unres_queue; (uc = *cp) != NULL;
cp = &uc->next) {
if (ipv6_addr_equal(&uc->mf6c_origin, &c->mf6c_origin) &&
if (net_eq(mfc6_net(uc), &init_net) &&
ipv6_addr_equal(&uc->mf6c_origin, &c->mf6c_origin) &&
ipv6_addr_equal(&uc->mf6c_mcastgrp, &c->mf6c_mcastgrp)) {
*cp = uc->next;
if (atomic_dec_and_test(&cache_resolve_queue_len))
del_timer(&ipmr_expire_timer);
atomic_dec(&init_net.ipv6.cache_resolve_queue_len);
break;
}
}
if (mfc_unres_queue == NULL)
del_timer(&ipmr_expire_timer);
spin_unlock_bh(&mfc_unres_lock);

if (uc) {
Expand Down Expand Up @@ -1172,18 +1174,18 @@ static void mroute_clean_tables(struct sock *sk)
}
}

if (atomic_read(&cache_resolve_queue_len) != 0) {
struct mfc6_cache *c;
if (atomic_read(&init_net.ipv6.cache_resolve_queue_len) != 0) {
struct mfc6_cache *c, **cp;

spin_lock_bh(&mfc_unres_lock);
while (mfc_unres_queue != NULL) {
c = mfc_unres_queue;
mfc_unres_queue = c->next;
spin_unlock_bh(&mfc_unres_lock);

cp = &mfc_unres_queue;
while ((c = *cp) != NULL) {
if (!net_eq(mfc6_net(c), &init_net)) {
cp = &c->next;
continue;
}
*cp = c->next;
ip6mr_destroy_unres(c);

spin_lock_bh(&mfc_unres_lock);
}
spin_unlock_bh(&mfc_unres_lock);
}
Expand Down

0 comments on commit e3d7964

Please sign in to comment.