From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH conntrack-tools] ipv6: remove use of HAVE_INET_PTON_IPV6
Date: Mon, 29 May 2017 18:25:23 +0200 [thread overview]
Message-ID: <20170529162523.GA22681@salvia> (raw)
In-Reply-To: <1496072655-26752-1-git-send-email-nicolas.dichtel@6wind.com>
On Mon, May 29, 2017 at 05:44:15PM +0200, Nicolas Dichtel wrote:
> The goal of this patch is to fix the ipv6 support when conntrackd is
> cross-compiled. The AC_RUN_IFELSE macro must be avoided as much as possible.
> See section 6.6 of the gnu autoconf:
> "If you really need to test for a runtime behavior while configuring, you can
> write a test program to determine the result, and compile and run it using
> AC_RUN_IFELSE. Avoid running test programs if possible, because this prevents
> people from configuring your package for cross-compiling."
>
> Let's remove this check and test the returned error to handle the case where
> ipv6 is not supported (inet_pton() returns -1 when the family is not supported).
Much less ifdef pollution, much better indeed.
One comment below:
> diff --git a/src/read_config_yy.y b/src/read_config_yy.y
> index 3bb7c5f90017..e4fd277a47ea 100644
> --- a/src/read_config_yy.y
> +++ b/src/read_config_yy.y
> @@ -240,17 +240,17 @@ multicast_option : T_IPV4_ADDR T_IP
> multicast_option : T_IPV6_ADDR T_IP
> {
> __max_dedicated_links_reached();
> + int err;
>
> -#ifdef HAVE_INET_PTON_IPV6
> - if (inet_pton(AF_INET6, $2,
> - &conf.channel[conf.channel_num].u.mcast.in) <= 0) {
> + err = inet_pton(AF_INET6, $2,
> + &conf.channel[conf.channel_num].u.mcast.in);
> + if (err == 0) {
> dlog(LOG_WARNING, "%s is not a valid IPv6 address", $2);
> break;
> + } else if (err < 0) {
> + dlog(LOG_WARNING, "inet_pton(): IPv6 unsupported!");
> + break;
Probably better to exit() here and to use LOG_ERR instead?
If we cannot interpret this IPv6 address, we shouldn't go much
further.
next prev parent reply other threads:[~2017-05-29 16:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-29 15:44 [PATCH conntrack-tools] ipv6: remove use of HAVE_INET_PTON_IPV6 Nicolas Dichtel
2017-05-29 16:25 ` Pablo Neira Ayuso [this message]
2017-05-30 7:54 ` Nicolas Dichtel
2017-05-30 7:56 ` [PATCH conntrack-tools v2] " Nicolas Dichtel
2017-06-06 15:37 ` 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=20170529162523.GA22681@salvia \
--to=pablo@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.