Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352461
b: refs/heads/master
c: 7cb8a93
h: refs/heads/master
i:
  352459: e9632e3
v: v3
  • Loading branch information
Steffen Klassert committed Feb 11, 2013
1 parent 1683399 commit 81b14cc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 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: 8d068875caca3b507ffa8a57d521483fd4eebcc7
refs/heads/master: 7cb8a93968e395e40a72a50da0b6114e752304b4
18 changes: 16 additions & 2 deletions trunk/net/xfrm/xfrm_policy.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,14 +607,28 @@ static void xfrm_policy_requeue(struct xfrm_policy *old,
spin_unlock_bh(&pq->hold_queue.lock);
}

static bool xfrm_policy_mark_match(struct xfrm_policy *policy,
struct xfrm_policy *pol)
{
u32 mark = policy->mark.v & policy->mark.m;

if (policy->mark.v == pol->mark.v && policy->mark.m == pol->mark.m)
return true;

if ((mark & pol->mark.m) == pol->mark.v &&
policy->priority == pol->priority)
return true;

return false;
}

int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
{
struct net *net = xp_net(policy);
struct xfrm_policy *pol;
struct xfrm_policy *delpol;
struct hlist_head *chain;
struct hlist_node *entry, *newpos;
u32 mark = policy->mark.v & policy->mark.m;

write_lock_bh(&xfrm_policy_lock);
chain = policy_hash_bysel(net, &policy->selector, policy->family, dir);
Expand All @@ -623,7 +637,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
hlist_for_each_entry(pol, entry, chain, bydst) {
if (pol->type == policy->type &&
!selector_cmp(&pol->selector, &policy->selector) &&
(mark & pol->mark.m) == pol->mark.v &&
xfrm_policy_mark_match(policy, pol) &&
xfrm_sec_ctx_match(pol->security, policy->security) &&
!WARN_ON(delpol)) {
if (excl) {
Expand Down

0 comments on commit 81b14cc

Please sign in to comment.