netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iptables] libxtables: fix getaddrinfo return value usage
@ 2014-06-10 13:29 Domen Puncer
  2014-06-11  9:37 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Domen Puncer @ 2014-06-10 13:29 UTC (permalink / raw)
  To: netfilter-devel

getaddrinfo return value on error can also be positive.

Signed-off-by: Domen Puncer Kugler <domen.puncer@samsung.com>
---
 libxtables/xtoptions.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libxtables/xtoptions.c b/libxtables/xtoptions.c
index 9b4c5aa..d26d2f8 100644
--- a/libxtables/xtoptions.c
+++ b/libxtables/xtoptions.c
@@ -519,7 +519,7 @@ static void xtopt_parse_host(struct xt_option_call *cb)
 	int ret;

 	ret = getaddrinfo(cb->arg, NULL, &hints, &res);
-	if (ret < 0)
+	if (ret != 0)
 		xt_params->exit_err(PARAMETER_PROBLEM,
 			"getaddrinfo: %s\n", gai_strerror(ret));

@@ -562,7 +562,7 @@ static int xtables_getportbyname(const char *name)
 	int ret;

 	ret = getaddrinfo(NULL, name, NULL, &res);
-	if (ret < 0)
+	if (ret != 0)
 		return -1;
 	ret = -1;
 	for (p = res; p != NULL; p = p->ai_next) {
@@ -675,7 +675,7 @@ static int xtopt_parse_mask(struct xt_option_call *cb)
 	int ret;

 	ret = getaddrinfo(cb->arg, NULL, &hints, &res);
-	if (ret < 0)
+	if (ret != 0)
 		return 0;

 	memcpy(&cb->val.hmask, xtables_sa_host(res->ai_addr, res->ai_family),

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iptables] libxtables: fix getaddrinfo return value usage
  2014-06-10 13:29 [PATCH iptables] libxtables: fix getaddrinfo return value usage Domen Puncer
@ 2014-06-11  9:37 ` Pablo Neira Ayuso
  2014-06-11  9:48   ` Domen Puncer
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-11  9:37 UTC (permalink / raw)
  To: Domen Puncer; +Cc: netfilter-devel

On Tue, Jun 10, 2014 at 02:29:49PM +0100, Domen Puncer wrote:
> getaddrinfo return value on error can also be positive.

At quick glance, all EAI_* that I see are negative.

What problem are you experience? What case are you trying to catch?

Thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iptables] libxtables: fix getaddrinfo return value usage
  2014-06-11  9:37 ` Pablo Neira Ayuso
@ 2014-06-11  9:48   ` Domen Puncer
  2014-06-11 17:55     ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Domen Puncer @ 2014-06-11  9:48 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel@vger.kernel.org

On 11/06/14 10:37, Pablo Neira Ayuso wrote:
> On Tue, Jun 10, 2014 at 02:29:49PM +0100, Domen Puncer wrote:
>> getaddrinfo return value on error can also be positive.
> 
> At quick glance, all EAI_* that I see are negative.

You don't see all of them :-)
On Android they're positive, e.g.:
	android-ndk-r9d/platforms/android-19/arch-arm/usr/include/netdb.h
	147 #define EAI_NONAME       8      /* hostname nor servname provided,
or not known */

And as a plus, it's not bad to conform to specs.

> 
> What problem are you experience? What case are you trying to catch?
> 
> Thanks.
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iptables] libxtables: fix getaddrinfo return value usage
  2014-06-11  9:48   ` Domen Puncer
@ 2014-06-11 17:55     ` Pablo Neira Ayuso
  2014-06-12  7:01       ` Domen Puncer
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-11 17:55 UTC (permalink / raw)
  To: Domen Puncer; +Cc: netfilter-devel@vger.kernel.org

On Wed, Jun 11, 2014 at 10:48:19AM +0100, Domen Puncer wrote:
> On 11/06/14 10:37, Pablo Neira Ayuso wrote:
> > On Tue, Jun 10, 2014 at 02:29:49PM +0100, Domen Puncer wrote:
> >> getaddrinfo return value on error can also be positive.
> > 
> > At quick glance, all EAI_* that I see are negative.
> 
> You don't see all of them :-)
> On Android they're positive, e.g.:
> 	android-ndk-r9d/platforms/android-19/arch-arm/usr/include/netdb.h
> 	147 #define EAI_NONAME       8      /* hostname nor servname provided,
> or not known */

I suspected something like this..

Please, next time include this in the patch description since the
beginning, thanks.

> And as a plus, it's not bad to conform to specs.

It sounds like a reasonable assumption to me.

Do you have more patches like this in your queue?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iptables] libxtables: fix getaddrinfo return value usage
  2014-06-11 17:55     ` Pablo Neira Ayuso
@ 2014-06-12  7:01       ` Domen Puncer
  2014-06-16  9:48         ` Pablo Neira Ayuso
  0 siblings, 1 reply; 6+ messages in thread
From: Domen Puncer @ 2014-06-12  7:01 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel@vger.kernel.org

On 11/06/14 18:55, Pablo Neira Ayuso wrote:
> On Wed, Jun 11, 2014 at 10:48:19AM +0100, Domen Puncer wrote:
>> On 11/06/14 10:37, Pablo Neira Ayuso wrote:
>>> On Tue, Jun 10, 2014 at 02:29:49PM +0100, Domen Puncer wrote:
>>>> getaddrinfo return value on error can also be positive.
>>>
>>> At quick glance, all EAI_* that I see are negative.
>>
>> You don't see all of them :-)
>> On Android they're positive, e.g.:
>> 	android-ndk-r9d/platforms/android-19/arch-arm/usr/include/netdb.h
>> 	147 #define EAI_NONAME       8      /* hostname nor servname provided,
>> or not known */
> 
> I suspected something like this..
> 
> Please, next time include this in the patch description since the
> beginning, thanks.

OK. Will do so.

> 
>> And as a plus, it's not bad to conform to specs.
> 
> It sounds like a reasonable assumption to me.
> 
> Do you have more patches like this in your queue?

Sorry, this was just a one-off.


Best regards,
  Domen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iptables] libxtables: fix getaddrinfo return value usage
  2014-06-12  7:01       ` Domen Puncer
@ 2014-06-16  9:48         ` Pablo Neira Ayuso
  0 siblings, 0 replies; 6+ messages in thread
From: Pablo Neira Ayuso @ 2014-06-16  9:48 UTC (permalink / raw)
  To: Domen Puncer; +Cc: netfilter-devel@vger.kernel.org

On Thu, Jun 12, 2014 at 08:01:29AM +0100, Domen Puncer wrote:
> On 11/06/14 18:55, Pablo Neira Ayuso wrote:
> > On Wed, Jun 11, 2014 at 10:48:19AM +0100, Domen Puncer wrote:
> >> On 11/06/14 10:37, Pablo Neira Ayuso wrote:
> >>> On Tue, Jun 10, 2014 at 02:29:49PM +0100, Domen Puncer wrote:
> >>>> getaddrinfo return value on error can also be positive.
> >>>
> >>> At quick glance, all EAI_* that I see are negative.
> >>
> >> You don't see all of them :-)
> >> On Android they're positive, e.g.:
> >> 	android-ndk-r9d/platforms/android-19/arch-arm/usr/include/netdb.h
> >> 	147 #define EAI_NONAME       8      /* hostname nor servname provided,
> >> or not known */
> > 
> > I suspected something like this..
> > 
> > Please, next time include this in the patch description since the
> > beginning, thanks.
> 
> OK. Will do so.

Applied. I have appended the information above into the description.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-16  9:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 13:29 [PATCH iptables] libxtables: fix getaddrinfo return value usage Domen Puncer
2014-06-11  9:37 ` Pablo Neira Ayuso
2014-06-11  9:48   ` Domen Puncer
2014-06-11 17:55     ` Pablo Neira Ayuso
2014-06-12  7:01       ` Domen Puncer
2014-06-16  9:48         ` Pablo Neira Ayuso

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).