Skip to content

Commit

Permalink
revised the case that the reported path MTU is less than the minimum
Browse files Browse the repository at this point in the history
MTU (1280);
just use the minimum MTU instead of the reported one.
from now on, the RTV_MTU flag will never be used for IPv6 routes.
  • Loading branch information
jinmei committed Apr 6, 2002
1 parent 6254b0d commit 4b5e56d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
35 changes: 22 additions & 13 deletions kame/sys/netinet6/icmp6.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: icmp6.c,v 1.288 2002/03/02 05:54:01 jinmei Exp $ */
/* $KAME: icmp6.c,v 1.289 2002/04/06 11:26:21 jinmei Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -1374,6 +1374,18 @@ icmp6_mtudisc_update(ip6cp, dst, validated)
#endif
#endif

/*
* RFC 1981 says that we may receive a Too Big message reporting a
* next-hop MTU that is less than the minimum MTU, but the behavior
* which should be taken in that case is not very clear.
* We can perhaps discard such a message, but we dare to reduce the
* MTU to the minimum MTU; using a too small MTU reduces performance,
* whereas using a too large MTU causes reachability problem.
* The former should be better.
*/
if (mtu < IPV6_MINMTU)
mtu = IPV6_MINMTU;

#if defined(__NetBSD__) || defined(__OpenBSD__)
/*
* allow non-validated cases if memory is plenty, to make traffic
Expand Down Expand Up @@ -1424,16 +1436,10 @@ icmp6_mtudisc_update(ip6cp, dst, validated)
#endif
#endif

if (rt && (rt->rt_flags & RTF_HOST)
&& !(rt->rt_rmx.rmx_locks & RTV_MTU)) {
if (mtu < IPV6_MMTU) {
/* xxx */
rt->rt_rmx.rmx_locks |= RTV_MTU;
} else if (mtu < rt->rt_ifp->if_mtu &&
rt->rt_rmx.rmx_mtu > mtu) {
icmp6stat.icp6s_pmtuchg++;
rt->rt_rmx.rmx_mtu = mtu;
}
if (rt && (rt->rt_flags & RTF_HOST) && mtu >= IPV6_MMTU &&
mtu < rt->rt_ifp->if_mtu && mtu < rt->rt_rmx.rmx_mtu) {
icmp6stat.icp6s_pmtuchg++;
rt->rt_rmx.rmx_mtu = mtu;
}
if (rt) { /* XXX: need braces to avoid conflict with else in RTFREE. */
RTFREE(rt);
Expand Down Expand Up @@ -3605,8 +3611,11 @@ icmp6_mtudisc_timeout(rt, r)
rtrequest((int) RTM_DELETE, (struct sockaddr *)rt_key(rt),
rt->rt_gateway, rt_mask(rt), rt->rt_flags, 0);
} else {
if ((rt->rt_rmx.rmx_locks & RTV_MTU) == 0)
rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;
/*
* we do not have to check the RTV_MTU flag, which should
* always be off for IPv6.
*/
rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;
}
}

Expand Down
5 changes: 2 additions & 3 deletions kame/sys/netinet6/in6_rmx.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: in6_rmx.c,v 1.11 2001/07/26 06:53:16 jinmei Exp $ */
/* $KAME: in6_rmx.c,v 1.12 2002/04/06 11:26:21 jinmei Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -180,8 +180,7 @@ in6_addroute(void *v_arg, void *n_arg, struct radix_node_head *head,
rt->rt_rmx.rmx_recvpipe = tcp_recvspace;
#endif

if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU)
&& rt->rt_ifp)
if (!rt->rt_rmx.rmx_mtu && rt->rt_ifp)
rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu;

ret = rn_addroute(v_arg, n_arg, head, treenodes);
Expand Down
5 changes: 2 additions & 3 deletions kame/sys/netinet6/ip6_output.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $KAME: ip6_output.c,v 1.290 2002/03/17 19:48:19 jinmei Exp $ */
/* $KAME: ip6_output.c,v 1.291 2002/04/06 11:26:21 jinmei Exp $ */

/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
Expand Down Expand Up @@ -1795,8 +1795,7 @@ ip6_getpmtu(ro_pmtu, ro, ifp, dst, mtup)
* this case happens with path MTU discovery timeouts.
*/
mtu = ifmtu;
if ((ro_pmtu->ro_rt->rt_rmx.rmx_locks & RTV_MTU) == 0)
ro_pmtu->ro_rt->rt_rmx.rmx_mtu = mtu; /* XXX */
ro_pmtu->ro_rt->rt_rmx.rmx_mtu = mtu; /* XXX */
}
} else if (ifp) {
mtu = nd_ifinfo[ifp->if_index].linkmtu;
Expand Down

0 comments on commit 4b5e56d

Please sign in to comment.