diff options
Diffstat (limited to 'net/ipv6')
| -rw-r--r-- | net/ipv6/ah6.c | 8 | ||||
| -rw-r--r-- | net/ipv6/inet6_connection_sock.c | 2 | ||||
| -rw-r--r-- | net/ipv6/ip6_input.c | 8 | ||||
| -rw-r--r-- | net/ipv6/ip6_tunnel.c | 8 | ||||
| -rw-r--r-- | net/ipv6/ipv6_sockglue.c | 2 | ||||
| -rw-r--r-- | net/ipv6/ndisc.c | 2 | ||||
| -rw-r--r-- | net/ipv6/netfilter/Kconfig | 1 | ||||
| -rw-r--r-- | net/ipv6/route.c | 21 | ||||
| -rw-r--r-- | net/ipv6/tcp_ipv6.c | 13 | ||||
| -rw-r--r-- | net/ipv6/udp.c | 15 |
10 files changed, 49 insertions, 31 deletions
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index 2195ae651923..4c0f894d0843 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
| @@ -324,8 +324,6 @@ static void ah6_output_done(struct crypto_async_request *base, int err) | |||
| 324 | #endif | 324 | #endif |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | err = ah->nexthdr; | ||
| 328 | |||
| 329 | kfree(AH_SKB_CB(skb)->tmp); | 327 | kfree(AH_SKB_CB(skb)->tmp); |
| 330 | xfrm_output_resume(skb, err); | 328 | xfrm_output_resume(skb, err); |
| 331 | } | 329 | } |
| @@ -466,12 +464,12 @@ static void ah6_input_done(struct crypto_async_request *base, int err) | |||
| 466 | if (err) | 464 | if (err) |
| 467 | goto out; | 465 | goto out; |
| 468 | 466 | ||
| 467 | err = ah->nexthdr; | ||
| 468 | |||
| 469 | skb->network_header += ah_hlen; | 469 | skb->network_header += ah_hlen; |
| 470 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 470 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
| 471 | __skb_pull(skb, ah_hlen + hdr_len); | 471 | __skb_pull(skb, ah_hlen + hdr_len); |
| 472 | skb_set_transport_header(skb, -hdr_len); | 472 | skb_set_transport_header(skb, -hdr_len); |
| 473 | |||
| 474 | err = ah->nexthdr; | ||
| 475 | out: | 473 | out: |
| 476 | kfree(AH_SKB_CB(skb)->tmp); | 474 | kfree(AH_SKB_CB(skb)->tmp); |
| 477 | xfrm_input_resume(skb, err); | 475 | xfrm_input_resume(skb, err); |
| @@ -583,8 +581,6 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
| 583 | if (err == -EINPROGRESS) | 581 | if (err == -EINPROGRESS) |
| 584 | goto out; | 582 | goto out; |
| 585 | 583 | ||
| 586 | if (err == -EBUSY) | ||
| 587 | err = NET_XMIT_DROP; | ||
| 588 | goto out_free; | 584 | goto out_free; |
| 589 | } | 585 | } |
| 590 | 586 | ||
diff --git a/net/ipv6/inet6_connection_sock.c b/net/ipv6/inet6_connection_sock.c index fee46d5a2f12..1567fb120392 100644 --- a/net/ipv6/inet6_connection_sock.c +++ b/net/ipv6/inet6_connection_sock.c | |||
| @@ -85,7 +85,7 @@ struct dst_entry *inet6_csk_route_req(struct sock *sk, | |||
| 85 | * request_sock (formerly open request) hash tables. | 85 | * request_sock (formerly open request) hash tables. |
| 86 | */ | 86 | */ |
| 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, | 87 | static u32 inet6_synq_hash(const struct in6_addr *raddr, const __be16 rport, |
| 88 | const u32 rnd, const u16 synq_hsize) | 88 | const u32 rnd, const u32 synq_hsize) |
| 89 | { | 89 | { |
| 90 | u32 c; | 90 | u32 c; |
| 91 | 91 | ||
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 027c7ff6f1e5..a46c64eb0a66 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c | |||
| @@ -111,6 +111,14 @@ int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt | |||
| 111 | ipv6_addr_loopback(&hdr->daddr)) | 111 | ipv6_addr_loopback(&hdr->daddr)) |
| 112 | goto err; | 112 | goto err; |
| 113 | 113 | ||
| 114 | /* | ||
| 115 | * RFC4291 2.7 | ||
| 116 | * Multicast addresses must not be used as source addresses in IPv6 | ||
| 117 | * packets or appear in any Routing header. | ||
| 118 | */ | ||
| 119 | if (ipv6_addr_is_multicast(&hdr->saddr)) | ||
| 120 | goto err; | ||
| 121 | |||
| 114 | skb->transport_header = skb->network_header + sizeof(*hdr); | 122 | skb->transport_header = skb->network_header + sizeof(*hdr); |
| 115 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); | 123 | IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr); |
| 116 | 124 | ||
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index bdc15c9003d7..4e2e9ff67ef2 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
| @@ -289,6 +289,8 @@ static struct ip6_tnl *ip6_tnl_create(struct net *net, struct ip6_tnl_parm *p) | |||
| 289 | if ((err = register_netdevice(dev)) < 0) | 289 | if ((err = register_netdevice(dev)) < 0) |
| 290 | goto failed_free; | 290 | goto failed_free; |
| 291 | 291 | ||
| 292 | strcpy(t->parms.name, dev->name); | ||
| 293 | |||
| 292 | dev_hold(dev); | 294 | dev_hold(dev); |
| 293 | ip6_tnl_link(ip6n, t); | 295 | ip6_tnl_link(ip6n, t); |
| 294 | return t; | 296 | return t; |
| @@ -1407,7 +1409,6 @@ ip6_tnl_dev_init_gen(struct net_device *dev) | |||
| 1407 | struct ip6_tnl *t = netdev_priv(dev); | 1409 | struct ip6_tnl *t = netdev_priv(dev); |
| 1408 | 1410 | ||
| 1409 | t->dev = dev; | 1411 | t->dev = dev; |
| 1410 | strcpy(t->parms.name, dev->name); | ||
| 1411 | dev->tstats = alloc_percpu(struct pcpu_tstats); | 1412 | dev->tstats = alloc_percpu(struct pcpu_tstats); |
| 1412 | if (!dev->tstats) | 1413 | if (!dev->tstats) |
| 1413 | return -ENOMEM; | 1414 | return -ENOMEM; |
| @@ -1487,6 +1488,7 @@ static void __net_exit ip6_tnl_destroy_tunnels(struct ip6_tnl_net *ip6n) | |||
| 1487 | static int __net_init ip6_tnl_init_net(struct net *net) | 1488 | static int __net_init ip6_tnl_init_net(struct net *net) |
| 1488 | { | 1489 | { |
| 1489 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); | 1490 | struct ip6_tnl_net *ip6n = net_generic(net, ip6_tnl_net_id); |
| 1491 | struct ip6_tnl *t = NULL; | ||
| 1490 | int err; | 1492 | int err; |
| 1491 | 1493 | ||
| 1492 | ip6n->tnls[0] = ip6n->tnls_wc; | 1494 | ip6n->tnls[0] = ip6n->tnls_wc; |
| @@ -1507,6 +1509,10 @@ static int __net_init ip6_tnl_init_net(struct net *net) | |||
| 1507 | err = register_netdev(ip6n->fb_tnl_dev); | 1509 | err = register_netdev(ip6n->fb_tnl_dev); |
| 1508 | if (err < 0) | 1510 | if (err < 0) |
| 1509 | goto err_register; | 1511 | goto err_register; |
| 1512 | |||
| 1513 | t = netdev_priv(ip6n->fb_tnl_dev); | ||
| 1514 | |||
| 1515 | strcpy(t->parms.name, ip6n->fb_tnl_dev->name); | ||
| 1510 | return 0; | 1516 | return 0; |
| 1511 | 1517 | ||
| 1512 | err_register: | 1518 | err_register: |
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c index c99e3ee9781f..26cb08c84b74 100644 --- a/net/ipv6/ipv6_sockglue.c +++ b/net/ipv6/ipv6_sockglue.c | |||
| @@ -503,7 +503,7 @@ done: | |||
| 503 | goto e_inval; | 503 | goto e_inval; |
| 504 | if (val > 255 || val < -1) | 504 | if (val > 255 || val < -1) |
| 505 | goto e_inval; | 505 | goto e_inval; |
| 506 | np->mcast_hops = val; | 506 | np->mcast_hops = (val == -1 ? IPV6_DEFAULT_MCASTHOPS : val); |
| 507 | retv = 0; | 507 | retv = 0; |
| 508 | break; | 508 | break; |
| 509 | 509 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 44e5b7f2a6c1..0cb78d7ddaf5 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
| @@ -1571,7 +1571,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
| 1571 | } | 1571 | } |
| 1572 | if (!rt->rt6i_peer) | 1572 | if (!rt->rt6i_peer) |
| 1573 | rt6_bind_peer(rt, 1); | 1573 | rt6_bind_peer(rt, 1); |
| 1574 | if (inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) | 1574 | if (!inet_peer_xrlim_allow(rt->rt6i_peer, 1*HZ)) |
| 1575 | goto release; | 1575 | goto release; |
| 1576 | 1576 | ||
| 1577 | if (dev->addr_len) { | 1577 | if (dev->addr_len) { |
diff --git a/net/ipv6/netfilter/Kconfig b/net/ipv6/netfilter/Kconfig index 448464844a25..f792b34cbe9c 100644 --- a/net/ipv6/netfilter/Kconfig +++ b/net/ipv6/netfilter/Kconfig | |||
| @@ -186,7 +186,6 @@ config IP6_NF_MANGLE | |||
| 186 | 186 | ||
| 187 | config IP6_NF_RAW | 187 | config IP6_NF_RAW |
| 188 | tristate 'raw table support (required for TRACE)' | 188 | tristate 'raw table support (required for TRACE)' |
| 189 | depends on NETFILTER_ADVANCED | ||
| 190 | help | 189 | help |
| 191 | This option adds a `raw' table to ip6tables. This table is the very | 190 | This option adds a `raw' table to ip6tables. This table is the very |
| 192 | first in the netfilter framework and hooks in at the PREROUTING | 191 | first in the netfilter framework and hooks in at the PREROUTING |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8473016bba4a..3399dd326287 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
| @@ -77,7 +77,7 @@ static struct rt6_info *ip6_rt_copy(const struct rt6_info *ort, | |||
| 77 | const struct in6_addr *dest); | 77 | const struct in6_addr *dest); |
| 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); | 78 | static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie); |
| 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); | 79 | static unsigned int ip6_default_advmss(const struct dst_entry *dst); |
| 80 | static unsigned int ip6_default_mtu(const struct dst_entry *dst); | 80 | static unsigned int ip6_mtu(const struct dst_entry *dst); |
| 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); | 81 | static struct dst_entry *ip6_negative_advice(struct dst_entry *); |
| 82 | static void ip6_dst_destroy(struct dst_entry *); | 82 | static void ip6_dst_destroy(struct dst_entry *); |
| 83 | static void ip6_dst_ifdown(struct dst_entry *, | 83 | static void ip6_dst_ifdown(struct dst_entry *, |
| @@ -144,7 +144,7 @@ static struct dst_ops ip6_dst_ops_template = { | |||
| 144 | .gc_thresh = 1024, | 144 | .gc_thresh = 1024, |
| 145 | .check = ip6_dst_check, | 145 | .check = ip6_dst_check, |
| 146 | .default_advmss = ip6_default_advmss, | 146 | .default_advmss = ip6_default_advmss, |
| 147 | .default_mtu = ip6_default_mtu, | 147 | .mtu = ip6_mtu, |
| 148 | .cow_metrics = ipv6_cow_metrics, | 148 | .cow_metrics = ipv6_cow_metrics, |
| 149 | .destroy = ip6_dst_destroy, | 149 | .destroy = ip6_dst_destroy, |
| 150 | .ifdown = ip6_dst_ifdown, | 150 | .ifdown = ip6_dst_ifdown, |
| @@ -155,9 +155,11 @@ static struct dst_ops ip6_dst_ops_template = { | |||
| 155 | .neigh_lookup = ip6_neigh_lookup, | 155 | .neigh_lookup = ip6_neigh_lookup, |
| 156 | }; | 156 | }; |
| 157 | 157 | ||
| 158 | static unsigned int ip6_blackhole_default_mtu(const struct dst_entry *dst) | 158 | static unsigned int ip6_blackhole_mtu(const struct dst_entry *dst) |
| 159 | { | 159 | { |
| 160 | return 0; | 160 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); |
| 161 | |||
| 162 | return mtu ? : dst->dev->mtu; | ||
| 161 | } | 163 | } |
| 162 | 164 | ||
| 163 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) | 165 | static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu) |
| @@ -175,7 +177,7 @@ static struct dst_ops ip6_dst_blackhole_ops = { | |||
| 175 | .protocol = cpu_to_be16(ETH_P_IPV6), | 177 | .protocol = cpu_to_be16(ETH_P_IPV6), |
| 176 | .destroy = ip6_dst_destroy, | 178 | .destroy = ip6_dst_destroy, |
| 177 | .check = ip6_dst_check, | 179 | .check = ip6_dst_check, |
| 178 | .default_mtu = ip6_blackhole_default_mtu, | 180 | .mtu = ip6_blackhole_mtu, |
| 179 | .default_advmss = ip6_default_advmss, | 181 | .default_advmss = ip6_default_advmss, |
| 180 | .update_pmtu = ip6_rt_blackhole_update_pmtu, | 182 | .update_pmtu = ip6_rt_blackhole_update_pmtu, |
| 181 | .cow_metrics = ip6_rt_blackhole_cow_metrics, | 183 | .cow_metrics = ip6_rt_blackhole_cow_metrics, |
| @@ -1041,10 +1043,15 @@ static unsigned int ip6_default_advmss(const struct dst_entry *dst) | |||
| 1041 | return mtu; | 1043 | return mtu; |
| 1042 | } | 1044 | } |
| 1043 | 1045 | ||
| 1044 | static unsigned int ip6_default_mtu(const struct dst_entry *dst) | 1046 | static unsigned int ip6_mtu(const struct dst_entry *dst) |
| 1045 | { | 1047 | { |
| 1046 | unsigned int mtu = IPV6_MIN_MTU; | ||
| 1047 | struct inet6_dev *idev; | 1048 | struct inet6_dev *idev; |
| 1049 | unsigned int mtu = dst_metric_raw(dst, RTAX_MTU); | ||
| 1050 | |||
| 1051 | if (mtu) | ||
| 1052 | return mtu; | ||
| 1053 | |||
| 1054 | mtu = IPV6_MIN_MTU; | ||
| 1048 | 1055 | ||
| 1049 | rcu_read_lock(); | 1056 | rcu_read_lock(); |
| 1050 | idev = __in6_dev_get(dst->dev); | 1057 | idev = __in6_dev_get(dst->dev); |
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 36131d122a6f..2dea4bb7b54a 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
| @@ -1255,6 +1255,13 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1255 | if (!want_cookie || tmp_opt.tstamp_ok) | 1255 | if (!want_cookie || tmp_opt.tstamp_ok) |
| 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); | 1256 | TCP_ECN_create_request(req, tcp_hdr(skb)); |
| 1257 | 1257 | ||
| 1258 | treq->iif = sk->sk_bound_dev_if; | ||
| 1259 | |||
| 1260 | /* So that link locals have meaning */ | ||
| 1261 | if (!sk->sk_bound_dev_if && | ||
| 1262 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
| 1263 | treq->iif = inet6_iif(skb); | ||
| 1264 | |||
| 1258 | if (!isn) { | 1265 | if (!isn) { |
| 1259 | struct inet_peer *peer = NULL; | 1266 | struct inet_peer *peer = NULL; |
| 1260 | 1267 | ||
| @@ -1264,12 +1271,6 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb) | |||
| 1264 | atomic_inc(&skb->users); | 1271 | atomic_inc(&skb->users); |
| 1265 | treq->pktopts = skb; | 1272 | treq->pktopts = skb; |
| 1266 | } | 1273 | } |
| 1267 | treq->iif = sk->sk_bound_dev_if; | ||
| 1268 | |||
| 1269 | /* So that link locals have meaning */ | ||
| 1270 | if (!sk->sk_bound_dev_if && | ||
| 1271 | ipv6_addr_type(&treq->rmt_addr) & IPV6_ADDR_LINKLOCAL) | ||
| 1272 | treq->iif = inet6_iif(skb); | ||
| 1273 | 1274 | ||
| 1274 | if (want_cookie) { | 1275 | if (want_cookie) { |
| 1275 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); | 1276 | isn = cookie_v6_init_sequence(sk, skb, &req->mss); |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 846f4757eb8d..8c2541915183 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
| @@ -340,7 +340,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
| 340 | struct ipv6_pinfo *np = inet6_sk(sk); | 340 | struct ipv6_pinfo *np = inet6_sk(sk); |
| 341 | struct inet_sock *inet = inet_sk(sk); | 341 | struct inet_sock *inet = inet_sk(sk); |
| 342 | struct sk_buff *skb; | 342 | struct sk_buff *skb; |
| 343 | unsigned int ulen; | 343 | unsigned int ulen, copied; |
| 344 | int peeked; | 344 | int peeked; |
| 345 | int err; | 345 | int err; |
| 346 | int is_udplite = IS_UDPLITE(sk); | 346 | int is_udplite = IS_UDPLITE(sk); |
| @@ -363,9 +363,10 @@ try_again: | |||
| 363 | goto out; | 363 | goto out; |
| 364 | 364 | ||
| 365 | ulen = skb->len - sizeof(struct udphdr); | 365 | ulen = skb->len - sizeof(struct udphdr); |
| 366 | if (len > ulen) | 366 | copied = len; |
| 367 | len = ulen; | 367 | if (copied > ulen) |
| 368 | else if (len < ulen) | 368 | copied = ulen; |
| 369 | else if (copied < ulen) | ||
| 369 | msg->msg_flags |= MSG_TRUNC; | 370 | msg->msg_flags |= MSG_TRUNC; |
| 370 | 371 | ||
| 371 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); | 372 | is_udp4 = (skb->protocol == htons(ETH_P_IP)); |
| @@ -376,14 +377,14 @@ try_again: | |||
| 376 | * coverage checksum (UDP-Lite), do it before the copy. | 377 | * coverage checksum (UDP-Lite), do it before the copy. |
| 377 | */ | 378 | */ |
| 378 | 379 | ||
| 379 | if (len < ulen || UDP_SKB_CB(skb)->partial_cov) { | 380 | if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) { |
| 380 | if (udp_lib_checksum_complete(skb)) | 381 | if (udp_lib_checksum_complete(skb)) |
| 381 | goto csum_copy_err; | 382 | goto csum_copy_err; |
| 382 | } | 383 | } |
| 383 | 384 | ||
| 384 | if (skb_csum_unnecessary(skb)) | 385 | if (skb_csum_unnecessary(skb)) |
| 385 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), | 386 | err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr), |
| 386 | msg->msg_iov,len); | 387 | msg->msg_iov, copied ); |
| 387 | else { | 388 | else { |
| 388 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); | 389 | err = skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr), msg->msg_iov); |
| 389 | if (err == -EINVAL) | 390 | if (err == -EINVAL) |
| @@ -432,7 +433,7 @@ try_again: | |||
| 432 | datagram_recv_ctl(sk, msg, skb); | 433 | datagram_recv_ctl(sk, msg, skb); |
| 433 | } | 434 | } |
| 434 | 435 | ||
| 435 | err = len; | 436 | err = copied; |
| 436 | if (flags & MSG_TRUNC) | 437 | if (flags & MSG_TRUNC) |
| 437 | err = ulen; | 438 | err = ulen; |
| 438 | 439 | ||
