@@ -192,8 +192,12 @@ int nf_ct_l4proto_register_sysctl(struct net *net,pn->ctl_table=NULL;}}+}else{+/* in case any module doesn't kmemdup sysctl table */+err=-ENOENT;}#endif /* CONFIG_SYSCTL */+returnerr;}
After this patch, there will be two sysctl knobs for GRE.
net.netfilter.nf_conntrack_gre_timeout_replied = 180
net.netfilter.nf_conntrack_gre_timeout_unreplied = 30
Signed-off-by: Yafang Shao <redacted>
---
net/netfilter/nf_conntrack_proto_gre.c | 43 +++++++++++++++++++++++++++++++++-
1 file changed, 42 insertions(+), 1 deletion(-)
If pn is NULL, it will return 0.
That's not proper. We should return an error.
Signed-off-by: Yafang Shao <redacted>
---
net/netfilter/nf_conntrack_proto.c | 1 +
1 file changed, 1 insertion(+)
All of the callers will execute drop_sysctl_table() whatever the callee
insert_header() successes or fails.
So we can't execute drop_sysctl_table() in insert_header().
Signed-off-by: Yafang Shao <redacted>
---
fs/proc/proc_sysctl.c | 1 -
1 file changed, 1 deletion(-)
nf_ct_l4proto_net() may return NULL.
That may happens if some module forget to set both l4proto->get_net_proto
and l4proto->net_id.
We'd check the return value here, in case crash happens.
Signed-off-by: Yafang Shao <redacted>
---
net/netfilter/nf_conntrack_proto.c | 3 +++
1 file changed, 3 insertions(+)
@@ -946,6 +946,9 @@ int nf_conntrack_proto_pernet_init(struct net *net)structnf_proto_net*pn=nf_ct_l4proto_net(net,&nf_conntrack_l4proto_generic);+if(pn==NULL)+return-EINVAL;+err=nf_conntrack_l4proto_generic.init_net(net);if(err<0)returnerr;
From: Pablo Neira Ayuso <pablo@netfilter.org> Date: 2018-12-12 23:26:53
On Wed, Dec 05, 2018 at 08:56:29PM +0800, Yafang Shao wrote:
quoted hunk
nf_ct_l4proto_net() may return NULL.
That may happens if some module forget to set both l4proto->get_net_proto
and l4proto->net_id.
We'd check the return value here, in case crash happens.
Signed-off-by: Yafang Shao <redacted>
---
net/netfilter/nf_conntrack_proto.c | 3 +++
1 file changed, 3 insertions(+)
@@ -946,6 +946,9 @@ int nf_conntrack_proto_pernet_init(struct net *net)structnf_proto_net*pn=nf_ct_l4proto_net(net,&nf_conntrack_l4proto_generic);
There is another spot missing in this file that is missing the check
for NULL.
We can probably simplify all this is we place the gre conntracker in
the conntrack core, as it's been suggested already. It's the only one
remaining as a module and it now supports for IPv6, so it's probably
better follow that path.
On Thu, Dec 13, 2018 at 7:26 AM Pablo Neira Ayuso [off-list ref] wrote:
On Wed, Dec 05, 2018 at 08:56:29PM +0800, Yafang Shao wrote:
quoted
nf_ct_l4proto_net() may return NULL.
That may happens if some module forget to set both l4proto->get_net_proto
and l4proto->net_id.
We'd check the return value here, in case crash happens.
Signed-off-by: Yafang Shao <redacted>
---
net/netfilter/nf_conntrack_proto.c | 3 +++
1 file changed, 3 insertions(+)
@@ -946,6 +946,9 @@ int nf_conntrack_proto_pernet_init(struct net *net)structnf_proto_net*pn=nf_ct_l4proto_net(net,&nf_conntrack_l4proto_generic);
There is another spot missing in this file that is missing the check
for NULL.
We can probably simplify all this is we place the gre conntracker in
the conntrack core, as it's been suggested already. It's the only one
remaining as a module and it now supports for IPv6, so it's probably
better follow that path.
Got it.
Thanks for your explanation.
Thanks
Yafang