diff options
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/Kconfig | 8 | ||||
-rw-r--r-- | net/ipv4/esp4.c | 2 | ||||
-rw-r--r-- | net/ipv4/icmp.c | 24 | ||||
-rw-r--r-- | net/ipv4/inet_fragment.c | 3 | ||||
-rw-r--r-- | net/ipv4/inet_timewait_sock.c | 1 | ||||
-rw-r--r-- | net/ipv4/ip_forward.c | 2 | ||||
-rw-r--r-- | net/ipv4/ip_sockglue.c | 2 | ||||
-rw-r--r-- | net/ipv4/ipconfig.c | 2 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_queue.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_CLUSTERIP.c | 5 | ||||
-rw-r--r-- | net/ipv4/netfilter/ipt_recent.c | 3 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | 7 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 65 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 3 | ||||
-rw-r--r-- | net/ipv4/udp.c | 4 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_beet.c | 11 | ||||
-rw-r--r-- | net/ipv4/xfrm4_mode_tunnel.c | 2 | ||||
-rw-r--r-- | net/ipv4/xfrm4_output.c | 2 | ||||
-rw-r--r-- | net/ipv4/xfrm4_state.c | 2 |
20 files changed, 97 insertions, 61 deletions
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig index 9c7e5ffb223d..4670683b4688 100644 --- a/net/ipv4/Kconfig +++ b/net/ipv4/Kconfig | |||
@@ -160,7 +160,7 @@ config IP_PNP_DHCP | |||
160 | 160 | ||
161 | If unsure, say Y. Note that if you want to use DHCP, a DHCP server | 161 | If unsure, say Y. Note that if you want to use DHCP, a DHCP server |
162 | must be operating on your network. Read | 162 | must be operating on your network. Read |
163 | <file:Documentation/nfsroot.txt> for details. | 163 | <file:Documentation/filesystems/nfsroot.txt> for details. |
164 | 164 | ||
165 | config IP_PNP_BOOTP | 165 | config IP_PNP_BOOTP |
166 | bool "IP: BOOTP support" | 166 | bool "IP: BOOTP support" |
@@ -175,7 +175,7 @@ config IP_PNP_BOOTP | |||
175 | does BOOTP itself, providing all necessary information on the kernel | 175 | does BOOTP itself, providing all necessary information on the kernel |
176 | command line, you can say N here. If unsure, say Y. Note that if you | 176 | command line, you can say N here. If unsure, say Y. Note that if you |
177 | want to use BOOTP, a BOOTP server must be operating on your network. | 177 | want to use BOOTP, a BOOTP server must be operating on your network. |
178 | Read <file:Documentation/nfsroot.txt> for details. | 178 | Read <file:Documentation/filesystems/nfsroot.txt> for details. |
179 | 179 | ||
180 | config IP_PNP_RARP | 180 | config IP_PNP_RARP |
181 | bool "IP: RARP support" | 181 | bool "IP: RARP support" |
@@ -187,8 +187,8 @@ config IP_PNP_RARP | |||
187 | discovered automatically at boot time using the RARP protocol (an | 187 | discovered automatically at boot time using the RARP protocol (an |
188 | older protocol which is being obsoleted by BOOTP and DHCP), say Y | 188 | older protocol which is being obsoleted by BOOTP and DHCP), say Y |
189 | here. Note that if you want to use RARP, a RARP server must be | 189 | here. Note that if you want to use RARP, a RARP server must be |
190 | operating on your network. Read <file:Documentation/nfsroot.txt> for | 190 | operating on your network. Read |
191 | details. | 191 | <file:Documentation/filesystems/nfsroot.txt> for details. |
192 | 192 | ||
193 | # not yet ready.. | 193 | # not yet ready.. |
194 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP | 194 | # bool ' IP: ARP support' CONFIG_IP_PNP_ARP |
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c index f3ceca31aa45..4e73e5708e70 100644 --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c | |||
@@ -336,7 +336,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb) | |||
336 | struct scatterlist *asg; | 336 | struct scatterlist *asg; |
337 | int err = -EINVAL; | 337 | int err = -EINVAL; |
338 | 338 | ||
339 | if (!pskb_may_pull(skb, sizeof(*esph))) | 339 | if (!pskb_may_pull(skb, sizeof(*esph) + crypto_aead_ivsize(aead))) |
340 | goto out; | 340 | goto out; |
341 | 341 | ||
342 | if (elen <= 0) | 342 | if (elen <= 0) |
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index a13c074dac09..40508babad8c 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c | |||
@@ -591,7 +591,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
591 | } | 591 | } |
592 | 592 | ||
593 | if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) | 593 | if (xfrm_decode_session_reverse(skb_in, &fl, AF_INET)) |
594 | goto out_unlock; | 594 | goto relookup_failed; |
595 | 595 | ||
596 | if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) | 596 | if (inet_addr_type(net, fl.fl4_src) == RTN_LOCAL) |
597 | err = __ip_route_output_key(net, &rt2, &fl); | 597 | err = __ip_route_output_key(net, &rt2, &fl); |
@@ -601,7 +601,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
601 | 601 | ||
602 | fl2.fl4_dst = fl.fl4_src; | 602 | fl2.fl4_dst = fl.fl4_src; |
603 | if (ip_route_output_key(net, &rt2, &fl2)) | 603 | if (ip_route_output_key(net, &rt2, &fl2)) |
604 | goto out_unlock; | 604 | goto relookup_failed; |
605 | 605 | ||
606 | /* Ugh! */ | 606 | /* Ugh! */ |
607 | odst = skb_in->dst; | 607 | odst = skb_in->dst; |
@@ -614,21 +614,23 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info) | |||
614 | } | 614 | } |
615 | 615 | ||
616 | if (err) | 616 | if (err) |
617 | goto out_unlock; | 617 | goto relookup_failed; |
618 | 618 | ||
619 | err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL, | 619 | err = xfrm_lookup((struct dst_entry **)&rt2, &fl, NULL, |
620 | XFRM_LOOKUP_ICMP); | 620 | XFRM_LOOKUP_ICMP); |
621 | if (err == -ENOENT) { | 621 | switch (err) { |
622 | case 0: | ||
623 | dst_release(&rt->u.dst); | ||
624 | rt = rt2; | ||
625 | break; | ||
626 | case -EPERM: | ||
627 | goto ende; | ||
628 | default: | ||
629 | relookup_failed: | ||
622 | if (!rt) | 630 | if (!rt) |
623 | goto out_unlock; | 631 | goto out_unlock; |
624 | goto route_done; | 632 | break; |
625 | } | 633 | } |
626 | |||
627 | dst_release(&rt->u.dst); | ||
628 | rt = rt2; | ||
629 | |||
630 | if (err) | ||
631 | goto out_unlock; | ||
632 | } | 634 | } |
633 | 635 | ||
634 | route_done: | 636 | route_done: |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index 724d69aed031..a0a3c78cb5e0 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -86,7 +86,10 @@ EXPORT_SYMBOL(inet_frags_fini); | |||
86 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) | 86 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) |
87 | { | 87 | { |
88 | nf->low_thresh = 0; | 88 | nf->low_thresh = 0; |
89 | |||
90 | local_bh_disable(); | ||
89 | inet_frag_evictor(nf, f); | 91 | inet_frag_evictor(nf, f); |
92 | local_bh_enable(); | ||
90 | } | 93 | } |
91 | EXPORT_SYMBOL(inet_frags_exit_net); | 94 | EXPORT_SYMBOL(inet_frags_exit_net); |
92 | 95 | ||
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index 876169f3a528..717c411a5c6b 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -124,6 +124,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, const int stat | |||
124 | tw->tw_hash = sk->sk_hash; | 124 | tw->tw_hash = sk->sk_hash; |
125 | tw->tw_ipv6only = 0; | 125 | tw->tw_ipv6only = 0; |
126 | tw->tw_prot = sk->sk_prot_creator; | 126 | tw->tw_prot = sk->sk_prot_creator; |
127 | tw->tw_net = sk->sk_net; | ||
127 | atomic_set(&tw->tw_refcnt, 1); | 128 | atomic_set(&tw->tw_refcnt, 1); |
128 | inet_twsk_dead_node_init(tw); | 129 | inet_twsk_dead_node_init(tw); |
129 | __module_get(tw->tw_prot->owner); | 130 | __module_get(tw->tw_prot->owner); |
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 0b3b328d82db..a4506c8cfef0 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -85,7 +85,7 @@ int ip_forward(struct sk_buff *skb) | |||
85 | if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) | 85 | if (opt->is_strictroute && rt->rt_dst != rt->rt_gateway) |
86 | goto sr_failed; | 86 | goto sr_failed; |
87 | 87 | ||
88 | if (unlikely(skb->len > dst_mtu(&rt->u.dst) && | 88 | if (unlikely(skb->len > dst_mtu(&rt->u.dst) && !skb_is_gso(skb) && |
89 | (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { | 89 | (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { |
90 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); | 90 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); |
91 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, | 91 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, |
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index f72457b4b0a7..c2921d01e925 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1132,7 +1132,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
1132 | } | 1132 | } |
1133 | release_sock(sk); | 1133 | release_sock(sk); |
1134 | 1134 | ||
1135 | if (len < sizeof(int) && len > 0 && val>=0 && val<255) { | 1135 | if (len < sizeof(int) && len > 0 && val>=0 && val<=255) { |
1136 | unsigned char ucval = (unsigned char)val; | 1136 | unsigned char ucval = (unsigned char)val; |
1137 | len = 1; | 1137 | len = 1; |
1138 | if (put_user(len, optlen)) | 1138 | if (put_user(len, optlen)) |
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 7c992fbbc2c3..4824fe8996bf 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c | |||
@@ -1411,7 +1411,7 @@ late_initcall(ip_auto_config); | |||
1411 | 1411 | ||
1412 | /* | 1412 | /* |
1413 | * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel | 1413 | * Decode any IP configuration options in the "ip=" or "nfsaddrs=" kernel |
1414 | * command line parameter. See Documentation/nfsroot.txt. | 1414 | * command line parameter. See Documentation/filesystems/nfsroot.txt. |
1415 | */ | 1415 | */ |
1416 | static int __init ic_proto_name(char *name) | 1416 | static int __init ic_proto_name(char *name) |
1417 | { | 1417 | { |
diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c index fe05da41d6ba..4dc162894cb2 100644 --- a/net/ipv4/netfilter/ip_queue.c +++ b/net/ipv4/netfilter/ip_queue.c | |||
@@ -588,11 +588,9 @@ static int __init ip_queue_init(void) | |||
588 | } | 588 | } |
589 | 589 | ||
590 | #ifdef CONFIG_PROC_FS | 590 | #ifdef CONFIG_PROC_FS |
591 | proc = create_proc_entry(IPQ_PROC_FS_NAME, 0, init_net.proc_net); | 591 | proc = proc_create(IPQ_PROC_FS_NAME, 0, init_net.proc_net, |
592 | if (proc) { | 592 | &ip_queue_proc_fops); |
593 | proc->owner = THIS_MODULE; | 593 | if (!proc) { |
594 | proc->proc_fops = &ip_queue_proc_fops; | ||
595 | } else { | ||
596 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); | 594 | printk(KERN_ERR "ip_queue: failed to create proc entry\n"); |
597 | goto cleanup_ipqnl; | 595 | goto cleanup_ipqnl; |
598 | } | 596 | } |
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index c6cf84c77611..52926c8e3cc1 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c | |||
@@ -167,14 +167,13 @@ clusterip_config_init(struct ipt_clusterip_tgt_info *i, __be32 ip, | |||
167 | 167 | ||
168 | /* create proc dir entry */ | 168 | /* create proc dir entry */ |
169 | sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); | 169 | sprintf(buffer, "%u.%u.%u.%u", NIPQUAD(ip)); |
170 | c->pde = create_proc_entry(buffer, S_IWUSR|S_IRUSR, | 170 | c->pde = proc_create(buffer, S_IWUSR|S_IRUSR, |
171 | clusterip_procdir); | 171 | clusterip_procdir, &clusterip_proc_fops); |
172 | if (!c->pde) { | 172 | if (!c->pde) { |
173 | kfree(c); | 173 | kfree(c); |
174 | return NULL; | 174 | return NULL; |
175 | } | 175 | } |
176 | } | 176 | } |
177 | c->pde->proc_fops = &clusterip_proc_fops; | ||
178 | c->pde->data = c; | 177 | c->pde->data = c; |
179 | #endif | 178 | #endif |
180 | 179 | ||
diff --git a/net/ipv4/netfilter/ipt_recent.c b/net/ipv4/netfilter/ipt_recent.c index 8e8f0425a8ed..50e06690eb5b 100644 --- a/net/ipv4/netfilter/ipt_recent.c +++ b/net/ipv4/netfilter/ipt_recent.c | |||
@@ -276,12 +276,11 @@ recent_mt_check(const char *tablename, const void *ip, | |||
276 | for (i = 0; i < ip_list_hash_size; i++) | 276 | for (i = 0; i < ip_list_hash_size; i++) |
277 | INIT_LIST_HEAD(&t->iphash[i]); | 277 | INIT_LIST_HEAD(&t->iphash[i]); |
278 | #ifdef CONFIG_PROC_FS | 278 | #ifdef CONFIG_PROC_FS |
279 | t->proc = create_proc_entry(t->name, ip_list_perms, proc_dir); | 279 | t->proc = proc_create(t->name, ip_list_perms, proc_dir, &recent_fops); |
280 | if (t->proc == NULL) { | 280 | if (t->proc == NULL) { |
281 | kfree(t); | 281 | kfree(t); |
282 | goto out; | 282 | goto out; |
283 | } | 283 | } |
284 | t->proc->proc_fops = &recent_fops; | ||
285 | t->proc->uid = ip_list_uid; | 284 | t->proc->uid = ip_list_uid; |
286 | t->proc->gid = ip_list_gid; | 285 | t->proc->gid = ip_list_gid; |
287 | t->proc->data = t; | 286 | t->proc->data = t; |
diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c index 089252e82c01..f500b0fdaef4 100644 --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c | |||
@@ -395,13 +395,10 @@ int __init nf_conntrack_ipv4_compat_init(void) | |||
395 | if (!proc_exp) | 395 | if (!proc_exp) |
396 | goto err2; | 396 | goto err2; |
397 | 397 | ||
398 | proc_stat = create_proc_entry("ip_conntrack", S_IRUGO, init_net.proc_net_stat); | 398 | proc_stat = proc_create("ip_conntrack", S_IRUGO, |
399 | init_net.proc_net_stat, &ct_cpu_seq_fops); | ||
399 | if (!proc_stat) | 400 | if (!proc_stat) |
400 | goto err3; | 401 | goto err3; |
401 | |||
402 | proc_stat->proc_fops = &ct_cpu_seq_fops; | ||
403 | proc_stat->owner = THIS_MODULE; | ||
404 | |||
405 | return 0; | 402 | return 0; |
406 | 403 | ||
407 | err3: | 404 | err3: |
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 0d5fa3a54d04..36b4e3bb056f 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -629,6 +629,8 @@ static int __init nf_nat_init(void) | |||
629 | size_t i; | 629 | size_t i; |
630 | int ret; | 630 | int ret; |
631 | 631 | ||
632 | need_ipv4_conntrack(); | ||
633 | |||
632 | ret = nf_ct_extend_register(&nat_extend); | 634 | ret = nf_ct_extend_register(&nat_extend); |
633 | if (ret < 0) { | 635 | if (ret < 0) { |
634 | printk(KERN_ERR "nf_nat_core: Unable to register extension\n"); | 636 | printk(KERN_ERR "nf_nat_core: Unable to register extension\n"); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 7facdb0f6960..5119856017ab 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1625,13 +1625,11 @@ out: | |||
1625 | return flag; | 1625 | return flag; |
1626 | } | 1626 | } |
1627 | 1627 | ||
1628 | /* If we receive more dupacks than we expected counting segments | 1628 | /* Limits sacked_out so that sum with lost_out isn't ever larger than |
1629 | * in assumption of absent reordering, interpret this as reordering. | 1629 | * packets_out. Returns zero if sacked_out adjustement wasn't necessary. |
1630 | * The only another reason could be bug in receiver TCP. | ||
1631 | */ | 1630 | */ |
1632 | static void tcp_check_reno_reordering(struct sock *sk, const int addend) | 1631 | int tcp_limit_reno_sacked(struct tcp_sock *tp) |
1633 | { | 1632 | { |
1634 | struct tcp_sock *tp = tcp_sk(sk); | ||
1635 | u32 holes; | 1633 | u32 holes; |
1636 | 1634 | ||
1637 | holes = max(tp->lost_out, 1U); | 1635 | holes = max(tp->lost_out, 1U); |
@@ -1639,8 +1637,20 @@ static void tcp_check_reno_reordering(struct sock *sk, const int addend) | |||
1639 | 1637 | ||
1640 | if ((tp->sacked_out + holes) > tp->packets_out) { | 1638 | if ((tp->sacked_out + holes) > tp->packets_out) { |
1641 | tp->sacked_out = tp->packets_out - holes; | 1639 | tp->sacked_out = tp->packets_out - holes; |
1642 | tcp_update_reordering(sk, tp->packets_out + addend, 0); | 1640 | return 1; |
1643 | } | 1641 | } |
1642 | return 0; | ||
1643 | } | ||
1644 | |||
1645 | /* If we receive more dupacks than we expected counting segments | ||
1646 | * in assumption of absent reordering, interpret this as reordering. | ||
1647 | * The only another reason could be bug in receiver TCP. | ||
1648 | */ | ||
1649 | static void tcp_check_reno_reordering(struct sock *sk, const int addend) | ||
1650 | { | ||
1651 | struct tcp_sock *tp = tcp_sk(sk); | ||
1652 | if (tcp_limit_reno_sacked(tp)) | ||
1653 | tcp_update_reordering(sk, tp->packets_out + addend, 0); | ||
1644 | } | 1654 | } |
1645 | 1655 | ||
1646 | /* Emulate SACKs for SACKless connection: account for a new dupack. */ | 1656 | /* Emulate SACKs for SACKless connection: account for a new dupack. */ |
@@ -1681,11 +1691,16 @@ static inline void tcp_reset_reno_sack(struct tcp_sock *tp) | |||
1681 | int tcp_use_frto(struct sock *sk) | 1691 | int tcp_use_frto(struct sock *sk) |
1682 | { | 1692 | { |
1683 | const struct tcp_sock *tp = tcp_sk(sk); | 1693 | const struct tcp_sock *tp = tcp_sk(sk); |
1694 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
1684 | struct sk_buff *skb; | 1695 | struct sk_buff *skb; |
1685 | 1696 | ||
1686 | if (!sysctl_tcp_frto) | 1697 | if (!sysctl_tcp_frto) |
1687 | return 0; | 1698 | return 0; |
1688 | 1699 | ||
1700 | /* MTU probe and F-RTO won't really play nicely along currently */ | ||
1701 | if (icsk->icsk_mtup.probe_size) | ||
1702 | return 0; | ||
1703 | |||
1689 | if (IsSackFrto()) | 1704 | if (IsSackFrto()) |
1690 | return 1; | 1705 | return 1; |
1691 | 1706 | ||
@@ -2134,11 +2149,13 @@ static void tcp_verify_retransmit_hint(struct tcp_sock *tp, struct sk_buff *skb) | |||
2134 | /* Mark head of queue up as lost. With RFC3517 SACK, the packets is | 2149 | /* Mark head of queue up as lost. With RFC3517 SACK, the packets is |
2135 | * is against sacked "cnt", otherwise it's against facked "cnt" | 2150 | * is against sacked "cnt", otherwise it's against facked "cnt" |
2136 | */ | 2151 | */ |
2137 | static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit) | 2152 | static void tcp_mark_head_lost(struct sock *sk, int packets) |
2138 | { | 2153 | { |
2139 | struct tcp_sock *tp = tcp_sk(sk); | 2154 | struct tcp_sock *tp = tcp_sk(sk); |
2140 | struct sk_buff *skb; | 2155 | struct sk_buff *skb; |
2141 | int cnt; | 2156 | int cnt, oldcnt; |
2157 | int err; | ||
2158 | unsigned int mss; | ||
2142 | 2159 | ||
2143 | BUG_TRAP(packets <= tp->packets_out); | 2160 | BUG_TRAP(packets <= tp->packets_out); |
2144 | if (tp->lost_skb_hint) { | 2161 | if (tp->lost_skb_hint) { |
@@ -2157,13 +2174,25 @@ static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit) | |||
2157 | tp->lost_skb_hint = skb; | 2174 | tp->lost_skb_hint = skb; |
2158 | tp->lost_cnt_hint = cnt; | 2175 | tp->lost_cnt_hint = cnt; |
2159 | 2176 | ||
2177 | if (after(TCP_SKB_CB(skb)->end_seq, tp->high_seq)) | ||
2178 | break; | ||
2179 | |||
2180 | oldcnt = cnt; | ||
2160 | if (tcp_is_fack(tp) || tcp_is_reno(tp) || | 2181 | if (tcp_is_fack(tp) || tcp_is_reno(tp) || |
2161 | (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) | 2182 | (TCP_SKB_CB(skb)->sacked & TCPCB_SACKED_ACKED)) |
2162 | cnt += tcp_skb_pcount(skb); | 2183 | cnt += tcp_skb_pcount(skb); |
2163 | 2184 | ||
2164 | if (((!fast_rexmit || (tp->lost_out > 0)) && (cnt > packets)) || | 2185 | if (cnt > packets) { |
2165 | after(TCP_SKB_CB(skb)->end_seq, tp->high_seq)) | 2186 | if (tcp_is_sack(tp) || (oldcnt >= packets)) |
2166 | break; | 2187 | break; |
2188 | |||
2189 | mss = skb_shinfo(skb)->gso_size; | ||
2190 | err = tcp_fragment(sk, skb, (packets - oldcnt) * mss, mss); | ||
2191 | if (err < 0) | ||
2192 | break; | ||
2193 | cnt = packets; | ||
2194 | } | ||
2195 | |||
2167 | if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) { | 2196 | if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_SACKED_ACKED|TCPCB_LOST))) { |
2168 | TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; | 2197 | TCP_SKB_CB(skb)->sacked |= TCPCB_LOST; |
2169 | tp->lost_out += tcp_skb_pcount(skb); | 2198 | tp->lost_out += tcp_skb_pcount(skb); |
@@ -2180,17 +2209,17 @@ static void tcp_update_scoreboard(struct sock *sk, int fast_rexmit) | |||
2180 | struct tcp_sock *tp = tcp_sk(sk); | 2209 | struct tcp_sock *tp = tcp_sk(sk); |
2181 | 2210 | ||
2182 | if (tcp_is_reno(tp)) { | 2211 | if (tcp_is_reno(tp)) { |
2183 | tcp_mark_head_lost(sk, 1, fast_rexmit); | 2212 | tcp_mark_head_lost(sk, 1); |
2184 | } else if (tcp_is_fack(tp)) { | 2213 | } else if (tcp_is_fack(tp)) { |
2185 | int lost = tp->fackets_out - tp->reordering; | 2214 | int lost = tp->fackets_out - tp->reordering; |
2186 | if (lost <= 0) | 2215 | if (lost <= 0) |
2187 | lost = 1; | 2216 | lost = 1; |
2188 | tcp_mark_head_lost(sk, lost, fast_rexmit); | 2217 | tcp_mark_head_lost(sk, lost); |
2189 | } else { | 2218 | } else { |
2190 | int sacked_upto = tp->sacked_out - tp->reordering; | 2219 | int sacked_upto = tp->sacked_out - tp->reordering; |
2191 | if (sacked_upto < 0) | 2220 | if (sacked_upto < fast_rexmit) |
2192 | sacked_upto = 0; | 2221 | sacked_upto = fast_rexmit; |
2193 | tcp_mark_head_lost(sk, sacked_upto, fast_rexmit); | 2222 | tcp_mark_head_lost(sk, sacked_upto); |
2194 | } | 2223 | } |
2195 | 2224 | ||
2196 | /* New heuristics: it is possible only after we switched | 2225 | /* New heuristics: it is possible only after we switched |
@@ -2524,7 +2553,7 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag) | |||
2524 | before(tp->snd_una, tp->high_seq) && | 2553 | before(tp->snd_una, tp->high_seq) && |
2525 | icsk->icsk_ca_state != TCP_CA_Open && | 2554 | icsk->icsk_ca_state != TCP_CA_Open && |
2526 | tp->fackets_out > tp->reordering) { | 2555 | tp->fackets_out > tp->reordering) { |
2527 | tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering, 0); | 2556 | tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering); |
2528 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); | 2557 | NET_INC_STATS_BH(LINUX_MIB_TCPLOSS); |
2529 | } | 2558 | } |
2530 | 2559 | ||
@@ -2586,6 +2615,8 @@ static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int flag) | |||
2586 | case TCP_CA_Loss: | 2615 | case TCP_CA_Loss: |
2587 | if (flag & FLAG_DATA_ACKED) | 2616 | if (flag & FLAG_DATA_ACKED) |
2588 | icsk->icsk_retransmits = 0; | 2617 | icsk->icsk_retransmits = 0; |
2618 | if (tcp_is_reno(tp) && flag & FLAG_SND_UNA_ADVANCED) | ||
2619 | tcp_reset_reno_sack(tp); | ||
2589 | if (!tcp_try_undo_loss(sk)) { | 2620 | if (!tcp_try_undo_loss(sk)) { |
2590 | tcp_moderate_cwnd(tp); | 2621 | tcp_moderate_cwnd(tp); |
2591 | tcp_xmit_retransmit_queue(sk); | 2622 | tcp_xmit_retransmit_queue(sk); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 72b9350006fe..d29ef79c00ca 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1808,6 +1808,9 @@ void tcp_simple_retransmit(struct sock *sk) | |||
1808 | if (!lost) | 1808 | if (!lost) |
1809 | return; | 1809 | return; |
1810 | 1810 | ||
1811 | if (tcp_is_reno(tp)) | ||
1812 | tcp_limit_reno_sacked(tp); | ||
1813 | |||
1811 | tcp_verify_left_out(tp); | 1814 | tcp_verify_left_out(tp); |
1812 | 1815 | ||
1813 | /* Don't muck with the congestion window here. | 1816 | /* Don't muck with the congestion window here. |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 7ea1b67b6de1..1704c1474ea1 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1556,14 +1556,14 @@ static void *udp_seq_start(struct seq_file *seq, loff_t *pos) | |||
1556 | __acquires(udp_hash_lock) | 1556 | __acquires(udp_hash_lock) |
1557 | { | 1557 | { |
1558 | read_lock(&udp_hash_lock); | 1558 | read_lock(&udp_hash_lock); |
1559 | return *pos ? udp_get_idx(seq, *pos-1) : (void *)1; | 1559 | return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN; |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 1562 | static void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
1563 | { | 1563 | { |
1564 | struct sock *sk; | 1564 | struct sock *sk; |
1565 | 1565 | ||
1566 | if (v == (void *)1) | 1566 | if (v == SEQ_START_TOKEN) |
1567 | sk = udp_get_idx(seq, 0); | 1567 | sk = udp_get_idx(seq, 0); |
1568 | else | 1568 | else |
1569 | sk = udp_get_next(seq, v); | 1569 | sk = udp_get_next(seq, v); |
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c index b47030ba162b..9c798abce736 100644 --- a/net/ipv4/xfrm4_mode_beet.c +++ b/net/ipv4/xfrm4_mode_beet.c | |||
@@ -39,13 +39,11 @@ static void xfrm4_beet_make_header(struct sk_buff *skb) | |||
39 | static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) | 39 | static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) |
40 | { | 40 | { |
41 | struct ip_beet_phdr *ph; | 41 | struct ip_beet_phdr *ph; |
42 | struct iphdr *iph, *top_iph; | 42 | struct iphdr *top_iph; |
43 | int hdrlen, optlen; | 43 | int hdrlen, optlen; |
44 | 44 | ||
45 | iph = ip_hdr(skb); | ||
46 | |||
47 | hdrlen = 0; | 45 | hdrlen = 0; |
48 | optlen = iph->ihl * 4 - sizeof(*iph); | 46 | optlen = XFRM_MODE_SKB_CB(skb)->optlen; |
49 | if (unlikely(optlen)) | 47 | if (unlikely(optlen)) |
50 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); | 48 | hdrlen += IPV4_BEET_PHMAXLEN - (optlen & 4); |
51 | 49 | ||
@@ -53,11 +51,12 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
53 | hdrlen); | 51 | hdrlen); |
54 | skb->mac_header = skb->network_header + | 52 | skb->mac_header = skb->network_header + |
55 | offsetof(struct iphdr, protocol); | 53 | offsetof(struct iphdr, protocol); |
56 | skb->transport_header = skb->network_header + sizeof(*iph); | 54 | skb->transport_header = skb->network_header + sizeof(*top_iph); |
57 | 55 | ||
58 | xfrm4_beet_make_header(skb); | 56 | xfrm4_beet_make_header(skb); |
59 | 57 | ||
60 | ph = (struct ip_beet_phdr *)__skb_pull(skb, sizeof(*iph) - hdrlen); | 58 | ph = (struct ip_beet_phdr *) |
59 | __skb_pull(skb, XFRM_MODE_SKB_CB(skb)->ihl - hdrlen); | ||
61 | 60 | ||
62 | top_iph = ip_hdr(skb); | 61 | top_iph = ip_hdr(skb); |
63 | 62 | ||
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index 8dee617ee900..584e6d74e3a9 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -41,7 +41,7 @@ static int xfrm4_mode_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) | |||
41 | top_iph->ihl = 5; | 41 | top_iph->ihl = 5; |
42 | top_iph->version = 4; | 42 | top_iph->version = 4; |
43 | 43 | ||
44 | top_iph->protocol = x->inner_mode->afinfo->proto; | 44 | top_iph->protocol = xfrm_af2proto(skb->dst->ops->family); |
45 | 45 | ||
46 | /* DS disclosed */ | 46 | /* DS disclosed */ |
47 | top_iph->tos = INET_ECN_encapsulate(XFRM_MODE_SKB_CB(skb)->tos, | 47 | top_iph->tos = INET_ECN_encapsulate(XFRM_MODE_SKB_CB(skb)->tos, |
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index d5a58a818021..8c3180adddbf 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c | |||
@@ -56,7 +56,7 @@ int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb) | |||
56 | { | 56 | { |
57 | int err; | 57 | int err; |
58 | 58 | ||
59 | err = x->inner_mode->afinfo->extract_output(x, skb); | 59 | err = xfrm_inner_extract_output(x, skb); |
60 | if (err) | 60 | if (err) |
61 | return err; | 61 | return err; |
62 | 62 | ||
diff --git a/net/ipv4/xfrm4_state.c b/net/ipv4/xfrm4_state.c index fdeebe68a379..07735ed280d7 100644 --- a/net/ipv4/xfrm4_state.c +++ b/net/ipv4/xfrm4_state.c | |||
@@ -52,10 +52,12 @@ int xfrm4_extract_header(struct sk_buff *skb) | |||
52 | { | 52 | { |
53 | struct iphdr *iph = ip_hdr(skb); | 53 | struct iphdr *iph = ip_hdr(skb); |
54 | 54 | ||
55 | XFRM_MODE_SKB_CB(skb)->ihl = sizeof(*iph); | ||
55 | XFRM_MODE_SKB_CB(skb)->id = iph->id; | 56 | XFRM_MODE_SKB_CB(skb)->id = iph->id; |
56 | XFRM_MODE_SKB_CB(skb)->frag_off = iph->frag_off; | 57 | XFRM_MODE_SKB_CB(skb)->frag_off = iph->frag_off; |
57 | XFRM_MODE_SKB_CB(skb)->tos = iph->tos; | 58 | XFRM_MODE_SKB_CB(skb)->tos = iph->tos; |
58 | XFRM_MODE_SKB_CB(skb)->ttl = iph->ttl; | 59 | XFRM_MODE_SKB_CB(skb)->ttl = iph->ttl; |
60 | XFRM_MODE_SKB_CB(skb)->optlen = iph->ihl * 4 - sizeof(*iph); | ||
59 | memset(XFRM_MODE_SKB_CB(skb)->flow_lbl, 0, | 61 | memset(XFRM_MODE_SKB_CB(skb)->flow_lbl, 0, |
60 | sizeof(XFRM_MODE_SKB_CB(skb)->flow_lbl)); | 62 | sizeof(XFRM_MODE_SKB_CB(skb)->flow_lbl)); |
61 | 63 | ||