diff options
Diffstat (limited to 'net/ipv4/ip_forward.c')
-rw-r--r-- | net/ipv4/ip_forward.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c index 369e721c4bab..9cb04df0054b 100644 --- a/net/ipv4/ip_forward.c +++ b/net/ipv4/ip_forward.c | |||
@@ -67,14 +67,14 @@ int ip_forward(struct sk_buff *skb) | |||
67 | if (skb->pkt_type != PACKET_HOST) | 67 | if (skb->pkt_type != PACKET_HOST) |
68 | goto drop; | 68 | goto drop; |
69 | 69 | ||
70 | skb->ip_summed = CHECKSUM_NONE; | 70 | skb_forward_csum(skb); |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * According to the RFC, we must first decrease the TTL field. If | 73 | * According to the RFC, we must first decrease the TTL field. If |
74 | * that reaches zero, we must reply an ICMP control message telling | 74 | * that reaches zero, we must reply an ICMP control message telling |
75 | * that the packet's lifetime expired. | 75 | * that the packet's lifetime expired. |
76 | */ | 76 | */ |
77 | if (skb->nh.iph->ttl <= 1) | 77 | if (ip_hdr(skb)->ttl <= 1) |
78 | goto too_many_hops; | 78 | goto too_many_hops; |
79 | 79 | ||
80 | if (!xfrm4_route_forward(skb)) | 80 | if (!xfrm4_route_forward(skb)) |
@@ -85,10 +85,18 @@ 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) && | ||
89 | (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { | ||
90 | IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); | ||
91 | icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, | ||
92 | htonl(dst_mtu(&rt->u.dst))); | ||
93 | goto drop; | ||
94 | } | ||
95 | |||
88 | /* We are about to mangle packet. Copy it! */ | 96 | /* We are about to mangle packet. Copy it! */ |
89 | if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev)+rt->u.dst.header_len)) | 97 | if (skb_cow(skb, LL_RESERVED_SPACE(rt->u.dst.dev)+rt->u.dst.header_len)) |
90 | goto drop; | 98 | goto drop; |
91 | iph = skb->nh.iph; | 99 | iph = ip_hdr(skb); |
92 | 100 | ||
93 | /* Decrease ttl after skb cow done */ | 101 | /* Decrease ttl after skb cow done */ |
94 | ip_decrease_ttl(iph); | 102 | ip_decrease_ttl(iph); |