summaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_user.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 19:36:58 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 19:36:58 -0700
commit7e20ef030dde0e52dd5a57220ee82fa9facbea4e (patch)
tree5006db4f85a2d7be2777748aaff2966e79dddc6f /net/xfrm/xfrm_user.c
parenta3d52136ee8f7399859f9a0824470fd49b1d1a00 (diff)
parent07d939677166cc4f000c767196872a9becc2697b (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (49 commits) [SCTP]: Set assoc_id correctly during INIT collision. [SCTP]: Re-order SCTP initializations to avoid race with sctp_rcv() [SCTP]: Fix the SO_REUSEADDR handling to be similar to TCP. [SCTP]: Verify all destination ports in sctp_connectx. [XFRM] SPD info TLV aggregation [XFRM] SAD info TLV aggregationx [AF_RXRPC]: Sort out MTU handling. [AF_IUCV/IUCV] : Add missing section annotations [AF_IUCV]: Implementation of a skb backlog queue [NETLINK]: Remove bogus BUG_ON [IPV6]: Some cleanups in include/net/ipv6.h [TCP]: zero out rx_opt in tcp_disconnect() [BNX2]: Fix TSO problem with small MSS. [NET]: Rework dev_base via list_head (v3) [TCP] Highspeed: Limited slow-start is nowadays in tcp_slow_start [BNX2]: Update version and reldate. [BNX2]: Print bus information for PCIE devices. [BNX2]: Add 1-shot MSI handler for 5709. [BNX2]: Restructure PHY event handling. [BNX2]: Add indirect spinlock. ...
Diffstat (limited to 'net/xfrm/xfrm_user.c')
-rw-r--r--net/xfrm/xfrm_user.c73
1 files changed, 25 insertions, 48 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 4210d91624c..b14c7e590c3 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,
static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
{
- struct xfrm_spdinfo si;
+ struct xfrmk_spdinfo si;
+ struct xfrmu_spdinfo spc;
+ struct xfrmu_spdhinfo sph;
struct nlmsghdr *nlh;
u32 *f;
@@ -685,23 +687,17 @@ static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
f = nlmsg_data(nlh);
*f = flags;
xfrm_spd_getinfo(&si);
-
- if (flags & XFRM_SPD_HMASK)
- NLA_PUT_U32(skb, XFRMA_SPDHMASK, si.spdhcnt);
- if (flags & XFRM_SPD_HMAX)
- NLA_PUT_U32(skb, XFRMA_SPDHMAX, si.spdhmcnt);
- if (flags & XFRM_SPD_ICNT)
- NLA_PUT_U32(skb, XFRMA_SPDICNT, si.incnt);
- if (flags & XFRM_SPD_OCNT)
- NLA_PUT_U32(skb, XFRMA_SPDOCNT, si.outcnt);
- if (flags & XFRM_SPD_FCNT)
- NLA_PUT_U32(skb, XFRMA_SPDFCNT, si.fwdcnt);
- if (flags & XFRM_SPD_ISCNT)
- NLA_PUT_U32(skb, XFRMA_SPDISCNT, si.inscnt);
- if (flags & XFRM_SPD_OSCNT)
- NLA_PUT_U32(skb, XFRMA_SPDOSCNT, si.inscnt);
- if (flags & XFRM_SPD_FSCNT)
- NLA_PUT_U32(skb, XFRMA_SPDFSCNT, si.inscnt);
+ spc.incnt = si.incnt;
+ spc.outcnt = si.outcnt;
+ spc.fwdcnt = si.fwdcnt;
+ spc.inscnt = si.inscnt;
+ spc.outscnt = si.outscnt;
+ spc.fwdscnt = si.fwdscnt;
+ sph.spdhcnt = si.spdhcnt;
+ sph.spdhmcnt = si.spdhmcnt;
+
+ NLA_PUT(skb, XFRMA_SPD_INFO, sizeof(spc), &spc);
+ NLA_PUT(skb, XFRMA_SPD_HINFO, sizeof(sph), &sph);
return nlmsg_end(skb, nlh);
@@ -719,23 +715,8 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
u32 seq = nlh->nlmsg_seq;
int len = NLMSG_LENGTH(sizeof(u32));
-
- if (*flags & XFRM_SPD_HMASK)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_HMAX)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_ICNT)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_OCNT)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_FCNT)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_ISCNT)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_OSCNT)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SPD_FSCNT)
- len += RTA_SPACE(sizeof(u32));
+ len += RTA_SPACE(sizeof(struct xfrmu_spdinfo));
+ len += RTA_SPACE(sizeof(struct xfrmu_spdhinfo));
r_skb = alloc_skb(len, GFP_ATOMIC);
if (r_skb == NULL)
@@ -749,7 +730,8 @@ static int xfrm_get_spdinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
{
- struct xfrm_sadinfo si;
+ struct xfrmk_sadinfo si;
+ struct xfrmu_sadhinfo sh;
struct nlmsghdr *nlh;
u32 *f;
@@ -761,12 +743,11 @@ static int build_sadinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
*f = flags;
xfrm_sad_getinfo(&si);
- if (flags & XFRM_SAD_HMASK)
- NLA_PUT_U32(skb, XFRMA_SADHMASK, si.sadhcnt);
- if (flags & XFRM_SAD_HMAX)
- NLA_PUT_U32(skb, XFRMA_SADHMAX, si.sadhmcnt);
- if (flags & XFRM_SAD_CNT)
- NLA_PUT_U32(skb, XFRMA_SADCNT, si.sadcnt);
+ sh.sadhmcnt = si.sadhmcnt;
+ sh.sadhcnt = si.sadhcnt;
+
+ NLA_PUT_U32(skb, XFRMA_SAD_CNT, si.sadcnt);
+ NLA_PUT(skb, XFRMA_SAD_HINFO, sizeof(sh), &sh);
return nlmsg_end(skb, nlh);
@@ -784,12 +765,8 @@ static int xfrm_get_sadinfo(struct sk_buff *skb, struct nlmsghdr *nlh,
u32 seq = nlh->nlmsg_seq;
int len = NLMSG_LENGTH(sizeof(u32));
- if (*flags & XFRM_SAD_HMASK)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SAD_HMAX)
- len += RTA_SPACE(sizeof(u32));
- if (*flags & XFRM_SAD_CNT)
- len += RTA_SPACE(sizeof(u32));
+ len += RTA_SPACE(sizeof(struct xfrmu_sadhinfo));
+ len += RTA_SPACE(sizeof(u32));
r_skb = alloc_skb(len, GFP_ATOMIC);