aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/xfrm.h39
-rw-r--r--include/net/xfrm.h24
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--net/xfrm/xfrm_user.c51
4 files changed, 45 insertions, 71 deletions
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index c237fe3af8ce..b58adc52448d 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -288,36 +288,29 @@ struct xfrmu_sadhinfo {
288 __u32 sadhmcnt; /* max allowed hash bkts */ 288 __u32 sadhmcnt; /* max allowed hash bkts */
289}; 289};
290 290
291/* SPD Table filter flags */
292enum xfrm_spd_ftype_t {
293 XFRM_SPD_UNSPEC,
294 XFRM_SPD_HMASK=1,
295 XFRM_SPD_HMAX=2,
296 XFRM_SPD_ICNT=4,
297 XFRM_SPD_OCNT=8,
298 XFRM_SPD_FCNT=16,
299 XFRM_SPD_ISCNT=32,
300 XFRM_SPD_OSCNT=64,
301 XFRM_SPD_FSCNT=128,
302 __XFRM_SPD_MAX
303
304#define XFRM_SPD_MAX (__XFRM_SPD_MAX - 1)
305};
306enum xfrm_spdattr_type_t { 291enum xfrm_spdattr_type_t {
307 XFRMA_SPD_UNSPEC, 292 XFRMA_SPD_UNSPEC,
308 XFRMA_SPDHMASK, 293 XFRMA_SPD_INFO,
309 XFRMA_SPDHMAX, 294 XFRMA_SPD_HINFO,
310 XFRMA_SPDICNT,
311 XFRMA_SPDOCNT,
312 XFRMA_SPDFCNT,
313 XFRMA_SPDISCNT,
314 XFRMA_SPDOSCNT,
315 XFRMA_SPDFSCNT,
316 __XFRMA_SPD_MAX 295 __XFRMA_SPD_MAX
317 296
318#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1) 297#define XFRMA_SPD_MAX (__XFRMA_SPD_MAX - 1)
319}; 298};
320 299
300struct xfrmu_spdinfo {
301 __u32 incnt;
302 __u32 outcnt;
303 __u32 fwdcnt;
304 __u32 inscnt;
305 __u32 outscnt;
306 __u32 fwdscnt;
307};
308
309struct xfrmu_spdhinfo {
310 __u32 spdhcnt;
311 __u32 spdhmcnt;
312};
313
321struct xfrm_usersa_info { 314struct xfrm_usersa_info {
322 struct xfrm_selector sel; 315 struct xfrm_selector sel;
323 struct xfrm_id id; 316 struct xfrm_id id;
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d0d7db51d3fc..39ef925d39dd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -416,17 +416,6 @@ struct xfrm_audit
416 u32 secid; 416 u32 secid;
417}; 417};
418 418
419struct xfrm_spdinfo
420{
421 u32 incnt;
422 u32 outcnt;
423 u32 fwdcnt;
424 u32 inscnt;
425 u32 outscnt;
426 u32 fwdscnt;
427 u32 spdhcnt;
428 u32 spdhmcnt;
429};
430#ifdef CONFIG_AUDITSYSCALL 419#ifdef CONFIG_AUDITSYSCALL
431extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result, 420extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
432 struct xfrm_policy *xp, struct xfrm_state *x); 421 struct xfrm_policy *xp, struct xfrm_state *x);
@@ -963,11 +952,22 @@ struct xfrmk_sadinfo {
963 u32 sadcnt; /* current running count */ 952 u32 sadcnt; /* current running count */
964}; 953};
965 954
955struct xfrmk_spdinfo {
956 u32 incnt;
957 u32 outcnt;
958 u32 fwdcnt;
959 u32 inscnt;
960 u32 outscnt;
961 u32 fwdscnt;
962 u32 spdhcnt;
963 u32 spdhmcnt;
964};
965
966extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 966extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
967extern int xfrm_state_delete(struct xfrm_state *x); 967extern int xfrm_state_delete(struct xfrm_state *x);
968extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); 968extern void xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info);
969extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); 969extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si);
970extern void xfrm_spd_getinfo(struct xfrm_spdinfo *si); 970extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
971extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); 971extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
972extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); 972extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
973extern void xfrm_replay_notify(struct xfrm_state *x, int event); 973extern void xfrm_replay_notify(struct xfrm_state *x, int event);
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 263e34e45265..95271e8426a1 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -579,7 +579,7 @@ static inline int xfrm_byidx_should_resize(int total)
579 return 0; 579 return 0;
580} 580}
581 581
582void xfrm_spd_getinfo(struct xfrm_spdinfo *si) 582void xfrm_spd_getinfo(struct xfrmk_spdinfo *si)
583{ 583{
584 read_lock_bh(&xfrm_policy_lock); 584 read_lock_bh(&xfrm_policy_lock);
585 si->incnt = xfrm_policy_count[XFRM_POLICY_IN]; 585 si->incnt = xfrm_policy_count[XFRM_POLICY_IN];
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index c35b9ea3b62b..b14c7e590c31 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -674,7 +674,9 @@ static struct sk_buff *xfrm_state_netlink(struct sk_buff *in_skb,
674 674
675static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags) 675static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
676{ 676{
677 struct xfrm_spdinfo si; 677 struct xfrmk_spdinfo si;
678 struct xfrmu_spdinfo spc;
679 struct xfrmu_spdhinfo sph;
678 struct nlmsghdr *nlh; 680 struct nlmsghdr *nlh;
679 u32 *f; 681 u32 *f;
680 682
@@ -685,23 +687,17 @@ static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
685 f = nlmsg_data(nlh); 687 f = nlmsg_data(nlh);
686 *f = flags; 688 *f = flags;
687 xfrm_spd_getinfo(&si); 689 xfrm_spd_getinfo(&si);
688 690 spc.incnt = si.incnt;
689 if (flags & XFRM_SPD_HMASK) 691 spc.outcnt = si.outcnt;
690 NLA_PUT_U32(skb, XFRMA_SPDHMASK, si.spdhcnt); 692 spc.fwdcnt = si.fwdcnt;
691 if (flags & XFRM_SPD_HMAX) 693 spc.inscnt = si.inscnt;
692 NLA_PUT_U32(skb, XFRMA_SPDHMAX, si.spdhmcnt); 694 spc.outscnt = si.outscnt;
693 if (flags & XFRM_SPD_ICNT) 695 spc.fwdscnt = si.fwdscnt;
694 NLA_PUT_U32(skb, XFRMA_SPDICNT, si.incnt); 696 sph.spdhcnt = si.spdhcnt;
695 if (flags & XFRM_SPD_OCNT) 697 sph.spdhmcnt = si.spdhmcnt;
696 NLA_PUT_U32(skb, XFRMA_SPDOCNT, si.outcnt); 698
697 if (flags & XFRM_SPD_FCNT) 699 NLA_PUT(skb, XFRMA_SPD_INFO, sizeof(spc), &spc);
698 NLA_PUT_U32(skb, XFRMA_SPDFCNT, si.fwdcnt); 700 NLA_PUT(skb, XFRMA_SPD_HINFO, sizeof(sph), &sph);
699 if (flags & XFRM_SPD_ISCNT)
700 NLA_PUT_U32(skb, XFRMA_SPDISCNT, si.inscnt);
701 if (flags & XFRM_SPD_OSCNT)
702 NLA_PUT_U32(skb, XFRMA_SPDOSCNT, si.inscnt);
703 if (flags & XFRM_SPD_FSCNT)
704 NLA_PUT_U32(skb, XFRMA_SPDFSCNT, si.inscnt);
705 701
706 return nlmsg_end(skb, nlh); 702 return nlmsg_end(skb, nlh);
707 703
@@ -719,23 +715,8 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
719 u32 seq = nlh->nlmsg_seq; 715 u32 seq = nlh->nlmsg_seq;
720 int len = NLMSG_LENGTH(sizeof(u32)); 716 int len = NLMSG_LENGTH(sizeof(u32));
721 717
722 718 len += RTA_SPACE(sizeof(struct xfrmu_spdinfo));
723 if (*flags & XFRM_SPD_HMASK) 719 len += RTA_SPACE(sizeof(struct xfrmu_spdhinfo));
724 len += RTA_SPACE(sizeof(u32));
725 if (*flags & XFRM_SPD_HMAX)
726 len += RTA_SPACE(sizeof(u32));
727 if (*flags & XFRM_SPD_ICNT)
728 len += RTA_SPACE(sizeof(u32));
729 if (*flags & XFRM_SPD_OCNT)
730 len += RTA_SPACE(sizeof(u32));
731 if (*flags & XFRM_SPD_FCNT)
732 len += RTA_SPACE(sizeof(u32));
733 if (*flags & XFRM_SPD_ISCNT)
734 len += RTA_SPACE(sizeof(u32));
735 if (*flags & XFRM_SPD_OSCNT)
736 len += RTA_SPACE(sizeof(u32));
737 if (*flags & XFRM_SPD_FSCNT)
738 len += RTA_SPACE(sizeof(u32));
739 720
740 r_skb = alloc_skb(len, GFP_ATOMIC); 721 r_skb = alloc_skb(len, GFP_ATOMIC);
741 if (r_skb == NULL) 722 if (r_skb == NULL)