diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2010-02-22 19:20:22 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-22 19:20:22 -0500 |
commit | bd55775c8dd656fc69b3a42a1c4ab32abb7e8af9 (patch) | |
tree | 766b30d5fc29d5d4849a10a290db51fe0f7c3ad7 /net/xfrm/xfrm_user.c | |
parent | bf825f81b454fae2ffe1b675f3a549656726440e (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/xfrm/xfrm_user.c')
-rw-r--r-- | net/xfrm/xfrm_user.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index ee04e6bf0e54..331ae731080a 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -31,6 +31,9 @@ | |||
31 | #include <linux/in6.h> | 31 | #include <linux/in6.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #define DUMMY_MARK 0 | ||
35 | static struct xfrm_mark dummy_mark = {0, 0}; | ||
36 | |||
34 | static inline int aead_len(struct xfrm_algo_aead *alg) | 37 | static inline int aead_len(struct xfrm_algo_aead *alg) |
35 | { | 38 | { |
36 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); | 39 | return sizeof(*alg) + ((alg->alg_key_len + 7) / 8); |
@@ -530,7 +533,7 @@ static struct xfrm_state *xfrm_user_state_lookup(struct net *net, | |||
530 | 533 | ||
531 | if (xfrm_id_proto_match(p->proto, IPSEC_PROTO_ANY)) { | 534 | if (xfrm_id_proto_match(p->proto, IPSEC_PROTO_ANY)) { |
532 | err = -ESRCH; | 535 | err = -ESRCH; |
533 | x = xfrm_state_lookup(net, &p->daddr, p->spi, p->proto, p->family); | 536 | x = xfrm_state_lookup(net, DUMMY_MARK, &p->daddr, p->spi, p->proto, p->family); |
534 | } else { | 537 | } else { |
535 | xfrm_address_t *saddr = NULL; | 538 | xfrm_address_t *saddr = NULL; |
536 | 539 | ||
@@ -541,7 +544,7 @@ static struct xfrm_state *xfrm_user_state_lookup(struct net *net, | |||
541 | } | 544 | } |
542 | 545 | ||
543 | err = -ESRCH; | 546 | err = -ESRCH; |
544 | x = xfrm_state_lookup_byaddr(net, &p->daddr, saddr, | 547 | x = xfrm_state_lookup_byaddr(net, DUMMY_MARK, &p->daddr, saddr, |
545 | p->proto, p->family); | 548 | p->proto, p->family); |
546 | } | 549 | } |
547 | 550 | ||
@@ -958,7 +961,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
958 | 961 | ||
959 | x = NULL; | 962 | x = NULL; |
960 | if (p->info.seq) { | 963 | if (p->info.seq) { |
961 | x = xfrm_find_acq_byseq(net, p->info.seq); | 964 | x = xfrm_find_acq_byseq(net, DUMMY_MARK, p->info.seq); |
962 | if (x && xfrm_addr_cmp(&x->id.daddr, daddr, family)) { | 965 | if (x && xfrm_addr_cmp(&x->id.daddr, daddr, family)) { |
963 | xfrm_state_put(x); | 966 | xfrm_state_put(x); |
964 | x = NULL; | 967 | x = NULL; |
@@ -966,7 +969,7 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
966 | } | 969 | } |
967 | 970 | ||
968 | if (!x) | 971 | if (!x) |
969 | x = xfrm_find_acq(net, p->info.mode, p->info.reqid, | 972 | x = xfrm_find_acq(net, &dummy_mark, p->info.mode, p->info.reqid, |
970 | p->info.id.proto, daddr, | 973 | p->info.id.proto, daddr, |
971 | &p->info.saddr, 1, | 974 | &p->info.saddr, 1, |
972 | family); | 975 | family); |
@@ -1598,7 +1601,7 @@ static int xfrm_get_ae(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1598 | if (r_skb == NULL) | 1601 | if (r_skb == NULL) |
1599 | return -ENOMEM; | 1602 | return -ENOMEM; |
1600 | 1603 | ||
1601 | x = xfrm_state_lookup(net, &id->daddr, id->spi, id->proto, id->family); | 1604 | x = xfrm_state_lookup(net, DUMMY_MARK, &id->daddr, id->spi, id->proto, id->family); |
1602 | if (x == NULL) { | 1605 | if (x == NULL) { |
1603 | kfree_skb(r_skb); | 1606 | kfree_skb(r_skb); |
1604 | return -ESRCH; | 1607 | return -ESRCH; |
@@ -1640,7 +1643,7 @@ static int xfrm_new_ae(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1640 | if (!(nlh->nlmsg_flags&NLM_F_REPLACE)) | 1643 | if (!(nlh->nlmsg_flags&NLM_F_REPLACE)) |
1641 | return err; | 1644 | return err; |
1642 | 1645 | ||
1643 | x = xfrm_state_lookup(net, &p->sa_id.daddr, p->sa_id.spi, p->sa_id.proto, p->sa_id.family); | 1646 | x = xfrm_state_lookup(net, DUMMY_MARK, &p->sa_id.daddr, p->sa_id.spi, p->sa_id.proto, p->sa_id.family); |
1644 | if (x == NULL) | 1647 | if (x == NULL) |
1645 | return -ESRCH; | 1648 | return -ESRCH; |
1646 | 1649 | ||
@@ -1767,7 +1770,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1767 | struct xfrm_user_expire *ue = nlmsg_data(nlh); | 1770 | struct xfrm_user_expire *ue = nlmsg_data(nlh); |
1768 | struct xfrm_usersa_info *p = &ue->state; | 1771 | struct xfrm_usersa_info *p = &ue->state; |
1769 | 1772 | ||
1770 | x = xfrm_state_lookup(net, &p->id.daddr, p->id.spi, p->id.proto, p->family); | 1773 | x = xfrm_state_lookup(net, DUMMY_MARK, &p->id.daddr, p->id.spi, p->id.proto, p->family); |
1771 | 1774 | ||
1772 | err = -ENOENT; | 1775 | err = -ENOENT; |
1773 | if (x == NULL) | 1776 | if (x == NULL) |