netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf] netfilter: conntrack: fix CT target for UNSPEC helpers
@ 2016-11-03 13:44 Florian Westphal
  2016-11-08 23:07 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2016-11-03 13:44 UTC (permalink / raw)
  To: netfilter-devel; +Cc: twoerner, Florian Westphal

Thomas reports its not possible to attach the H.245 helper:

iptables -t raw -A PREROUTING -p udp -j CT --helper H.245
iptables: No chain/target/match by that name.
xt_CT: No such helper "H.245"

This is because H.245 registers as NFPROTO_UNSPEC, but the CT target
passes NFPROTO_IPV4/IPV6 to nf_conntrack_helper_try_module_get.

We should treat UNSPEC as wildcard and ignore the l3num instead.

Reported-by: Thomas Woerner <twoerner@redhat.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 net/netfilter/nf_conntrack_helper.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c
index 336e21559e01..7341adf7059d 100644
--- a/net/netfilter/nf_conntrack_helper.c
+++ b/net/netfilter/nf_conntrack_helper.c
@@ -138,9 +138,14 @@ __nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum)
 
 	for (i = 0; i < nf_ct_helper_hsize; i++) {
 		hlist_for_each_entry_rcu(h, &nf_ct_helper_hash[i], hnode) {
-			if (!strcmp(h->name, name) &&
-			    h->tuple.src.l3num == l3num &&
-			    h->tuple.dst.protonum == protonum)
+			if (strcmp(h->name, name))
+				continue;
+
+			if (h->tuple.src.l3num != NFPROTO_UNSPEC &&
+			    h->tuple.src.l3num != l3num)
+				continue;
+
+			if (h->tuple.dst.protonum == protonum)
 				return h;
 		}
 	}
-- 
2.7.3


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

* Re: [PATCH nf] netfilter: conntrack: fix CT target for UNSPEC helpers
  2016-11-03 13:44 [PATCH nf] netfilter: conntrack: fix CT target for UNSPEC helpers Florian Westphal
@ 2016-11-08 23:07 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-11-08 23:07 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, twoerner

On Thu, Nov 03, 2016 at 02:44:42PM +0100, Florian Westphal wrote:
> Thomas reports its not possible to attach the H.245 helper:
> 
> iptables -t raw -A PREROUTING -p udp -j CT --helper H.245
> iptables: No chain/target/match by that name.
> xt_CT: No such helper "H.245"
> 
> This is because H.245 registers as NFPROTO_UNSPEC, but the CT target
> passes NFPROTO_IPV4/IPV6 to nf_conntrack_helper_try_module_get.
> 
> We should treat UNSPEC as wildcard and ignore the l3num instead.

Also applied, thanks.

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

end of thread, other threads:[~2016-11-08 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-03 13:44 [PATCH nf] netfilter: conntrack: fix CT target for UNSPEC helpers Florian Westphal
2016-11-08 23:07 ` 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).