aboutsummaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
authorJamal Hadi Salim <hadi@cyberus.ca>2010-02-22 19:20:22 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-22 19:20:22 -0500
commitbd55775c8dd656fc69b3a42a1c4ab32abb7e8af9 (patch)
tree766b30d5fc29d5d4849a10a290db51fe0f7c3ad7 /net/key
parentbf825f81b454fae2ffe1b675f3a549656726440e (diff)
xfrm: SA lookups signature with mark
pass mark to all SA lookups to prepare them for when we add code to have them search. Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index da2fe5f57619..aae3cd86ccd7 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -43,6 +43,8 @@ struct netns_pfkey {
43}; 43};
44static DEFINE_MUTEX(pfkey_mutex); 44static DEFINE_MUTEX(pfkey_mutex);
45 45
46#define DUMMY_MARK 0
47static struct xfrm_mark dummy_mark = {0, 0};
46struct pfkey_sock { 48struct pfkey_sock {
47 /* struct sock must be the first member of struct pfkey_sock */ 49 /* struct sock must be the first member of struct pfkey_sock */
48 struct sock sk; 50 struct sock sk;
@@ -647,7 +649,7 @@ static struct xfrm_state *pfkey_xfrm_state_lookup(struct net *net, struct sadb_
647 if (!xaddr) 649 if (!xaddr)
648 return NULL; 650 return NULL;
649 651
650 return xfrm_state_lookup(net, xaddr, sa->sadb_sa_spi, proto, family); 652 return xfrm_state_lookup(net, DUMMY_MARK, xaddr, sa->sadb_sa_spi, proto, family);
651} 653}
652 654
653#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) 655#define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1)))
@@ -1316,7 +1318,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1316 } 1318 }
1317 1319
1318 if (hdr->sadb_msg_seq) { 1320 if (hdr->sadb_msg_seq) {
1319 x = xfrm_find_acq_byseq(net, hdr->sadb_msg_seq); 1321 x = xfrm_find_acq_byseq(net, DUMMY_MARK, hdr->sadb_msg_seq);
1320 if (x && xfrm_addr_cmp(&x->id.daddr, xdaddr, family)) { 1322 if (x && xfrm_addr_cmp(&x->id.daddr, xdaddr, family)) {
1321 xfrm_state_put(x); 1323 xfrm_state_put(x);
1322 x = NULL; 1324 x = NULL;
@@ -1324,7 +1326,7 @@ static int pfkey_getspi(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
1324 } 1326 }
1325 1327
1326 if (!x) 1328 if (!x)
1327 x = xfrm_find_acq(net, mode, reqid, proto, xdaddr, xsaddr, 1, family); 1329 x = xfrm_find_acq(net, &dummy_mark, mode, reqid, proto, xdaddr, xsaddr, 1, family);
1328 1330
1329 if (x == NULL) 1331 if (x == NULL)
1330 return -ENOENT; 1332 return -ENOENT;
@@ -1373,7 +1375,7 @@ static int pfkey_acquire(struct sock *sk, struct sk_buff *skb, struct sadb_msg *
1373 if (hdr->sadb_msg_seq == 0 || hdr->sadb_msg_errno == 0) 1375 if (hdr->sadb_msg_seq == 0 || hdr->sadb_msg_errno == 0)
1374 return 0; 1376 return 0;
1375 1377
1376 x = xfrm_find_acq_byseq(net, hdr->sadb_msg_seq); 1378 x = xfrm_find_acq_byseq(net, DUMMY_MARK, hdr->sadb_msg_seq);
1377 if (x == NULL) 1379 if (x == NULL)
1378 return 0; 1380 return 0;
1379 1381
@@ -2572,8 +2574,8 @@ static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, struct sadb_msg *h
2572 return -EINVAL; 2574 return -EINVAL;
2573 2575
2574 delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2); 2576 delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2);
2575 xp = xfrm_policy_byid(net, XFRM_POLICY_TYPE_MAIN, dir, 2577 xp = xfrm_policy_byid(net, XFRM_POLICY_TYPE_MAIN,
2576 pol->sadb_x_policy_id, delete, &err); 2578 dir, pol->sadb_x_policy_id, delete, &err);
2577 if (xp == NULL) 2579 if (xp == NULL)
2578 return -ENOENT; 2580 return -ENOENT;
2579 2581