diff options
author | Ulrich Weber <uweber@astaro.com> | 2010-02-26 07:34:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-26 07:34:49 -0500 |
commit | 14f3ad6f4a12495b32b0dd743bc7179f36658208 (patch) | |
tree | bff2b347d1a1755955ba1b37c561b1bff2f6d861 /net/ipv6/ip6_output.c | |
parent | fbf219f1c89b15e90ec2db5a3e9636376dc623db (diff) |
ipv6: Use 1280 as min MTU for ipv6 forwarding
Clients will set their MTU to 1280 if they receive a
ICMPV6_PKT_TOOBIG message with an MTU less than 1280.
To allow encapsulating of packets over a 1280 link
we should always accept packets with a size of 1280
for forwarding even if the path has a lower MTU and
fragment the encapsulated packets afterwards.
In case a forwarded packet is not going to be encapsulated
a ICMPV6_PKT_TOOBIG msg will still be send by ip6_fragment()
with the correct MTU.
Signed-off-by: Ulrich Weber <uweber@astaro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 1a5fe9ad1947..dabf108ad811 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -402,6 +402,7 @@ int ip6_forward(struct sk_buff *skb) | |||
402 | struct ipv6hdr *hdr = ipv6_hdr(skb); | 402 | struct ipv6hdr *hdr = ipv6_hdr(skb); |
403 | struct inet6_skb_parm *opt = IP6CB(skb); | 403 | struct inet6_skb_parm *opt = IP6CB(skb); |
404 | struct net *net = dev_net(dst->dev); | 404 | struct net *net = dev_net(dst->dev); |
405 | u32 mtu; | ||
405 | 406 | ||
406 | if (net->ipv6.devconf_all->forwarding == 0) | 407 | if (net->ipv6.devconf_all->forwarding == 0) |
407 | goto error; | 408 | goto error; |
@@ -508,10 +509,14 @@ int ip6_forward(struct sk_buff *skb) | |||
508 | } | 509 | } |
509 | } | 510 | } |
510 | 511 | ||
511 | if (skb->len > dst_mtu(dst)) { | 512 | mtu = dst_mtu(dst); |
513 | if (mtu < IPV6_MIN_MTU) | ||
514 | mtu = IPV6_MIN_MTU; | ||
515 | |||
516 | if (skb->len > mtu) { | ||
512 | /* Again, force OUTPUT device used as source address */ | 517 | /* Again, force OUTPUT device used as source address */ |
513 | skb->dev = dst->dev; | 518 | skb->dev = dst->dev; |
514 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, dst_mtu(dst)); | 519 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
515 | IP6_INC_STATS_BH(net, | 520 | IP6_INC_STATS_BH(net, |
516 | ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); | 521 | ip6_dst_idev(dst), IPSTATS_MIB_INTOOBIGERRORS); |
517 | IP6_INC_STATS_BH(net, | 522 | IP6_INC_STATS_BH(net, |
@@ -621,8 +626,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
621 | mtu = ip6_skb_dst_mtu(skb); | 626 | mtu = ip6_skb_dst_mtu(skb); |
622 | 627 | ||
623 | /* We must not fragment if the socket is set to force MTU discovery | 628 | /* We must not fragment if the socket is set to force MTU discovery |
624 | * or if the skb it not generated by a local socket. (This last | 629 | * or if the skb it not generated by a local socket. |
625 | * check should be redundant, but it's free.) | ||
626 | */ | 630 | */ |
627 | if (!skb->local_df) { | 631 | if (!skb->local_df) { |
628 | skb->dev = skb_dst(skb)->dev; | 632 | skb->dev = skb_dst(skb)->dev; |