From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH lnf-queue] api: add nfq_nlmsg_get_timestamp helper
Date: Tue, 27 Aug 2013 00:53:25 +0200 [thread overview]
Message-ID: <20130826225325.GA4695@localhost> (raw)
In-Reply-To: <1377184037-19790-1-git-send-email-fw@strlen.de>
Hi Florian,
On Thu, Aug 22, 2013 at 05:07:17PM +0200, Florian Westphal wrote:
> The NFQA_TIMESTAMP structure is in network byte order, so it seems
> appropriate to add a helper to convert it to a timeval struct.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> examples/nf-queue.c | 9 ++++++++-
> include/libnetfilter_queue/libnetfilter_queue.h | 2 ++
> src/nlmsg.c | 15 +++++++++++++++
> 3 files changed, 25 insertions(+), 1 deletions(-)
>
> diff --git a/examples/nf-queue.c b/examples/nf-queue.c
> index 1f465ad..2722426 100644
> --- a/examples/nf-queue.c
> +++ b/examples/nf-queue.c
> @@ -5,6 +5,7 @@
> #include <string.h>
> #include <time.h>
> #include <arpa/inet.h>
> +#include <sys/time.h>
>
> #include <libmnl/libmnl.h>
> #include <linux/netfilter.h>
> @@ -54,6 +55,7 @@ static int queue_cb(const struct nlmsghdr *nlh, void *data)
> uint32_t id = 0, skbinfo;
> struct nfgenmsg *nfg;
> uint16_t plen;
> + struct timeval tv;
>
> if (nfq_nlmsg_parse(nlh, attr) < 0) {
> perror("problems parsing");
> @@ -72,7 +74,11 @@ static int queue_cb(const struct nlmsghdr *nlh, void *data)
> plen = mnl_attr_get_payload_len(attr[NFQA_PAYLOAD]);
> /* void *payload = mnl_attr_get_payload(attr[NFQA_PAYLOAD]); */
>
> - skbinfo = attr[NFQA_SKB_INFO] ? ntohl(mnl_attr_get_u32(attr[NFQA_SKB_INFO])) : 0;
> + if (attr[NFQA_TIMESTAMP])
> + nfq_nlmsg_get_timestamp(attr[NFQA_TIMESTAMP], &tv);
I think we can update nfq_get_timestamp to use libmnl without breaking
backward compatibility. Same thing with all other getter functions
that we have.
Regards.
next prev parent reply other threads:[~2013-08-26 22:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 15:07 [PATCH lnf-queue] api: add nfq_nlmsg_get_timestamp helper Florian Westphal
2013-08-26 22:53 ` Pablo Neira Ayuso [this message]
2013-08-28 8:46 ` Florian Westphal
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=20130826225325.GA4695@localhost \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@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).