diff options
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/af_inet6.c | 4 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 17 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 18 | ||||
-rw-r--r-- | net/ipv6/ip6_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 9 | ||||
-rw-r--r-- | net/ipv6/ipv6_sockglue.c | 5 | ||||
-rw-r--r-- | net/ipv6/ndisc.c | 24 | ||||
-rw-r--r-- | net/ipv6/protocol.c | 15 | ||||
-rw-r--r-- | net/ipv6/raw.c | 9 | ||||
-rw-r--r-- | net/ipv6/route.c | 34 | ||||
-rw-r--r-- | net/ipv6/sit.c | 5 | ||||
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 21 | ||||
-rw-r--r-- | net/ipv6/udp.c | 17 |
13 files changed, 79 insertions, 101 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index bf85d5f97032..a123a328aeb3 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -306,8 +306,10 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
306 | v4addr != htonl(INADDR_ANY) && | 306 | v4addr != htonl(INADDR_ANY) && |
307 | chk_addr_ret != RTN_LOCAL && | 307 | chk_addr_ret != RTN_LOCAL && |
308 | chk_addr_ret != RTN_MULTICAST && | 308 | chk_addr_ret != RTN_MULTICAST && |
309 | chk_addr_ret != RTN_BROADCAST) | 309 | chk_addr_ret != RTN_BROADCAST) { |
310 | err = -EADDRNOTAVAIL; | ||
310 | goto out; | 311 | goto out; |
312 | } | ||
311 | } else { | 313 | } else { |
312 | if (addr_type != IPV6_ADDR_ANY) { | 314 | if (addr_type != IPV6_ADDR_ANY) { |
313 | struct net_device *dev = NULL; | 315 | struct net_device *dev = NULL; |
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index eab62a7a8f06..e2325f6a05fb 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -323,7 +323,7 @@ void icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, | |||
323 | int iif = 0; | 323 | int iif = 0; |
324 | int addr_type = 0; | 324 | int addr_type = 0; |
325 | int len; | 325 | int len; |
326 | int hlimit, tclass; | 326 | int hlimit; |
327 | int err = 0; | 327 | int err = 0; |
328 | 328 | ||
329 | if ((u8 *)hdr < skb->head || | 329 | if ((u8 *)hdr < skb->head || |
@@ -469,10 +469,6 @@ route_done: | |||
469 | if (hlimit < 0) | 469 | if (hlimit < 0) |
470 | hlimit = ip6_dst_hoplimit(dst); | 470 | hlimit = ip6_dst_hoplimit(dst); |
471 | 471 | ||
472 | tclass = np->tclass; | ||
473 | if (tclass < 0) | ||
474 | tclass = 0; | ||
475 | |||
476 | msg.skb = skb; | 472 | msg.skb = skb; |
477 | msg.offset = skb_network_offset(skb); | 473 | msg.offset = skb_network_offset(skb); |
478 | msg.type = type; | 474 | msg.type = type; |
@@ -488,8 +484,8 @@ route_done: | |||
488 | 484 | ||
489 | err = ip6_append_data(sk, icmpv6_getfrag, &msg, | 485 | err = ip6_append_data(sk, icmpv6_getfrag, &msg, |
490 | len + sizeof(struct icmp6hdr), | 486 | len + sizeof(struct icmp6hdr), |
491 | sizeof(struct icmp6hdr), | 487 | sizeof(struct icmp6hdr), hlimit, |
492 | hlimit, tclass, NULL, &fl, (struct rt6_info*)dst, | 488 | np->tclass, NULL, &fl, (struct rt6_info*)dst, |
493 | MSG_DONTWAIT); | 489 | MSG_DONTWAIT); |
494 | if (err) { | 490 | if (err) { |
495 | ip6_flush_pending_frames(sk); | 491 | ip6_flush_pending_frames(sk); |
@@ -522,7 +518,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
522 | struct dst_entry *dst; | 518 | struct dst_entry *dst; |
523 | int err = 0; | 519 | int err = 0; |
524 | int hlimit; | 520 | int hlimit; |
525 | int tclass; | ||
526 | 521 | ||
527 | saddr = &ipv6_hdr(skb)->daddr; | 522 | saddr = &ipv6_hdr(skb)->daddr; |
528 | 523 | ||
@@ -562,10 +557,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
562 | if (hlimit < 0) | 557 | if (hlimit < 0) |
563 | hlimit = ip6_dst_hoplimit(dst); | 558 | hlimit = ip6_dst_hoplimit(dst); |
564 | 559 | ||
565 | tclass = np->tclass; | ||
566 | if (tclass < 0) | ||
567 | tclass = 0; | ||
568 | |||
569 | idev = in6_dev_get(skb->dev); | 560 | idev = in6_dev_get(skb->dev); |
570 | 561 | ||
571 | msg.skb = skb; | 562 | msg.skb = skb; |
@@ -573,7 +564,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
573 | msg.type = ICMPV6_ECHO_REPLY; | 564 | msg.type = ICMPV6_ECHO_REPLY; |
574 | 565 | ||
575 | err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr), | 566 | err = ip6_append_data(sk, icmpv6_getfrag, &msg, skb->len + sizeof(struct icmp6hdr), |
576 | sizeof(struct icmp6hdr), hlimit, tclass, NULL, &fl, | 567 | sizeof(struct icmp6hdr), hlimit, np->tclass, NULL, &fl, |
577 | (struct rt6_info*)dst, MSG_DONTWAIT); | 568 | (struct rt6_info*)dst, MSG_DONTWAIT); |
578 | 569 | ||
579 | if (err) { | 570 | if (err) { |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 93beee944657..cd48801a8d6f 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -194,7 +194,8 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
194 | struct ipv6hdr *hdr; | 194 | struct ipv6hdr *hdr; |
195 | u8 proto = fl->proto; | 195 | u8 proto = fl->proto; |
196 | int seg_len = skb->len; | 196 | int seg_len = skb->len; |
197 | int hlimit, tclass; | 197 | int hlimit = -1; |
198 | int tclass = 0; | ||
198 | u32 mtu; | 199 | u32 mtu; |
199 | 200 | ||
200 | if (opt) { | 201 | if (opt) { |
@@ -237,19 +238,13 @@ int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl, | |||
237 | /* | 238 | /* |
238 | * Fill in the IPv6 header | 239 | * Fill in the IPv6 header |
239 | */ | 240 | */ |
240 | 241 | if (np) { | |
241 | hlimit = -1; | 242 | tclass = np->tclass; |
242 | if (np) | ||
243 | hlimit = np->hop_limit; | 243 | hlimit = np->hop_limit; |
244 | } | ||
244 | if (hlimit < 0) | 245 | if (hlimit < 0) |
245 | hlimit = ip6_dst_hoplimit(dst); | 246 | hlimit = ip6_dst_hoplimit(dst); |
246 | 247 | ||
247 | tclass = -1; | ||
248 | if (np) | ||
249 | tclass = np->tclass; | ||
250 | if (tclass < 0) | ||
251 | tclass = 0; | ||
252 | |||
253 | *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel; | 248 | *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | fl->fl6_flowlabel; |
254 | 249 | ||
255 | hdr->payload_len = htons(seg_len); | 250 | hdr->payload_len = htons(seg_len); |
@@ -1516,7 +1511,7 @@ int ip6_push_pending_frames(struct sock *sk) | |||
1516 | err = ip6_local_out(skb); | 1511 | err = ip6_local_out(skb); |
1517 | if (err) { | 1512 | if (err) { |
1518 | if (err > 0) | 1513 | if (err > 0) |
1519 | err = np->recverr ? net_xmit_errno(err) : 0; | 1514 | err = net_xmit_errno(err); |
1520 | if (err) | 1515 | if (err) |
1521 | goto error; | 1516 | goto error; |
1522 | } | 1517 | } |
@@ -1525,6 +1520,7 @@ out: | |||
1525 | ip6_cork_release(inet, np); | 1520 | ip6_cork_release(inet, np); |
1526 | return err; | 1521 | return err; |
1527 | error: | 1522 | error: |
1523 | IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | ||
1528 | goto out; | 1524 | goto out; |
1529 | } | 1525 | } |
1530 | 1526 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index a1d6045c4694..7d25bbe32110 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -1036,7 +1036,7 @@ ip6ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1036 | return 0; | 1036 | return 0; |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | static int | 1039 | static netdev_tx_t |
1040 | ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) | 1040 | ip6_tnl_xmit(struct sk_buff *skb, struct net_device *dev) |
1041 | { | 1041 | { |
1042 | struct ip6_tnl *t = netdev_priv(dev); | 1042 | struct ip6_tnl *t = netdev_priv(dev); |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 07ded5075b33..5c8d73730c75 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -204,7 +204,7 @@ static int ip6mr_vif_seq_show(struct seq_file *seq, void *v) | |||
204 | return 0; | 204 | return 0; |
205 | } | 205 | } |
206 | 206 | ||
207 | static struct seq_operations ip6mr_vif_seq_ops = { | 207 | static const struct seq_operations ip6mr_vif_seq_ops = { |
208 | .start = ip6mr_vif_seq_start, | 208 | .start = ip6mr_vif_seq_start, |
209 | .next = ip6mr_vif_seq_next, | 209 | .next = ip6mr_vif_seq_next, |
210 | .stop = ip6mr_vif_seq_stop, | 210 | .stop = ip6mr_vif_seq_stop, |
@@ -217,7 +217,7 @@ static int ip6mr_vif_open(struct inode *inode, struct file *file) | |||
217 | sizeof(struct ipmr_vif_iter)); | 217 | sizeof(struct ipmr_vif_iter)); |
218 | } | 218 | } |
219 | 219 | ||
220 | static struct file_operations ip6mr_vif_fops = { | 220 | static const struct file_operations ip6mr_vif_fops = { |
221 | .owner = THIS_MODULE, | 221 | .owner = THIS_MODULE, |
222 | .open = ip6mr_vif_open, | 222 | .open = ip6mr_vif_open, |
223 | .read = seq_read, | 223 | .read = seq_read, |
@@ -341,7 +341,7 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file) | |||
341 | sizeof(struct ipmr_mfc_iter)); | 341 | sizeof(struct ipmr_mfc_iter)); |
342 | } | 342 | } |
343 | 343 | ||
344 | static struct file_operations ip6mr_mfc_fops = { | 344 | static const struct file_operations ip6mr_mfc_fops = { |
345 | .owner = THIS_MODULE, | 345 | .owner = THIS_MODULE, |
346 | .open = ipmr_mfc_open, | 346 | .open = ipmr_mfc_open, |
347 | .read = seq_read, | 347 | .read = seq_read, |
@@ -416,7 +416,8 @@ static struct inet6_protocol pim6_protocol = { | |||
416 | 416 | ||
417 | /* Service routines creating virtual interfaces: PIMREG */ | 417 | /* Service routines creating virtual interfaces: PIMREG */ |
418 | 418 | ||
419 | static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev) | 419 | static netdev_tx_t reg_vif_xmit(struct sk_buff *skb, |
420 | struct net_device *dev) | ||
420 | { | 421 | { |
421 | struct net *net = dev_net(dev); | 422 | struct net *net = dev_net(dev); |
422 | 423 | ||
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index a7fdf9a27f15..f5e0682b402d 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
@@ -315,6 +315,9 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname, | |||
315 | goto e_inval; | 315 | goto e_inval; |
316 | if (val < -1 || val > 0xff) | 316 | if (val < -1 || val > 0xff) |
317 | goto e_inval; | 317 | goto e_inval; |
318 | /* RFC 3542, 6.5: default traffic class of 0x0 */ | ||
319 | if (val == -1) | ||
320 | val = 0; | ||
318 | np->tclass = val; | 321 | np->tclass = val; |
319 | retv = 0; | 322 | retv = 0; |
320 | break; | 323 | break; |
@@ -1037,8 +1040,6 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname, | |||
1037 | 1040 | ||
1038 | case IPV6_TCLASS: | 1041 | case IPV6_TCLASS: |
1039 | val = np->tclass; | 1042 | val = np->tclass; |
1040 | if (val < 0) | ||
1041 | val = 0; | ||
1042 | break; | 1043 | break; |
1043 | 1044 | ||
1044 | case IPV6_RECVTCLASS: | 1045 | case IPV6_RECVTCLASS: |
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 9eb68e92cc18..7015478797f6 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -98,7 +98,7 @@ static int pndisc_constructor(struct pneigh_entry *n); | |||
98 | static void pndisc_destructor(struct pneigh_entry *n); | 98 | static void pndisc_destructor(struct pneigh_entry *n); |
99 | static void pndisc_redo(struct sk_buff *skb); | 99 | static void pndisc_redo(struct sk_buff *skb); |
100 | 100 | ||
101 | static struct neigh_ops ndisc_generic_ops = { | 101 | static const struct neigh_ops ndisc_generic_ops = { |
102 | .family = AF_INET6, | 102 | .family = AF_INET6, |
103 | .solicit = ndisc_solicit, | 103 | .solicit = ndisc_solicit, |
104 | .error_report = ndisc_error_report, | 104 | .error_report = ndisc_error_report, |
@@ -108,7 +108,7 @@ static struct neigh_ops ndisc_generic_ops = { | |||
108 | .queue_xmit = dev_queue_xmit, | 108 | .queue_xmit = dev_queue_xmit, |
109 | }; | 109 | }; |
110 | 110 | ||
111 | static struct neigh_ops ndisc_hh_ops = { | 111 | static const struct neigh_ops ndisc_hh_ops = { |
112 | .family = AF_INET6, | 112 | .family = AF_INET6, |
113 | .solicit = ndisc_solicit, | 113 | .solicit = ndisc_solicit, |
114 | .error_report = ndisc_error_report, | 114 | .error_report = ndisc_error_report, |
@@ -119,7 +119,7 @@ static struct neigh_ops ndisc_hh_ops = { | |||
119 | }; | 119 | }; |
120 | 120 | ||
121 | 121 | ||
122 | static struct neigh_ops ndisc_direct_ops = { | 122 | static const struct neigh_ops ndisc_direct_ops = { |
123 | .family = AF_INET6, | 123 | .family = AF_INET6, |
124 | .output = dev_queue_xmit, | 124 | .output = dev_queue_xmit, |
125 | .connected_output = dev_queue_xmit, | 125 | .connected_output = dev_queue_xmit, |
@@ -955,8 +955,8 @@ static void ndisc_recv_na(struct sk_buff *skb) | |||
955 | */ | 955 | */ |
956 | if (skb->pkt_type != PACKET_LOOPBACK) | 956 | if (skb->pkt_type != PACKET_LOOPBACK) |
957 | ND_PRINTK1(KERN_WARNING | 957 | ND_PRINTK1(KERN_WARNING |
958 | "ICMPv6 NA: someone advertises our address on %s!\n", | 958 | "ICMPv6 NA: someone advertises our address %pI6 on %s!\n", |
959 | ifp->idev->dev->name); | 959 | &ifp->addr, ifp->idev->dev->name); |
960 | in6_ifa_put(ifp); | 960 | in6_ifa_put(ifp); |
961 | return; | 961 | return; |
962 | } | 962 | } |
@@ -1151,10 +1151,6 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1151 | skb->dev->name); | 1151 | skb->dev->name); |
1152 | return; | 1152 | return; |
1153 | } | 1153 | } |
1154 | if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra) { | ||
1155 | in6_dev_put(in6_dev); | ||
1156 | return; | ||
1157 | } | ||
1158 | 1154 | ||
1159 | if (!ndisc_parse_options(opt, optlen, &ndopts)) { | 1155 | if (!ndisc_parse_options(opt, optlen, &ndopts)) { |
1160 | in6_dev_put(in6_dev); | 1156 | in6_dev_put(in6_dev); |
@@ -1163,6 +1159,10 @@ static void ndisc_router_discovery(struct sk_buff *skb) | |||
1163 | return; | 1159 | return; |
1164 | } | 1160 | } |
1165 | 1161 | ||
1162 | /* skip route and link configuration on routers */ | ||
1163 | if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra) | ||
1164 | goto skip_linkparms; | ||
1165 | |||
1166 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | 1166 | #ifdef CONFIG_IPV6_NDISC_NODETYPE |
1167 | /* skip link-specific parameters from interior routers */ | 1167 | /* skip link-specific parameters from interior routers */ |
1168 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) | 1168 | if (skb->ndisc_nodetype == NDISC_NODETYPE_NODEFAULT) |
@@ -1283,9 +1283,7 @@ skip_defrtr: | |||
1283 | } | 1283 | } |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | #ifdef CONFIG_IPV6_NDISC_NODETYPE | ||
1287 | skip_linkparms: | 1286 | skip_linkparms: |
1288 | #endif | ||
1289 | 1287 | ||
1290 | /* | 1288 | /* |
1291 | * Process options. | 1289 | * Process options. |
@@ -1312,6 +1310,10 @@ skip_linkparms: | |||
1312 | NEIGH_UPDATE_F_ISROUTER); | 1310 | NEIGH_UPDATE_F_ISROUTER); |
1313 | } | 1311 | } |
1314 | 1312 | ||
1313 | /* skip route and link configuration on routers */ | ||
1314 | if (in6_dev->cnf.forwarding || !in6_dev->cnf.accept_ra) | ||
1315 | goto out; | ||
1316 | |||
1315 | #ifdef CONFIG_IPV6_ROUTE_INFO | 1317 | #ifdef CONFIG_IPV6_ROUTE_INFO |
1316 | if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) { | 1318 | if (in6_dev->cnf.accept_ra_rtr_pref && ndopts.nd_opts_ri) { |
1317 | struct nd_opt_hdr *p; | 1319 | struct nd_opt_hdr *p; |
diff --git a/net/ipv6/protocol.c b/net/ipv6/protocol.c index 9ab789159913..568864f722ca 100644 --- a/net/ipv6/protocol.c +++ b/net/ipv6/protocol.c | |||
@@ -20,20 +20,9 @@ | |||
20 | * - Removed unused variable 'inet6_protocol_base' | 20 | * - Removed unused variable 'inet6_protocol_base' |
21 | * - Modified inet6_del_protocol() to correctly maintain copy bit. | 21 | * - Modified inet6_del_protocol() to correctly maintain copy bit. |
22 | */ | 22 | */ |
23 | 23 | #include <linux/module.h> | |
24 | #include <linux/errno.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/socket.h> | ||
27 | #include <linux/sockios.h> | ||
28 | #include <linux/net.h> | ||
29 | #include <linux/in6.h> | ||
30 | #include <linux/netdevice.h> | 24 | #include <linux/netdevice.h> |
31 | #include <linux/if_arp.h> | 25 | #include <linux/spinlock.h> |
32 | |||
33 | #include <net/sock.h> | ||
34 | #include <net/snmp.h> | ||
35 | |||
36 | #include <net/ipv6.h> | ||
37 | #include <net/protocol.h> | 26 | #include <net/protocol.h> |
38 | 27 | ||
39 | struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | 28 | struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index d6c3c1c34b2d..7d675b8d82d3 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -642,7 +642,7 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, | 642 | err = NF_HOOK(PF_INET6, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev, |
643 | dst_output); | 643 | dst_output); |
644 | if (err > 0) | 644 | if (err > 0) |
645 | err = np->recverr ? net_xmit_errno(err) : 0; | 645 | err = net_xmit_errno(err); |
646 | if (err) | 646 | if (err) |
647 | goto error; | 647 | goto error; |
648 | out: | 648 | out: |
@@ -653,6 +653,8 @@ error_fault: | |||
653 | kfree_skb(skb); | 653 | kfree_skb(skb); |
654 | error: | 654 | error: |
655 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); | 655 | IP6_INC_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); |
656 | if (err == -ENOBUFS && !np->recverr) | ||
657 | err = 0; | ||
656 | return err; | 658 | return err; |
657 | } | 659 | } |
658 | 660 | ||
@@ -877,11 +879,8 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
877 | hlimit = ip6_dst_hoplimit(dst); | 879 | hlimit = ip6_dst_hoplimit(dst); |
878 | } | 880 | } |
879 | 881 | ||
880 | if (tclass < 0) { | 882 | if (tclass < 0) |
881 | tclass = np->tclass; | 883 | tclass = np->tclass; |
882 | if (tclass < 0) | ||
883 | tclass = 0; | ||
884 | } | ||
885 | 884 | ||
886 | if (msg->msg_flags&MSG_CONFIRM) | 885 | if (msg->msg_flags&MSG_CONFIRM) |
887 | goto do_confirm; | 886 | goto do_confirm; |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 1473ee0a1f51..9ccfef345560 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -665,7 +665,7 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad | |||
665 | net->ipv6.sysctl.ip6_rt_gc_elasticity = 1; | 665 | net->ipv6.sysctl.ip6_rt_gc_elasticity = 1; |
666 | net->ipv6.sysctl.ip6_rt_gc_min_interval = 0; | 666 | net->ipv6.sysctl.ip6_rt_gc_min_interval = 0; |
667 | 667 | ||
668 | ip6_dst_gc(net->ipv6.ip6_dst_ops); | 668 | ip6_dst_gc(&net->ipv6.ip6_dst_ops); |
669 | 669 | ||
670 | net->ipv6.sysctl.ip6_rt_gc_elasticity = | 670 | net->ipv6.sysctl.ip6_rt_gc_elasticity = |
671 | saved_rt_elasticity; | 671 | saved_rt_elasticity; |
@@ -970,7 +970,7 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev, | |||
970 | if (unlikely(idev == NULL)) | 970 | if (unlikely(idev == NULL)) |
971 | return NULL; | 971 | return NULL; |
972 | 972 | ||
973 | rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 973 | rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops); |
974 | if (unlikely(rt == NULL)) { | 974 | if (unlikely(rt == NULL)) { |
975 | in6_dev_put(idev); | 975 | in6_dev_put(idev); |
976 | goto out; | 976 | goto out; |
@@ -1060,7 +1060,7 @@ static void icmp6_clean_all(int (*func)(struct rt6_info *rt, void *arg), | |||
1060 | static int ip6_dst_gc(struct dst_ops *ops) | 1060 | static int ip6_dst_gc(struct dst_ops *ops) |
1061 | { | 1061 | { |
1062 | unsigned long now = jiffies; | 1062 | unsigned long now = jiffies; |
1063 | struct net *net = ops->dst_net; | 1063 | struct net *net = container_of(ops, struct net, ipv6.ip6_dst_ops); |
1064 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; | 1064 | int rt_min_interval = net->ipv6.sysctl.ip6_rt_gc_min_interval; |
1065 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; | 1065 | int rt_max_size = net->ipv6.sysctl.ip6_rt_max_size; |
1066 | int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; | 1066 | int rt_elasticity = net->ipv6.sysctl.ip6_rt_gc_elasticity; |
@@ -1154,7 +1154,7 @@ int ip6_route_add(struct fib6_config *cfg) | |||
1154 | goto out; | 1154 | goto out; |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 1157 | rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops); |
1158 | 1158 | ||
1159 | if (rt == NULL) { | 1159 | if (rt == NULL) { |
1160 | err = -ENOMEM; | 1160 | err = -ENOMEM; |
@@ -1643,7 +1643,7 @@ out: | |||
1643 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) | 1643 | static struct rt6_info * ip6_rt_copy(struct rt6_info *ort) |
1644 | { | 1644 | { |
1645 | struct net *net = dev_net(ort->rt6i_dev); | 1645 | struct net *net = dev_net(ort->rt6i_dev); |
1646 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 1646 | struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops); |
1647 | 1647 | ||
1648 | if (rt) { | 1648 | if (rt) { |
1649 | rt->u.dst.input = ort->u.dst.input; | 1649 | rt->u.dst.input = ort->u.dst.input; |
@@ -1923,7 +1923,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, | |||
1923 | int anycast) | 1923 | int anycast) |
1924 | { | 1924 | { |
1925 | struct net *net = dev_net(idev->dev); | 1925 | struct net *net = dev_net(idev->dev); |
1926 | struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); | 1926 | struct rt6_info *rt = ip6_dst_alloc(&net->ipv6.ip6_dst_ops); |
1927 | struct neighbour *neigh; | 1927 | struct neighbour *neigh; |
1928 | 1928 | ||
1929 | if (rt == NULL) | 1929 | if (rt == NULL) |
@@ -2501,7 +2501,7 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v) | |||
2501 | net->ipv6.rt6_stats->fib_rt_alloc, | 2501 | net->ipv6.rt6_stats->fib_rt_alloc, |
2502 | net->ipv6.rt6_stats->fib_rt_entries, | 2502 | net->ipv6.rt6_stats->fib_rt_entries, |
2503 | net->ipv6.rt6_stats->fib_rt_cache, | 2503 | net->ipv6.rt6_stats->fib_rt_cache, |
2504 | atomic_read(&net->ipv6.ip6_dst_ops->entries), | 2504 | atomic_read(&net->ipv6.ip6_dst_ops.entries), |
2505 | net->ipv6.rt6_stats->fib_discarded_routes); | 2505 | net->ipv6.rt6_stats->fib_discarded_routes); |
2506 | 2506 | ||
2507 | return 0; | 2507 | return 0; |
@@ -2637,7 +2637,7 @@ struct ctl_table *ipv6_route_sysctl_init(struct net *net) | |||
2637 | 2637 | ||
2638 | if (table) { | 2638 | if (table) { |
2639 | table[0].data = &net->ipv6.sysctl.flush_delay; | 2639 | table[0].data = &net->ipv6.sysctl.flush_delay; |
2640 | table[1].data = &net->ipv6.ip6_dst_ops->gc_thresh; | 2640 | table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; |
2641 | table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; | 2641 | table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; |
2642 | table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; | 2642 | table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; |
2643 | table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; | 2643 | table[4].data = &net->ipv6.sysctl.ip6_rt_gc_timeout; |
@@ -2655,12 +2655,8 @@ static int ip6_route_net_init(struct net *net) | |||
2655 | { | 2655 | { |
2656 | int ret = -ENOMEM; | 2656 | int ret = -ENOMEM; |
2657 | 2657 | ||
2658 | net->ipv6.ip6_dst_ops = kmemdup(&ip6_dst_ops_template, | 2658 | memcpy(&net->ipv6.ip6_dst_ops, &ip6_dst_ops_template, |
2659 | sizeof(*net->ipv6.ip6_dst_ops), | 2659 | sizeof(net->ipv6.ip6_dst_ops)); |
2660 | GFP_KERNEL); | ||
2661 | if (!net->ipv6.ip6_dst_ops) | ||
2662 | goto out; | ||
2663 | net->ipv6.ip6_dst_ops->dst_net = hold_net(net); | ||
2664 | 2660 | ||
2665 | net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, | 2661 | net->ipv6.ip6_null_entry = kmemdup(&ip6_null_entry_template, |
2666 | sizeof(*net->ipv6.ip6_null_entry), | 2662 | sizeof(*net->ipv6.ip6_null_entry), |
@@ -2669,7 +2665,7 @@ static int ip6_route_net_init(struct net *net) | |||
2669 | goto out_ip6_dst_ops; | 2665 | goto out_ip6_dst_ops; |
2670 | net->ipv6.ip6_null_entry->u.dst.path = | 2666 | net->ipv6.ip6_null_entry->u.dst.path = |
2671 | (struct dst_entry *)net->ipv6.ip6_null_entry; | 2667 | (struct dst_entry *)net->ipv6.ip6_null_entry; |
2672 | net->ipv6.ip6_null_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2668 | net->ipv6.ip6_null_entry->u.dst.ops = &net->ipv6.ip6_dst_ops; |
2673 | 2669 | ||
2674 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES | 2670 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
2675 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, | 2671 | net->ipv6.ip6_prohibit_entry = kmemdup(&ip6_prohibit_entry_template, |
@@ -2679,7 +2675,7 @@ static int ip6_route_net_init(struct net *net) | |||
2679 | goto out_ip6_null_entry; | 2675 | goto out_ip6_null_entry; |
2680 | net->ipv6.ip6_prohibit_entry->u.dst.path = | 2676 | net->ipv6.ip6_prohibit_entry->u.dst.path = |
2681 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; | 2677 | (struct dst_entry *)net->ipv6.ip6_prohibit_entry; |
2682 | net->ipv6.ip6_prohibit_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2678 | net->ipv6.ip6_prohibit_entry->u.dst.ops = &net->ipv6.ip6_dst_ops; |
2683 | 2679 | ||
2684 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, | 2680 | net->ipv6.ip6_blk_hole_entry = kmemdup(&ip6_blk_hole_entry_template, |
2685 | sizeof(*net->ipv6.ip6_blk_hole_entry), | 2681 | sizeof(*net->ipv6.ip6_blk_hole_entry), |
@@ -2688,7 +2684,7 @@ static int ip6_route_net_init(struct net *net) | |||
2688 | goto out_ip6_prohibit_entry; | 2684 | goto out_ip6_prohibit_entry; |
2689 | net->ipv6.ip6_blk_hole_entry->u.dst.path = | 2685 | net->ipv6.ip6_blk_hole_entry->u.dst.path = |
2690 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; | 2686 | (struct dst_entry *)net->ipv6.ip6_blk_hole_entry; |
2691 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = net->ipv6.ip6_dst_ops; | 2687 | net->ipv6.ip6_blk_hole_entry->u.dst.ops = &net->ipv6.ip6_dst_ops; |
2692 | #endif | 2688 | #endif |
2693 | 2689 | ||
2694 | net->ipv6.sysctl.flush_delay = 0; | 2690 | net->ipv6.sysctl.flush_delay = 0; |
@@ -2717,8 +2713,6 @@ out_ip6_null_entry: | |||
2717 | kfree(net->ipv6.ip6_null_entry); | 2713 | kfree(net->ipv6.ip6_null_entry); |
2718 | #endif | 2714 | #endif |
2719 | out_ip6_dst_ops: | 2715 | out_ip6_dst_ops: |
2720 | release_net(net->ipv6.ip6_dst_ops->dst_net); | ||
2721 | kfree(net->ipv6.ip6_dst_ops); | ||
2722 | goto out; | 2716 | goto out; |
2723 | } | 2717 | } |
2724 | 2718 | ||
@@ -2733,8 +2727,6 @@ static void ip6_route_net_exit(struct net *net) | |||
2733 | kfree(net->ipv6.ip6_prohibit_entry); | 2727 | kfree(net->ipv6.ip6_prohibit_entry); |
2734 | kfree(net->ipv6.ip6_blk_hole_entry); | 2728 | kfree(net->ipv6.ip6_blk_hole_entry); |
2735 | #endif | 2729 | #endif |
2736 | release_net(net->ipv6.ip6_dst_ops->dst_net); | ||
2737 | kfree(net->ipv6.ip6_dst_ops); | ||
2738 | } | 2730 | } |
2739 | 2731 | ||
2740 | static struct pernet_operations ip6_route_net_ops = { | 2732 | static struct pernet_operations ip6_route_net_ops = { |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index d335a306a4db..0ae4f6448187 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -609,7 +609,8 @@ static inline __be32 try_6to4(struct in6_addr *v6dst) | |||
609 | * and that skb is filled properly by that function. | 609 | * and that skb is filled properly by that function. |
610 | */ | 610 | */ |
611 | 611 | ||
612 | static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | 612 | static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb, |
613 | struct net_device *dev) | ||
613 | { | 614 | { |
614 | struct ip_tunnel *tunnel = netdev_priv(dev); | 615 | struct ip_tunnel *tunnel = netdev_priv(dev); |
615 | struct net_device_stats *stats = &tunnel->dev->stats; | 616 | struct net_device_stats *stats = &tunnel->dev->stats; |
@@ -778,7 +779,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
778 | iph->version = 4; | 779 | iph->version = 4; |
779 | iph->ihl = sizeof(struct iphdr)>>2; | 780 | iph->ihl = sizeof(struct iphdr)>>2; |
780 | if (mtu > IPV6_MIN_MTU) | 781 | if (mtu > IPV6_MIN_MTU) |
781 | iph->frag_off = htons(IP_DF); | 782 | iph->frag_off = tiph->frag_off; |
782 | else | 783 | else |
783 | iph->frag_off = 0; | 784 | iph->frag_off = 0; |
784 | 785 | ||
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index d849dd53b788..3aae0f217d61 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -75,11 +75,11 @@ static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, | |||
75 | 75 | ||
76 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); | 76 | static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb); |
77 | 77 | ||
78 | static struct inet_connection_sock_af_ops ipv6_mapped; | 78 | static const struct inet_connection_sock_af_ops ipv6_mapped; |
79 | static struct inet_connection_sock_af_ops ipv6_specific; | 79 | static const struct inet_connection_sock_af_ops ipv6_specific; |
80 | #ifdef CONFIG_TCP_MD5SIG | 80 | #ifdef CONFIG_TCP_MD5SIG |
81 | static struct tcp_sock_af_ops tcp_sock_ipv6_specific; | 81 | static const struct tcp_sock_af_ops tcp_sock_ipv6_specific; |
82 | static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; | 82 | static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific; |
83 | #else | 83 | #else |
84 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, | 84 | static struct tcp_md5sig_key *tcp_v6_md5_do_lookup(struct sock *sk, |
85 | struct in6_addr *addr) | 85 | struct in6_addr *addr) |
@@ -591,7 +591,7 @@ static int tcp_v6_md5_do_add(struct sock *sk, struct in6_addr *peer, | |||
591 | } | 591 | } |
592 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; | 592 | sk->sk_route_caps &= ~NETIF_F_GSO_MASK; |
593 | } | 593 | } |
594 | if (tcp_alloc_md5sig_pool() == NULL) { | 594 | if (tcp_alloc_md5sig_pool(sk) == NULL) { |
595 | kfree(newkey); | 595 | kfree(newkey); |
596 | return -ENOMEM; | 596 | return -ENOMEM; |
597 | } | 597 | } |
@@ -894,7 +894,7 @@ struct request_sock_ops tcp6_request_sock_ops __read_mostly = { | |||
894 | }; | 894 | }; |
895 | 895 | ||
896 | #ifdef CONFIG_TCP_MD5SIG | 896 | #ifdef CONFIG_TCP_MD5SIG |
897 | static struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { | 897 | static const struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { |
898 | .md5_lookup = tcp_v6_reqsk_md5_lookup, | 898 | .md5_lookup = tcp_v6_reqsk_md5_lookup, |
899 | .calc_md5_hash = tcp_v6_md5_hash_skb, | 899 | .calc_md5_hash = tcp_v6_md5_hash_skb, |
900 | }; | 900 | }; |
@@ -1003,6 +1003,7 @@ static void tcp_v6_send_response(struct sk_buff *skb, u32 seq, u32 ack, u32 win, | |||
1003 | skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); | 1003 | skb_reserve(buff, MAX_HEADER + sizeof(struct ipv6hdr) + tot_len); |
1004 | 1004 | ||
1005 | t1 = (struct tcphdr *) skb_push(buff, tot_len); | 1005 | t1 = (struct tcphdr *) skb_push(buff, tot_len); |
1006 | skb_reset_transport_header(skb); | ||
1006 | 1007 | ||
1007 | /* Swap the send and the receive. */ | 1008 | /* Swap the send and the receive. */ |
1008 | memset(t1, 0, sizeof(*t1)); | 1009 | memset(t1, 0, sizeof(*t1)); |
@@ -1760,7 +1761,7 @@ static int tcp_v6_remember_stamp(struct sock *sk) | |||
1760 | return 0; | 1761 | return 0; |
1761 | } | 1762 | } |
1762 | 1763 | ||
1763 | static struct inet_connection_sock_af_ops ipv6_specific = { | 1764 | static const struct inet_connection_sock_af_ops ipv6_specific = { |
1764 | .queue_xmit = inet6_csk_xmit, | 1765 | .queue_xmit = inet6_csk_xmit, |
1765 | .send_check = tcp_v6_send_check, | 1766 | .send_check = tcp_v6_send_check, |
1766 | .rebuild_header = inet6_sk_rebuild_header, | 1767 | .rebuild_header = inet6_sk_rebuild_header, |
@@ -1780,7 +1781,7 @@ static struct inet_connection_sock_af_ops ipv6_specific = { | |||
1780 | }; | 1781 | }; |
1781 | 1782 | ||
1782 | #ifdef CONFIG_TCP_MD5SIG | 1783 | #ifdef CONFIG_TCP_MD5SIG |
1783 | static struct tcp_sock_af_ops tcp_sock_ipv6_specific = { | 1784 | static const struct tcp_sock_af_ops tcp_sock_ipv6_specific = { |
1784 | .md5_lookup = tcp_v6_md5_lookup, | 1785 | .md5_lookup = tcp_v6_md5_lookup, |
1785 | .calc_md5_hash = tcp_v6_md5_hash_skb, | 1786 | .calc_md5_hash = tcp_v6_md5_hash_skb, |
1786 | .md5_add = tcp_v6_md5_add_func, | 1787 | .md5_add = tcp_v6_md5_add_func, |
@@ -1792,7 +1793,7 @@ static struct tcp_sock_af_ops tcp_sock_ipv6_specific = { | |||
1792 | * TCP over IPv4 via INET6 API | 1793 | * TCP over IPv4 via INET6 API |
1793 | */ | 1794 | */ |
1794 | 1795 | ||
1795 | static struct inet_connection_sock_af_ops ipv6_mapped = { | 1796 | static const struct inet_connection_sock_af_ops ipv6_mapped = { |
1796 | .queue_xmit = ip_queue_xmit, | 1797 | .queue_xmit = ip_queue_xmit, |
1797 | .send_check = tcp_v4_send_check, | 1798 | .send_check = tcp_v4_send_check, |
1798 | .rebuild_header = inet_sk_rebuild_header, | 1799 | .rebuild_header = inet_sk_rebuild_header, |
@@ -1812,7 +1813,7 @@ static struct inet_connection_sock_af_ops ipv6_mapped = { | |||
1812 | }; | 1813 | }; |
1813 | 1814 | ||
1814 | #ifdef CONFIG_TCP_MD5SIG | 1815 | #ifdef CONFIG_TCP_MD5SIG |
1815 | static struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = { | 1816 | static const struct tcp_sock_af_ops tcp_sock_ipv6_mapped_specific = { |
1816 | .md5_lookup = tcp_v4_md5_lookup, | 1817 | .md5_lookup = tcp_v4_md5_lookup, |
1817 | .calc_md5_hash = tcp_v4_md5_hash_skb, | 1818 | .calc_md5_hash = tcp_v4_md5_hash_skb, |
1818 | .md5_add = tcp_v6_md5_add_func, | 1819 | .md5_add = tcp_v6_md5_add_func, |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index d79fa6724451..164040613c2e 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -724,12 +724,18 @@ static int udp_v6_push_pending_frames(struct sock *sk) | |||
724 | 724 | ||
725 | send: | 725 | send: |
726 | err = ip6_push_pending_frames(sk); | 726 | err = ip6_push_pending_frames(sk); |
727 | if (err) { | ||
728 | if (err == -ENOBUFS && !inet6_sk(sk)->recverr) { | ||
729 | UDP6_INC_STATS_USER(sock_net(sk), | ||
730 | UDP_MIB_SNDBUFERRORS, is_udplite); | ||
731 | err = 0; | ||
732 | } | ||
733 | } else | ||
734 | UDP6_INC_STATS_USER(sock_net(sk), | ||
735 | UDP_MIB_OUTDATAGRAMS, is_udplite); | ||
727 | out: | 736 | out: |
728 | up->len = 0; | 737 | up->len = 0; |
729 | up->pending = 0; | 738 | up->pending = 0; |
730 | if (!err) | ||
731 | UDP6_INC_STATS_USER(sock_net(sk), | ||
732 | UDP_MIB_OUTDATAGRAMS, is_udplite); | ||
733 | return err; | 739 | return err; |
734 | } | 740 | } |
735 | 741 | ||
@@ -946,11 +952,8 @@ do_udp_sendmsg: | |||
946 | hlimit = ip6_dst_hoplimit(dst); | 952 | hlimit = ip6_dst_hoplimit(dst); |
947 | } | 953 | } |
948 | 954 | ||
949 | if (tclass < 0) { | 955 | if (tclass < 0) |
950 | tclass = np->tclass; | 956 | tclass = np->tclass; |
951 | if (tclass < 0) | ||
952 | tclass = 0; | ||
953 | } | ||
954 | 957 | ||
955 | if (msg->msg_flags&MSG_CONFIRM) | 958 | if (msg->msg_flags&MSG_CONFIRM) |
956 | goto do_confirm; | 959 | goto do_confirm; |