diff options
-rw-r--r-- | include/linux/xfrm.h | 21 | ||||
-rw-r--r-- | include/net/xfrm.h | 17 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 22 |
4 files changed, 25 insertions, 37 deletions
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index a5d53e0fe152..c237fe3af8ce 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -243,17 +243,6 @@ enum xfrm_ae_ftype_t { | |||
243 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) | 243 | #define XFRM_AE_MAX (__XFRM_AE_MAX - 1) |
244 | }; | 244 | }; |
245 | 245 | ||
246 | /* SAD Table filter flags */ | ||
247 | enum xfrm_sad_ftype_t { | ||
248 | XFRM_SAD_UNSPEC, | ||
249 | XFRM_SAD_HMASK=1, | ||
250 | XFRM_SAD_HMAX=2, | ||
251 | XFRM_SAD_CNT=4, | ||
252 | __XFRM_SAD_MAX | ||
253 | |||
254 | #define XFRM_SAD_MAX (__XFRM_SAD_MAX - 1) | ||
255 | }; | ||
256 | |||
257 | struct xfrm_userpolicy_type { | 246 | struct xfrm_userpolicy_type { |
258 | __u8 type; | 247 | __u8 type; |
259 | __u16 reserved1; | 248 | __u16 reserved1; |
@@ -287,14 +276,18 @@ enum xfrm_attr_type_t { | |||
287 | 276 | ||
288 | enum xfrm_sadattr_type_t { | 277 | enum xfrm_sadattr_type_t { |
289 | XFRMA_SAD_UNSPEC, | 278 | XFRMA_SAD_UNSPEC, |
290 | XFRMA_SADHMASK, | 279 | XFRMA_SAD_CNT, |
291 | XFRMA_SADHMAX, | 280 | XFRMA_SAD_HINFO, |
292 | XFRMA_SADCNT, | ||
293 | __XFRMA_SAD_MAX | 281 | __XFRMA_SAD_MAX |
294 | 282 | ||
295 | #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) | 283 | #define XFRMA_SAD_MAX (__XFRMA_SAD_MAX - 1) |
296 | }; | 284 | }; |
297 | 285 | ||
286 | struct xfrmu_sadhinfo { | ||
287 | __u32 sadhcnt; /* current hash bkts */ | ||
288 | __u32 sadhmcnt; /* max allowed hash bkts */ | ||
289 | }; | ||
290 | |||
298 | /* SPD Table filter flags */ | 291 | /* SPD Table filter flags */ |
299 | enum xfrm_spd_ftype_t { | 292 | enum xfrm_spd_ftype_t { |
300 | XFRM_SPD_UNSPEC, | 293 | XFRM_SPD_UNSPEC, |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 66c2d3eec03c..d0d7db51d3fc 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -416,14 +416,6 @@ struct xfrm_audit | |||
416 | u32 secid; | 416 | u32 secid; |
417 | }; | 417 | }; |
418 | 418 | ||
419 | /* SAD metadata, add more later */ | ||
420 | struct xfrm_sadinfo | ||
421 | { | ||
422 | u32 sadhcnt; /* current hash bkts */ | ||
423 | u32 sadhmcnt; /* max allowed hash bkts */ | ||
424 | u32 sadcnt; /* current running count */ | ||
425 | }; | ||
426 | |||
427 | struct xfrm_spdinfo | 419 | struct xfrm_spdinfo |
428 | { | 420 | { |
429 | u32 incnt; | 421 | u32 incnt; |
@@ -964,10 +956,17 @@ static inline int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **s | |||
964 | return -ENOSYS; | 956 | return -ENOSYS; |
965 | } | 957 | } |
966 | #endif | 958 | #endif |
959 | |||
960 | struct xfrmk_sadinfo { | ||
961 | u32 sadhcnt; /* current hash bkts */ | ||
962 | u32 sadhmcnt; /* max allowed hash bkts */ | ||
963 | u32 sadcnt; /* current running count */ | ||
964 | }; | ||
965 | |||
967 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); | 966 | extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); |
968 | extern int xfrm_state_delete(struct xfrm_state *x); | 967 | extern int xfrm_state_delete(struct xfrm_state *x); |
969 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 968 | extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); |
970 | extern void xfrm_sad_getinfo(struct xfrm_sadinfo *si); | 969 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); |
971 | extern void xfrm_spd_getinfo(struct xfrm_spdinfo *si); | 970 | extern void xfrm_spd_getinfo(struct xfrm_spdinfo *si); |
972 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 971 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); |
973 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 972 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
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 | ||