diff options
author | David S. Miller <davem@davemloft.net> | 2013-01-29 15:32:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-01-29 15:32:13 -0500 |
commit | f1e7b73acc26e8908af783bcd3a9900fd80688f5 (patch) | |
tree | 9a9382fb7f12f1889020efb4bffa3f4a88589fc5 /net | |
parent | 218774dc341f219bfcf940304a081b121a0e8099 (diff) | |
parent | fc16e884a2320198b8cb7bc2fdcf6b4485e79709 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Bring in the 'net' tree so that we can get some ipv4/ipv6 bug
fixes that some net-next work will build upon.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/batman-adv/distributed-arp-table.c | 19 | ||||
-rw-r--r-- | net/core/scm.c | 5 | ||||
-rw-r--r-- | net/ipv4/ah4.c | 18 | ||||
-rw-r--r-- | net/ipv4/datagram.c | 25 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 12 | ||||
-rw-r--r-- | net/ipv4/ip_gre.c | 6 | ||||
-rw-r--r-- | net/ipv4/ipcomp.c | 7 | ||||
-rw-r--r-- | net/ipv4/ping.c | 1 | ||||
-rw-r--r-- | net/ipv4/raw.c | 1 | ||||
-rw-r--r-- | net/ipv4/route.c | 54 | ||||
-rw-r--r-- | net/ipv4/tcp_ipv4.c | 9 | ||||
-rw-r--r-- | net/ipv4/udp.c | 1 | ||||
-rw-r--r-- | net/ipv6/ah6.c | 11 | ||||
-rw-r--r-- | net/ipv6/esp6.c | 5 | ||||
-rw-r--r-- | net/ipv6/icmp.c | 12 | ||||
-rw-r--r-- | net/ipv6/ip6_output.c | 4 | ||||
-rw-r--r-- | net/ipv6/ip6mr.c | 3 | ||||
-rw-r--r-- | net/sctp/outqueue.c | 12 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 4 | ||||
-rw-r--r-- | net/sctp/sysctl.c | 4 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_replay.c | 4 |
22 files changed, 188 insertions, 31 deletions
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 7485a78484ff..ea0bd31d41c2 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c | |||
@@ -738,6 +738,7 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
738 | struct arphdr *arphdr; | 738 | struct arphdr *arphdr; |
739 | struct ethhdr *ethhdr; | 739 | struct ethhdr *ethhdr; |
740 | __be32 ip_src, ip_dst; | 740 | __be32 ip_src, ip_dst; |
741 | uint8_t *hw_src, *hw_dst; | ||
741 | uint16_t type = 0; | 742 | uint16_t type = 0; |
742 | 743 | ||
743 | /* pull the ethernet header */ | 744 | /* pull the ethernet header */ |
@@ -777,9 +778,23 @@ static uint16_t batadv_arp_get_type(struct batadv_priv *bat_priv, | |||
777 | ip_src = batadv_arp_ip_src(skb, hdr_size); | 778 | ip_src = batadv_arp_ip_src(skb, hdr_size); |
778 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); | 779 | ip_dst = batadv_arp_ip_dst(skb, hdr_size); |
779 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || | 780 | if (ipv4_is_loopback(ip_src) || ipv4_is_multicast(ip_src) || |
780 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst)) | 781 | ipv4_is_loopback(ip_dst) || ipv4_is_multicast(ip_dst) || |
782 | ipv4_is_zeronet(ip_src) || ipv4_is_lbcast(ip_src) || | ||
783 | ipv4_is_zeronet(ip_dst) || ipv4_is_lbcast(ip_dst)) | ||
781 | goto out; | 784 | goto out; |
782 | 785 | ||
786 | hw_src = batadv_arp_hw_src(skb, hdr_size); | ||
787 | if (is_zero_ether_addr(hw_src) || is_multicast_ether_addr(hw_src)) | ||
788 | goto out; | ||
789 | |||
790 | /* we don't care about the destination MAC address in ARP requests */ | ||
791 | if (arphdr->ar_op != htons(ARPOP_REQUEST)) { | ||
792 | hw_dst = batadv_arp_hw_dst(skb, hdr_size); | ||
793 | if (is_zero_ether_addr(hw_dst) || | ||
794 | is_multicast_ether_addr(hw_dst)) | ||
795 | goto out; | ||
796 | } | ||
797 | |||
783 | type = ntohs(arphdr->ar_op); | 798 | type = ntohs(arphdr->ar_op); |
784 | out: | 799 | out: |
785 | return type; | 800 | return type; |
@@ -1012,6 +1027,8 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv, | |||
1012 | */ | 1027 | */ |
1013 | ret = !batadv_is_my_client(bat_priv, hw_dst); | 1028 | ret = !batadv_is_my_client(bat_priv, hw_dst); |
1014 | out: | 1029 | out: |
1030 | if (ret) | ||
1031 | kfree_skb(skb); | ||
1015 | /* if ret == false -> packet has to be delivered to the interface */ | 1032 | /* if ret == false -> packet has to be delivered to the interface */ |
1016 | return ret; | 1033 | return ret; |
1017 | } | 1034 | } |
diff --git a/net/core/scm.c b/net/core/scm.c index 57fb1ee6649f..905dcc6ad1e3 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <net/sock.h> | 35 | #include <net/sock.h> |
36 | #include <net/compat.h> | 36 | #include <net/compat.h> |
37 | #include <net/scm.h> | 37 | #include <net/scm.h> |
38 | #include <net/cls_cgroup.h> | ||
38 | 39 | ||
39 | 40 | ||
40 | /* | 41 | /* |
@@ -302,8 +303,10 @@ void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm) | |||
302 | } | 303 | } |
303 | /* Bump the usage count and install the file. */ | 304 | /* Bump the usage count and install the file. */ |
304 | sock = sock_from_file(fp[i], &err); | 305 | sock = sock_from_file(fp[i], &err); |
305 | if (sock) | 306 | if (sock) { |
306 | sock_update_netprioidx(sock->sk, current); | 307 | sock_update_netprioidx(sock->sk, current); |
308 | sock_update_classid(sock->sk, current); | ||
309 | } | ||
307 | fd_install(new_fd, get_file(fp[i])); | 310 | fd_install(new_fd, get_file(fp[i])); |
308 | } | 311 | } |
309 | 312 | ||
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c index a0d8392491c3..a69b4e4a02b5 100644 --- a/net/ipv4/ah4.c +++ b/net/ipv4/ah4.c | |||
@@ -269,7 +269,11 @@ static void ah_input_done(struct crypto_async_request *base, int err) | |||
269 | skb->network_header += ah_hlen; | 269 | skb->network_header += ah_hlen; |
270 | memcpy(skb_network_header(skb), work_iph, ihl); | 270 | memcpy(skb_network_header(skb), work_iph, ihl); |
271 | __skb_pull(skb, ah_hlen + ihl); | 271 | __skb_pull(skb, ah_hlen + ihl); |
272 | skb_set_transport_header(skb, -ihl); | 272 | |
273 | if (x->props.mode == XFRM_MODE_TUNNEL) | ||
274 | skb_reset_transport_header(skb); | ||
275 | else | ||
276 | skb_set_transport_header(skb, -ihl); | ||
273 | out: | 277 | out: |
274 | kfree(AH_SKB_CB(skb)->tmp); | 278 | kfree(AH_SKB_CB(skb)->tmp); |
275 | xfrm_input_resume(skb, err); | 279 | xfrm_input_resume(skb, err); |
@@ -381,7 +385,10 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb) | |||
381 | skb->network_header += ah_hlen; | 385 | skb->network_header += ah_hlen; |
382 | memcpy(skb_network_header(skb), work_iph, ihl); | 386 | memcpy(skb_network_header(skb), work_iph, ihl); |
383 | __skb_pull(skb, ah_hlen + ihl); | 387 | __skb_pull(skb, ah_hlen + ihl); |
384 | skb_set_transport_header(skb, -ihl); | 388 | if (x->props.mode == XFRM_MODE_TUNNEL) |
389 | skb_reset_transport_header(skb); | ||
390 | else | ||
391 | skb_set_transport_header(skb, -ihl); | ||
385 | 392 | ||
386 | err = nexthdr; | 393 | err = nexthdr; |
387 | 394 | ||
@@ -413,9 +420,12 @@ static void ah4_err(struct sk_buff *skb, u32 info) | |||
413 | if (!x) | 420 | if (!x) |
414 | return; | 421 | return; |
415 | 422 | ||
416 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 423 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
424 | atomic_inc(&flow_cache_genid); | ||
425 | rt_genid_bump(net); | ||
426 | |||
417 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); | 427 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0); |
418 | else | 428 | } else |
419 | ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); | 429 | ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0); |
420 | xfrm_state_put(x); | 430 | xfrm_state_put(x); |
421 | } | 431 | } |
diff --git a/net/ipv4/datagram.c b/net/ipv4/datagram.c index 424fafbc8cb0..b28e863fe0a7 100644 --- a/net/ipv4/datagram.c +++ b/net/ipv4/datagram.c | |||
@@ -85,3 +85,28 @@ out: | |||
85 | return err; | 85 | return err; |
86 | } | 86 | } |
87 | EXPORT_SYMBOL(ip4_datagram_connect); | 87 | EXPORT_SYMBOL(ip4_datagram_connect); |
88 | |||
89 | void ip4_datagram_release_cb(struct sock *sk) | ||
90 | { | ||
91 | const struct inet_sock *inet = inet_sk(sk); | ||
92 | const struct ip_options_rcu *inet_opt; | ||
93 | __be32 daddr = inet->inet_daddr; | ||
94 | struct flowi4 fl4; | ||
95 | struct rtable *rt; | ||
96 | |||
97 | if (! __sk_dst_get(sk) || __sk_dst_check(sk, 0)) | ||
98 | return; | ||
99 | |||
100 | rcu_read_lock(); | ||
101 | inet_opt = rcu_dereference(inet->inet_opt); | ||
102 | if (inet_opt && inet_opt->opt.srr) | ||
103 | daddr = inet_opt->opt.faddr; | ||
104 | rt = ip_route_output_ports(sock_net(sk), &fl4, sk, daddr, | ||
105 | inet->inet_saddr, inet->inet_dport, | ||
106 | inet->inet_sport, sk->sk_protocol, | ||
107 | RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); | ||
108 | if (!IS_ERR(rt)) | ||
109 | __sk_dst_set(sk, &rt->dst); | ||
110 | rcu_read_unlock(); | ||
111 | } | ||
112 | EXPORT_SYMBOL_GPL(ip4_datagram_release_cb); | ||
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index b61e9deb7c7e..3b4f0cd2e63e 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -346,7 +346,10 @@ static int esp_input_done2(struct sk_buff *skb, int err) | |||
346 | 346 | ||
347 | pskb_trim(skb, skb->len - alen - padlen - 2); | 347 | pskb_trim(skb, skb->len - alen - padlen - 2); |
348 | __skb_pull(skb, hlen); | 348 | __skb_pull(skb, hlen); |
349 | skb_set_transport_header(skb, -ihl); | 349 | if (x->props.mode == XFRM_MODE_TUNNEL) |
350 | skb_reset_transport_header(skb); | ||
351 | else | ||
352 | skb_set_transport_header(skb, -ihl); | ||
350 | 353 | ||
351 | err = nexthdr[1]; | 354 | err = nexthdr[1]; |
352 | 355 | ||
@@ -499,9 +502,12 @@ static void esp4_err(struct sk_buff *skb, u32 info) | |||
499 | if (!x) | 502 | if (!x) |
500 | return; | 503 | return; |
501 | 504 | ||
502 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 505 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
506 | atomic_inc(&flow_cache_genid); | ||
507 | rt_genid_bump(net); | ||
508 | |||
503 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); | 509 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0); |
504 | else | 510 | } else |
505 | ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); | 511 | ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0); |
506 | xfrm_state_put(x); | 512 | xfrm_state_put(x); |
507 | } | 513 | } |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 801e02355ec4..00a14b9864ea 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -965,8 +965,12 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev | |||
965 | ptr--; | 965 | ptr--; |
966 | } | 966 | } |
967 | if (tunnel->parms.o_flags&GRE_CSUM) { | 967 | if (tunnel->parms.o_flags&GRE_CSUM) { |
968 | int offset = skb_transport_offset(skb); | ||
969 | |||
968 | *ptr = 0; | 970 | *ptr = 0; |
969 | *(__sum16 *)ptr = ip_compute_csum((void *)(iph+1), skb->len - sizeof(struct iphdr)); | 971 | *(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset, |
972 | skb->len - offset, | ||
973 | 0)); | ||
970 | } | 974 | } |
971 | } | 975 | } |
972 | 976 | ||
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c index d3ab47e19a89..9a46daed2f3c 100644 --- a/net/ipv4/ipcomp.c +++ b/net/ipv4/ipcomp.c | |||
@@ -47,9 +47,12 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info) | |||
47 | if (!x) | 47 | if (!x) |
48 | return; | 48 | return; |
49 | 49 | ||
50 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) | 50 | if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) { |
51 | atomic_inc(&flow_cache_genid); | ||
52 | rt_genid_bump(net); | ||
53 | |||
51 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); | 54 | ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0); |
52 | else | 55 | } else |
53 | ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); | 56 | ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0); |
54 | xfrm_state_put(x); | 57 | xfrm_state_put(x); |
55 | } | 58 | } |
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 8f3d05424a3e..6f9c07268cf6 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -738,6 +738,7 @@ struct proto ping_prot = { | |||
738 | .recvmsg = ping_recvmsg, | 738 | .recvmsg = ping_recvmsg, |
739 | .bind = ping_bind, | 739 | .bind = ping_bind, |
740 | .backlog_rcv = ping_queue_rcv_skb, | 740 | .backlog_rcv = ping_queue_rcv_skb, |
741 | .release_cb = ip4_datagram_release_cb, | ||
741 | .hash = ping_v4_hash, | 742 | .hash = ping_v4_hash, |
742 | .unhash = ping_v4_unhash, | 743 | .unhash = ping_v4_unhash, |
743 | .get_port = ping_v4_get_port, | 744 | .get_port = ping_v4_get_port, |
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 73d1e4df4bf6..6f08991409c3 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -894,6 +894,7 @@ struct proto raw_prot = { | |||
894 | .recvmsg = raw_recvmsg, | 894 | .recvmsg = raw_recvmsg, |
895 | .bind = raw_bind, | 895 | .bind = raw_bind, |
896 | .backlog_rcv = raw_rcv_skb, | 896 | .backlog_rcv = raw_rcv_skb, |
897 | .release_cb = ip4_datagram_release_cb, | ||
897 | .hash = raw_hash_sk, | 898 | .hash = raw_hash_sk, |
898 | .unhash = raw_unhash_sk, | 899 | .unhash = raw_unhash_sk, |
899 | .obj_size = sizeof(struct raw_sock), | 900 | .obj_size = sizeof(struct raw_sock), |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 844a9ef60dbd..a0fcc47fee73 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -912,6 +912,9 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu) | |||
912 | struct dst_entry *dst = &rt->dst; | 912 | struct dst_entry *dst = &rt->dst; |
913 | struct fib_result res; | 913 | struct fib_result res; |
914 | 914 | ||
915 | if (dst_metric_locked(dst, RTAX_MTU)) | ||
916 | return; | ||
917 | |||
915 | if (dst->dev->mtu < mtu) | 918 | if (dst->dev->mtu < mtu) |
916 | return; | 919 | return; |
917 | 920 | ||
@@ -962,7 +965,7 @@ void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, | |||
962 | } | 965 | } |
963 | EXPORT_SYMBOL_GPL(ipv4_update_pmtu); | 966 | EXPORT_SYMBOL_GPL(ipv4_update_pmtu); |
964 | 967 | ||
965 | void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | 968 | static void __ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) |
966 | { | 969 | { |
967 | const struct iphdr *iph = (const struct iphdr *) skb->data; | 970 | const struct iphdr *iph = (const struct iphdr *) skb->data; |
968 | struct flowi4 fl4; | 971 | struct flowi4 fl4; |
@@ -975,6 +978,53 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | |||
975 | ip_rt_put(rt); | 978 | ip_rt_put(rt); |
976 | } | 979 | } |
977 | } | 980 | } |
981 | |||
982 | void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) | ||
983 | { | ||
984 | const struct iphdr *iph = (const struct iphdr *) skb->data; | ||
985 | struct flowi4 fl4; | ||
986 | struct rtable *rt; | ||
987 | struct dst_entry *dst; | ||
988 | bool new = false; | ||
989 | |||
990 | bh_lock_sock(sk); | ||
991 | rt = (struct rtable *) __sk_dst_get(sk); | ||
992 | |||
993 | if (sock_owned_by_user(sk) || !rt) { | ||
994 | __ipv4_sk_update_pmtu(skb, sk, mtu); | ||
995 | goto out; | ||
996 | } | ||
997 | |||
998 | __build_flow_key(&fl4, sk, iph, 0, 0, 0, 0, 0); | ||
999 | |||
1000 | if (!__sk_dst_check(sk, 0)) { | ||
1001 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | ||
1002 | if (IS_ERR(rt)) | ||
1003 | goto out; | ||
1004 | |||
1005 | new = true; | ||
1006 | } | ||
1007 | |||
1008 | __ip_rt_update_pmtu((struct rtable *) rt->dst.path, &fl4, mtu); | ||
1009 | |||
1010 | dst = dst_check(&rt->dst, 0); | ||
1011 | if (!dst) { | ||
1012 | if (new) | ||
1013 | dst_release(&rt->dst); | ||
1014 | |||
1015 | rt = ip_route_output_flow(sock_net(sk), &fl4, sk); | ||
1016 | if (IS_ERR(rt)) | ||
1017 | goto out; | ||
1018 | |||
1019 | new = true; | ||
1020 | } | ||
1021 | |||
1022 | if (new) | ||
1023 | __sk_dst_set(sk, &rt->dst); | ||
1024 | |||
1025 | out: | ||
1026 | bh_unlock_sock(sk); | ||
1027 | } | ||
978 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); | 1028 | EXPORT_SYMBOL_GPL(ipv4_sk_update_pmtu); |
979 | 1029 | ||
980 | void ipv4_redirect(struct sk_buff *skb, struct net *net, | 1030 | void ipv4_redirect(struct sk_buff *skb, struct net *net, |
@@ -1120,7 +1170,7 @@ static unsigned int ipv4_mtu(const struct dst_entry *dst) | |||
1120 | if (!mtu || time_after_eq(jiffies, rt->dst.expires)) | 1170 | if (!mtu || time_after_eq(jiffies, rt->dst.expires)) |
1121 | mtu = dst_metric_raw(dst, RTAX_MTU); | 1171 | mtu = dst_metric_raw(dst, RTAX_MTU); |
1122 | 1172 | ||
1123 | if (mtu && rt_is_output_route(rt)) | 1173 | if (mtu) |
1124 | return mtu; | 1174 | return mtu; |
1125 | 1175 | ||
1126 | mtu = dst->dev->mtu; | 1176 | mtu = dst->dev->mtu; |
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index bbbdcc5c1973..5a1cfc692df0 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c | |||
@@ -369,11 +369,10 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) | |||
369 | * We do take care of PMTU discovery (RFC1191) special case : | 369 | * We do take care of PMTU discovery (RFC1191) special case : |
370 | * we can receive locally generated ICMP messages while socket is held. | 370 | * we can receive locally generated ICMP messages while socket is held. |
371 | */ | 371 | */ |
372 | if (sock_owned_by_user(sk) && | 372 | if (sock_owned_by_user(sk)) { |
373 | type != ICMP_DEST_UNREACH && | 373 | if (!(type == ICMP_DEST_UNREACH && code == ICMP_FRAG_NEEDED)) |
374 | code != ICMP_FRAG_NEEDED) | 374 | NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); |
375 | NET_INC_STATS_BH(net, LINUX_MIB_LOCKDROPPEDICMPS); | 375 | } |
376 | |||
377 | if (sk->sk_state == TCP_CLOSE) | 376 | if (sk->sk_state == TCP_CLOSE) |
378 | goto out; | 377 | goto out; |
379 | 378 | ||
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index e0610e4b5158..6791aac06ea9 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1977,6 +1977,7 @@ struct proto udp_prot = { | |||
1977 | .recvmsg = udp_recvmsg, | 1977 | .recvmsg = udp_recvmsg, |
1978 | .sendpage = udp_sendpage, | 1978 | .sendpage = udp_sendpage, |
1979 | .backlog_rcv = __udp_queue_rcv_skb, | 1979 | .backlog_rcv = __udp_queue_rcv_skb, |
1980 | .release_cb = ip4_datagram_release_cb, | ||
1980 | .hash = udp_lib_hash, | 1981 | .hash = udp_lib_hash, |
1981 | .unhash = udp_lib_unhash, | 1982 | .unhash = udp_lib_unhash, |
1982 | .rehash = udp_v4_rehash, | 1983 | .rehash = udp_v4_rehash, |
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c index ecc35b93314b..384233188ac1 100644 --- a/net/ipv6/ah6.c +++ b/net/ipv6/ah6.c | |||
@@ -472,7 +472,10 @@ static void ah6_input_done(struct crypto_async_request *base, int err) | |||
472 | skb->network_header += ah_hlen; | 472 | skb->network_header += ah_hlen; |
473 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 473 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
474 | __skb_pull(skb, ah_hlen + hdr_len); | 474 | __skb_pull(skb, ah_hlen + hdr_len); |
475 | skb_set_transport_header(skb, -hdr_len); | 475 | if (x->props.mode == XFRM_MODE_TUNNEL) |
476 | skb_reset_transport_header(skb); | ||
477 | else | ||
478 | skb_set_transport_header(skb, -hdr_len); | ||
476 | out: | 479 | out: |
477 | kfree(AH_SKB_CB(skb)->tmp); | 480 | kfree(AH_SKB_CB(skb)->tmp); |
478 | xfrm_input_resume(skb, err); | 481 | xfrm_input_resume(skb, err); |
@@ -593,9 +596,13 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb) | |||
593 | 596 | ||
594 | skb->network_header += ah_hlen; | 597 | skb->network_header += ah_hlen; |
595 | memcpy(skb_network_header(skb), work_iph, hdr_len); | 598 | memcpy(skb_network_header(skb), work_iph, hdr_len); |
596 | skb->transport_header = skb->network_header; | ||
597 | __skb_pull(skb, ah_hlen + hdr_len); | 599 | __skb_pull(skb, ah_hlen + hdr_len); |
598 | 600 | ||
601 | if (x->props.mode == XFRM_MODE_TUNNEL) | ||
602 | skb_reset_transport_header(skb); | ||
603 | else | ||
604 | skb_set_transport_header(skb, -hdr_len); | ||
605 | |||
599 | err = nexthdr; | 606 | err = nexthdr; |
600 | 607 | ||
601 | out_free: | 608 | out_free: |
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index 282f3723ee19..40ffd72243a4 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c | |||
@@ -300,7 +300,10 @@ static int esp_input_done2(struct sk_buff *skb, int err) | |||
300 | 300 | ||
301 | pskb_trim(skb, skb->len - alen - padlen - 2); | 301 | pskb_trim(skb, skb->len - alen - padlen - 2); |
302 | __skb_pull(skb, hlen); | 302 | __skb_pull(skb, hlen); |
303 | skb_set_transport_header(skb, -hdr_len); | 303 | if (x->props.mode == XFRM_MODE_TUNNEL) |
304 | skb_reset_transport_header(skb); | ||
305 | else | ||
306 | skb_set_transport_header(skb, -hdr_len); | ||
304 | 307 | ||
305 | err = nexthdr[1]; | 308 | err = nexthdr[1]; |
306 | 309 | ||
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index b4a9fd51dae7..fff5bdd8b680 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -81,10 +81,22 @@ static inline struct sock *icmpv6_sk(struct net *net) | |||
81 | return net->ipv6.icmp_sk[smp_processor_id()]; | 81 | return net->ipv6.icmp_sk[smp_processor_id()]; |
82 | } | 82 | } |
83 | 83 | ||
84 | static void icmpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | ||
85 | u8 type, u8 code, int offset, __be32 info) | ||
86 | { | ||
87 | struct net *net = dev_net(skb->dev); | ||
88 | |||
89 | if (type == ICMPV6_PKT_TOOBIG) | ||
90 | ip6_update_pmtu(skb, net, info, 0, 0); | ||
91 | else if (type == NDISC_REDIRECT) | ||
92 | ip6_redirect(skb, net, 0, 0); | ||
93 | } | ||
94 | |||
84 | static int icmpv6_rcv(struct sk_buff *skb); | 95 | static int icmpv6_rcv(struct sk_buff *skb); |
85 | 96 | ||
86 | static const struct inet6_protocol icmpv6_protocol = { | 97 | static const struct inet6_protocol icmpv6_protocol = { |
87 | .handler = icmpv6_rcv, | 98 | .handler = icmpv6_rcv, |
99 | .err_handler = icmpv6_err, | ||
88 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 100 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
89 | }; | 101 | }; |
90 | 102 | ||
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 7dea45af66d3..906b7e6dd7fb 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -1190,10 +1190,10 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, | |||
1190 | if (dst_allfrag(rt->dst.path)) | 1190 | if (dst_allfrag(rt->dst.path)) |
1191 | cork->flags |= IPCORK_ALLFRAG; | 1191 | cork->flags |= IPCORK_ALLFRAG; |
1192 | cork->length = 0; | 1192 | cork->length = 0; |
1193 | exthdrlen = (opt ? opt->opt_flen : 0) - rt->rt6i_nfheader_len; | 1193 | exthdrlen = (opt ? opt->opt_flen : 0); |
1194 | length += exthdrlen; | 1194 | length += exthdrlen; |
1195 | transhdrlen += exthdrlen; | 1195 | transhdrlen += exthdrlen; |
1196 | dst_exthdrlen = rt->dst.header_len; | 1196 | dst_exthdrlen = rt->dst.header_len - rt->rt6i_nfheader_len; |
1197 | } else { | 1197 | } else { |
1198 | rt = (struct rt6_info *)cork->dst; | 1198 | rt = (struct rt6_info *)cork->dst; |
1199 | fl6 = &inet->cork.fl.u.ip6; | 1199 | fl6 = &inet->cork.fl.u.ip6; |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index acc32494006a..351ce98e90d9 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -1766,6 +1766,9 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns | |||
1766 | return -EINVAL; | 1766 | return -EINVAL; |
1767 | if (get_user(v, (u32 __user *)optval)) | 1767 | if (get_user(v, (u32 __user *)optval)) |
1768 | return -EFAULT; | 1768 | return -EFAULT; |
1769 | /* "pim6reg%u" should not exceed 16 bytes (IFNAMSIZ) */ | ||
1770 | if (v != RT_TABLE_DEFAULT && v >= 100000000) | ||
1771 | return -EINVAL; | ||
1769 | if (sk == mrt->mroute6_sk) | 1772 | if (sk == mrt->mroute6_sk) |
1770 | return -EBUSY; | 1773 | return -EBUSY; |
1771 | 1774 | ||
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 379c81dee9d1..9bcdbd02d777 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -224,7 +224,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | |||
224 | 224 | ||
225 | /* Free the outqueue structure and any related pending chunks. | 225 | /* Free the outqueue structure and any related pending chunks. |
226 | */ | 226 | */ |
227 | void sctp_outq_teardown(struct sctp_outq *q) | 227 | static void __sctp_outq_teardown(struct sctp_outq *q) |
228 | { | 228 | { |
229 | struct sctp_transport *transport; | 229 | struct sctp_transport *transport; |
230 | struct list_head *lchunk, *temp; | 230 | struct list_head *lchunk, *temp; |
@@ -277,8 +277,6 @@ void sctp_outq_teardown(struct sctp_outq *q) | |||
277 | sctp_chunk_free(chunk); | 277 | sctp_chunk_free(chunk); |
278 | } | 278 | } |
279 | 279 | ||
280 | q->error = 0; | ||
281 | |||
282 | /* Throw away any leftover control chunks. */ | 280 | /* Throw away any leftover control chunks. */ |
283 | list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { | 281 | list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) { |
284 | list_del_init(&chunk->list); | 282 | list_del_init(&chunk->list); |
@@ -286,11 +284,17 @@ void sctp_outq_teardown(struct sctp_outq *q) | |||
286 | } | 284 | } |
287 | } | 285 | } |
288 | 286 | ||
287 | void sctp_outq_teardown(struct sctp_outq *q) | ||
288 | { | ||
289 | __sctp_outq_teardown(q); | ||
290 | sctp_outq_init(q->asoc, q); | ||
291 | } | ||
292 | |||
289 | /* Free the outqueue structure and any related pending chunks. */ | 293 | /* Free the outqueue structure and any related pending chunks. */ |
290 | void sctp_outq_free(struct sctp_outq *q) | 294 | void sctp_outq_free(struct sctp_outq *q) |
291 | { | 295 | { |
292 | /* Throw away leftover chunks. */ | 296 | /* Throw away leftover chunks. */ |
293 | sctp_outq_teardown(q); | 297 | __sctp_outq_teardown(q); |
294 | 298 | ||
295 | /* If we were kmalloc()'d, free the memory. */ | 299 | /* If we were kmalloc()'d, free the memory. */ |
296 | if (q->malloced) | 300 | if (q->malloced) |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 618ec7e216ca..5131fcfedb03 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -1779,8 +1779,10 @@ static sctp_disposition_t sctp_sf_do_dupcook_a(struct net *net, | |||
1779 | 1779 | ||
1780 | /* Update the content of current association. */ | 1780 | /* Update the content of current association. */ |
1781 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); | 1781 | sctp_add_cmd_sf(commands, SCTP_CMD_UPDATE_ASSOC, SCTP_ASOC(new_asoc)); |
1782 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1783 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); | 1782 | sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(ev)); |
1783 | sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE, | ||
1784 | SCTP_STATE(SCTP_STATE_ESTABLISHED)); | ||
1785 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); | ||
1784 | return SCTP_DISPOSITION_CONSUME; | 1786 | return SCTP_DISPOSITION_CONSUME; |
1785 | 1787 | ||
1786 | nomem_ev: | 1788 | nomem_ev: |
diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c index 043889ac86c0..bf3c6e8fc401 100644 --- a/net/sctp/sysctl.c +++ b/net/sctp/sysctl.c | |||
@@ -366,7 +366,11 @@ int sctp_sysctl_net_register(struct net *net) | |||
366 | 366 | ||
367 | void sctp_sysctl_net_unregister(struct net *net) | 367 | void sctp_sysctl_net_unregister(struct net *net) |
368 | { | 368 | { |
369 | struct ctl_table *table; | ||
370 | |||
371 | table = net->sctp.sysctl_header->ctl_table_arg; | ||
369 | unregister_net_sysctl_table(net->sctp.sysctl_header); | 372 | unregister_net_sysctl_table(net->sctp.sysctl_header); |
373 | kfree(table); | ||
370 | } | 374 | } |
371 | 375 | ||
372 | static struct ctl_table_header * sctp_sysctl_header; | 376 | static struct ctl_table_header * sctp_sysctl_header; |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 41eabc46f110..07c585756d2a 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2656,7 +2656,7 @@ static void xfrm_policy_fini(struct net *net) | |||
2656 | WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); | 2656 | WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir])); |
2657 | 2657 | ||
2658 | htab = &net->xfrm.policy_bydst[dir]; | 2658 | htab = &net->xfrm.policy_bydst[dir]; |
2659 | sz = (htab->hmask + 1); | 2659 | sz = (htab->hmask + 1) * sizeof(struct hlist_head); |
2660 | WARN_ON(!hlist_empty(htab->table)); | 2660 | WARN_ON(!hlist_empty(htab->table)); |
2661 | xfrm_hash_free(htab->table, sz); | 2661 | xfrm_hash_free(htab->table, sz); |
2662 | } | 2662 | } |
diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c index 765f6fe951eb..35754cc8a9e5 100644 --- a/net/xfrm/xfrm_replay.c +++ b/net/xfrm/xfrm_replay.c | |||
@@ -242,11 +242,13 @@ static void xfrm_replay_advance_bmp(struct xfrm_state *x, __be32 net_seq) | |||
242 | u32 diff; | 242 | u32 diff; |
243 | struct xfrm_replay_state_esn *replay_esn = x->replay_esn; | 243 | struct xfrm_replay_state_esn *replay_esn = x->replay_esn; |
244 | u32 seq = ntohl(net_seq); | 244 | u32 seq = ntohl(net_seq); |
245 | u32 pos = (replay_esn->seq - 1) % replay_esn->replay_window; | 245 | u32 pos; |
246 | 246 | ||
247 | if (!replay_esn->replay_window) | 247 | if (!replay_esn->replay_window) |
248 | return; | 248 | return; |
249 | 249 | ||
250 | pos = (replay_esn->seq - 1) % replay_esn->replay_window; | ||
251 | |||
250 | if (seq > replay_esn->seq) { | 252 | if (seq > replay_esn->seq) { |
251 | diff = seq - replay_esn->seq; | 253 | diff = seq - replay_esn->seq; |
252 | 254 | ||