aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/addrconf.c67
-rw-r--r--net/ipv6/addrlabel.c34
-rw-r--r--net/ipv6/ah6.c4
-rw-r--r--net/ipv6/anycast.c6
-rw-r--r--net/ipv6/esp6.c4
-rw-r--r--net/ipv6/exthdrs.c2
-rw-r--r--net/ipv6/icmp.c11
-rw-r--r--net/ipv6/ip6_flowlabel.c4
-rw-r--r--net/ipv6/ip6_output.c2
-rw-r--r--net/ipv6/ip6mr.c5
-rw-r--r--net/ipv6/ipcomp6.c4
-rw-r--r--net/ipv6/mcast.c10
-rw-r--r--net/ipv6/ndisc.c99
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c7
-rw-r--r--net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c5
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c2
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c6
-rw-r--r--net/ipv6/reassembly.c12
-rw-r--r--net/ipv6/route.c43
-rw-r--r--net/ipv6/sysctl_net_ipv6.c4
-rw-r--r--net/ipv6/tcp_ipv6.c8
-rw-r--r--net/ipv6/udp.c137
-rw-r--r--net/ipv6/udp_impl.h4
-rw-r--r--net/ipv6/udplite.c9
-rw-r--r--net/ipv6/xfrm6_policy.c9
25 files changed, 272 insertions, 226 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d9da5eb9dcb2..0e41f1be6dc9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2988,9 +2988,8 @@ static void if6_seq_stop(struct seq_file *seq, void *v)
2988static int if6_seq_show(struct seq_file *seq, void *v) 2988static int if6_seq_show(struct seq_file *seq, void *v)
2989{ 2989{
2990 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; 2990 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
2991 seq_printf(seq, 2991 seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
2992 NIP6_SEQFMT " %02x %02x %02x %02x %8s\n", 2992 &ifp->addr,
2993 NIP6(ifp->addr),
2994 ifp->idev->dev->ifindex, 2993 ifp->idev->dev->ifindex,
2995 ifp->prefix_len, 2994 ifp->prefix_len,
2996 ifp->scope, 2995 ifp->scope,
@@ -4033,8 +4032,8 @@ static struct addrconf_sysctl_table
4033 .data = &ipv6_devconf.forwarding, 4032 .data = &ipv6_devconf.forwarding,
4034 .maxlen = sizeof(int), 4033 .maxlen = sizeof(int),
4035 .mode = 0644, 4034 .mode = 0644,
4036 .proc_handler = &addrconf_sysctl_forward, 4035 .proc_handler = addrconf_sysctl_forward,
4037 .strategy = &addrconf_sysctl_forward_strategy, 4036 .strategy = addrconf_sysctl_forward_strategy,
4038 }, 4037 },
4039 { 4038 {
4040 .ctl_name = NET_IPV6_HOP_LIMIT, 4039 .ctl_name = NET_IPV6_HOP_LIMIT,
@@ -4050,7 +4049,7 @@ static struct addrconf_sysctl_table
4050 .data = &ipv6_devconf.mtu6, 4049 .data = &ipv6_devconf.mtu6,
4051 .maxlen = sizeof(int), 4050 .maxlen = sizeof(int),
4052 .mode = 0644, 4051 .mode = 0644,
4053 .proc_handler = &proc_dointvec, 4052 .proc_handler = proc_dointvec,
4054 }, 4053 },
4055 { 4054 {
4056 .ctl_name = NET_IPV6_ACCEPT_RA, 4055 .ctl_name = NET_IPV6_ACCEPT_RA,
@@ -4058,7 +4057,7 @@ static struct addrconf_sysctl_table
4058 .data = &ipv6_devconf.accept_ra, 4057 .data = &ipv6_devconf.accept_ra,
4059 .maxlen = sizeof(int), 4058 .maxlen = sizeof(int),
4060 .mode = 0644, 4059 .mode = 0644,
4061 .proc_handler = &proc_dointvec, 4060 .proc_handler = proc_dointvec,
4062 }, 4061 },
4063 { 4062 {
4064 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS, 4063 .ctl_name = NET_IPV6_ACCEPT_REDIRECTS,
@@ -4066,7 +4065,7 @@ static struct addrconf_sysctl_table
4066 .data = &ipv6_devconf.accept_redirects, 4065 .data = &ipv6_devconf.accept_redirects,
4067 .maxlen = sizeof(int), 4066 .maxlen = sizeof(int),
4068 .mode = 0644, 4067 .mode = 0644,
4069 .proc_handler = &proc_dointvec, 4068 .proc_handler = proc_dointvec,
4070 }, 4069 },
4071 { 4070 {
4072 .ctl_name = NET_IPV6_AUTOCONF, 4071 .ctl_name = NET_IPV6_AUTOCONF,
@@ -4074,7 +4073,7 @@ static struct addrconf_sysctl_table
4074 .data = &ipv6_devconf.autoconf, 4073 .data = &ipv6_devconf.autoconf,
4075 .maxlen = sizeof(int), 4074 .maxlen = sizeof(int),
4076 .mode = 0644, 4075 .mode = 0644,
4077 .proc_handler = &proc_dointvec, 4076 .proc_handler = proc_dointvec,
4078 }, 4077 },
4079 { 4078 {
4080 .ctl_name = NET_IPV6_DAD_TRANSMITS, 4079 .ctl_name = NET_IPV6_DAD_TRANSMITS,
@@ -4082,7 +4081,7 @@ static struct addrconf_sysctl_table
4082 .data = &ipv6_devconf.dad_transmits, 4081 .data = &ipv6_devconf.dad_transmits,
4083 .maxlen = sizeof(int), 4082 .maxlen = sizeof(int),
4084 .mode = 0644, 4083 .mode = 0644,
4085 .proc_handler = &proc_dointvec, 4084 .proc_handler = proc_dointvec,
4086 }, 4085 },
4087 { 4086 {
4088 .ctl_name = NET_IPV6_RTR_SOLICITS, 4087 .ctl_name = NET_IPV6_RTR_SOLICITS,
@@ -4090,7 +4089,7 @@ static struct addrconf_sysctl_table
4090 .data = &ipv6_devconf.rtr_solicits, 4089 .data = &ipv6_devconf.rtr_solicits,
4091 .maxlen = sizeof(int), 4090 .maxlen = sizeof(int),
4092 .mode = 0644, 4091 .mode = 0644,
4093 .proc_handler = &proc_dointvec, 4092 .proc_handler = proc_dointvec,
4094 }, 4093 },
4095 { 4094 {
4096 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL, 4095 .ctl_name = NET_IPV6_RTR_SOLICIT_INTERVAL,
@@ -4098,8 +4097,8 @@ static struct addrconf_sysctl_table
4098 .data = &ipv6_devconf.rtr_solicit_interval, 4097 .data = &ipv6_devconf.rtr_solicit_interval,
4099 .maxlen = sizeof(int), 4098 .maxlen = sizeof(int),
4100 .mode = 0644, 4099 .mode = 0644,
4101 .proc_handler = &proc_dointvec_jiffies, 4100 .proc_handler = proc_dointvec_jiffies,
4102 .strategy = &sysctl_jiffies, 4101 .strategy = sysctl_jiffies,
4103 }, 4102 },
4104 { 4103 {
4105 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY, 4104 .ctl_name = NET_IPV6_RTR_SOLICIT_DELAY,
@@ -4107,8 +4106,8 @@ static struct addrconf_sysctl_table
4107 .data = &ipv6_devconf.rtr_solicit_delay, 4106 .data = &ipv6_devconf.rtr_solicit_delay,
4108 .maxlen = sizeof(int), 4107 .maxlen = sizeof(int),
4109 .mode = 0644, 4108 .mode = 0644,
4110 .proc_handler = &proc_dointvec_jiffies, 4109 .proc_handler = proc_dointvec_jiffies,
4111 .strategy = &sysctl_jiffies, 4110 .strategy = sysctl_jiffies,
4112 }, 4111 },
4113 { 4112 {
4114 .ctl_name = NET_IPV6_FORCE_MLD_VERSION, 4113 .ctl_name = NET_IPV6_FORCE_MLD_VERSION,
@@ -4116,7 +4115,7 @@ static struct addrconf_sysctl_table
4116 .data = &ipv6_devconf.force_mld_version, 4115 .data = &ipv6_devconf.force_mld_version,
4117 .maxlen = sizeof(int), 4116 .maxlen = sizeof(int),
4118 .mode = 0644, 4117 .mode = 0644,
4119 .proc_handler = &proc_dointvec, 4118 .proc_handler = proc_dointvec,
4120 }, 4119 },
4121#ifdef CONFIG_IPV6_PRIVACY 4120#ifdef CONFIG_IPV6_PRIVACY
4122 { 4121 {
@@ -4125,7 +4124,7 @@ static struct addrconf_sysctl_table
4125 .data = &ipv6_devconf.use_tempaddr, 4124 .data = &ipv6_devconf.use_tempaddr,
4126 .maxlen = sizeof(int), 4125 .maxlen = sizeof(int),
4127 .mode = 0644, 4126 .mode = 0644,
4128 .proc_handler = &proc_dointvec, 4127 .proc_handler = proc_dointvec,
4129 }, 4128 },
4130 { 4129 {
4131 .ctl_name = NET_IPV6_TEMP_VALID_LFT, 4130 .ctl_name = NET_IPV6_TEMP_VALID_LFT,
@@ -4133,7 +4132,7 @@ static struct addrconf_sysctl_table
4133 .data = &ipv6_devconf.temp_valid_lft, 4132 .data = &ipv6_devconf.temp_valid_lft,
4134 .maxlen = sizeof(int), 4133 .maxlen = sizeof(int),
4135 .mode = 0644, 4134 .mode = 0644,
4136 .proc_handler = &proc_dointvec, 4135 .proc_handler = proc_dointvec,
4137 }, 4136 },
4138 { 4137 {
4139 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT, 4138 .ctl_name = NET_IPV6_TEMP_PREFERED_LFT,
@@ -4141,7 +4140,7 @@ static struct addrconf_sysctl_table
4141 .data = &ipv6_devconf.temp_prefered_lft, 4140 .data = &ipv6_devconf.temp_prefered_lft,
4142 .maxlen = sizeof(int), 4141 .maxlen = sizeof(int),
4143 .mode = 0644, 4142 .mode = 0644,
4144 .proc_handler = &proc_dointvec, 4143 .proc_handler = proc_dointvec,
4145 }, 4144 },
4146 { 4145 {
4147 .ctl_name = NET_IPV6_REGEN_MAX_RETRY, 4146 .ctl_name = NET_IPV6_REGEN_MAX_RETRY,
@@ -4149,7 +4148,7 @@ static struct addrconf_sysctl_table
4149 .data = &ipv6_devconf.regen_max_retry, 4148 .data = &ipv6_devconf.regen_max_retry,
4150 .maxlen = sizeof(int), 4149 .maxlen = sizeof(int),
4151 .mode = 0644, 4150 .mode = 0644,
4152 .proc_handler = &proc_dointvec, 4151 .proc_handler = proc_dointvec,
4153 }, 4152 },
4154 { 4153 {
4155 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR, 4154 .ctl_name = NET_IPV6_MAX_DESYNC_FACTOR,
@@ -4157,7 +4156,7 @@ static struct addrconf_sysctl_table
4157 .data = &ipv6_devconf.max_desync_factor, 4156 .data = &ipv6_devconf.max_desync_factor,
4158 .maxlen = sizeof(int), 4157 .maxlen = sizeof(int),
4159 .mode = 0644, 4158 .mode = 0644,
4160 .proc_handler = &proc_dointvec, 4159 .proc_handler = proc_dointvec,
4161 }, 4160 },
4162#endif 4161#endif
4163 { 4162 {
@@ -4166,7 +4165,7 @@ static struct addrconf_sysctl_table
4166 .data = &ipv6_devconf.max_addresses, 4165 .data = &ipv6_devconf.max_addresses,
4167 .maxlen = sizeof(int), 4166 .maxlen = sizeof(int),
4168 .mode = 0644, 4167 .mode = 0644,
4169 .proc_handler = &proc_dointvec, 4168 .proc_handler = proc_dointvec,
4170 }, 4169 },
4171 { 4170 {
4172 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR, 4171 .ctl_name = NET_IPV6_ACCEPT_RA_DEFRTR,
@@ -4174,7 +4173,7 @@ static struct addrconf_sysctl_table
4174 .data = &ipv6_devconf.accept_ra_defrtr, 4173 .data = &ipv6_devconf.accept_ra_defrtr,
4175 .maxlen = sizeof(int), 4174 .maxlen = sizeof(int),
4176 .mode = 0644, 4175 .mode = 0644,
4177 .proc_handler = &proc_dointvec, 4176 .proc_handler = proc_dointvec,
4178 }, 4177 },
4179 { 4178 {
4180 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO, 4179 .ctl_name = NET_IPV6_ACCEPT_RA_PINFO,
@@ -4182,7 +4181,7 @@ static struct addrconf_sysctl_table
4182 .data = &ipv6_devconf.accept_ra_pinfo, 4181 .data = &ipv6_devconf.accept_ra_pinfo,
4183 .maxlen = sizeof(int), 4182 .maxlen = sizeof(int),
4184 .mode = 0644, 4183 .mode = 0644,
4185 .proc_handler = &proc_dointvec, 4184 .proc_handler = proc_dointvec,
4186 }, 4185 },
4187#ifdef CONFIG_IPV6_ROUTER_PREF 4186#ifdef CONFIG_IPV6_ROUTER_PREF
4188 { 4187 {
@@ -4191,7 +4190,7 @@ static struct addrconf_sysctl_table
4191 .data = &ipv6_devconf.accept_ra_rtr_pref, 4190 .data = &ipv6_devconf.accept_ra_rtr_pref,
4192 .maxlen = sizeof(int), 4191 .maxlen = sizeof(int),
4193 .mode = 0644, 4192 .mode = 0644,
4194 .proc_handler = &proc_dointvec, 4193 .proc_handler = proc_dointvec,
4195 }, 4194 },
4196 { 4195 {
4197 .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL, 4196 .ctl_name = NET_IPV6_RTR_PROBE_INTERVAL,
@@ -4199,8 +4198,8 @@ static struct addrconf_sysctl_table
4199 .data = &ipv6_devconf.rtr_probe_interval, 4198 .data = &ipv6_devconf.rtr_probe_interval,
4200 .maxlen = sizeof(int), 4199 .maxlen = sizeof(int),
4201 .mode = 0644, 4200 .mode = 0644,
4202 .proc_handler = &proc_dointvec_jiffies, 4201 .proc_handler = proc_dointvec_jiffies,
4203 .strategy = &sysctl_jiffies, 4202 .strategy = sysctl_jiffies,
4204 }, 4203 },
4205#ifdef CONFIG_IPV6_ROUTE_INFO 4204#ifdef CONFIG_IPV6_ROUTE_INFO
4206 { 4205 {
@@ -4209,7 +4208,7 @@ static struct addrconf_sysctl_table
4209 .data = &ipv6_devconf.accept_ra_rt_info_max_plen, 4208 .data = &ipv6_devconf.accept_ra_rt_info_max_plen,
4210 .maxlen = sizeof(int), 4209 .maxlen = sizeof(int),
4211 .mode = 0644, 4210 .mode = 0644,
4212 .proc_handler = &proc_dointvec, 4211 .proc_handler = proc_dointvec,
4213 }, 4212 },
4214#endif 4213#endif
4215#endif 4214#endif
@@ -4219,7 +4218,7 @@ static struct addrconf_sysctl_table
4219 .data = &ipv6_devconf.proxy_ndp, 4218 .data = &ipv6_devconf.proxy_ndp,
4220 .maxlen = sizeof(int), 4219 .maxlen = sizeof(int),
4221 .mode = 0644, 4220 .mode = 0644,
4222 .proc_handler = &proc_dointvec, 4221 .proc_handler = proc_dointvec,
4223 }, 4222 },
4224 { 4223 {
4225 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE, 4224 .ctl_name = NET_IPV6_ACCEPT_SOURCE_ROUTE,
@@ -4227,7 +4226,7 @@ static struct addrconf_sysctl_table
4227 .data = &ipv6_devconf.accept_source_route, 4226 .data = &ipv6_devconf.accept_source_route,
4228 .maxlen = sizeof(int), 4227 .maxlen = sizeof(int),
4229 .mode = 0644, 4228 .mode = 0644,
4230 .proc_handler = &proc_dointvec, 4229 .proc_handler = proc_dointvec,
4231 }, 4230 },
4232#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 4231#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
4233 { 4232 {
@@ -4236,7 +4235,7 @@ static struct addrconf_sysctl_table
4236 .data = &ipv6_devconf.optimistic_dad, 4235 .data = &ipv6_devconf.optimistic_dad,
4237 .maxlen = sizeof(int), 4236 .maxlen = sizeof(int),
4238 .mode = 0644, 4237 .mode = 0644,
4239 .proc_handler = &proc_dointvec, 4238 .proc_handler = proc_dointvec,
4240 4239
4241 }, 4240 },
4242#endif 4241#endif
@@ -4247,7 +4246,7 @@ static struct addrconf_sysctl_table
4247 .data = &ipv6_devconf.mc_forwarding, 4246 .data = &ipv6_devconf.mc_forwarding,
4248 .maxlen = sizeof(int), 4247 .maxlen = sizeof(int),
4249 .mode = 0644, 4248 .mode = 0644,
4250 .proc_handler = &proc_dointvec, 4249 .proc_handler = proc_dointvec,
4251 }, 4250 },
4252#endif 4251#endif
4253 { 4252 {
@@ -4256,7 +4255,7 @@ static struct addrconf_sysctl_table
4256 .data = &ipv6_devconf.disable_ipv6, 4255 .data = &ipv6_devconf.disable_ipv6,
4257 .maxlen = sizeof(int), 4256 .maxlen = sizeof(int),
4258 .mode = 0644, 4257 .mode = 0644,
4259 .proc_handler = &proc_dointvec, 4258 .proc_handler = proc_dointvec,
4260 }, 4259 },
4261 { 4260 {
4262 .ctl_name = CTL_UNNUMBERED, 4261 .ctl_name = CTL_UNNUMBERED,
@@ -4264,7 +4263,7 @@ static struct addrconf_sysctl_table
4264 .data = &ipv6_devconf.accept_dad, 4263 .data = &ipv6_devconf.accept_dad,
4265 .maxlen = sizeof(int), 4264 .maxlen = sizeof(int),
4266 .mode = 0644, 4265 .mode = 0644,
4267 .proc_handler = &proc_dointvec, 4266 .proc_handler = proc_dointvec,
4268 }, 4267 },
4269 { 4268 {
4270 .ctl_name = 0, /* sentinel */ 4269 .ctl_name = 0, /* sentinel */
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index 08909039d87b..6ff73c4c126a 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -186,10 +186,8 @@ u32 ipv6_addr_label(struct net *net,
186 label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT; 186 label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT;
187 rcu_read_unlock(); 187 rcu_read_unlock();
188 188
189 ADDRLABEL(KERN_DEBUG "%s(addr=" NIP6_FMT ", type=%d, ifindex=%d) => %08x\n", 189 ADDRLABEL(KERN_DEBUG "%s(addr=%pI6, type=%d, ifindex=%d) => %08x\n",
190 __func__, 190 __func__, addr, type, ifindex, label);
191 NIP6(*addr), type, ifindex,
192 label);
193 191
194 return label; 192 return label;
195} 193}
@@ -203,11 +201,8 @@ static struct ip6addrlbl_entry *ip6addrlbl_alloc(struct net *net,
203 struct ip6addrlbl_entry *newp; 201 struct ip6addrlbl_entry *newp;
204 int addrtype; 202 int addrtype;
205 203
206 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u)\n", 204 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u)\n",
207 __func__, 205 __func__, prefix, prefixlen, ifindex, (unsigned int)label);
208 NIP6(*prefix), prefixlen,
209 ifindex,
210 (unsigned int)label);
211 206
212 addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK); 207 addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK);
213 208
@@ -294,12 +289,9 @@ static int ip6addrlbl_add(struct net *net,
294 struct ip6addrlbl_entry *newp; 289 struct ip6addrlbl_entry *newp;
295 int ret = 0; 290 int ret = 0;
296 291
297 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n", 292 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n",
298 __func__, 293 __func__, prefix, prefixlen, ifindex, (unsigned int)label,
299 NIP6(*prefix), prefixlen, 294 replace);
300 ifindex,
301 (unsigned int)label,
302 replace);
303 295
304 newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label); 296 newp = ip6addrlbl_alloc(net, prefix, prefixlen, ifindex, label);
305 if (IS_ERR(newp)) 297 if (IS_ERR(newp))
@@ -321,10 +313,8 @@ static int __ip6addrlbl_del(struct net *net,
321 struct hlist_node *pos, *n; 313 struct hlist_node *pos, *n;
322 int ret = -ESRCH; 314 int ret = -ESRCH;
323 315
324 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n", 316 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n",
325 __func__, 317 __func__, prefix, prefixlen, ifindex);
326 NIP6(*prefix), prefixlen,
327 ifindex);
328 318
329 hlist_for_each_entry_safe(p, pos, n, &ip6addrlbl_table.head, list) { 319 hlist_for_each_entry_safe(p, pos, n, &ip6addrlbl_table.head, list) {
330 if (p->prefixlen == prefixlen && 320 if (p->prefixlen == prefixlen &&
@@ -347,10 +337,8 @@ static int ip6addrlbl_del(struct net *net,
347 struct in6_addr prefix_buf; 337 struct in6_addr prefix_buf;
348 int ret; 338 int ret;
349 339
350 ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n", 340 ADDRLABEL(KERN_DEBUG "%s(prefix=%pI6, prefixlen=%d, ifindex=%d)\n",
351 __func__, 341 __func__, prefix, prefixlen, ifindex);
352 NIP6(*prefix), prefixlen,
353 ifindex);
354 342
355 ipv6_addr_prefix(&prefix_buf, prefix, prefixlen); 343 ipv6_addr_prefix(&prefix_buf, prefix, prefixlen);
356 spin_lock(&ip6addrlbl_table.lock); 344 spin_lock(&ip6addrlbl_table.lock);
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 2ff0c8233e47..7a8a01369e5c 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -419,8 +419,8 @@ static void ah6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
419 if (!x) 419 if (!x)
420 return; 420 return;
421 421
422 NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/" NIP6_FMT "\n", 422 NETDEBUG(KERN_DEBUG "pmtu discovery on SA AH/%08x/%pI6\n",
423 ntohl(ah->spi), NIP6(iph->daddr)); 423 ntohl(ah->spi), &iph->daddr);
424 424
425 xfrm_state_put(x); 425 xfrm_state_put(x);
426} 426}
diff --git a/net/ipv6/anycast.c b/net/ipv6/anycast.c
index 8336cd81cb4f..1ae58bec1de0 100644
--- a/net/ipv6/anycast.c
+++ b/net/ipv6/anycast.c
@@ -512,11 +512,9 @@ static int ac6_seq_show(struct seq_file *seq, void *v)
512 struct ifacaddr6 *im = (struct ifacaddr6 *)v; 512 struct ifacaddr6 *im = (struct ifacaddr6 *)v;
513 struct ac6_iter_state *state = ac6_seq_private(seq); 513 struct ac6_iter_state *state = ac6_seq_private(seq);
514 514
515 seq_printf(seq, 515 seq_printf(seq, "%-4d %-15s %pi6 %5d\n",
516 "%-4d %-15s " NIP6_SEQFMT " %5d\n",
517 state->dev->ifindex, state->dev->name, 516 state->dev->ifindex, state->dev->name,
518 NIP6(im->aca_addr), 517 &im->aca_addr, im->aca_users);
519 im->aca_users);
520 return 0; 518 return 0;
521} 519}
522 520
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index b181b08fb761..c02a6308defe 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -367,8 +367,8 @@ static void esp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
367 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6); 367 x = xfrm_state_lookup((xfrm_address_t *)&iph->daddr, esph->spi, IPPROTO_ESP, AF_INET6);
368 if (!x) 368 if (!x)
369 return; 369 return;
370 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/" NIP6_FMT "\n", 370 printk(KERN_DEBUG "pmtu discovery on SA ESP/%08x/%pI6\n",
371 ntohl(esph->spi), NIP6(iph->daddr)); 371 ntohl(esph->spi), &iph->daddr);
372 xfrm_state_put(x); 372 xfrm_state_put(x);
373} 373}
374 374
diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
index 6bfffec2371c..1c7f400a3cfe 100644
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
@@ -219,7 +219,7 @@ static int ipv6_dest_hao(struct sk_buff *skb, int optoff)
219 219
220 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) { 220 if (!(ipv6_addr_type(&hao->addr) & IPV6_ADDR_UNICAST)) {
221 LIMIT_NETDEBUG( 221 LIMIT_NETDEBUG(
222 KERN_DEBUG "hao is not an unicast addr: " NIP6_FMT "\n", NIP6(hao->addr)); 222 KERN_DEBUG "hao is not an unicast addr: %pI6\n", &hao->addr);
223 goto discard; 223 goto discard;
224 } 224 }
225 225
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 9b7d19ae5ced..be351009fd03 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -646,9 +646,10 @@ static int icmpv6_rcv(struct sk_buff *skb)
646 int type; 646 int type;
647 647
648 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { 648 if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
649 struct sec_path *sp = skb_sec_path(skb);
649 int nh; 650 int nh;
650 651
651 if (!(skb->sp && skb->sp->xvec[skb->sp->len - 1]->props.flags & 652 if (!(sp && sp->xvec[sp->len - 1]->props.flags &
652 XFRM_STATE_ICMP)) 653 XFRM_STATE_ICMP))
653 goto drop_no_count; 654 goto drop_no_count;
654 655
@@ -680,8 +681,8 @@ static int icmpv6_rcv(struct sk_buff *skb)
680 skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len, 681 skb->csum = ~csum_unfold(csum_ipv6_magic(saddr, daddr, skb->len,
681 IPPROTO_ICMPV6, 0)); 682 IPPROTO_ICMPV6, 0));
682 if (__skb_checksum_complete(skb)) { 683 if (__skb_checksum_complete(skb)) {
683 LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [" NIP6_FMT " > " NIP6_FMT "]\n", 684 LIMIT_NETDEBUG(KERN_DEBUG "ICMPv6 checksum failed [%pI6 > %pI6]\n",
684 NIP6(*saddr), NIP6(*daddr)); 685 saddr, daddr);
685 goto discard_it; 686 goto discard_it;
686 } 687 }
687 } 688 }
@@ -955,8 +956,8 @@ ctl_table ipv6_icmp_table_template[] = {
955 .data = &init_net.ipv6.sysctl.icmpv6_time, 956 .data = &init_net.ipv6.sysctl.icmpv6_time,
956 .maxlen = sizeof(int), 957 .maxlen = sizeof(int),
957 .mode = 0644, 958 .mode = 0644,
958 .proc_handler = &proc_dointvec_ms_jiffies, 959 .proc_handler = proc_dointvec_ms_jiffies,
959 .strategy = &sysctl_ms_jiffies 960 .strategy = sysctl_ms_jiffies
960 }, 961 },
961 { .ctl_name = 0 }, 962 { .ctl_name = 0 },
962}; 963};
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 37a4e777e347..7927a8498d17 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -696,14 +696,14 @@ static int ip6fl_seq_show(struct seq_file *seq, void *v)
696 else { 696 else {
697 struct ip6_flowlabel *fl = v; 697 struct ip6_flowlabel *fl = v;
698 seq_printf(seq, 698 seq_printf(seq,
699 "%05X %-1d %-6d %-6d %-6ld %-8ld " NIP6_SEQFMT " %-4d\n", 699 "%05X %-1d %-6d %-6d %-6ld %-8ld %pi6 %-4d\n",
700 (unsigned)ntohl(fl->label), 700 (unsigned)ntohl(fl->label),
701 fl->share, 701 fl->share,
702 (unsigned)fl->owner, 702 (unsigned)fl->owner,
703 atomic_read(&fl->users), 703 atomic_read(&fl->users),
704 fl->linger/HZ, 704 fl->linger/HZ,
705 (long)(fl->expires - jiffies)/HZ, 705 (long)(fl->expires - jiffies)/HZ,
706 NIP6(fl->dst), 706 &fl->dst,
707 fl->opt ? fl->opt->opt_nflen : 0); 707 fl->opt ? fl->opt->opt_nflen : 0);
708 } 708 }
709 return 0; 709 return 0;
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index c77db0b95e26..7d92fd97cfb9 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -490,7 +490,7 @@ int ip6_forward(struct sk_buff *skb)
490 We don't send redirects to frames decapsulated from IPsec. 490 We don't send redirects to frames decapsulated from IPsec.
491 */ 491 */
492 if (skb->dev == dst->dev && dst->neighbour && opt->srcrt == 0 && 492 if (skb->dev == dst->dev && dst->neighbour && opt->srcrt == 0 &&
493 !skb->sp) { 493 !skb_sec_path(skb)) {
494 struct in6_addr *target = NULL; 494 struct in6_addr *target = NULL;
495 struct rt6_info *rt; 495 struct rt6_info *rt;
496 struct neighbour *n = dst->neighbour; 496 struct neighbour *n = dst->neighbour;
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 52a7eb0e2c2c..b17377d6f260 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -297,9 +297,8 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
297 const struct mfc6_cache *mfc = v; 297 const struct mfc6_cache *mfc = v;
298 const struct ipmr_mfc_iter *it = seq->private; 298 const struct ipmr_mfc_iter *it = seq->private;
299 299
300 seq_printf(seq, 300 seq_printf(seq, "%pI6 %pI6 %-3d %8ld %8ld %8ld",
301 NIP6_FMT " " NIP6_FMT " %-3d %8ld %8ld %8ld", 301 &mfc->mf6c_mcastgrp, &mfc->mf6c_origin,
302 NIP6(mfc->mf6c_mcastgrp), NIP6(mfc->mf6c_origin),
303 mfc->mf6c_parent, 302 mfc->mf6c_parent,
304 mfc->mfc_un.res.pkt, 303 mfc->mfc_un.res.pkt,
305 mfc->mfc_un.res.bytes, 304 mfc->mfc_un.res.bytes,
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index 4545e4306862..d4576a9c154f 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -67,8 +67,8 @@ static void ipcomp6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
67 if (!x) 67 if (!x)
68 return; 68 return;
69 69
70 printk(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/" NIP6_FMT "\n", 70 printk(KERN_DEBUG "pmtu discovery on SA IPCOMP/%08x/%pI6\n",
71 spi, NIP6(iph->daddr)); 71 spi, &iph->daddr);
72 xfrm_state_put(x); 72 xfrm_state_put(x);
73} 73}
74 74
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index d7b3c6d398ae..a76199ecad23 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -2430,9 +2430,9 @@ static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
2430 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq); 2430 struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
2431 2431
2432 seq_printf(seq, 2432 seq_printf(seq,
2433 "%-4d %-15s " NIP6_SEQFMT " %5d %08X %ld\n", 2433 "%-4d %-15s %pi6 %5d %08X %ld\n",
2434 state->dev->ifindex, state->dev->name, 2434 state->dev->ifindex, state->dev->name,
2435 NIP6(im->mca_addr), 2435 &im->mca_addr,
2436 im->mca_users, im->mca_flags, 2436 im->mca_users, im->mca_flags,
2437 (im->mca_flags&MAF_TIMER_RUNNING) ? 2437 (im->mca_flags&MAF_TIMER_RUNNING) ?
2438 jiffies_to_clock_t(im->mca_timer.expires-jiffies) : 0); 2438 jiffies_to_clock_t(im->mca_timer.expires-jiffies) : 0);
@@ -2591,10 +2591,10 @@ static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
2591 "Source Address", "INC", "EXC"); 2591 "Source Address", "INC", "EXC");
2592 } else { 2592 } else {
2593 seq_printf(seq, 2593 seq_printf(seq,
2594 "%3d %6.6s " NIP6_SEQFMT " " NIP6_SEQFMT " %6lu %6lu\n", 2594 "%3d %6.6s %pi6 %pi6 %6lu %6lu\n",
2595 state->dev->ifindex, state->dev->name, 2595 state->dev->ifindex, state->dev->name,
2596 NIP6(state->im->mca_addr), 2596 &state->im->mca_addr,
2597 NIP6(psf->sf_addr), 2597 &psf->sf_addr,
2598 psf->sf_count[MCAST_INCLUDE], 2598 psf->sf_count[MCAST_INCLUDE],
2599 psf->sf_count[MCAST_EXCLUDE]); 2599 psf->sf_count[MCAST_EXCLUDE]);
2600 } 2600 }
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 172438320eec..fbf451c0d77a 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -437,38 +437,20 @@ static void pndisc_destructor(struct pneigh_entry *n)
437 ipv6_dev_mc_dec(dev, &maddr); 437 ipv6_dev_mc_dec(dev, &maddr);
438} 438}
439 439
440/* 440struct sk_buff *ndisc_build_skb(struct net_device *dev,
441 * Send a Neighbour Advertisement 441 const struct in6_addr *daddr,
442 */ 442 const struct in6_addr *saddr,
443static void __ndisc_send(struct net_device *dev, 443 struct icmp6hdr *icmp6h,
444 struct neighbour *neigh, 444 const struct in6_addr *target,
445 const struct in6_addr *daddr, 445 int llinfo)
446 const struct in6_addr *saddr,
447 struct icmp6hdr *icmp6h, const struct in6_addr *target,
448 int llinfo)
449{ 446{
450 struct flowi fl;
451 struct dst_entry *dst;
452 struct net *net = dev_net(dev); 447 struct net *net = dev_net(dev);
453 struct sock *sk = net->ipv6.ndisc_sk; 448 struct sock *sk = net->ipv6.ndisc_sk;
454 struct sk_buff *skb; 449 struct sk_buff *skb;
455 struct icmp6hdr *hdr; 450 struct icmp6hdr *hdr;
456 struct inet6_dev *idev;
457 int len; 451 int len;
458 int err; 452 int err;
459 u8 *opt, type; 453 u8 *opt;
460
461 type = icmp6h->icmp6_type;
462
463 icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex);
464
465 dst = icmp6_dst_alloc(dev, neigh, daddr);
466 if (!dst)
467 return;
468
469 err = xfrm_lookup(&dst, &fl, NULL, 0);
470 if (err < 0)
471 return;
472 454
473 if (!dev->addr_len) 455 if (!dev->addr_len)
474 llinfo = 0; 456 llinfo = 0;
@@ -485,8 +467,7 @@ static void __ndisc_send(struct net_device *dev,
485 ND_PRINTK0(KERN_ERR 467 ND_PRINTK0(KERN_ERR
486 "ICMPv6 ND: %s() failed to allocate an skb.\n", 468 "ICMPv6 ND: %s() failed to allocate an skb.\n",
487 __func__); 469 __func__);
488 dst_release(dst); 470 return NULL;
489 return;
490 } 471 }
491 472
492 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 473 skb_reserve(skb, LL_RESERVED_SPACE(dev));
@@ -513,6 +494,42 @@ static void __ndisc_send(struct net_device *dev,
513 csum_partial((__u8 *) hdr, 494 csum_partial((__u8 *) hdr,
514 len, 0)); 495 len, 0));
515 496
497 return skb;
498}
499
500EXPORT_SYMBOL(ndisc_build_skb);
501
502void ndisc_send_skb(struct sk_buff *skb,
503 struct net_device *dev,
504 struct neighbour *neigh,
505 const struct in6_addr *daddr,
506 const struct in6_addr *saddr,
507 struct icmp6hdr *icmp6h)
508{
509 struct flowi fl;
510 struct dst_entry *dst;
511 struct net *net = dev_net(dev);
512 struct sock *sk = net->ipv6.ndisc_sk;
513 struct inet6_dev *idev;
514 int err;
515 u8 type;
516
517 type = icmp6h->icmp6_type;
518
519 icmpv6_flow_init(sk, &fl, type, saddr, daddr, dev->ifindex);
520
521 dst = icmp6_dst_alloc(dev, neigh, daddr);
522 if (!dst) {
523 kfree_skb(skb);
524 return;
525 }
526
527 err = xfrm_lookup(&dst, &fl, NULL, 0);
528 if (err < 0) {
529 kfree_skb(skb);
530 return;
531 }
532
516 skb->dst = dst; 533 skb->dst = dst;
517 534
518 idev = in6_dev_get(dst->dev); 535 idev = in6_dev_get(dst->dev);
@@ -529,6 +546,27 @@ static void __ndisc_send(struct net_device *dev,
529 in6_dev_put(idev); 546 in6_dev_put(idev);
530} 547}
531 548
549EXPORT_SYMBOL(ndisc_send_skb);
550
551/*
552 * Send a Neighbour Discover packet
553 */
554static void __ndisc_send(struct net_device *dev,
555 struct neighbour *neigh,
556 const struct in6_addr *daddr,
557 const struct in6_addr *saddr,
558 struct icmp6hdr *icmp6h, const struct in6_addr *target,
559 int llinfo)
560{
561 struct sk_buff *skb;
562
563 skb = ndisc_build_skb(dev, daddr, saddr, icmp6h, target, llinfo);
564 if (!skb)
565 return;
566
567 ndisc_send_skb(skb, dev, neigh, daddr, saddr, icmp6h);
568}
569
532static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, 570static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
533 const struct in6_addr *daddr, 571 const struct in6_addr *daddr,
534 const struct in6_addr *solicited_addr, 572 const struct in6_addr *solicited_addr,
@@ -647,11 +685,8 @@ static void ndisc_solicit(struct neighbour *neigh, struct sk_buff *skb)
647 685
648 if ((probes -= neigh->parms->ucast_probes) < 0) { 686 if ((probes -= neigh->parms->ucast_probes) < 0) {
649 if (!(neigh->nud_state & NUD_VALID)) { 687 if (!(neigh->nud_state & NUD_VALID)) {
650 ND_PRINTK1(KERN_DEBUG 688 ND_PRINTK1(KERN_DEBUG "%s(): trying to ucast probe in NUD_INVALID: %pI6\n",
651 "%s(): trying to ucast probe in NUD_INVALID: " 689 __func__, target);
652 NIP6_FMT "\n",
653 __func__,
654 NIP6(*target));
655 } 690 }
656 ndisc_send_ns(dev, neigh, target, target, saddr); 691 ndisc_send_ns(dev, neigh, target, target, saddr);
657 } else if ((probes -= neigh->parms->app_probes) < 0) { 692 } else if ((probes -= neigh->parms->app_probes) < 0) {
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index caa441d09567..7c668c63f708 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -61,7 +61,7 @@ static void dump_packet(const struct nf_loginfo *info,
61 } 61 }
62 62
63 /* Max length: 88 "SRC=0000.0000.0000.0000.0000.0000.0000.0000 DST=0000.0000.0000.0000.0000.0000.0000.0000 " */ 63 /* Max length: 88 "SRC=0000.0000.0000.0000.0000.0000.0000.0000 DST=0000.0000.0000.0000.0000.0000.0000.0000 " */
64 printk("SRC=" NIP6_FMT " DST=" NIP6_FMT " ", NIP6(ih->saddr), NIP6(ih->daddr)); 64 printk("SRC=%pI6 DST=%pI6 ", &ih->saddr, &ih->daddr);
65 65
66 /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */ 66 /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
67 printk("LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ", 67 printk("LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ",
@@ -424,9 +424,8 @@ ip6t_log_packet(u_int8_t pf,
424 if (skb->dev->type == ARPHRD_SIT) { 424 if (skb->dev->type == ARPHRD_SIT) {
425 const struct iphdr *iph = 425 const struct iphdr *iph =
426 (struct iphdr *)skb_mac_header(skb); 426 (struct iphdr *)skb_mac_header(skb);
427 printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", 427 printk("TUNNEL=%pI4->%pI4 ",
428 NIPQUAD(iph->saddr), 428 &iph->saddr, &iph->daddr);
429 NIPQUAD(iph->daddr));
430 } 429 }
431 } else 430 } else
432 printk(" "); 431 printk(" ");
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
index e91db16611d9..727b9530448a 100644
--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
@@ -56,9 +56,8 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
56static int ipv6_print_tuple(struct seq_file *s, 56static int ipv6_print_tuple(struct seq_file *s,
57 const struct nf_conntrack_tuple *tuple) 57 const struct nf_conntrack_tuple *tuple)
58{ 58{
59 return seq_printf(s, "src=" NIP6_FMT " dst=" NIP6_FMT " ", 59 return seq_printf(s, "src=%pI6 dst=%pI6 ",
60 NIP6(*((struct in6_addr *)tuple->src.u3.ip6)), 60 tuple->src.u3.ip6, tuple->dst.u3.ip6);
61 NIP6(*((struct in6_addr *)tuple->dst.u3.ip6)));
62} 61}
63 62
64/* 63/*
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index 05726177903f..bd52151d31e9 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -253,7 +253,7 @@ static struct ctl_table icmpv6_sysctl_table[] = {
253 .data = &nf_ct_icmpv6_timeout, 253 .data = &nf_ct_icmpv6_timeout,
254 .maxlen = sizeof(unsigned int), 254 .maxlen = sizeof(unsigned int),
255 .mode = 0644, 255 .mode = 0644,
256 .proc_handler = &proc_dointvec_jiffies, 256 .proc_handler = proc_dointvec_jiffies,
257 }, 257 },
258 { 258 {
259 .ctl_name = 0 259 .ctl_name = 0
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 9967ac7a01a8..ed4d79a9e4a6 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -80,7 +80,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = {
80 .data = &nf_init_frags.timeout, 80 .data = &nf_init_frags.timeout,
81 .maxlen = sizeof(unsigned int), 81 .maxlen = sizeof(unsigned int),
82 .mode = 0644, 82 .mode = 0644,
83 .proc_handler = &proc_dointvec_jiffies, 83 .proc_handler = proc_dointvec_jiffies,
84 }, 84 },
85 { 85 {
86 .ctl_name = NET_NF_CONNTRACK_FRAG6_LOW_THRESH, 86 .ctl_name = NET_NF_CONNTRACK_FRAG6_LOW_THRESH,
@@ -88,7 +88,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = {
88 .data = &nf_init_frags.low_thresh, 88 .data = &nf_init_frags.low_thresh,
89 .maxlen = sizeof(unsigned int), 89 .maxlen = sizeof(unsigned int),
90 .mode = 0644, 90 .mode = 0644,
91 .proc_handler = &proc_dointvec, 91 .proc_handler = proc_dointvec,
92 }, 92 },
93 { 93 {
94 .ctl_name = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH, 94 .ctl_name = NET_NF_CONNTRACK_FRAG6_HIGH_THRESH,
@@ -96,7 +96,7 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = {
96 .data = &nf_init_frags.high_thresh, 96 .data = &nf_init_frags.high_thresh,
97 .maxlen = sizeof(unsigned int), 97 .maxlen = sizeof(unsigned int),
98 .mode = 0644, 98 .mode = 0644,
99 .proc_handler = &proc_dointvec, 99 .proc_handler = proc_dointvec,
100 }, 100 },
101 { .ctl_name = 0 } 101 { .ctl_name = 0 }
102}; 102};
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index af12de071f4c..3c575118fca5 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -642,7 +642,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
642 .data = &init_net.ipv6.frags.high_thresh, 642 .data = &init_net.ipv6.frags.high_thresh,
643 .maxlen = sizeof(int), 643 .maxlen = sizeof(int),
644 .mode = 0644, 644 .mode = 0644,
645 .proc_handler = &proc_dointvec 645 .proc_handler = proc_dointvec
646 }, 646 },
647 { 647 {
648 .ctl_name = NET_IPV6_IP6FRAG_LOW_THRESH, 648 .ctl_name = NET_IPV6_IP6FRAG_LOW_THRESH,
@@ -650,7 +650,7 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
650 .data = &init_net.ipv6.frags.low_thresh, 650 .data = &init_net.ipv6.frags.low_thresh,
651 .maxlen = sizeof(int), 651 .maxlen = sizeof(int),
652 .mode = 0644, 652 .mode = 0644,
653 .proc_handler = &proc_dointvec 653 .proc_handler = proc_dointvec
654 }, 654 },
655 { 655 {
656 .ctl_name = NET_IPV6_IP6FRAG_TIME, 656 .ctl_name = NET_IPV6_IP6FRAG_TIME,
@@ -658,8 +658,8 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = {
658 .data = &init_net.ipv6.frags.timeout, 658 .data = &init_net.ipv6.frags.timeout,
659 .maxlen = sizeof(int), 659 .maxlen = sizeof(int),
660 .mode = 0644, 660 .mode = 0644,
661 .proc_handler = &proc_dointvec_jiffies, 661 .proc_handler = proc_dointvec_jiffies,
662 .strategy = &sysctl_jiffies, 662 .strategy = sysctl_jiffies,
663 }, 663 },
664 { } 664 { }
665}; 665};
@@ -671,8 +671,8 @@ static struct ctl_table ip6_frags_ctl_table[] = {
671 .data = &ip6_frags.secret_interval, 671 .data = &ip6_frags.secret_interval,
672 .maxlen = sizeof(int), 672 .maxlen = sizeof(int),
673 .mode = 0644, 673 .mode = 0644,
674 .proc_handler = &proc_dointvec_jiffies, 674 .proc_handler = proc_dointvec_jiffies,
675 .strategy = &sysctl_jiffies 675 .strategy = sysctl_jiffies
676 }, 676 },
677 { } 677 { }
678}; 678};
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 89dc69924340..4d40dc214b2d 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2408,19 +2408,16 @@ static int rt6_info_route(struct rt6_info *rt, void *p_arg)
2408{ 2408{
2409 struct seq_file *m = p_arg; 2409 struct seq_file *m = p_arg;
2410 2410
2411 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_dst.addr), 2411 seq_printf(m, "%pi6 %02x ", &rt->rt6i_dst.addr, rt->rt6i_dst.plen);
2412 rt->rt6i_dst.plen);
2413 2412
2414#ifdef CONFIG_IPV6_SUBTREES 2413#ifdef CONFIG_IPV6_SUBTREES
2415 seq_printf(m, NIP6_SEQFMT " %02x ", NIP6(rt->rt6i_src.addr), 2414 seq_printf(m, "%pi6 %02x ", &rt->rt6i_src.addr, rt->rt6i_src.plen);
2416 rt->rt6i_src.plen);
2417#else 2415#else
2418 seq_puts(m, "00000000000000000000000000000000 00 "); 2416 seq_puts(m, "00000000000000000000000000000000 00 ");
2419#endif 2417#endif
2420 2418
2421 if (rt->rt6i_nexthop) { 2419 if (rt->rt6i_nexthop) {
2422 seq_printf(m, NIP6_SEQFMT, 2420 seq_printf(m, "%pi6", rt->rt6i_nexthop->primary_key);
2423 NIP6(*((struct in6_addr *)rt->rt6i_nexthop->primary_key)));
2424 } else { 2421 } else {
2425 seq_puts(m, "00000000000000000000000000000000"); 2422 seq_puts(m, "00000000000000000000000000000000");
2426 } 2423 }
@@ -2502,7 +2499,7 @@ ctl_table ipv6_route_table_template[] = {
2502 .data = &init_net.ipv6.sysctl.flush_delay, 2499 .data = &init_net.ipv6.sysctl.flush_delay,
2503 .maxlen = sizeof(int), 2500 .maxlen = sizeof(int),
2504 .mode = 0200, 2501 .mode = 0200,
2505 .proc_handler = &ipv6_sysctl_rtcache_flush 2502 .proc_handler = ipv6_sysctl_rtcache_flush
2506 }, 2503 },
2507 { 2504 {
2508 .ctl_name = NET_IPV6_ROUTE_GC_THRESH, 2505 .ctl_name = NET_IPV6_ROUTE_GC_THRESH,
@@ -2510,7 +2507,7 @@ ctl_table ipv6_route_table_template[] = {
2510 .data = &ip6_dst_ops_template.gc_thresh, 2507 .data = &ip6_dst_ops_template.gc_thresh,
2511 .maxlen = sizeof(int), 2508 .maxlen = sizeof(int),
2512 .mode = 0644, 2509 .mode = 0644,
2513 .proc_handler = &proc_dointvec, 2510 .proc_handler = proc_dointvec,
2514 }, 2511 },
2515 { 2512 {
2516 .ctl_name = NET_IPV6_ROUTE_MAX_SIZE, 2513 .ctl_name = NET_IPV6_ROUTE_MAX_SIZE,
@@ -2518,7 +2515,7 @@ ctl_table ipv6_route_table_template[] = {
2518 .data = &init_net.ipv6.sysctl.ip6_rt_max_size, 2515 .data = &init_net.ipv6.sysctl.ip6_rt_max_size,
2519 .maxlen = sizeof(int), 2516 .maxlen = sizeof(int),
2520 .mode = 0644, 2517 .mode = 0644,
2521 .proc_handler = &proc_dointvec, 2518 .proc_handler = proc_dointvec,
2522 }, 2519 },
2523 { 2520 {
2524 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL, 2521 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL,
@@ -2526,8 +2523,8 @@ ctl_table ipv6_route_table_template[] = {
2526 .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, 2523 .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval,
2527 .maxlen = sizeof(int), 2524 .maxlen = sizeof(int),
2528 .mode = 0644, 2525 .mode = 0644,
2529 .proc_handler = &proc_dointvec_jiffies, 2526 .proc_handler = proc_dointvec_jiffies,
2530 .strategy = &sysctl_jiffies, 2527 .strategy = sysctl_jiffies,
2531 }, 2528 },
2532 { 2529 {
2533 .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT, 2530 .ctl_name = NET_IPV6_ROUTE_GC_TIMEOUT,
@@ -2535,8 +2532,8 @@ ctl_table ipv6_route_table_template[] = {
2535 .data = &init_net.ipv6.sysctl.ip6_rt_gc_timeout, 2532 .data = &init_net.ipv6.sysctl.ip6_rt_gc_timeout,
2536 .maxlen = sizeof(int), 2533 .maxlen = sizeof(int),
2537 .mode = 0644, 2534 .mode = 0644,
2538 .proc_handler = &proc_dointvec_jiffies, 2535 .proc_handler = proc_dointvec_jiffies,
2539 .strategy = &sysctl_jiffies, 2536 .strategy = sysctl_jiffies,
2540 }, 2537 },
2541 { 2538 {
2542 .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL, 2539 .ctl_name = NET_IPV6_ROUTE_GC_INTERVAL,
@@ -2544,8 +2541,8 @@ ctl_table ipv6_route_table_template[] = {
2544 .data = &init_net.ipv6.sysctl.ip6_rt_gc_interval, 2541 .data = &init_net.ipv6.sysctl.ip6_rt_gc_interval,
2545 .maxlen = sizeof(int), 2542 .maxlen = sizeof(int),
2546 .mode = 0644, 2543 .mode = 0644,
2547 .proc_handler = &proc_dointvec_jiffies, 2544 .proc_handler = proc_dointvec_jiffies,
2548 .strategy = &sysctl_jiffies, 2545 .strategy = sysctl_jiffies,
2549 }, 2546 },
2550 { 2547 {
2551 .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY, 2548 .ctl_name = NET_IPV6_ROUTE_GC_ELASTICITY,
@@ -2553,8 +2550,8 @@ ctl_table ipv6_route_table_template[] = {
2553 .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity, 2550 .data = &init_net.ipv6.sysctl.ip6_rt_gc_elasticity,
2554 .maxlen = sizeof(int), 2551 .maxlen = sizeof(int),
2555 .mode = 0644, 2552 .mode = 0644,
2556 .proc_handler = &proc_dointvec_jiffies, 2553 .proc_handler = proc_dointvec_jiffies,
2557 .strategy = &sysctl_jiffies, 2554 .strategy = sysctl_jiffies,
2558 }, 2555 },
2559 { 2556 {
2560 .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES, 2557 .ctl_name = NET_IPV6_ROUTE_MTU_EXPIRES,
@@ -2562,8 +2559,8 @@ ctl_table ipv6_route_table_template[] = {
2562 .data = &init_net.ipv6.sysctl.ip6_rt_mtu_expires, 2559 .data = &init_net.ipv6.sysctl.ip6_rt_mtu_expires,
2563 .maxlen = sizeof(int), 2560 .maxlen = sizeof(int),
2564 .mode = 0644, 2561 .mode = 0644,
2565 .proc_handler = &proc_dointvec_jiffies, 2562 .proc_handler = proc_dointvec_jiffies,
2566 .strategy = &sysctl_jiffies, 2563 .strategy = sysctl_jiffies,
2567 }, 2564 },
2568 { 2565 {
2569 .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS, 2566 .ctl_name = NET_IPV6_ROUTE_MIN_ADVMSS,
@@ -2571,8 +2568,8 @@ ctl_table ipv6_route_table_template[] = {
2571 .data = &init_net.ipv6.sysctl.ip6_rt_min_advmss, 2568 .data = &init_net.ipv6.sysctl.ip6_rt_min_advmss,
2572 .maxlen = sizeof(int), 2569 .maxlen = sizeof(int),
2573 .mode = 0644, 2570 .mode = 0644,
2574 .proc_handler = &proc_dointvec_jiffies, 2571 .proc_handler = proc_dointvec_jiffies,
2575 .strategy = &sysctl_jiffies, 2572 .strategy = sysctl_jiffies,
2576 }, 2573 },
2577 { 2574 {
2578 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS, 2575 .ctl_name = NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
@@ -2580,8 +2577,8 @@ ctl_table ipv6_route_table_template[] = {
2580 .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval, 2577 .data = &init_net.ipv6.sysctl.ip6_rt_gc_min_interval,
2581 .maxlen = sizeof(int), 2578 .maxlen = sizeof(int),
2582 .mode = 0644, 2579 .mode = 0644,
2583 .proc_handler = &proc_dointvec_ms_jiffies, 2580 .proc_handler = proc_dointvec_ms_jiffies,
2584 .strategy = &sysctl_ms_jiffies, 2581 .strategy = sysctl_ms_jiffies,
2585 }, 2582 },
2586 { .ctl_name = 0 } 2583 { .ctl_name = 0 }
2587}; 2584};
diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
index 587f8f60c489..9048fe7e7ea7 100644
--- a/net/ipv6/sysctl_net_ipv6.c
+++ b/net/ipv6/sysctl_net_ipv6.c
@@ -35,7 +35,7 @@ static ctl_table ipv6_table_template[] = {
35 .data = &init_net.ipv6.sysctl.bindv6only, 35 .data = &init_net.ipv6.sysctl.bindv6only,
36 .maxlen = sizeof(int), 36 .maxlen = sizeof(int),
37 .mode = 0644, 37 .mode = 0644,
38 .proc_handler = &proc_dointvec 38 .proc_handler = proc_dointvec
39 }, 39 },
40 { .ctl_name = 0 } 40 { .ctl_name = 0 }
41}; 41};
@@ -47,7 +47,7 @@ static ctl_table ipv6_table[] = {
47 .data = &sysctl_mld_max_msf, 47 .data = &sysctl_mld_max_msf,
48 .maxlen = sizeof(int), 48 .maxlen = sizeof(int),
49 .mode = 0644, 49 .mode = 0644,
50 .proc_handler = &proc_dointvec 50 .proc_handler = proc_dointvec
51 }, 51 },
52 { .ctl_name = 0 } 52 { .ctl_name = 0 }
53}; 53};
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b6b356b7912a..984276463a8d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -872,12 +872,10 @@ static int tcp_v6_inbound_md5_hash (struct sock *sk, struct sk_buff *skb)
872 872
873 if (genhash || memcmp(hash_location, newhash, 16) != 0) { 873 if (genhash || memcmp(hash_location, newhash, 16) != 0) {
874 if (net_ratelimit()) { 874 if (net_ratelimit()) {
875 printk(KERN_INFO "MD5 Hash %s for " 875 printk(KERN_INFO "MD5 Hash %s for (%pI6, %u)->(%pI6, %u)\n",
876 "(" NIP6_FMT ", %u)->"
877 "(" NIP6_FMT ", %u)\n",
878 genhash ? "failed" : "mismatch", 876 genhash ? "failed" : "mismatch",
879 NIP6(ip6h->saddr), ntohs(th->source), 877 &ip6h->saddr, ntohs(th->source),
880 NIP6(ip6h->daddr), ntohs(th->dest)); 878 &ip6h->daddr, ntohs(th->dest));
881 } 879 }
882 return 1; 880 return 1;
883 } 881 }
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index 8b48512ebf6a..8dafa36b1ba5 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -54,62 +54,89 @@ int udp_v6_get_port(struct sock *sk, unsigned short snum)
54 return udp_lib_get_port(sk, snum, ipv6_rcv_saddr_equal); 54 return udp_lib_get_port(sk, snum, ipv6_rcv_saddr_equal);
55} 55}
56 56
57static inline int compute_score(struct sock *sk, struct net *net,
58 unsigned short hnum,
59 struct in6_addr *saddr, __be16 sport,
60 struct in6_addr *daddr, __be16 dport,
61 int dif)
62{
63 int score = -1;
64
65 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum &&
66 sk->sk_family == PF_INET6) {
67 struct ipv6_pinfo *np = inet6_sk(sk);
68 struct inet_sock *inet = inet_sk(sk);
69
70 score = 0;
71 if (inet->dport) {
72 if (inet->dport != sport)
73 return -1;
74 score++;
75 }
76 if (!ipv6_addr_any(&np->rcv_saddr)) {
77 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
78 return -1;
79 score++;
80 }
81 if (!ipv6_addr_any(&np->daddr)) {
82 if (!ipv6_addr_equal(&np->daddr, saddr))
83 return -1;
84 score++;
85 }
86 if (sk->sk_bound_dev_if) {
87 if (sk->sk_bound_dev_if != dif)
88 return -1;
89 score++;
90 }
91 }
92 return score;
93}
94
57static struct sock *__udp6_lib_lookup(struct net *net, 95static struct sock *__udp6_lib_lookup(struct net *net,
58 struct in6_addr *saddr, __be16 sport, 96 struct in6_addr *saddr, __be16 sport,
59 struct in6_addr *daddr, __be16 dport, 97 struct in6_addr *daddr, __be16 dport,
60 int dif, struct hlist_head udptable[]) 98 int dif, struct udp_table *udptable)
61{ 99{
62 struct sock *sk, *result = NULL; 100 struct sock *sk, *result;
63 struct hlist_node *node; 101 struct hlist_node *node, *next;
64 unsigned short hnum = ntohs(dport); 102 unsigned short hnum = ntohs(dport);
65 int badness = -1; 103 unsigned int hash = udp_hashfn(net, hnum);
66 104 struct udp_hslot *hslot = &udptable->hash[hash];
67 read_lock(&udp_hash_lock); 105 int score, badness;
68 sk_for_each(sk, node, &udptable[udp_hashfn(net, hnum)]) { 106
69 struct inet_sock *inet = inet_sk(sk); 107 rcu_read_lock();
70 108begin:
71 if (net_eq(sock_net(sk), net) && sk->sk_hash == hnum && 109 result = NULL;
72 sk->sk_family == PF_INET6) { 110 badness = -1;
73 struct ipv6_pinfo *np = inet6_sk(sk); 111 sk_for_each_rcu_safenext(sk, node, &hslot->head, next) {
74 int score = 0; 112 /*
75 if (inet->dport) { 113 * lockless reader, and SLAB_DESTROY_BY_RCU items:
76 if (inet->dport != sport) 114 * We must check this item was not moved to another chain
77 continue; 115 */
78 score++; 116 if (udp_hashfn(net, sk->sk_hash) != hash)
79 } 117 goto begin;
80 if (!ipv6_addr_any(&np->rcv_saddr)) { 118 score = compute_score(sk, net, hnum, saddr, sport, daddr, dport, dif);
81 if (!ipv6_addr_equal(&np->rcv_saddr, daddr)) 119 if (score > badness) {
82 continue; 120 result = sk;
83 score++; 121 badness = score;
84 } 122 }
85 if (!ipv6_addr_any(&np->daddr)) { 123 }
86 if (!ipv6_addr_equal(&np->daddr, saddr)) 124 if (result) {
87 continue; 125 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
88 score++; 126 result = NULL;
89 } 127 else if (unlikely(compute_score(result, net, hnum, saddr, sport,
90 if (sk->sk_bound_dev_if) { 128 daddr, dport, dif) < badness)) {
91 if (sk->sk_bound_dev_if != dif) 129 sock_put(result);
92 continue; 130 goto begin;
93 score++;
94 }
95 if (score == 4) {
96 result = sk;
97 break;
98 } else if (score > badness) {
99 result = sk;
100 badness = score;
101 }
102 } 131 }
103 } 132 }
104 if (result) 133 rcu_read_unlock();
105 sock_hold(result);
106 read_unlock(&udp_hash_lock);
107 return result; 134 return result;
108} 135}
109 136
110static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb, 137static struct sock *__udp6_lib_lookup_skb(struct sk_buff *skb,
111 __be16 sport, __be16 dport, 138 __be16 sport, __be16 dport,
112 struct hlist_head udptable[]) 139 struct udp_table *udptable)
113{ 140{
114 struct sock *sk; 141 struct sock *sk;
115 struct ipv6hdr *iph = ipv6_hdr(skb); 142 struct ipv6hdr *iph = ipv6_hdr(skb);
@@ -253,7 +280,7 @@ csum_copy_err:
253 280
254void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt, 281void __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
255 int type, int code, int offset, __be32 info, 282 int type, int code, int offset, __be32 info,
256 struct hlist_head udptable[] ) 283 struct udp_table *udptable)
257{ 284{
258 struct ipv6_pinfo *np; 285 struct ipv6_pinfo *np;
259 struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; 286 struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data;
@@ -289,7 +316,7 @@ static __inline__ void udpv6_err(struct sk_buff *skb,
289 struct inet6_skb_parm *opt, int type, 316 struct inet6_skb_parm *opt, int type,
290 int code, int offset, __be32 info ) 317 int code, int offset, __be32 info )
291{ 318{
292 __udp6_lib_err(skb, opt, type, code, offset, info, udp_hash); 319 __udp6_lib_err(skb, opt, type, code, offset, info, &udp_table);
293} 320}
294 321
295int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb) 322int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
@@ -388,14 +415,15 @@ static struct sock *udp_v6_mcast_next(struct net *net, struct sock *sk,
388 */ 415 */
389static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb, 416static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
390 struct in6_addr *saddr, struct in6_addr *daddr, 417 struct in6_addr *saddr, struct in6_addr *daddr,
391 struct hlist_head udptable[]) 418 struct udp_table *udptable)
392{ 419{
393 struct sock *sk, *sk2; 420 struct sock *sk, *sk2;
394 const struct udphdr *uh = udp_hdr(skb); 421 const struct udphdr *uh = udp_hdr(skb);
422 struct udp_hslot *hslot = &udptable->hash[udp_hashfn(net, ntohs(uh->dest))];
395 int dif; 423 int dif;
396 424
397 read_lock(&udp_hash_lock); 425 spin_lock(&hslot->lock);
398 sk = sk_head(&udptable[udp_hashfn(net, ntohs(uh->dest))]); 426 sk = sk_head(&hslot->head);
399 dif = inet6_iif(skb); 427 dif = inet6_iif(skb);
400 sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif); 428 sk = udp_v6_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
401 if (!sk) { 429 if (!sk) {
@@ -423,7 +451,7 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
423 sk_add_backlog(sk, skb); 451 sk_add_backlog(sk, skb);
424 bh_unlock_sock(sk); 452 bh_unlock_sock(sk);
425out: 453out:
426 read_unlock(&udp_hash_lock); 454 spin_unlock(&hslot->lock);
427 return 0; 455 return 0;
428} 456}
429 457
@@ -461,7 +489,7 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
461 return 0; 489 return 0;
462} 490}
463 491
464int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[], 492int __udp6_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
465 int proto) 493 int proto)
466{ 494{
467 struct sock *sk; 495 struct sock *sk;
@@ -558,7 +586,7 @@ discard:
558 586
559static __inline__ int udpv6_rcv(struct sk_buff *skb) 587static __inline__ int udpv6_rcv(struct sk_buff *skb)
560{ 588{
561 return __udp6_lib_rcv(skb, udp_hash, IPPROTO_UDP); 589 return __udp6_lib_rcv(skb, &udp_table, IPPROTO_UDP);
562} 590}
563 591
564/* 592/*
@@ -1022,7 +1050,7 @@ int udp6_seq_show(struct seq_file *seq, void *v)
1022static struct udp_seq_afinfo udp6_seq_afinfo = { 1050static struct udp_seq_afinfo udp6_seq_afinfo = {
1023 .name = "udp6", 1051 .name = "udp6",
1024 .family = AF_INET6, 1052 .family = AF_INET6,
1025 .hashtable = udp_hash, 1053 .udp_table = &udp_table,
1026 .seq_fops = { 1054 .seq_fops = {
1027 .owner = THIS_MODULE, 1055 .owner = THIS_MODULE,
1028 }, 1056 },
@@ -1064,7 +1092,8 @@ struct proto udpv6_prot = {
1064 .sysctl_wmem = &sysctl_udp_wmem_min, 1092 .sysctl_wmem = &sysctl_udp_wmem_min,
1065 .sysctl_rmem = &sysctl_udp_rmem_min, 1093 .sysctl_rmem = &sysctl_udp_rmem_min,
1066 .obj_size = sizeof(struct udp6_sock), 1094 .obj_size = sizeof(struct udp6_sock),
1067 .h.udp_hash = udp_hash, 1095 .slab_flags = SLAB_DESTROY_BY_RCU,
1096 .h.udp_table = &udp_table,
1068#ifdef CONFIG_COMPAT 1097#ifdef CONFIG_COMPAT
1069 .compat_setsockopt = compat_udpv6_setsockopt, 1098 .compat_setsockopt = compat_udpv6_setsockopt,
1070 .compat_getsockopt = compat_udpv6_getsockopt, 1099 .compat_getsockopt = compat_udpv6_getsockopt,
diff --git a/net/ipv6/udp_impl.h b/net/ipv6/udp_impl.h
index 92dd7da766d8..23779208c334 100644
--- a/net/ipv6/udp_impl.h
+++ b/net/ipv6/udp_impl.h
@@ -7,9 +7,9 @@
7#include <net/inet_common.h> 7#include <net/inet_common.h>
8#include <net/transp_v6.h> 8#include <net/transp_v6.h>
9 9
10extern int __udp6_lib_rcv(struct sk_buff *, struct hlist_head [], int ); 10extern int __udp6_lib_rcv(struct sk_buff *, struct udp_table *, int );
11extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *, 11extern void __udp6_lib_err(struct sk_buff *, struct inet6_skb_parm *,
12 int , int , int , __be32 , struct hlist_head []); 12 int , int , int , __be32 , struct udp_table *);
13 13
14extern int udp_v6_get_port(struct sock *sk, unsigned short snum); 14extern int udp_v6_get_port(struct sock *sk, unsigned short snum);
15 15
diff --git a/net/ipv6/udplite.c b/net/ipv6/udplite.c
index 3cd1a1ac3d6c..ba162a824585 100644
--- a/net/ipv6/udplite.c
+++ b/net/ipv6/udplite.c
@@ -15,14 +15,14 @@
15 15
16static int udplitev6_rcv(struct sk_buff *skb) 16static int udplitev6_rcv(struct sk_buff *skb)
17{ 17{
18 return __udp6_lib_rcv(skb, udplite_hash, IPPROTO_UDPLITE); 18 return __udp6_lib_rcv(skb, &udplite_table, IPPROTO_UDPLITE);
19} 19}
20 20
21static void udplitev6_err(struct sk_buff *skb, 21static void udplitev6_err(struct sk_buff *skb,
22 struct inet6_skb_parm *opt, 22 struct inet6_skb_parm *opt,
23 int type, int code, int offset, __be32 info) 23 int type, int code, int offset, __be32 info)
24{ 24{
25 __udp6_lib_err(skb, opt, type, code, offset, info, udplite_hash); 25 __udp6_lib_err(skb, opt, type, code, offset, info, &udplite_table);
26} 26}
27 27
28static struct inet6_protocol udplitev6_protocol = { 28static struct inet6_protocol udplitev6_protocol = {
@@ -49,7 +49,8 @@ struct proto udplitev6_prot = {
49 .unhash = udp_lib_unhash, 49 .unhash = udp_lib_unhash,
50 .get_port = udp_v6_get_port, 50 .get_port = udp_v6_get_port,
51 .obj_size = sizeof(struct udp6_sock), 51 .obj_size = sizeof(struct udp6_sock),
52 .h.udp_hash = udplite_hash, 52 .slab_flags = SLAB_DESTROY_BY_RCU,
53 .h.udp_table = &udplite_table,
53#ifdef CONFIG_COMPAT 54#ifdef CONFIG_COMPAT
54 .compat_setsockopt = compat_udpv6_setsockopt, 55 .compat_setsockopt = compat_udpv6_setsockopt,
55 .compat_getsockopt = compat_udpv6_getsockopt, 56 .compat_getsockopt = compat_udpv6_getsockopt,
@@ -95,7 +96,7 @@ void udplitev6_exit(void)
95static struct udp_seq_afinfo udplite6_seq_afinfo = { 96static struct udp_seq_afinfo udplite6_seq_afinfo = {
96 .name = "udplite6", 97 .name = "udplite6",
97 .family = AF_INET6, 98 .family = AF_INET6,
98 .hashtable = udplite_hash, 99 .udp_table = &udplite_table,
99 .seq_fops = { 100 .seq_fops = {
100 .owner = THIS_MODULE, 101 .owner = THIS_MODULE,
101 }, 102 },
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 08e4cbbe3f04..604bc0a96c05 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -144,6 +144,7 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev)
144static inline void 144static inline void
145_decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) 145_decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
146{ 146{
147 int onlyproto = 0;
147 u16 offset = skb_network_header_len(skb); 148 u16 offset = skb_network_header_len(skb);
148 struct ipv6hdr *hdr = ipv6_hdr(skb); 149 struct ipv6hdr *hdr = ipv6_hdr(skb);
149 struct ipv6_opt_hdr *exthdr; 150 struct ipv6_opt_hdr *exthdr;
@@ -159,6 +160,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
159 exthdr = (struct ipv6_opt_hdr *)(nh + offset); 160 exthdr = (struct ipv6_opt_hdr *)(nh + offset);
160 161
161 switch (nexthdr) { 162 switch (nexthdr) {
163 case NEXTHDR_FRAGMENT:
164 onlyproto = 1;
162 case NEXTHDR_ROUTING: 165 case NEXTHDR_ROUTING:
163 case NEXTHDR_HOP: 166 case NEXTHDR_HOP:
164 case NEXTHDR_DEST: 167 case NEXTHDR_DEST:
@@ -172,7 +175,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
172 case IPPROTO_TCP: 175 case IPPROTO_TCP:
173 case IPPROTO_SCTP: 176 case IPPROTO_SCTP:
174 case IPPROTO_DCCP: 177 case IPPROTO_DCCP:
175 if (pskb_may_pull(skb, nh + offset + 4 - skb->data)) { 178 if (!onlyproto && pskb_may_pull(skb, nh + offset + 4 - skb->data)) {
176 __be16 *ports = (__be16 *)exthdr; 179 __be16 *ports = (__be16 *)exthdr;
177 180
178 fl->fl_ip_sport = ports[!!reverse]; 181 fl->fl_ip_sport = ports[!!reverse];
@@ -182,7 +185,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
182 return; 185 return;
183 186
184 case IPPROTO_ICMPV6: 187 case IPPROTO_ICMPV6:
185 if (pskb_may_pull(skb, nh + offset + 2 - skb->data)) { 188 if (!onlyproto && pskb_may_pull(skb, nh + offset + 2 - skb->data)) {
186 u8 *icmp = (u8 *)exthdr; 189 u8 *icmp = (u8 *)exthdr;
187 190
188 fl->fl_icmp_type = icmp[0]; 191 fl->fl_icmp_type = icmp[0];
@@ -193,7 +196,7 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse)
193 196
194#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 197#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
195 case IPPROTO_MH: 198 case IPPROTO_MH:
196 if (pskb_may_pull(skb, nh + offset + 3 - skb->data)) { 199 if (!onlyproto && pskb_may_pull(skb, nh + offset + 3 - skb->data)) {
197 struct ip6_mh *mh; 200 struct ip6_mh *mh;
198 mh = (struct ip6_mh *)exthdr; 201 mh = (struct ip6_mh *)exthdr;
199 202