diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-01-29 06:33:07 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2001-01-29 06:33:07 +0000 |
commit | 28a931ed96b1cee519b696aea1d2a627f3add866 (patch) | |
tree | 954f35ffee3df296025a977f7335b6e9686e07b9 /sys/net | |
parent | 3e69d06600d67479fe28260f374456ba5edb721f (diff) |
cleanup rmx_mtu handling (no #ifdef INET6). from netbsd.
(same change is in kame)
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index ce604596ca5..0d4a75de234 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.23 2001/01/19 06:37:36 itojun Exp $ */ +/* $OpenBSD: route.c,v 1.24 2001/01/29 06:33:06 itojun Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -627,9 +627,6 @@ rtrequest1(req, info, ret_nrt) rt_maskedcopy(dst, ndst, netmask); } else Bcopy(dst, ndst, dst->sa_len); -if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { /* XXX */ - rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; -} rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask, rnh, rt->rt_nodes); if (rn == NULL) { @@ -649,6 +646,14 @@ if (!rt->rt_rmx.rmx_mtu && !(rt->rt_rmx.rmx_locks & RTV_MTU)) { /* XXX */ */ rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */ rt->rt_parent = *ret_nrt; /* Back ptr. to parent. */ + } else if (!rt->rt_rmx.rmx_mtu && + !(rt->rt_rmx.rmx_locks & RTV_MTU)) { /* XXX */ + if (rt->rt_gwroute) { + rt->rt_rmx.rmx_mtu = + rt->rt_gwroute->rt_rmx.rmx_mtu; + } else { + rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; + } } if (ifa->ifa_rtrequest) ifa->ifa_rtrequest(req, rt, info); @@ -702,6 +707,16 @@ rt_setgate(rt0, dst, gate) } if (rt->rt_flags & RTF_GATEWAY) { 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. + */ + 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)) { + rt->rt_rmx.rmx_mtu = rt->rt_gwroute->rt_rmx.rmx_mtu; + } } return 0; } @@ -785,12 +800,6 @@ rtinit(ifa, cmd, flags) } if (cmd == RTM_ADD && error == 0 && (rt = nrt) != NULL) { rt->rt_refcnt--; -#ifdef INET6 - /* Initialize Path MTU for IPv6 interface route */ - if (ifa->ifa_addr->sa_family == AF_INET6 && - !rt->rt_rmx.rmx_mtu) - rt->rt_rmx.rmx_mtu = ifa->ifa_ifp->if_mtu; -#endif /* INET6 */ if (rt->rt_ifa != ifa) { printf("rtinit: wrong ifa (%p) was (%p)\n", ifa, rt->rt_ifa); |