[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <463200CC.6010207@trash.net>
Date: Fri, 27 Apr 2007 15:55:24 +0200
From: Patrick McHardy <kaber@...sh.net>
To: hadi@...erus.ca
CC: David Miller <davem@...emloft.net>, netdev@...r.kernel.org
Subject: Re: [PATCH][XFRM] export SPD info
jamal wrote:
> +static int build_spdinfo(struct sk_buff *skb, u32 pid, u32 seq, u32 flags)
> +{
> + struct xfrm_spdinfo si;
> + struct nlmsghdr *nlh;
> + u32 *f;
> +
> + nlh = nlmsg_put(skb, pid, seq, XFRM_MSG_NEWSPDINFO, sizeof(u32), 0);
> + if (nlh == NULL) /* shouldnt really happen ... */
> + return -EMSGSIZE;
> +
> + 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);
It it really worth the extra code for dumping them conditionally?
The attributes are neither large nor will they be sent very often.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists