From dc1d7df81146512cda3d56678e100be756116f60 Mon Sep 17 00:00:00 2001 From: itojun Date: Thu, 26 Jul 2001 05:47:37 +0000 Subject: [PATCH] do not initialize rmx_mtu on RTM_ADD. on gateway change, copy rmx_mtu from gateway only under the following condition: - current MTU is not locked - current MTU was discovered via PMTUD XXX if gateway has MTU == 0, current MTU is set to 0 and we are going to rediscover PMTU again. is it good or bad? --- sys/net/route.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 0bfb45db42c2..1cd22a73e47d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $NetBSD: route.c,v 1.46 2001/07/25 07:13:44 itojun Exp $ */ +/* $NetBSD: route.c,v 1.47 2001/07/26 05:47:37 itojun Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -727,13 +727,15 @@ rt_setgate(rt0, dst, gate) rt->rt_gwroute = rtalloc1(gate, 1); /* * If we switched gateways, grab the MTU from the new - * gateway route if the current MTU is 0 or greater - * than the MTU of gateway. + * gateway route if the current MTU, if the current MTU is + * greater than the MTU of gateway. + * Note that, if the MTU of gateway is 0, we will reset the + * MTU of the route to run PMTUD again from scratch. XXX */ if (rt->rt_gwroute && !(rt->rt_rmx.rmx_locks & RTV_MTU) - && (rt->rt_rmx.rmx_mtu == 0 - || rt->rt_rmx.rmx_mtu > rt->rt_gwroute->rt_rmx.rmx_mtu)) { /* XXX */ + && rt->rt_rmx.rmx_mtu + && rt->rt_rmx.rmx_mtu > rt->rt_gwroute->rt_rmx.rmx_mtu) { rt->rt_rmx.rmx_mtu = rt->rt_gwroute->rt_rmx.rmx_mtu; } } @@ -821,7 +823,6 @@ rtinit(ifa, cmd, flags) IFAFREE(rt->rt_ifa); rt->rt_ifa = ifa; rt->rt_ifp = ifa->ifa_ifp; - rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; /*XXX*/ IFAREF(ifa); if (ifa->ifa_rtrequest) ifa->ifa_rtrequest(RTM_ADD, rt, NULL);