From: Nikolay Borisov <kernel@kyup.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, ebiederm@xmission.com
Subject: [PATCH 2/4] inetpeer: Namespacify inet_peer_maxttl sysctl knob
Date: Wed, 17 Feb 2016 12:09:56 +0200 [thread overview]
Message-ID: <1455703798-15258-3-git-send-email-kernel@kyup.com> (raw)
In-Reply-To: <1455703798-15258-1-git-send-email-kernel@kyup.com>
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
---
include/net/ip.h | 1 -
include/net/netns/ipv4.h | 2 ++
net/ipv4/inetpeer.c | 2 +-
net/ipv4/sysctl_net_ipv4.c | 15 ++++++++-------
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/include/net/ip.h b/include/net/ip.h
index cbb134b2f0e4..c33d53176d3c 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -243,7 +243,6 @@ static inline int inet_is_local_reserved_port(struct net *net, int port)
/* From inetpeer.c */
extern int inet_peer_threshold;
extern int inet_peer_minttl;
-extern int inet_peer_maxttl;
void ipfrag_init(void);
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index a69cde3ce460..b0623c4e2f0a 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -88,6 +88,8 @@ struct netns_ipv4 {
int sysctl_ip_dynaddr;
int sysctl_ip_early_demux;
+ int sysctl_inet_peer_maxttl;
+
int sysctl_fwmark_reflect;
int sysctl_tcp_fwmark_accept;
#ifdef CONFIG_NET_L3_MASTER_DEV
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index 86fa45809540..a9245ada56c2 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -82,7 +82,6 @@ EXPORT_SYMBOL_GPL(inet_peer_base_init);
int inet_peer_threshold __read_mostly = 65536 + 128; /* start to throw entries more
* aggressively at this stage */
int inet_peer_minttl __read_mostly = 120 * HZ; /* TTL under high load: 120 sec */
-int inet_peer_maxttl __read_mostly = 10 * 60 * HZ; /* usual time to live: 10 min */
static void inetpeer_gc_worker(struct work_struct *work)
{
@@ -369,6 +368,7 @@ static int inet_peer_gc(struct inet_peer_base *base,
struct inet_peer __rcu ***stackptr)
{
struct inet_peer *p, *gchead = NULL;
+ int inet_peer_maxttl = base->net->ipv4.sysctl_inet_peer_maxttl;
__u32 delta, ttl;
int cnt = 0;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1e1fe6086dd9..2aaa049cbf9d 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -359,13 +359,6 @@ static struct ctl_table ipv4_table[] = {
.proc_handler = proc_dointvec_jiffies,
},
{
- .procname = "inet_peer_maxttl",
- .data = &inet_peer_maxttl,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_jiffies,
- },
- {
.procname = "tcp_fack",
.data = &sysctl_tcp_fack,
.maxlen = sizeof(int),
@@ -737,6 +730,13 @@ static struct ctl_table ipv4_net_table[] = {
.proc_handler = proc_dointvec
},
{
+ .procname = "inet_peer_maxttl",
+ .data = &init_net.ipv4.sysctl_inet_peer_maxttl,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+ .proc_handler = proc_dointvec_jiffies,
+ },
+ {
.procname = "ip_early_demux",
.data = &init_net.ipv4.sysctl_ip_early_demux,
.maxlen = sizeof(int),
@@ -991,6 +991,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;
+ net->ipv4.sysctl_inet_peer_maxttl = 10 * 60 * HZ; /* usual time to live: 10 min */
return 0;
--
2.5.0
next prev parent reply other threads:[~2016-02-17 10:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-17 10:09 [PATCH 0/4] Namespacify inet_peer_* sysctl knobs Nikolay Borisov
2016-02-17 10:09 ` [PATCH 1/4] inetpeer: Add net namespace assosication in inet_peer_base Nikolay Borisov
2016-02-17 10:09 ` Nikolay Borisov [this message]
2016-02-17 10:09 ` [PATCH 3/4] inetpeer: Namespacify inet_peer_minttl sysctl knob Nikolay Borisov
2016-02-17 10:09 ` [PATCH 4/4] inetpeer: Namespacify inet_peer_threshold " Nikolay Borisov
2016-02-17 19:15 ` [PATCH 0/4] Namespacify inet_peer_* sysctl knobs Eric W. Biederman
2016-02-18 15:04 ` 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=1455703798-15258-3-git-send-email-kernel@kyup.com \
--to=kernel@kyup.com \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=netdev@vger.kernel.org \
/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.