From 4eb5acd9e2890524dbf44b7b70307df47dfa48d3 Mon Sep 17 00:00:00 2001 From: idelamer Date: Wed, 22 Jun 2011 12:14:58 +0000 Subject: [PATCH] Don't forward IPv6 packets that are larger than outgoing MTU, send ICMPv6 message back for Path MTU discovery. --- src/core/ipv6/ip6.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/ipv6/ip6.c b/src/core/ipv6/ip6.c index ab17bbb9..bae27ece 100644 --- a/src/core/ipv6/ip6.c +++ b/src/core/ipv6/ip6.c @@ -295,6 +295,17 @@ ip6_forward(struct pbuf *p, struct ip6_hdr *iphdr, struct netif *inp) return; } + if (netif->mtu && (p->tot_len > netif->mtu)) { +#if LWIP_ICMP6 + /* Don't send ICMP messages in response to ICMP messages */ + if (IP6H_NEXTH(iphdr) != IP6_NEXTH_ICMP6) { + icmp6_packet_too_big(p, netif->mtu); + } +#endif /* LWIP_ICMP6 */ + IP6_STATS_INC(ip6.drop); + return; + } + LWIP_DEBUGF(IP6_DEBUG, ("ip6_forward: forwarding packet to %"X16_F":%"X16_F":%"X16_F":%"X16_F":%"X16_F":%"X16_F":%"X16_F":%"X16_F"\n", IP6_ADDR_BLOCK1(ip6_current_dest_addr()), IP6_ADDR_BLOCK2(ip6_current_dest_addr()),