Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 34608
b: refs/heads/master
c: c7f5ea3
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Sep 22, 2006
1 parent acf59ce commit 1e84dbe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 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: 2575b65434d56559bd03854450b9b6aaf19b9c90
refs/heads/master: c7f5ea3a4d1ae6b3b426e113358fdc57494bc754
1 change: 0 additions & 1 deletion trunk/include/net/xfrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,6 @@ struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto,
extern void xfrm_policy_flush(u8 type);
extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
extern int xfrm_flush_bundles(void);
extern void xfrm_flush_all_bundles(void);
extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family, int strict);
extern void xfrm_init_pmtu(struct dst_entry *dst);

Expand Down
10 changes: 0 additions & 10 deletions trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,16 +1478,6 @@ int xfrm_flush_bundles(void)
return 0;
}

static int always_true(struct dst_entry *dst)
{
return 1;
}

void xfrm_flush_all_bundles(void)
{
xfrm_prune_bundles(always_true);
}

void xfrm_init_pmtu(struct dst_entry *dst)
{
do {
Expand Down
25 changes: 20 additions & 5 deletions trunk/net/xfrm/xfrm_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,13 +761,30 @@ static void __xfrm_state_insert(struct xfrm_state *x)
schedule_work(&xfrm_hash_work);
}

/* xfrm_state_lock is held */
static void __xfrm_state_bump_genids(struct xfrm_state *xnew)
{
unsigned short family = xnew->props.family;
u32 reqid = xnew->props.reqid;
struct xfrm_state *x;
struct hlist_node *entry;
unsigned int h;

h = xfrm_dst_hash(&xnew->id.daddr, reqid, family);
hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) {
if (x->props.family == family &&
x->props.reqid == reqid &&
!xfrm_addr_cmp(&x->id.daddr, &xnew->id.daddr, family))
x->genid = xfrm_state_genid;
}
}

void xfrm_state_insert(struct xfrm_state *x)
{
spin_lock_bh(&xfrm_state_lock);
__xfrm_state_bump_genids(x);
__xfrm_state_insert(x);
spin_unlock_bh(&xfrm_state_lock);

xfrm_flush_all_bundles();
}
EXPORT_SYMBOL(xfrm_state_insert);

Expand Down Expand Up @@ -889,15 +906,13 @@ int xfrm_state_add(struct xfrm_state *x)
x->id.proto,
&x->id.daddr, &x->props.saddr, 0);

__xfrm_state_bump_genids(x);
__xfrm_state_insert(x);
err = 0;

out:
spin_unlock_bh(&xfrm_state_lock);

if (!err)
xfrm_flush_all_bundles();

if (x1) {
xfrm_state_delete(x1);
xfrm_state_put(x1);
Expand Down

0 comments on commit 1e84dbe

Please sign in to comment.