netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH conntrack-tools] Allow protocol number zero
@ 2019-03-19 19:56 Brian Haley
  2019-03-20  7:22 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Haley @ 2019-03-19 19:56 UTC (permalink / raw)
  To: netfilter-devel

/etc/protocols defines protocol zero as 'ip' for IPv4, and
'hopopt' for IPv6, which can be used with conntrack as '-p ip'
or '-p hopopt'.  However it's equivalent, '-p 0' is considered
unsupported.  Change the range check in findproto() to allow
zero as well.

Signed-off-by: Brian Haley <bhaley@redhat.com>
---
 src/conntrack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conntrack.c b/src/conntrack.c
index daa93db..97132a9 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -628,7 +628,7 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
 	}
 	/* using a protocol number? */
 	protonum = atoi(name);
-	if (protonum > 0 && protonum <= IPPROTO_MAX) {
+	if (protonum >= 0 && protonum <= IPPROTO_MAX) {
 		/* try lookup by number, perhaps this protocol is supported */
 		list_for_each_entry(cur, &proto_list, head) {
 			if (cur->protonum == protonum) {
-- 
2.17.1


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

* Re: [PATCH conntrack-tools] Allow protocol number zero
  2019-03-19 19:56 [PATCH conntrack-tools] Allow protocol number zero Brian Haley
@ 2019-03-20  7:22 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2019-03-20  7:22 UTC (permalink / raw)
  To: Brian Haley; +Cc: netfilter-devel

On Tue, Mar 19, 2019 at 03:56:55PM -0400, Brian Haley wrote:
> /etc/protocols defines protocol zero as 'ip' for IPv4, and
> 'hopopt' for IPv6, which can be used with conntrack as '-p ip'
> or '-p hopopt'.  However it's equivalent, '-p 0' is considered
> unsupported.  Change the range check in findproto() to allow
> zero as well.

Applied, thanks.

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

end of thread, other threads:[~2019-03-20  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-19 19:56 [PATCH conntrack-tools] Allow protocol number zero Brian Haley
2019-03-20  7:22 ` 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).