netfilter: nf_ct_helper: bail out on duplicated ports
Subsystems (2)
Pablo Neira Ayuso
maintainerPATCH 1/1 netfilter: nf_ct_helper: bail out on duplicated ports
Compare the helper name up to the dash, so we can catch if the user has supplied duplicated ports via module parameters.
Reported-by Feng Gao <[email protected]>
Reported-by Taehee Yoo <[email protected]>
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- net/netfilter/nf_conntrack_helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/netfilter/nf_conntrack_helper.c +9 -2
@@ -361,9 +361,10 @@ EXPORT_SYMBOL_GPL(nf_ct_helper_log);int nf_conntrack_helper_register (struct nf_conntrack_helper *me) { -int ret =0 ;struct nf_conntrack_helper *cur;unsigned int h =helper_hash (&me->tuple); +const char *slash; +int len, ret =0 ;BUG_ON (me->expect_policy ==NULL );BUG_ON (me->expect_class_max >=NF_CT_MAX_EXPECT_CLASSES );
@@ -371,7 +372,13 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)mutex_lock (&nf_ct_helper_mutex);hlist_for_each_entry (cur, &nf_ct_helper_hash[h], hnode) { -if (strncmp (cur->name, me->name,NF_CT_HELPER_NAME_LEN ) ==0 && + slash =strchr (cur->name,'-' ); +if (slash) + len = slash - cur->name; +else + len =NF_CT_HELPER_NAME_LEN ; + +if (strncmp (cur->name, me->name, len) ==0 && cur->tuple.src.l3num == me->tuple.src.l3num && cur->tuple.dst.protonum == me->tuple.dst.protonum) { ret = -EEXIST ;
Signature · 1 line
2.1.4
Pablo Neira Ayuso
maintainerQuoted 27 lines · Pablo Neira Ayuso
Compare the helper name up to the dash, so we can catch if the user has supplied duplicated ports via module parameters.
Reported-by Feng Gao <[email protected]>Reported-by Taehee Yoo <[email protected]>Signed-off-by Pablo Neira Ayuso <[email protected]>--- net/netfilter/nf_conntrack_helper.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)net/netfilter/nf_conntrack_helper.c +2
-1@@ -361,9 +361,10 @@ EXPORT_SYMBOL_GPL(nf_ct_helper_log);int nf_conntrack_helper_register (struct nf_conntrack_helper *me) { -int ret =0 ;struct nf_conntrack_helper *cur;unsigned int h =helper_hash (&me->tuple); +const char *slash; +int len, ret =0 ;BUG_ON (me->expect_policy ==NULL );BUG_ON (me->expect_class_max >=NF_CT_MAX_EXPECT_CLASSES );
net/netfilter/nf_conntrack_helper.c int nf_conntrack_helper_register(struct nf_conntrack_helper *me) · line 375
Quoted 5 lines
net/netfilter/nf_conntrack_helper.c +1
-1@@ -371,7 +372,13 @@ int nf_conntrack_helper_register(struct nf_conntrack_helper *me)mutex_lock (&nf_ct_helper_mutex);hlist_for_each_entry (cur, &nf_ct_helper_hash[h], hnode) { - if (strncmp(cur->name, me->name, NF_CT_HELPER_NAME_LEN) == 0 && + slash =strchr (cur->name,'-' );
I'm discarding this, we have a valid helper using dash in the name.
net/netfilter/nf_conntrack_netbios_ns.c: .name = "netbios-ns",
Will send a new version of this patch.