Commit a6175633 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv6: convert elligible sysctls to u8

Convert most sysctls that can fit in a byte.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c3289c9
...@@ -20,7 +20,6 @@ struct netns_sysctl_ipv6 { ...@@ -20,7 +20,6 @@ struct netns_sysctl_ipv6 {
struct ctl_table_header *frags_hdr; struct ctl_table_header *frags_hdr;
struct ctl_table_header *xfrm6_hdr; struct ctl_table_header *xfrm6_hdr;
#endif #endif
int bindv6only;
int flush_delay; int flush_delay;
int ip6_rt_max_size; int ip6_rt_max_size;
int ip6_rt_gc_min_interval; int ip6_rt_gc_min_interval;
...@@ -29,21 +28,22 @@ struct netns_sysctl_ipv6 { ...@@ -29,21 +28,22 @@ struct netns_sysctl_ipv6 {
int ip6_rt_gc_elasticity; int ip6_rt_gc_elasticity;
int ip6_rt_mtu_expires; int ip6_rt_mtu_expires;
int ip6_rt_min_advmss; int ip6_rt_min_advmss;
int multipath_hash_policy; u8 bindv6only;
int flowlabel_consistency; u8 multipath_hash_policy;
int auto_flowlabels; u8 flowlabel_consistency;
u8 auto_flowlabels;
int icmpv6_time; int icmpv6_time;
int icmpv6_echo_ignore_all; u8 icmpv6_echo_ignore_all;
int icmpv6_echo_ignore_multicast; u8 icmpv6_echo_ignore_multicast;
int icmpv6_echo_ignore_anycast; u8 icmpv6_echo_ignore_anycast;
DECLARE_BITMAP(icmpv6_ratemask, ICMPV6_MSG_MAX + 1); DECLARE_BITMAP(icmpv6_ratemask, ICMPV6_MSG_MAX + 1);
unsigned long *icmpv6_ratemask_ptr; unsigned long *icmpv6_ratemask_ptr;
int anycast_src_echo_reply; u8 anycast_src_echo_reply;
int ip_nonlocal_bind; u8 ip_nonlocal_bind;
int fwmark_reflect; u8 fwmark_reflect;
u8 flowlabel_state_ranges;
int idgen_retries; int idgen_retries;
int idgen_delay; int idgen_delay;
int flowlabel_state_ranges;
int flowlabel_reflect; int flowlabel_reflect;
int max_dst_opts_cnt; int max_dst_opts_cnt;
int max_hbh_opts_cnt; int max_hbh_opts_cnt;
...@@ -51,7 +51,7 @@ struct netns_sysctl_ipv6 { ...@@ -51,7 +51,7 @@ struct netns_sysctl_ipv6 {
int max_hbh_opts_len; int max_hbh_opts_len;
int seg6_flowlabel; int seg6_flowlabel;
bool skip_notify_on_dev_down; bool skip_notify_on_dev_down;
int fib_notify_on_flag_change; u8 fib_notify_on_flag_change;
}; };
struct netns_ipv6 { struct netns_ipv6 {
......
...@@ -1169,23 +1169,23 @@ static struct ctl_table ipv6_icmp_table_template[] = { ...@@ -1169,23 +1169,23 @@ static struct ctl_table ipv6_icmp_table_template[] = {
{ {
.procname = "echo_ignore_all", .procname = "echo_ignore_all",
.data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_all, .data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_all,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec, .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "echo_ignore_multicast", .procname = "echo_ignore_multicast",
.data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_multicast, .data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_multicast,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec, .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "echo_ignore_anycast", .procname = "echo_ignore_anycast",
.data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_anycast, .data = &init_net.ipv6.sysctl.icmpv6_echo_ignore_anycast,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec, .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ratemask", .procname = "ratemask",
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
static int two = 2; static int two = 2;
static int flowlabel_reflect_max = 0x7; static int flowlabel_reflect_max = 0x7;
static int auto_flowlabels_min;
static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX;
static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,
...@@ -34,7 +33,7 @@ static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, ...@@ -34,7 +33,7 @@ static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write,
net = container_of(table->data, struct net, net = container_of(table->data, struct net,
ipv6.sysctl.multipath_hash_policy); ipv6.sysctl.multipath_hash_policy);
ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); ret = proc_dou8vec_minmax(table, write, buffer, lenp, ppos);
if (write && ret == 0) if (write && ret == 0)
call_netevent_notifiers(NETEVENT_IPV6_MPATH_HASH_UPDATE, net); call_netevent_notifiers(NETEVENT_IPV6_MPATH_HASH_UPDATE, net);
...@@ -45,39 +44,38 @@ static struct ctl_table ipv6_table_template[] = { ...@@ -45,39 +44,38 @@ static struct ctl_table ipv6_table_template[] = {
{ {
.procname = "bindv6only", .procname = "bindv6only",
.data = &init_net.ipv6.sysctl.bindv6only, .data = &init_net.ipv6.sysctl.bindv6only,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "anycast_src_echo_reply", .procname = "anycast_src_echo_reply",
.data = &init_net.ipv6.sysctl.anycast_src_echo_reply, .data = &init_net.ipv6.sysctl.anycast_src_echo_reply,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "flowlabel_consistency", .procname = "flowlabel_consistency",
.data = &init_net.ipv6.sysctl.flowlabel_consistency, .data = &init_net.ipv6.sysctl.flowlabel_consistency,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "auto_flowlabels", .procname = "auto_flowlabels",
.data = &init_net.ipv6.sysctl.auto_flowlabels, .data = &init_net.ipv6.sysctl.auto_flowlabels,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = &auto_flowlabels_min,
.extra2 = &auto_flowlabels_max .extra2 = &auto_flowlabels_max
}, },
{ {
.procname = "fwmark_reflect", .procname = "fwmark_reflect",
.data = &init_net.ipv6.sysctl.fwmark_reflect, .data = &init_net.ipv6.sysctl.fwmark_reflect,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "idgen_retries", .procname = "idgen_retries",
...@@ -96,16 +94,16 @@ static struct ctl_table ipv6_table_template[] = { ...@@ -96,16 +94,16 @@ static struct ctl_table ipv6_table_template[] = {
{ {
.procname = "flowlabel_state_ranges", .procname = "flowlabel_state_ranges",
.data = &init_net.ipv6.sysctl.flowlabel_state_ranges, .data = &init_net.ipv6.sysctl.flowlabel_state_ranges,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "ip_nonlocal_bind", .procname = "ip_nonlocal_bind",
.data = &init_net.ipv6.sysctl.ip_nonlocal_bind, .data = &init_net.ipv6.sysctl.ip_nonlocal_bind,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec .proc_handler = proc_dou8vec_minmax,
}, },
{ {
.procname = "flowlabel_reflect", .procname = "flowlabel_reflect",
...@@ -147,7 +145,7 @@ static struct ctl_table ipv6_table_template[] = { ...@@ -147,7 +145,7 @@ static struct ctl_table ipv6_table_template[] = {
{ {
.procname = "fib_multipath_hash_policy", .procname = "fib_multipath_hash_policy",
.data = &init_net.ipv6.sysctl.multipath_hash_policy, .data = &init_net.ipv6.sysctl.multipath_hash_policy,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_rt6_multipath_hash_policy, .proc_handler = proc_rt6_multipath_hash_policy,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
...@@ -163,9 +161,9 @@ static struct ctl_table ipv6_table_template[] = { ...@@ -163,9 +161,9 @@ static struct ctl_table ipv6_table_template[] = {
{ {
.procname = "fib_notify_on_flag_change", .procname = "fib_notify_on_flag_change",
.data = &init_net.ipv6.sysctl.fib_notify_on_flag_change, .data = &init_net.ipv6.sysctl.fib_notify_on_flag_change,
.maxlen = sizeof(int), .maxlen = sizeof(u8),
.mode = 0644, .mode = 0644,
.proc_handler = proc_dointvec_minmax, .proc_handler = proc_dou8vec_minmax,
.extra1 = SYSCTL_ZERO, .extra1 = SYSCTL_ZERO,
.extra2 = &two, .extra2 = &two,
}, },
......
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