From: Nikolay Borisov <kernel@kyup.com>
To: davem@davemloft.net
Cc: netfilter-devel@vger.kernel.org, ebiederm@xmission.com,
pabeni@redhat.com, jmorris@namei.org
Subject: [PATCH 4/6] ipv4: namespacify ip_early_demux sysctl knob
Date: Mon, 15 Feb 2016 12:03:01 +0200 [thread overview]
Message-ID: <1455530583-23053-5-git-send-email-kernel@kyup.com> (raw)
In-Reply-To: <1455530583-23053-1-git-send-email-kernel@kyup.com>
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
---
include/net/ip.h | 3 ---
include/net/netns/ipv4.h | 1 +
net/ipv4/ip_input.c | 5 +----
net/ipv4/sysctl_net_ipv4.c | 15 ++++++++-------
net/ipv6/ip6_input.c | 2 +-
5 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index e3fb25d76421..cbb134b2f0e4 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -245,9 +245,6 @@ extern int inet_peer_threshold;
extern int inet_peer_minttl;
extern int inet_peer_maxttl;
-/* From ip_input.c */
-extern int sysctl_ip_early_demux;
-
void ipfrag_init(void);
void ip_static_sysctl_init(void);
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index b7e3fb2587da..a69cde3ce460 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -86,6 +86,7 @@ struct netns_ipv4 {
int sysctl_ip_nonlocal_bind;
/* Shall we try to damage output packets if routing dev changes? */
int sysctl_ip_dynaddr;
+ int sysctl_ip_early_demux;
int sysctl_fwmark_reflect;
int sysctl_tcp_fwmark_accept;
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 852002f64c68..e3d782746d9d 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -308,15 +308,12 @@ drop:
return true;
}
-int sysctl_ip_early_demux __read_mostly = 1;
-EXPORT_SYMBOL(sysctl_ip_early_demux);
-
static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
const struct iphdr *iph = ip_hdr(skb);
struct rtable *rt;
- if (sysctl_ip_early_demux &&
+ if (net->ipv4.sysctl_ip_early_demux &&
!skb_dst(skb) &&
!skb->sk &&
!ip_is_fragment(iph)) {
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 04ac5b763385..1e1fe6086dd9 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -297,13 +297,6 @@ static struct ctl_table ipv4_table[] = {
.proc_handler = proc_dointvec
},
{
- .procname = "ip_early_demux",
- .data = &sysctl_ip_early_demux,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec
- },
- {
.procname = "tcp_fastopen",
.data = &sysctl_tcp_fastopen,
.maxlen = sizeof(int),
@@ -744,6 +737,13 @@ static struct ctl_table ipv4_net_table[] = {
.proc_handler = proc_dointvec
},
{
+ .procname = "ip_early_demux",
+ .data = &init_net.ipv4.sysctl_ip_early_demux,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec
+ },
+ {
.procname = "ip_default_ttl",
.data = &init_net.ipv4.sysctl_ip_default_ttl,
.maxlen = sizeof(int),
@@ -990,6 +990,7 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
net->ipv4.sysctl_ip_default_ttl = IPDEFTTL;
net->ipv4.sysctl_ip_dynaddr = 0;
+ net->ipv4.sysctl_ip_early_demux = 1;
return 0;
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 31ac3c56da4b..c05c425c2389 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -49,7 +49,7 @@
int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
- if (sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) {
+ if (net->ipv4.sysctl_ip_early_demux && !skb_dst(skb) && skb->sk == NULL) {
const struct inet6_protocol *ipprot;
ipprot = rcu_dereference(inet6_protos[ipv6_hdr(skb)->nexthdr]);
--
2.5.0
next prev parent reply other threads:[~2016-02-15 10:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 10:02 [PATCH 0/6] Namespacify various ip sysctl knobs Nikolay Borisov
2016-02-15 10:02 ` [PATCH 1/6] ipv4: Namespaceify ip_default_ttl sysctl knob Nikolay Borisov
2016-02-15 10:02 ` [PATCH 2/6] igmp: net: Move igmp namespace init to correct file Nikolay Borisov
2016-02-15 10:03 ` [PATCH 3/6] ipv4: Namespacify ip_dynaddr sysctl knob Nikolay Borisov
2016-02-15 10:03 ` Nikolay Borisov [this message]
2016-02-15 10:03 ` [PATCH 5/6] ipv4: namespacify ip fragment max dist " Nikolay Borisov
2016-02-15 10:03 ` [PATCH 6/6] net: Export ip fragment sysctl to unprivileged users Nikolay Borisov
2016-02-17 1:43 ` [PATCH 0/6] Namespacify various ip sysctl knobs David Miller
2016-02-17 5:14 ` Eric W. Biederman
2016-02-17 7:47 ` Nikolay Borisov
-- strict thread matches above, loose matches on Subject: below --
2016-02-15 10:11 Nikolay Borisov
2016-02-15 10:11 ` [PATCH 4/6] ipv4: namespacify ip_early_demux sysctl knob Nikolay Borisov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455530583-23053-5-git-send-email-kernel@kyup.com \
--to=kernel@kyup.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=jmorris@namei.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.