From: Patrick McHardy <kaber@trash.net>
To: hadi@cyberus.ca
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH][XFRM] export SPD info
Date: Fri, 27 Apr 2007 15:55:24 +0200 [thread overview]
Message-ID: <463200CC.6010207@trash.net> (raw)
In-Reply-To: <1177681421.4059.2.camel@localhost>
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.
next prev parent reply other threads:[~2007-04-27 13:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-27 13:43 [PATCH][XFRM] export SPD info jamal
2007-04-27 13:55 ` Patrick McHardy [this message]
2007-04-27 14:29 ` jamal
2007-04-29 4:19 ` David Miller
2007-04-30 12:04 ` jamal
2007-04-29 4:21 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=463200CC.6010207@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).