aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c80
1 files changed, 42 insertions, 38 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d9da5eb9dcb2..e92ad8455c63 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2031,8 +2031,8 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
2031 2031
2032#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE) 2032#if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
2033 if (dev->type == ARPHRD_SIT) { 2033 if (dev->type == ARPHRD_SIT) {
2034 const struct net_device_ops *ops = dev->netdev_ops;
2034 struct ifreq ifr; 2035 struct ifreq ifr;
2035 mm_segment_t oldfs;
2036 struct ip_tunnel_parm p; 2036 struct ip_tunnel_parm p;
2037 2037
2038 err = -EADDRNOTAVAIL; 2038 err = -EADDRNOTAVAIL;
@@ -2048,9 +2048,14 @@ int addrconf_set_dstaddr(struct net *net, void __user *arg)
2048 p.iph.ttl = 64; 2048 p.iph.ttl = 64;
2049 ifr.ifr_ifru.ifru_data = (__force void __user *)&p; 2049 ifr.ifr_ifru.ifru_data = (__force void __user *)&p;
2050 2050
2051 oldfs = get_fs(); set_fs(KERNEL_DS); 2051 if (ops->ndo_do_ioctl) {
2052 err = dev->do_ioctl(dev, &ifr, SIOCADDTUNNEL); 2052 mm_segment_t oldfs = get_fs();
2053 set_fs(oldfs); 2053
2054 set_fs(KERNEL_DS);
2055 err = ops->ndo_do_ioctl(dev, &ifr, SIOCADDTUNNEL);
2056 set_fs(oldfs);
2057 } else
2058 err = -EOPNOTSUPP;
2054 2059
2055 if (err == 0) { 2060 if (err == 0) {
2056 err = -ENOBUFS; 2061 err = -ENOBUFS;
@@ -2988,9 +2993,8 @@ static void if6_seq_stop(struct seq_file *seq, void *v)
2988static int if6_seq_show(struct seq_file *seq, void *v) 2993static int if6_seq_show(struct seq_file *seq, void *v)
2989{ 2994{
2990 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; 2995 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
2991 seq_printf(seq, 2996 seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
2992 NIP6_SEQFMT " %02x %02x %02x %02x %8s\n", 2997 &ifp->addr,
2993 NIP6(ifp->addr),
2994 ifp->idev->dev->ifindex, 2998 ifp->idev->dev->ifindex,
2995 ifp->prefix_len, 2999 ifp->prefix_len,
2996 ifp->scope, 3000 ifp->scope,
@@ -4033,8 +4037,8 @@ static struct addrconf_sysctl_table
4033 .data = &ipv6_devconf.forwarding, 4037 .data = &ipv6_devconf.forwarding,
4034 .maxlen = sizeof(int), 4038 .maxlen = sizeof(int),
4035 .mode = 0644, 4039 .mode = 0644,
4036 .proc_handler = &addrconf_sysctl_forward, 4040 .proc_handler = addrconf_sysctl_forward,
4037 .strategy = &addrconf_sysctl_forward_strategy, 4041 .strategy = addrconf_sysctl_forward_strategy,
4038 }, 4042 },
4039 { 4043 {
4040 .ctl_name = NET_IPV6_HOP_LIMIT, 4044 .ctl_name = NET_IPV6_HOP_LIMIT,
@@ -4050,7 +4054,7 @@ static struct addrconf_sysctl_table
4050 .data = &ipv6_devconf.mtu6, 4054 .data = &ipv6_devconf.mtu6,
4051 .maxlen = sizeof(int), 4055 .maxlen = sizeof(int),
4052 .mode = 0644, 4056 .mode = 0644,
4053 .proc_handler = &proc_dointvec, 4057 .proc_handler = proc_dointvec,
4054 }, 4058 },
4055 { 4059 {
4056 .ctl_name = NET_IPV6_ACCEPT_RA, 4060 .ctl_name = NET_IPV6_ACCEPT_RA,
@@ -4058,7 +4062,7 @@ static struct addrconf_sysctl_table
4058 .data = &ipv6_devconf.accept_ra, 4062 .data = &ipv6_devconf.accept_ra,
4059 .maxlen = sizeof(int), 4063 .maxlen = sizeof(int),
4060 .mode = 0644, 4064 .mode = 0644,
4061 .proc_handler = &proc_dointvec, 4065 .proc_handler = proc_dointvec,
4062 }, 4066 },
4063 { 4067 {
4064 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, 4068 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS,
@@ -4066,7 +4070,7 @@ static struct addrconf_sysctl_table
4066 .data = &ipv6_devconf.accept_redirects, 4070 .data = &ipv6_devconf.accept_redirects,
4067 .maxlen = sizeof(int), 4071 .maxlen = sizeof(int),
4068 .mode = 0644, 4072 .mode = 0644,
4069 .proc_handler = &proc_dointvec, 4073 .proc_handler = proc_dointvec,
4070 }, 4074 },
4071 { 4075 {
4072 .ctl_name = NET_IPV6_AUTOCONF, 4076 .ctl_name = NET_IPV6_AUTOCONF,
@@ -4074,7 +4078,7 @@ static struct addrconf_sysctl_table
4074 .data = &ipv6_devconf.autoconf, 4078 .data = &ipv6_devconf.autoconf,
4075 .maxlen = sizeof(int), 4079 .maxlen = sizeof(int),
4076 .mode = 0644, 4080 .mode = 0644,
4077 .proc_handler = &proc_dointvec, 4081 .proc_handler = proc_dointvec,
4078 }, 4082 },
4079 { 4083 {
4080 .ctl_name = NET_IPV6_DAD_TRANSMITS, 4084 .ctl_name = NET_IPV6_DAD_TRANSMITS,
@@ -4082,7 +4086,7 @@ static struct addrconf_sysctl_table
4082 .data = &ipv6_devconf.dad_transmits, 4086 .data = &ipv6_devconf.dad_transmits,
4083 .maxlen = sizeof(int), 4087 .maxlen = sizeof(int),
4084 .mode = 0644, 4088 .mode = 0644,
4085 .proc_handler = &proc_dointvec, 4089 .proc_handler = proc_dointvec,
4086 }, 4090 },
4087 { 4091 {
4088 .ctl_name = NET_IPV6_RTR_SOLICITS, 4092 .ctl_name = NET_IPV6_RTR_SOLICITS,
@@ -4090,7 +4094,7 @@ static struct addrconf_sysctl_table
4090 .data = &ipv6_devconf.rtr_solicits, 4094 .data = &ipv6_devconf.rtr_solicits,
4091 .maxlen = sizeof(int), 4095 .maxlen = sizeof(int),
4092 .mode = 0644, 4096 .mode = 0644,
4093 .proc_handler = &proc_dointvec, 4097 .proc_handler = proc_dointvec,
4094 }, 4098 },
4095 { 4099 {
4096 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, 4100 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL,
@@ -4098,8 +4102,8 @@ static struct addrconf_sysctl_table
4098 .data = &ipv6_devconf.rtr_solicit_interval, 4102 .data = &ipv6_devconf.rtr_solicit_interval,
4099 .maxlen = sizeof(int), 4103 .maxlen = sizeof(int),
4100 .mode = 0644, 4104 .mode = 0644,
4101 .proc_handler = &proc_dointvec_jiffies, 4105 .proc_handler = proc_dointvec_jiffies,
4102 .strategy = &sysctl_jiffies, 4106 .strategy = sysctl_jiffies,
4103 }, 4107 },
4104 { 4108 {
4105 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, 4109 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY,
@@ -4107,8 +4111,8 @@ static struct addrconf_sysctl_table
4107 .data = &ipv6_devconf.rtr_solicit_delay, 4111 .data = &ipv6_devconf.rtr_solicit_delay,
4108 .maxlen = sizeof(int), 4112 .maxlen = sizeof(int),
4109 .mode = 0644, 4113 .mode = 0644,
4110 .proc_handler = &proc_dointvec_jiffies, 4114 .proc_handler = proc_dointvec_jiffies,
4111 .strategy = &sysctl_jiffies, 4115 .strategy = sysctl_jiffies,
4112 }, 4116 },
4113 { 4117 {
4114 .ctl_name = NET_IPV6_FORCE_MLD_VERSION, 4118 .ctl_name = NET_IPV6_FORCE_MLD_VERSION,
@@ -4116,7 +4120,7 @@ static struct addrconf_sysctl_table
4116 .data = &ipv6_devconf.force_mld_version, 4120 .data = &ipv6_devconf.force_mld_version,
4117 .maxlen = sizeof(int), 4121 .maxlen = sizeof(int),
4118 .mode = 0644, 4122 .mode = 0644,
4119 .proc_handler = &proc_dointvec, 4123 .proc_handler = proc_dointvec,
4120 }, 4124 },
4121#ifdef CONFIG_IPV6_PRIVACY 4125#ifdef CONFIG_IPV6_PRIVACY
4122 { 4126 {
@@ -4125,7 +4129,7 @@ static struct addrconf_sysctl_table
4125 .data = &ipv6_devconf.use_tempaddr, 4129 .data = &ipv6_devconf.use_tempaddr,
4126 .maxlen = sizeof(int), 4130 .maxlen = sizeof(int),
4127 .mode = 0644, 4131 .mode = 0644,
4128 .proc_handler = &proc_dointvec, 4132 .proc_handler = proc_dointvec,
4129 }, 4133 },
4130 { 4134 {
4131 .ctl_name = NET_IPV6_TEMP_VALID_LFT, 4135 .ctl_name = NET_IPV6_TEMP_VALID_LFT,
@@ -4133,7 +4137,7 @@ static struct addrconf_sysctl_table
4133 .data = &ipv6_devconf.temp_valid_lft, 4137 .data = &ipv6_devconf.temp_valid_lft,
4134 .maxlen = sizeof(int), 4138 .maxlen = sizeof(int),
4135 .mode = 0644, 4139 .mode = 0644,
4136 .proc_handler = &proc_dointvec, 4140 .proc_handler = proc_dointvec,
4137 }, 4141 },
4138 { 4142 {
4139 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, 4143 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT,
@@ -4141,7 +4145,7 @@ static struct addrconf_sysctl_table
4141 .data = &ipv6_devconf.temp_prefered_lft, 4145 .data = &ipv6_devconf.temp_prefered_lft,
4142 .maxlen = sizeof(int), 4146 .maxlen = sizeof(int),
4143 .mode = 0644, 4147 .mode = 0644,
4144 .proc_handler = &proc_dointvec, 4148 .proc_handler = proc_dointvec,
4145 }, 4149 },
4146 { 4150 {
4147 .ctl_name = NET_IPV6_REGEN_MAX_RETRY, 4151 .ctl_name = NET_IPV6_REGEN_MAX_RETRY,
@@ -4149,7 +4153,7 @@ static struct addrconf_sysctl_table
4149 .data = &ipv6_devconf.regen_max_retry, 4153 .data = &ipv6_devconf.regen_max_retry,
4150 .maxlen = sizeof(int), 4154 .maxlen = sizeof(int),
4151 .mode = 0644, 4155 .mode = 0644,
4152 .proc_handler = &proc_dointvec, 4156 .proc_handler = proc_dointvec,
4153 }, 4157 },
4154 { 4158 {
4155 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, 4159 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR,
@@ -4157,7 +4161,7 @@ static struct addrconf_sysctl_table
4157 .data = &ipv6_devconf.max_desync_factor, 4161 .data = &ipv6_devconf.max_desync_factor,
4158 .maxlen = sizeof(int), 4162 .maxlen = sizeof(int),
4159 .mode = 0644, 4163 .mode = 0644,
4160 .proc_handler = &proc_dointvec, 4164 .proc_handler = proc_dointvec,
4161 }, 4165 },
4162#endif 4166#endif
4163 { 4167 {
@@ -4166,7 +4170,7 @@ static struct addrconf_sysctl_table
4166 .data = &ipv6_devconf.max_addresses, 4170 .data = &ipv6_devconf.max_addresses,
4167 .maxlen = sizeof(int), 4171 .maxlen = sizeof(int),
4168 .mode = 0644, 4172 .mode = 0644,
4169 .proc_handler = &proc_dointvec, 4173 .proc_handler = proc_dointvec,
4170 }, 4174 },
4171 { 4175 {
4172 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, 4176 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR,
@@ -4174,7 +4178,7 @@ static struct addrconf_sysctl_table
4174 .data = &ipv6_devconf.accept_ra_defrtr, 4178 .data = &ipv6_devconf.accept_ra_defrtr,
4175 .maxlen = sizeof(int), 4179 .maxlen = sizeof(int),
4176 .mode = 0644, 4180 .mode = 0644,
4177 .proc_handler = &proc_dointvec, 4181 .proc_handler = proc_dointvec,
4178 }, 4182 },
4179 { 4183 {
4180 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, 4184 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO,
@@ -4182,7 +4186,7 @@ static struct addrconf_sysctl_table
4182 .data = &ipv6_devconf.accept_ra_pinfo, 4186 .data = &ipv6_devconf.accept_ra_pinfo,
4183 .maxlen = sizeof(int), 4187 .maxlen = sizeof(int),
4184 .mode = 0644, 4188 .mode = 0644,
4185 .proc_handler = &proc_dointvec, 4189 .proc_handler = proc_dointvec,
4186 }, 4190 },
4187#ifdef CONFIG_IPV6_ROUTER_PREF 4191#ifdef CONFIG_IPV6_ROUTER_PREF
4188 { 4192 {
@@ -4191,7 +4195,7 @@ static struct addrconf_sysctl_table
4191 .data = &ipv6_devconf.accept_ra_rtr_pref, 4195 .data = &ipv6_devconf.accept_ra_rtr_pref,
4192 .maxlen = sizeof(int), 4196 .maxlen = sizeof(int),
4193 .mode = 0644, 4197 .mode = 0644,
4194 .proc_handler = &proc_dointvec, 4198 .proc_handler = proc_dointvec,
4195 }, 4199 },
4196 { 4200 {
4197 .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL, 4201 .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL,
@@ -4199,8 +4203,8 @@ static struct addrconf_sysctl_table
4199 .data = &ipv6_devconf.rtr_probe_interval, 4203 .data = &ipv6_devconf.rtr_probe_interval,
4200 .maxlen = sizeof(int), 4204 .maxlen = sizeof(int),
4201 .mode = 0644, 4205 .mode = 0644,
4202 .proc_handler = &proc_dointvec_jiffies, 4206 .proc_handler = proc_dointvec_jiffies,
4203 .strategy = &sysctl_jiffies, 4207 .strategy = sysctl_jiffies,
4204 }, 4208 },
4205#ifdef CONFIG_IPV6_ROUTE_INFO 4209#ifdef CONFIG_IPV6_ROUTE_INFO
4206 { 4210 {
@@ -4209,7 +4213,7 @@ static struct addrconf_sysctl_table
4209 .data = &ipv6_devconf.accept_ra_rt_info_max_plen, 4213 .data = &ipv6_devconf.accept_ra_rt_info_max_plen,
4210 .maxlen = sizeof(int), 4214 .maxlen = sizeof(int),
4211 .mode = 0644, 4215 .mode = 0644,
4212 .proc_handler = &proc_dointvec, 4216 .proc_handler = proc_dointvec,
4213 }, 4217 },
4214#endif 4218#endif
4215#endif 4219#endif
@@ -4219,7 +4223,7 @@ static struct addrconf_sysctl_table
4219 .data = &ipv6_devconf.proxy_ndp, 4223 .data = &ipv6_devconf.proxy_ndp,
4220 .maxlen = sizeof(int), 4224 .maxlen = sizeof(int),
4221 .mode = 0644, 4225 .mode = 0644,
4222 .proc_handler = &proc_dointvec, 4226 .proc_handler = proc_dointvec,
4223 }, 4227 },
4224 { 4228 {
4225 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, 4229 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE,
@@ -4227,7 +4231,7 @@ static struct addrconf_sysctl_table
4227 .data = &ipv6_devconf.accept_source_route, 4231 .data = &ipv6_devconf.accept_source_route,
4228 .maxlen = sizeof(int), 4232 .maxlen = sizeof(int),
4229 .mode = 0644, 4233 .mode = 0644,
4230 .proc_handler = &proc_dointvec, 4234 .proc_handler = proc_dointvec,
4231 }, 4235 },
4232#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 4236#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
4233 { 4237 {
@@ -4236,7 +4240,7 @@ static struct addrconf_sysctl_table
4236 .data = &ipv6_devconf.optimistic_dad, 4240 .data = &ipv6_devconf.optimistic_dad,
4237 .maxlen = sizeof(int), 4241 .maxlen = sizeof(int),
4238 .mode = 0644, 4242 .mode = 0644,
4239 .proc_handler = &proc_dointvec, 4243 .proc_handler = proc_dointvec,
4240 4244
4241 }, 4245 },
4242#endif 4246#endif
@@ -4247,7 +4251,7 @@ static struct addrconf_sysctl_table
4247 .data = &ipv6_devconf.mc_forwarding, 4251 .data = &ipv6_devconf.mc_forwarding,
4248 .maxlen = sizeof(int), 4252 .maxlen = sizeof(int),
4249 .mode = 0644, 4253 .mode = 0644,
4250 .proc_handler = &proc_dointvec, 4254 .proc_handler = proc_dointvec,
4251 }, 4255 },
4252#endif 4256#endif
4253 { 4257 {
@@ -4256,7 +4260,7 @@ static struct addrconf_sysctl_table
4256 .data = &ipv6_devconf.disable_ipv6, 4260 .data = &ipv6_devconf.disable_ipv6,
4257 .maxlen = sizeof(int), 4261 .maxlen = sizeof(int),
4258 .mode = 0644, 4262 .mode = 0644,
4259 .proc_handler = &proc_dointvec, 4263 .proc_handler = proc_dointvec,
4260 }, 4264 },
4261 { 4265 {
4262 .ctl_name = CTL_UNNUMBERED, 4266 .ctl_name = CTL_UNNUMBERED,
@@ -4264,7 +4268,7 @@ static struct addrconf_sysctl_table
4264 .data = &ipv6_devconf.accept_dad, 4268 .data = &ipv6_devconf.accept_dad,
4265 .maxlen = sizeof(int), 4269 .maxlen = sizeof(int),
4266 .mode = 0644, 4270 .mode = 0644,
4267 .proc_handler = &proc_dointvec, 4271 .proc_handler = proc_dointvec,
4268 }, 4272 },
4269 { 4273 {
4270 .ctl_name = 0, /* sentinel */ 4274 .ctl_name = 0, /* sentinel */