All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] conntrack: made the protocol option value case insensitive
@ 2015-06-25 10:12 pfeiffer.szilard
  2015-06-26  7:19 ` Florian Westphal
  0 siblings, 1 reply; 4+ messages in thread
From: pfeiffer.szilard @ 2015-06-25 10:12 UTC (permalink / raw)
  To: netfilter-devel; +Cc: pfeiffer.szilard

From: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>

Extensions register protocols by lowercase protocol name, but value of
proto command line option may be uppercase. Extension related options
cannot be used when protocol name comparision fails.

Signed-off-by: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
---
 src/conntrack.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/conntrack.c b/src/conntrack.c
index f7d37fb..b1a2589 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -555,6 +555,12 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
 	/* using the protocol name for an unsupported protocol? */
 	if ((pent = getprotobyname(name))) {
 		*pnum = pent->p_proto;
+		list_for_each_entry(cur, &proto_list, head) {
+			if (cur->protonum == pent->p_proto) {
+				*pnum = cur->protonum;
+				return cur;
+			}
+		}
 		return &ct_proto_unknown;
 	}
 	/* using a protocol number? */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] conntrack: made the protocol option value case insensitive
  2015-06-25 10:12 [PATCH] conntrack: made the protocol option value case insensitive pfeiffer.szilard
@ 2015-06-26  7:19 ` Florian Westphal
  2015-07-02 16:59   ` Pablo Neira Ayuso
  2015-07-02 22:53   ` Szilárd Pfeiffer
  0 siblings, 2 replies; 4+ messages in thread
From: Florian Westphal @ 2015-06-26  7:19 UTC (permalink / raw)
  To: pfeiffer.szilard; +Cc: netfilter-devel

pfeiffer.szilard@balabit.hu <pfeiffer.szilard@balabit.hu> wrote:
> From: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
> 
> Extensions register protocols by lowercase protocol name, but value of
> proto command line option may be uppercase. Extension related options
> cannot be used when protocol name comparision fails.
> 
> Signed-off-by: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
> ---
>  src/conntrack.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/src/conntrack.c b/src/conntrack.c
> index f7d37fb..b1a2589 100644
> --- a/src/conntrack.c
> +++ b/src/conntrack.c
> @@ -555,6 +555,12 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
>  	/* using the protocol name for an unsupported protocol? */
>  	if ((pent = getprotobyname(name))) {
>  		*pnum = pent->p_proto;

Why not use strcasecmp to check the proto_list?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] conntrack: made the protocol option value case insensitive
  2015-06-26  7:19 ` Florian Westphal
@ 2015-07-02 16:59   ` Pablo Neira Ayuso
  2015-07-02 22:53   ` Szilárd Pfeiffer
  1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2015-07-02 16:59 UTC (permalink / raw)
  To: pfeiffer.szilard; +Cc: Florian Westphal, netfilter-devel

On Fri, Jun 26, 2015 at 09:19:21AM +0200, Florian Westphal wrote:
> pfeiffer.szilard@balabit.hu <pfeiffer.szilard@balabit.hu> wrote:
> > From: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
> > 
> > Extensions register protocols by lowercase protocol name, but value of
> > proto command line option may be uppercase. Extension related options
> > cannot be used when protocol name comparision fails.
> > 
> > Signed-off-by: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
> > ---
> >  src/conntrack.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/src/conntrack.c b/src/conntrack.c
> > index f7d37fb..b1a2589 100644
> > --- a/src/conntrack.c
> > +++ b/src/conntrack.c
> > @@ -555,6 +555,12 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
> >  	/* using the protocol name for an unsupported protocol? */
> >  	if ((pent = getprotobyname(name))) {
> >  		*pnum = pent->p_proto;
> 
> Why not use strcasecmp to check the proto_list?

Please, address Florian's feedback and resubmit, thanks.

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] conntrack: made the protocol option value case insensitive
  2015-06-26  7:19 ` Florian Westphal
  2015-07-02 16:59   ` Pablo Neira Ayuso
@ 2015-07-02 22:53   ` Szilárd Pfeiffer
  1 sibling, 0 replies; 4+ messages in thread
From: Szilárd Pfeiffer @ 2015-07-02 22:53 UTC (permalink / raw)
  To: netfilter-devel

On 2015-06-26 09:19, Florian Westphal wrote:
> pfeiffer.szilard@balabit.hu <pfeiffer.szilard@balabit.hu> wrote:
>> From: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
>>
>> Extensions register protocols by lowercase protocol name, but value of
>> proto command line option may be uppercase. Extension related options
>> cannot be used when protocol name comparision fails.
>>
>> Signed-off-by: Szilárd Pfeiffer <pfeiffer.szilard@balabit.hu>
>> ---
>>  src/conntrack.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/src/conntrack.c b/src/conntrack.c
>> index f7d37fb..b1a2589 100644
>> --- a/src/conntrack.c
>> +++ b/src/conntrack.c
>> @@ -555,6 +555,12 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
>>  	/* using the protocol name for an unsupported protocol? */
>>  	if ((pent = getprotobyname(name))) {
>>  		*pnum = pent->p_proto;
> Why not use strcasecmp to check the proto_list?
>
I have just realized that iptables ignores case while checking value of
--protocol parameter, so the conntrack tool should do it in the same way.

I remake the patch. Thanks for your feedback.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-07-02 22:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-25 10:12 [PATCH] conntrack: made the protocol option value case insensitive pfeiffer.szilard
2015-06-26  7:19 ` Florian Westphal
2015-07-02 16:59   ` Pablo Neira Ayuso
2015-07-02 22:53   ` Szilárd Pfeiffer

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.