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?
This commit is contained in:
itojun 2001-07-26 05:47:37 +00:00
parent 91d95899b4
commit dc1d7df811
1 changed files with 7 additions and 6 deletions

View File

@ -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);