netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan Roe <duncan_roe@optusnet.com.au>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH libnetfilter_queue 0/1] src: Add nfq_hdr_put to library
Date: Tue,  4 Feb 2020 13:00:02 +1100	[thread overview]
Message-ID: <20200204020003.6478-1-duncan_roe@optusnet.com.au> (raw)

This is the first of a number of proposed additions to libnetfilter_queue.

The plan is to minimise the need for direct calls to libmnl functions in a
libnetfilter_queue program.

 - example program nf-queue.c is shorter
 - calling sequences are simplaer
 - documentation is mostly in one place

Other planned functions include:

 Function                  Purpose
 ========                  =======
 nfq_socket_sendto         Eliminate mnl_socket_sendto arg 3 (nlh->nlmsg_len)
 nfq_socket_open           Eliminate mnl_socket_open arg (NETLINK_NETFILTER)
 nfq_socket_bind           Eliminate mnl_socket_bind args 2 & 3
                           (0, MNL_SOCKET_AUTOPID)
 nfq_socket_setsockopt     Eliminate mnl_socket_setsockopt args 3 & 4
                           (&ret, sizeof(int))
 nfq_cb_run                Eliminate mnl_cb_run arg 3 (0). Also:
                           Replace mnl_cb_run arg 4 (unsigned int portid) with
                           (struct nlmsghdr *nlh). This eliminates the call to
                           mnl_socket_get_portid and the need to declare portid
 nfq_attr_put_config_flags Avoid having to call mnl_attr_put_u32 twice, also
                           avoid having to use htonl.
                           Implementation note: copy nfq_set_queue_flags
                                                documentation
 nfq_attr_put_u32          Avoid call to htonl
 nfq_attr_get_u32          Avoid call to ntohl

Leading eventually to the new top-level module:

Library Setup [CURRENT]

Duncan Roe (1):
  src: move static nfq_hdr_put from examples/nf-queue.c into the library
    since everyone is going to want it.

 examples/nf-queue.c                             | 15 -------------
 include/libnetfilter_queue/libnetfilter_queue.h |  1 +
 src/nlmsg.c                                     | 28 ++++++++++++++++++++++---
 3 files changed, 26 insertions(+), 18 deletions(-)

-- 
2.14.5


             reply	other threads:[~2020-02-04  2:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  2:00 Duncan Roe [this message]
2020-02-04  2:00 ` [PATCH libnetfilter_queue 1/1] src: move static nfq_hdr_put from examples/nf-queue.c into the library since everyone is going to want it Duncan Roe
2020-02-23 22:16   ` Pablo Neira Ayuso
2020-02-24  0:52     ` [PATCH libnetfilter_queue v2] " Duncan Roe
2020-02-24  2:21       ` [PATCH libnetfilter_queue v3] " Duncan Roe
2020-02-24  9:39         ` Pablo Neira Ayuso

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=20200204020003.6478-1-duncan_roe@optusnet.com.au \
    --to=duncan_roe@optusnet.com.au \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).