Skip to content

Commit

Permalink
ipv4: namespacify ip_early_demux sysctl knob
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Borisov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
KernelKyupCom authored and davem330 committed Feb 17, 2016
1 parent 287b7f3 commit e21145a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
3 changes: 0 additions & 3 deletions include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/net/netns/ipv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions net/ipv4/ip_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,12 @@ static inline bool ip_rcv_options(struct sk_buff *skb)
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)) {
Expand Down
15 changes: 8 additions & 7 deletions net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,6 @@ static struct ctl_table ipv4_table[] = {
.mode = 0644,
.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,
Expand Down Expand Up @@ -743,6 +736,13 @@ static struct ctl_table ipv4_net_table[] = {
.mode = 0644,
.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,
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/ip6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit e21145a

Please sign in to comment.