netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Giuseppe Longo <giuseppelng@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [iptables-nftables PATCH 3/5] nft: nft_xtables_config_load() called only in nft_init()
Date: Fri, 26 Jul 2013 16:59:02 +0200	[thread overview]
Message-ID: <20130726145902.GA28833@localhost> (raw)
In-Reply-To: <1374836719-27596-3-git-send-email-giuseppelng@gmail.com>

Hi Giuseppe,

On Fri, Jul 26, 2013 at 01:05:17PM +0200, Giuseppe Longo wrote:
[...]
> diff --git a/iptables/xtables-config.c b/iptables/xtables-config.c
> index b7cf609..d61b762 100644
> --- a/iptables/xtables-config.c
> +++ b/iptables/xtables-config.c
> @@ -15,6 +15,7 @@
>  #include <stdbool.h>
>  #include <string.h>
>  #include <errno.h>
> +#include <libmnl/libmnl.h>
>  
>  #include "xtables-multi.h"
>  #include "nft.h"
> @@ -35,11 +36,17 @@ int xtables_config_main(int argc, char *argv[])
>  	else
>  		filename = argv[1];
>  
> -	if (nft_init(&h, xtables_ipv4) < 0) {
> -                fprintf(stderr, "Failed to initialize nft: %s\n",
> -			strerror(errno));
> -		return EXIT_FAILURE;
> +	h.nl = mnl_socket_open(NETLINK_NETFILTER);
> +	if (h.nl == NULL) {
> +		perror("mnl_socket_open");
> +		return -1;
>  	}
> +	if (mnl_socket_bind(h.nl, 0, MNL_SOCKET_AUTOPID) < 0) {
> +		perror("mnl_socket_bind");
> +		return -1;
> +	}
> +	h.portid = mnl_socket_get_portid(h.nl);
> +	h.tables = xtables_ipv4;

Hm, why do we need this here?

  reply	other threads:[~2013-07-26 14:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-26 11:05 [iptables-nftables PATCH 1/5] nft: let nft_handle struct own the builtin table pointer Giuseppe Longo
2013-07-26 11:05 ` [iptables-nftables PATCH 2/5] nft: search builtin tables via nft_handle tables pointer Giuseppe Longo
2013-07-26 11:05 ` [iptables-nftables PATCH 3/5] nft: nft_xtables_config_load() called only in nft_init() Giuseppe Longo
2013-07-26 14:59   ` Pablo Neira Ayuso [this message]
2013-07-28  9:34     ` Giuseppe Longo
2013-07-29  6:14       ` Tomasz Bursztyka
2013-07-30  7:05   ` Tomasz Bursztyka
2013-07-26 11:05 ` [iptables-nftables PATCH 4/5] nft: export functions reusability Giuseppe Longo
2013-07-30  9:06   ` Pablo Neira Ayuso
2013-07-26 11:05 ` [iptables-nftables PATCH 5/5] nft: fix family operation lookup Giuseppe Longo
2013-07-30  9:46   ` Pablo Neira Ayuso
2013-07-26 12:31 ` [iptables-nftables PATCH 1/5] nft: let nft_handle struct own the builtin table pointer Pablo Neira Ayuso
2013-07-29  8:24 ` [iptables-nftables PATCH 4/5] nft: export functions reusability Tomasz Bursztyka

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=20130726145902.GA28833@localhost \
    --to=pablo@netfilter.org \
    --cc=giuseppelng@gmail.com \
    --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).