aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-20 06:27:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-20 06:27:18 -0400
commit4958134df54c2c84e9c22ea042761d439164d26e (patch)
tree503177afab11f7d25b12a84ce25b481d305c51ba /net/ipv4
parentc4f528795d1add8b63652673f7262729f679c6c1 (diff)
parentc698ca5278934c0ae32297a8725ced2e27585d7f (diff)
Merge 4.16-rc6 into tty-next
We want the serial/tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/ip_gre.c5
-rw-r--r--net/ipv4/ip_output.c2
-rw-r--r--net/ipv4/ip_tunnel.c13
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c15
-rw-r--r--net/ipv4/netfilter/nf_flow_table_ipv4.c3
-rw-r--r--net/ipv4/route.c18
-rw-r--r--net/ipv4/tcp_illinois.c2
-rw-r--r--net/ipv4/tcp_input.c24
-rw-r--r--net/ipv4/xfrm4_output.c3
10 files changed, 43 insertions, 44 deletions
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 2dd21c3281a1..b54b948b0596 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -55,7 +55,7 @@ static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
55 if (skb->ignore_df) 55 if (skb->ignore_df)
56 return false; 56 return false;
57 57
58 if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) 58 if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
59 return false; 59 return false;
60 60
61 return true; 61 return true;
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 45d97e9b2759..0901de42ed85 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -970,9 +970,6 @@ static void __gre_tunnel_init(struct net_device *dev)
970 970
971 t_hlen = tunnel->hlen + sizeof(struct iphdr); 971 t_hlen = tunnel->hlen + sizeof(struct iphdr);
972 972
973 dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
974 dev->mtu = ETH_DATA_LEN - t_hlen - 4;
975
976 dev->features |= GRE_FEATURES; 973 dev->features |= GRE_FEATURES;
977 dev->hw_features |= GRE_FEATURES; 974 dev->hw_features |= GRE_FEATURES;
978 975
@@ -1290,8 +1287,6 @@ static int erspan_tunnel_init(struct net_device *dev)
1290 erspan_hdr_len(tunnel->erspan_ver); 1287 erspan_hdr_len(tunnel->erspan_ver);
1291 t_hlen = tunnel->hlen + sizeof(struct iphdr); 1288 t_hlen = tunnel->hlen + sizeof(struct iphdr);
1292 1289
1293 dev->needed_headroom = LL_MAX_HEADER + t_hlen + 4;
1294 dev->mtu = ETH_DATA_LEN - t_hlen - 4;
1295 dev->features |= GRE_FEATURES; 1290 dev->features |= GRE_FEATURES;
1296 dev->hw_features |= GRE_FEATURES; 1291 dev->hw_features |= GRE_FEATURES;
1297 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 1292 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e8e675be60ec..66340ab750e6 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -248,7 +248,7 @@ static int ip_finish_output_gso(struct net *net, struct sock *sk,
248 248
249 /* common case: seglen is <= mtu 249 /* common case: seglen is <= mtu
250 */ 250 */
251 if (skb_gso_validate_mtu(skb, mtu)) 251 if (skb_gso_validate_network_len(skb, mtu))
252 return ip_finish_output2(net, sk, skb); 252 return ip_finish_output2(net, sk, skb);
253 253
254 /* Slowpath - GSO segment length exceeds the egress MTU. 254 /* Slowpath - GSO segment length exceeds the egress MTU.
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
index d786a8441bce..6d21068f9b55 100644
--- a/net/ipv4/ip_tunnel.c
+++ b/net/ipv4/ip_tunnel.c
@@ -710,16 +710,9 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
710 } 710 }
711 } 711 }
712 712
713 if (tunnel->fwmark) { 713 init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr,
714 init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr, 714 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link,
715 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link, 715 tunnel->fwmark);
716 tunnel->fwmark);
717 }
718 else {
719 init_tunnel_flow(&fl4, protocol, dst, tnl_params->saddr,
720 tunnel->parms.o_key, RT_TOS(tos), tunnel->parms.link,
721 skb->mark);
722 }
723 716
724 if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0) 717 if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0)
725 goto tx_error; 718 goto tx_error;
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 4b02ab39ebc5..8a8ae61cea71 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -232,7 +232,6 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i,
232 c->hash_mode = i->hash_mode; 232 c->hash_mode = i->hash_mode;
233 c->hash_initval = i->hash_initval; 233 c->hash_initval = i->hash_initval;
234 refcount_set(&c->refcount, 1); 234 refcount_set(&c->refcount, 1);
235 refcount_set(&c->entries, 1);
236 235
237 spin_lock_bh(&cn->lock); 236 spin_lock_bh(&cn->lock);
238 if (__clusterip_config_find(net, ip)) { 237 if (__clusterip_config_find(net, ip)) {
@@ -263,8 +262,10 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i,
263 262
264 c->notifier.notifier_call = clusterip_netdev_event; 263 c->notifier.notifier_call = clusterip_netdev_event;
265 err = register_netdevice_notifier(&c->notifier); 264 err = register_netdevice_notifier(&c->notifier);
266 if (!err) 265 if (!err) {
266 refcount_set(&c->entries, 1);
267 return c; 267 return c;
268 }
268 269
269#ifdef CONFIG_PROC_FS 270#ifdef CONFIG_PROC_FS
270 proc_remove(c->pde); 271 proc_remove(c->pde);
@@ -273,7 +274,7 @@ err:
273 spin_lock_bh(&cn->lock); 274 spin_lock_bh(&cn->lock);
274 list_del_rcu(&c->list); 275 list_del_rcu(&c->list);
275 spin_unlock_bh(&cn->lock); 276 spin_unlock_bh(&cn->lock);
276 kfree(c); 277 clusterip_config_put(c);
277 278
278 return ERR_PTR(err); 279 return ERR_PTR(err);
279} 280}
@@ -496,12 +497,15 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
496 return PTR_ERR(config); 497 return PTR_ERR(config);
497 } 498 }
498 } 499 }
499 cipinfo->config = config;
500 500
501 ret = nf_ct_netns_get(par->net, par->family); 501 ret = nf_ct_netns_get(par->net, par->family);
502 if (ret < 0) 502 if (ret < 0) {
503 pr_info("cannot load conntrack support for proto=%u\n", 503 pr_info("cannot load conntrack support for proto=%u\n",
504 par->family); 504 par->family);
505 clusterip_config_entry_put(par->net, config);
506 clusterip_config_put(config);
507 return ret;
508 }
505 509
506 if (!par->net->xt.clusterip_deprecated_warning) { 510 if (!par->net->xt.clusterip_deprecated_warning) {
507 pr_info("ipt_CLUSTERIP is deprecated and it will removed soon, " 511 pr_info("ipt_CLUSTERIP is deprecated and it will removed soon, "
@@ -509,6 +513,7 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
509 par->net->xt.clusterip_deprecated_warning = true; 513 par->net->xt.clusterip_deprecated_warning = true;
510 } 514 }
511 515
516 cipinfo->config = config;
512 return ret; 517 return ret;
513} 518}
514 519
diff --git a/net/ipv4/netfilter/nf_flow_table_ipv4.c b/net/ipv4/netfilter/nf_flow_table_ipv4.c
index 25d2975da156..0cd46bffa469 100644
--- a/net/ipv4/netfilter/nf_flow_table_ipv4.c
+++ b/net/ipv4/netfilter/nf_flow_table_ipv4.c
@@ -111,6 +111,7 @@ static int nf_flow_dnat_ip(const struct flow_offload *flow, struct sk_buff *skb,
111 default: 111 default:
112 return -1; 112 return -1;
113 } 113 }
114 csum_replace4(&iph->check, addr, new_addr);
114 115
115 return nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr); 116 return nf_flow_nat_ip_l4proto(skb, iph, thoff, addr, new_addr);
116} 117}
@@ -185,7 +186,7 @@ static bool __nf_flow_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
185 if ((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0) 186 if ((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0)
186 return false; 187 return false;
187 188
188 if (skb_is_gso(skb) && skb_gso_validate_mtu(skb, mtu)) 189 if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
189 return false; 190 return false;
190 191
191 return true; 192 return true;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index a4f44d815a61..860b3fd2f54b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -128,10 +128,11 @@ static int ip_rt_redirect_silence __read_mostly = ((HZ / 50) << (9 + 1));
128static int ip_rt_error_cost __read_mostly = HZ; 128static int ip_rt_error_cost __read_mostly = HZ;
129static int ip_rt_error_burst __read_mostly = 5 * HZ; 129static int ip_rt_error_burst __read_mostly = 5 * HZ;
130static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ; 130static int ip_rt_mtu_expires __read_mostly = 10 * 60 * HZ;
131static int ip_rt_min_pmtu __read_mostly = 512 + 20 + 20; 131static u32 ip_rt_min_pmtu __read_mostly = 512 + 20 + 20;
132static int ip_rt_min_advmss __read_mostly = 256; 132static int ip_rt_min_advmss __read_mostly = 256;
133 133
134static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT; 134static int ip_rt_gc_timeout __read_mostly = RT_GC_TIMEOUT;
135
135/* 136/*
136 * Interface to generic destination cache. 137 * Interface to generic destination cache.
137 */ 138 */
@@ -930,14 +931,23 @@ out_put_peer:
930 931
931static int ip_error(struct sk_buff *skb) 932static int ip_error(struct sk_buff *skb)
932{ 933{
933 struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
934 struct rtable *rt = skb_rtable(skb); 934 struct rtable *rt = skb_rtable(skb);
935 struct net_device *dev = skb->dev;
936 struct in_device *in_dev;
935 struct inet_peer *peer; 937 struct inet_peer *peer;
936 unsigned long now; 938 unsigned long now;
937 struct net *net; 939 struct net *net;
938 bool send; 940 bool send;
939 int code; 941 int code;
940 942
943 if (netif_is_l3_master(skb->dev)) {
944 dev = __dev_get_by_index(dev_net(skb->dev), IPCB(skb)->iif);
945 if (!dev)
946 goto out;
947 }
948
949 in_dev = __in_dev_get_rcu(dev);
950
941 /* IP on this device is disabled. */ 951 /* IP on this device is disabled. */
942 if (!in_dev) 952 if (!in_dev)
943 goto out; 953 goto out;
@@ -2818,6 +2828,7 @@ void ip_rt_multicast_event(struct in_device *in_dev)
2818static int ip_rt_gc_interval __read_mostly = 60 * HZ; 2828static int ip_rt_gc_interval __read_mostly = 60 * HZ;
2819static int ip_rt_gc_min_interval __read_mostly = HZ / 2; 2829static int ip_rt_gc_min_interval __read_mostly = HZ / 2;
2820static int ip_rt_gc_elasticity __read_mostly = 8; 2830static int ip_rt_gc_elasticity __read_mostly = 8;
2831static int ip_min_valid_pmtu __read_mostly = IPV4_MIN_MTU;
2821 2832
2822static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write, 2833static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
2823 void __user *buffer, 2834 void __user *buffer,
@@ -2933,7 +2944,8 @@ static struct ctl_table ipv4_route_table[] = {
2933 .data = &ip_rt_min_pmtu, 2944 .data = &ip_rt_min_pmtu,
2934 .maxlen = sizeof(int), 2945 .maxlen = sizeof(int),
2935 .mode = 0644, 2946 .mode = 0644,
2936 .proc_handler = proc_dointvec, 2947 .proc_handler = proc_dointvec_minmax,
2948 .extra1 = &ip_min_valid_pmtu,
2937 }, 2949 },
2938 { 2950 {
2939 .procname = "min_adv_mss", 2951 .procname = "min_adv_mss",
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 7c843578f233..faddf4f9a707 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -6,7 +6,7 @@
6 * The algorithm is described in: 6 * The algorithm is described in:
7 * "TCP-Illinois: A Loss and Delay-Based Congestion Control Algorithm 7 * "TCP-Illinois: A Loss and Delay-Based Congestion Control Algorithm
8 * for High-Speed Networks" 8 * for High-Speed Networks"
9 * http://www.ifp.illinois.edu/~srikant/Papers/liubassri06perf.pdf 9 * http://tamerbasar.csl.illinois.edu/LiuBasarSrikantPerfEvalArtJun2008.pdf
10 * 10 *
11 * Implemented from description in paper and ns-2 simulation. 11 * Implemented from description in paper and ns-2 simulation.
12 * Copyright (C) 2007 Stephen Hemminger <shemminger@linux-foundation.org> 12 * Copyright (C) 2007 Stephen Hemminger <shemminger@linux-foundation.org>
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 575d3c1fb6e8..9a1b3c1c1c14 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1971,11 +1971,6 @@ void tcp_enter_loss(struct sock *sk)
1971 /* F-RTO RFC5682 sec 3.1 step 1: retransmit SND.UNA if no previous 1971 /* F-RTO RFC5682 sec 3.1 step 1: retransmit SND.UNA if no previous
1972 * loss recovery is underway except recurring timeout(s) on 1972 * loss recovery is underway except recurring timeout(s) on
1973 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing 1973 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing
1974 *
1975 * In theory F-RTO can be used repeatedly during loss recovery.
1976 * In practice this interacts badly with broken middle-boxes that
1977 * falsely raise the receive window, which results in repeated
1978 * timeouts and stop-and-go behavior.
1979 */ 1974 */
1980 tp->frto = net->ipv4.sysctl_tcp_frto && 1975 tp->frto = net->ipv4.sysctl_tcp_frto &&
1981 (new_recovery || icsk->icsk_retransmits) && 1976 (new_recovery || icsk->icsk_retransmits) &&
@@ -2631,18 +2626,14 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack,
2631 tcp_try_undo_loss(sk, false)) 2626 tcp_try_undo_loss(sk, false))
2632 return; 2627 return;
2633 2628
2634 /* The ACK (s)acks some never-retransmitted data meaning not all
2635 * the data packets before the timeout were lost. Therefore we
2636 * undo the congestion window and state. This is essentially
2637 * the operation in F-RTO (RFC5682 section 3.1 step 3.b). Since
2638 * a retransmitted skb is permantly marked, we can apply such an
2639 * operation even if F-RTO was not used.
2640 */
2641 if ((flag & FLAG_ORIG_SACK_ACKED) &&
2642 tcp_try_undo_loss(sk, tp->undo_marker))
2643 return;
2644
2645 if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ 2629 if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */
2630 /* Step 3.b. A timeout is spurious if not all data are
2631 * lost, i.e., never-retransmitted data are (s)acked.
2632 */
2633 if ((flag & FLAG_ORIG_SACK_ACKED) &&
2634 tcp_try_undo_loss(sk, true))
2635 return;
2636
2646 if (after(tp->snd_nxt, tp->high_seq)) { 2637 if (after(tp->snd_nxt, tp->high_seq)) {
2647 if (flag & FLAG_DATA_SACKED || is_dupack) 2638 if (flag & FLAG_DATA_SACKED || is_dupack)
2648 tp->frto = 0; /* Step 3.a. loss was real */ 2639 tp->frto = 0; /* Step 3.a. loss was real */
@@ -4001,6 +3992,7 @@ void tcp_reset(struct sock *sk)
4001 /* This barrier is coupled with smp_rmb() in tcp_poll() */ 3992 /* This barrier is coupled with smp_rmb() in tcp_poll() */
4002 smp_wmb(); 3993 smp_wmb();
4003 3994
3995 tcp_write_queue_purge(sk);
4004 tcp_done(sk); 3996 tcp_done(sk);
4005 3997
4006 if (!sock_flag(sk, SOCK_DEAD)) 3998 if (!sock_flag(sk, SOCK_DEAD))
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 94b8702603bc..be980c195fc5 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -30,7 +30,8 @@ static int xfrm4_tunnel_check_size(struct sk_buff *skb)
30 30
31 mtu = dst_mtu(skb_dst(skb)); 31 mtu = dst_mtu(skb_dst(skb));
32 if ((!skb_is_gso(skb) && skb->len > mtu) || 32 if ((!skb_is_gso(skb) && skb->len > mtu) ||
33 (skb_is_gso(skb) && skb_gso_network_seglen(skb) > ip_skb_dst_mtu(skb->sk, skb))) { 33 (skb_is_gso(skb) &&
34 !skb_gso_validate_network_len(skb, ip_skb_dst_mtu(skb->sk, skb)))) {
34 skb->protocol = htons(ETH_P_IP); 35 skb->protocol = htons(ETH_P_IP);
35 36
36 if (skb->sk) 37 if (skb->sk)