netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipset: fix lookup of tcp port names
@ 2011-10-28 16:16 Stephen Hemminger
  2011-10-28 20:26 ` Jozsef Kadlecsik
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Hemminger @ 2011-10-28 16:16 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: netfilter, netfilter-devel

The protocol argument to getservbyname() must be lowercase tcp not
uppercase TCP. This fixes the bug observed by:

 # ipset add foo http
 ipset v6.9.1: Syntax error: 'http' is invalid as number
 Syntax error: cannot parse 'http' as a TCP port
---
 lib/parse.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/parse.c b/lib/parse.c
index 241d5ae..3ca702c 100644
--- a/lib/parse.c
+++ b/lib/parse.c
@@ -307,7 +307,7 @@ int
 ipset_parse_tcp_port(struct ipset_session *session,
 		     enum ipset_opt opt, const char *str)
 {
-	return ipset_parse_tcpudp_port(session, opt, str, "TCP");
+	return ipset_parse_tcpudp_port(session, opt, str, "tcp");
 }
 
 /**
@@ -330,7 +330,7 @@ ipset_parse_single_tcp_port(struct ipset_session *session,
 	assert(opt == IPSET_OPT_PORT || opt == IPSET_OPT_PORT_TO);
 	assert(str);
 
-	return ipset_parse_port(session, opt, str, "TCP");
+	return ipset_parse_port(session, opt, str, "tcp");
 }
 
 /**
-- 
1.7.2.5


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

* Re: [PATCH] ipset: fix lookup of tcp port names
  2011-10-28 16:16 [PATCH] ipset: fix lookup of tcp port names Stephen Hemminger
@ 2011-10-28 20:26 ` Jozsef Kadlecsik
  2011-10-29 14:48   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Jozsef Kadlecsik @ 2011-10-28 20:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netfilter, netfilter-devel

Hi Stephen,

On Fri, 28 Oct 2011, Stephen Hemminger wrote:

> The protocol argument to getservbyname() must be lowercase tcp not
> uppercase TCP. This fixes the bug observed by:
> 
>  # ipset add foo http
>  ipset v6.9.1: Syntax error: 'http' is invalid as number
>  Syntax error: cannot parse 'http' as a TCP port
> ---
>  lib/parse.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/parse.c b/lib/parse.c
> index 241d5ae..3ca702c 100644
> --- a/lib/parse.c
> +++ b/lib/parse.c
> @@ -307,7 +307,7 @@ int
>  ipset_parse_tcp_port(struct ipset_session *session,
>  		     enum ipset_opt opt, const char *str)
>  {
> -	return ipset_parse_tcpudp_port(session, opt, str, "TCP");
> +	return ipset_parse_tcpudp_port(session, opt, str, "tcp");
>  }
>  
>  /**
> @@ -330,7 +330,7 @@ ipset_parse_single_tcp_port(struct ipset_session *session,
>  	assert(opt == IPSET_OPT_PORT || opt == IPSET_OPT_PORT_TO);
>  	assert(str);
>  
> -	return ipset_parse_port(session, opt, str, "TCP");
> +	return ipset_parse_port(session, opt, str, "tcp");
>  }
>  
>  /**
> -- 
> 1.7.2.5

Ohh, thanks! Somehow port names haven't been tested by the testsuite....

Best regards,
Jozsef
-
E-mail  : kadlec@blackhole.kfki.hu, kadlec@mail.kfki.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : KFKI Research Institute for Particle and Nuclear Physics
          H-1525 Budapest 114, POB. 49, Hungary

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

* Re: [PATCH] ipset: fix lookup of tcp port names
  2011-10-28 20:26 ` Jozsef Kadlecsik
@ 2011-10-29 14:48   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2011-10-29 14:48 UTC (permalink / raw)
  To: Jozsef Kadlecsik; +Cc: netfilter, netfilter-devel

On Fri, 28 Oct 2011 22:26:36 +0200 (CEST)
Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> wrote:

> Hi Stephen,
> 
> On Fri, 28 Oct 2011, Stephen Hemminger wrote:
> 
> > The protocol argument to getservbyname() must be lowercase tcp not
> > uppercase TCP. This fixes the bug observed by:
> > 
> >  # ipset add foo http
> >  ipset v6.9.1: Syntax error: 'http' is invalid as number
> >  Syntax error: cannot parse 'http' as a TCP port
> > ---
> >  lib/parse.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/parse.c b/lib/parse.c
> > index 241d5ae..3ca702c 100644
> > --- a/lib/parse.c
> > +++ b/lib/parse.c
> > @@ -307,7 +307,7 @@ int
> >  ipset_parse_tcp_port(struct ipset_session *session,
> >  		     enum ipset_opt opt, const char *str)
> >  {
> > -	return ipset_parse_tcpudp_port(session, opt, str, "TCP");
> > +	return ipset_parse_tcpudp_port(session, opt, str, "tcp");
> >  }
> >  
> >  /**
> > @@ -330,7 +330,7 @@ ipset_parse_single_tcp_port(struct ipset_session *session,
> >  	assert(opt == IPSET_OPT_PORT || opt == IPSET_OPT_PORT_TO);
> >  	assert(str);
> >  
> > -	return ipset_parse_port(session, opt, str, "TCP");
> > +	return ipset_parse_port(session, opt, str, "tcp");
> >  }
> >  
> >  /**
> > -- 
> > 1.7.2.5
> 
> Ohh, thanks! Somehow port names haven't been tested by the testsuite....

Luckly they were by our regression testsuite.


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

end of thread, other threads:[~2011-10-29 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-28 16:16 [PATCH] ipset: fix lookup of tcp port names Stephen Hemminger
2011-10-28 20:26 ` Jozsef Kadlecsik
2011-10-29 14:48   ` Stephen Hemminger

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