aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c51
1 files changed, 16 insertions, 35 deletions
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)