From b15f1f564edcf7e5bcb88113af1b6e423317cb23 Mon Sep 17 00:00:00 2001 From: Jun-ichiro itojun Hagino Date: Wed, 29 May 2002 23:38:59 +0000 Subject: force fragment to minimum link MTU (1280) when needed (when PMTUD does not take effect) - like icmp6 responses or foo-over-IPv6 tunnel. --- sys/netinet6/icmp6.c | 10 ++++++++-- sys/netinet6/in6_gif.c | 11 +++++++++-- sys/netinet6/ip6_output.c | 4 +--- sys/netinet6/ip6_var.h | 3 ++- sys/netinet6/udp6_output.c | 4 ++-- 5 files changed, 22 insertions(+), 10 deletions(-) (limited to 'sys/netinet6') diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 6d4d27f9783..b61ef1ea4f5 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: icmp6.c,v 1.57 2002/05/29 07:54:59 itojun Exp $ */ +/* $OpenBSD: icmp6.c,v 1.58 2002/05/29 23:38:58 itojun Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -2212,7 +2212,13 @@ icmp6_reflect(m, off) m->m_flags &= ~(M_BCAST|M_MCAST); - if (ip6_output(m, NULL, NULL, 0, NULL, &outif) != 0 && outif) + /* + * To avoid a "too big" situation at an intermediate router + * and the path MTU discovery process, specify the IPV6_MINMTU flag. + * Note that only echo and node information replies are affected, + * since the length of ICMP6 errors is limited to the minimum MTU. + */ + if (ip6_output(m, NULL, NULL, IPV6_MINMTU, NULL, &outif) != 0 && outif) icmp6_ifstat_inc(outif, ifs6_out_error); if (outif) diff --git a/sys/netinet6/in6_gif.c b/sys/netinet6/in6_gif.c index 5d151177f0f..126c062ba23 100644 --- a/sys/netinet6/in6_gif.c +++ b/sys/netinet6/in6_gif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_gif.c,v 1.19 2001/12/07 09:16:07 itojun Exp $ */ +/* $OpenBSD: in6_gif.c,v 1.20 2002/05/29 23:38:58 itojun Exp $ */ /* $KAME: in6_gif.c,v 1.43 2001/01/22 07:27:17 itojun Exp $ */ /* @@ -194,7 +194,14 @@ in6_gif_output(ifp, family, m, rt) } } - return(ip6_output(m, 0, &sc->gif_ro6, 0, 0, NULL)); + /* + * force fragmentation to minimum MTU, to avoid path MTU discovery. + * it is too painful to ask for resend of inner packet, to achieve + * path MTU discovery for encapsulated packets. + */ + error = ip6_output(m, 0, &sc->gif_ro6, IPV6_MINMTU, 0, NULL); + + return error; } int in6_gif_input(mp, offp, proto) diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index a6a5b470f88..e1038027cb7 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_output.c,v 1.59 2002/05/29 07:54:59 itojun Exp $ */ +/* $OpenBSD: ip6_output.c,v 1.60 2002/05/29 23:38:58 itojun Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* @@ -713,12 +713,10 @@ ip6_output(m0, opt, ro, flags, im6o, ifpp) * The caller of this function may specify to use the minimum MTU * in some cases. */ -#ifdef IPV6_MINMTU if (mtu > IPV6_MMTU) { if ((flags & IPV6_MINMTU)) mtu = IPV6_MMTU; } -#endif /* Fake scoped addresses */ if ((ifp->if_flags & IFF_LOOPBACK) != 0) { diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 4c07d7c694f..f2179bde1c2 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.15 2002/05/28 03:04:38 itojun Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.16 2002/05/29 23:38:58 itojun Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -204,6 +204,7 @@ struct ip6stat { /* flags passed to ip6_output as last parameter */ #define IPV6_DADOUTPUT 0x01 /* DAD */ #define IPV6_FORWARDING 0x02 /* most of IPv6 header exists */ +#define IPV6_MINMTU 0x04 /* use minimum MTU (IPV6_USE_MIN_MTU) */ extern struct ip6stat ip6stat; /* statistics */ extern u_int32_t ip6_id; /* fragment identifier */ diff --git a/sys/netinet6/udp6_output.c b/sys/netinet6/udp6_output.c index c51cd703b10..98a042dbbf4 100644 --- a/sys/netinet6/udp6_output.c +++ b/sys/netinet6/udp6_output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp6_output.c,v 1.5 2001/12/06 04:19:26 itojun Exp $ */ +/* $OpenBSD: udp6_output.c,v 1.6 2002/05/29 23:38:58 itojun Exp $ */ /* $KAME: udp6_output.c,v 1.21 2001/02/07 11:51:54 itojun Exp $ */ /* @@ -264,7 +264,7 @@ udp6_output(in6p, m, addr6, control) } flags = 0; -#ifdef IPV6_MINMTU +#ifdef IN6P_MINMTU if (in6p->in6p_flags & IN6P_MINMTU) flags |= IPV6_MINMTU; #endif -- cgit v1.2.3