| .. | .. |
|---|
| 21 | 21 | #include <net/calipso.h> |
|---|
| 22 | 22 | #endif |
|---|
| 23 | 23 | |
|---|
| 24 | | -static int zero; |
|---|
| 25 | | -static int one = 1; |
|---|
| 24 | +static int two = 2; |
|---|
| 25 | +static int flowlabel_reflect_max = 0x7; |
|---|
| 26 | 26 | static int auto_flowlabels_min; |
|---|
| 27 | 27 | static int auto_flowlabels_max = IP6_AUTO_FLOW_LABEL_MAX; |
|---|
| 28 | 28 | |
|---|
| 29 | 29 | static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, |
|---|
| 30 | | - void __user *buffer, size_t *lenp, |
|---|
| 31 | | - loff_t *ppos) |
|---|
| 30 | + void *buffer, size_t *lenp, loff_t *ppos) |
|---|
| 32 | 31 | { |
|---|
| 33 | 32 | struct net *net; |
|---|
| 34 | 33 | int ret; |
|---|
| .. | .. |
|---|
| 113 | 112 | .data = &init_net.ipv6.sysctl.flowlabel_reflect, |
|---|
| 114 | 113 | .maxlen = sizeof(int), |
|---|
| 115 | 114 | .mode = 0644, |
|---|
| 116 | | - .proc_handler = proc_dointvec, |
|---|
| 115 | + .proc_handler = proc_dointvec_minmax, |
|---|
| 116 | + .extra1 = SYSCTL_ZERO, |
|---|
| 117 | + .extra2 = &flowlabel_reflect_max, |
|---|
| 117 | 118 | }, |
|---|
| 118 | 119 | { |
|---|
| 119 | 120 | .procname = "max_dst_opts_number", |
|---|
| .. | .. |
|---|
| 149 | 150 | .maxlen = sizeof(int), |
|---|
| 150 | 151 | .mode = 0644, |
|---|
| 151 | 152 | .proc_handler = proc_rt6_multipath_hash_policy, |
|---|
| 152 | | - .extra1 = &zero, |
|---|
| 153 | | - .extra2 = &one, |
|---|
| 153 | + .extra1 = SYSCTL_ZERO, |
|---|
| 154 | + .extra2 = &two, |
|---|
| 154 | 155 | }, |
|---|
| 155 | 156 | { |
|---|
| 156 | 157 | .procname = "seg6_flowlabel", |
|---|
| .. | .. |
|---|
| 176 | 177 | .maxlen = sizeof(int), |
|---|
| 177 | 178 | .mode = 0644, |
|---|
| 178 | 179 | .proc_handler = proc_dointvec_minmax, |
|---|
| 179 | | - .extra1 = &one |
|---|
| 180 | + .extra1 = SYSCTL_ONE |
|---|
| 180 | 181 | }, |
|---|
| 181 | 182 | #ifdef CONFIG_NETLABEL |
|---|
| 182 | 183 | { |
|---|
| .. | .. |
|---|
| 202 | 203 | struct ctl_table *ipv6_table; |
|---|
| 203 | 204 | struct ctl_table *ipv6_route_table; |
|---|
| 204 | 205 | struct ctl_table *ipv6_icmp_table; |
|---|
| 205 | | - int err; |
|---|
| 206 | + int err, i; |
|---|
| 206 | 207 | |
|---|
| 207 | 208 | err = -ENOMEM; |
|---|
| 208 | 209 | ipv6_table = kmemdup(ipv6_table_template, sizeof(ipv6_table_template), |
|---|
| 209 | 210 | GFP_KERNEL); |
|---|
| 210 | 211 | if (!ipv6_table) |
|---|
| 211 | 212 | goto out; |
|---|
| 212 | | - ipv6_table[0].data = &net->ipv6.sysctl.bindv6only; |
|---|
| 213 | | - ipv6_table[1].data = &net->ipv6.sysctl.anycast_src_echo_reply; |
|---|
| 214 | | - ipv6_table[2].data = &net->ipv6.sysctl.flowlabel_consistency; |
|---|
| 215 | | - ipv6_table[3].data = &net->ipv6.sysctl.auto_flowlabels; |
|---|
| 216 | | - ipv6_table[4].data = &net->ipv6.sysctl.fwmark_reflect; |
|---|
| 217 | | - ipv6_table[5].data = &net->ipv6.sysctl.idgen_retries; |
|---|
| 218 | | - ipv6_table[6].data = &net->ipv6.sysctl.idgen_delay; |
|---|
| 219 | | - ipv6_table[7].data = &net->ipv6.sysctl.flowlabel_state_ranges; |
|---|
| 220 | | - ipv6_table[8].data = &net->ipv6.sysctl.ip_nonlocal_bind; |
|---|
| 221 | | - ipv6_table[9].data = &net->ipv6.sysctl.flowlabel_reflect; |
|---|
| 222 | | - ipv6_table[10].data = &net->ipv6.sysctl.max_dst_opts_cnt; |
|---|
| 223 | | - ipv6_table[11].data = &net->ipv6.sysctl.max_hbh_opts_cnt; |
|---|
| 224 | | - ipv6_table[12].data = &net->ipv6.sysctl.max_dst_opts_len; |
|---|
| 225 | | - ipv6_table[13].data = &net->ipv6.sysctl.max_hbh_opts_len; |
|---|
| 226 | | - ipv6_table[14].data = &net->ipv6.sysctl.multipath_hash_policy, |
|---|
| 227 | | - ipv6_table[15].data = &net->ipv6.sysctl.seg6_flowlabel; |
|---|
| 213 | + /* Update the variables to point into the current struct net */ |
|---|
| 214 | + for (i = 0; i < ARRAY_SIZE(ipv6_table_template) - 1; i++) |
|---|
| 215 | + ipv6_table[i].data += (void *)net - (void *)&init_net; |
|---|
| 228 | 216 | |
|---|
| 229 | 217 | ipv6_route_table = ipv6_route_sysctl_init(net); |
|---|
| 230 | 218 | if (!ipv6_route_table) |
|---|