Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org
Subject: [PATCH] ipset: fix lookup of tcp port names
Date: Fri, 28 Oct 2011 18:16:13 +0200	[thread overview]
Message-ID: <20111028181613.6702aeb7@s6510.linuxnetplumber.net> (raw)

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


             reply	other threads:[~2011-10-28 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 16:16 Stephen Hemminger [this message]
2011-10-28 20:26 ` [PATCH] ipset: fix lookup of tcp port names Jozsef Kadlecsik
2011-10-29 14:48   ` Stephen Hemminger

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=20111028181613.6702aeb7@s6510.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=kadlec@blackhole.kfki.hu \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=netfilter@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