diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2007-05-04 15:55:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-05-04 15:55:13 -0400 |
commit | af11e31609d93765c1b22611592543e028f7aa54 (patch) | |
tree | f8a915dc7d98844667308f7c234d00f59113ff3f /net | |
parent | 224711df5c00f7540b89f32a8225866031977f17 (diff) |
[XFRM] SAD info TLV aggregationx
Aggregate the SAD info TLVs.
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/xfrm/xfrm_state.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 22 |
2 files changed, 10 insertions, 14 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index f3a61ebd8d65..9955ff4da0a2 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -421,7 +421,7 @@ restart: | |||
421 | } | 421 | } |
422 | EXPORT_SYMBOL(xfrm_state_flush); | 422 | EXPORT_SYMBOL(xfrm_state_flush); |
423 | 423 | ||
424 | void xfrm_sad_getinfo(struct xfrm_sadinfo *si) | 424 | void xfrm_sad_getinfo(struct xfrmk_sadinfo *si) |
425 | { | 425 | { |
426 | spin_lock_bh(&xfrm_state_lock); | 426 | spin_lock_bh(&xfrm_state_lock); |
427 | si->sadcnt = xfrm_state_num; | 427 | si->sadcnt = xfrm_state_num; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 4210d91624cd..c35b9ea3b62b 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -749,7 +749,8 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
749 | 749 | ||
750 | static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags) | 750 | static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags) |
751 | { | 751 | { |
752 | struct xfrm_sadinfo si; | 752 | struct xfrmk_sadinfo si; |
753 | struct xfrmu_sadhinfo sh; | ||
753 | struct nlmsghdr *nlh; | 754 | struct nlmsghdr *nlh; |
754 | u32 *f; | 755 | u32 *f; |
755 | 756 | ||
@@ -761,12 +762,11 @@ static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags) | |||
761 | *f = flags; | 762 | *f = flags; |
762 | xfrm_sad_getinfo(&si); | 763 | xfrm_sad_getinfo(&si); |
763 | 764 | ||
764 | if (flags & XFRM_SAD_HMASK) | 765 | sh.sadhmcnt = si.sadhmcnt; |
765 | NLA_PUT_U32(skb, XFRMA_SADHMASK, si.sadhcnt); | 766 | sh.sadhcnt = si.sadhcnt; |
766 | if (flags & XFRM_SAD_HMAX) | 767 | |
767 | NLA_PUT_U32(skb, XFRMA_SADHMAX, si.sadhmcnt); | 768 | NLA_PUT_U32(skb, XFRMA_SAD_CNT, si.sadcnt); |
768 | if (flags & XFRM_SAD_CNT) | 769 | NLA_PUT(skb, XFRMA_SAD_HINFO, sizeof(sh), &sh); |
769 | NLA_PUT_U32(skb, XFRMA_SADCNT, si.sadcnt); | ||
770 | 770 | ||
771 | return nlmsg_end(skb, nlh); | 771 | return nlmsg_end(skb, nlh); |
772 | 772 | ||
@@ -784,12 +784,8 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
784 | u32 seq = nlh->nlmsg_seq; | 784 | u32 seq = nlh->nlmsg_seq; |
785 | int len = NLMSG_LENGTH(sizeof(u32)); | 785 | int len = NLMSG_LENGTH(sizeof(u32)); |
786 | 786 | ||
787 | if (*flags & XFRM_SAD_HMASK) | 787 | len += RTA_SPACE(sizeof(struct xfrmu_sadhinfo)); |
788 | len += RTA_SPACE(sizeof(u32)); | 788 | len += RTA_SPACE(sizeof(u32)); |
789 | if (*flags & XFRM_SAD_HMAX) | ||
790 | len += RTA_SPACE(sizeof(u32)); | ||
791 | if (*flags & XFRM_SAD_CNT) | ||
792 | len += RTA_SPACE(sizeof(u32)); | ||
793 | 789 | ||
794 | r_skb = alloc_skb(len, GFP_ATOMIC); | 790 | r_skb = alloc_skb(len, GFP_ATOMIC); |
795 | 791 | ||