Commit 0153d5a8 authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso

netfilter: xt_CT: fix timeout setting with IPv6

This patch fixes ip6tables and the CT target if it is used to set
some custom conntrack timeout policy for IPv6.

Use xt_ct_find_proto which already handles the ip6tables case for us.
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent b61a602e
...@@ -180,9 +180,9 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, ...@@ -180,9 +180,9 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
typeof(nf_ct_timeout_find_get_hook) timeout_find_get; typeof(nf_ct_timeout_find_get_hook) timeout_find_get;
struct ctnl_timeout *timeout; struct ctnl_timeout *timeout;
struct nf_conn_timeout *timeout_ext; struct nf_conn_timeout *timeout_ext;
const struct ipt_entry *e = par->entryinfo;
struct nf_conntrack_l4proto *l4proto; struct nf_conntrack_l4proto *l4proto;
int ret = 0; int ret = 0;
u8 proto;
rcu_read_lock(); rcu_read_lock();
timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook); timeout_find_get = rcu_dereference(nf_ct_timeout_find_get_hook);
...@@ -192,9 +192,11 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, ...@@ -192,9 +192,11 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
goto out; goto out;
} }
if (e->ip.invflags & IPT_INV_PROTO) { proto = xt_ct_find_proto(par);
if (!proto) {
ret = -EINVAL; ret = -EINVAL;
pr_info("You cannot use inversion on L4 protocol\n"); pr_info("You must specify a L4 protocol, and not use "
"inversions on it.\n");
goto out; goto out;
} }
...@@ -214,7 +216,7 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par, ...@@ -214,7 +216,7 @@ xt_ct_set_timeout(struct nf_conn *ct, const struct xt_tgchk_param *par,
/* Make sure the timeout policy matches any existing protocol tracker, /* Make sure the timeout policy matches any existing protocol tracker,
* otherwise default to generic. * otherwise default to generic.
*/ */
l4proto = __nf_ct_l4proto_find(par->family, e->ip.proto); l4proto = __nf_ct_l4proto_find(par->family, proto);
if (timeout->l4proto->l4proto != l4proto->l4proto) { if (timeout->l4proto->l4proto != l4proto->l4proto) {
ret = -EINVAL; ret = -EINVAL;
pr_info("Timeout policy `%s' can only be used by L4 protocol " pr_info("Timeout policy `%s' can only be used by L4 protocol "
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment