diff options
author | John Heffner <jheffner@psc.edu> | 2007-04-20 18:52:39 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:09 -0400 |
commit | b881ef7603230550aa0150b22af94089f07ab00d (patch) | |
tree | ec74ff083cc84590e7a48510bb912821bb6cab6c | |
parent | fd44de7cc1d430caef91ad9aecec9ff000fe86f8 (diff) |
[IPV6]: MTU discovery check in ip6_fragment()
Adds a check in ip6_fragment() mirroring ip_fragment() for packets
that we can't fragment, and sends an ICMP Packet Too Big message
in response.
Signed-off-by: John Heffner <jheffner@psc.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/ip6_output.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 4cfdad4e8356..5a5b7d4ad31c 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -567,6 +567,19 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) | |||
567 | nexthdr = *prevhdr; | 567 | nexthdr = *prevhdr; |
568 | 568 | ||
569 | mtu = dst_mtu(&rt->u.dst); | 569 | mtu = dst_mtu(&rt->u.dst); |
570 | |||
571 | /* We must not fragment if the socket is set to force MTU discovery | ||
572 | * or if the skb it not generated by a local socket. (This last | ||
573 | * check should be redundant, but it's free.) | ||
574 | */ | ||
575 | if (!np || np->pmtudisc >= IPV6_PMTUDISC_DO) { | ||
576 | skb->dev = skb->dst->dev; | ||
577 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu, skb->dev); | ||
578 | IP6_INC_STATS(ip6_dst_idev(skb->dst), IPSTATS_MIB_FRAGFAILS); | ||
579 | kfree_skb(skb); | ||
580 | return -EMSGSIZE; | ||
581 | } | ||
582 | |||
570 | if (np && np->frag_size < mtu) { | 583 | if (np && np->frag_size < mtu) { |
571 | if (np->frag_size) | 584 | if (np->frag_size) |
572 | mtu = np->frag_size; | 585 | mtu = np->frag_size; |