From d3e9d64ff6195ae0b8325862d35eb96d66c16b05 Mon Sep 17 00:00:00 2001 From: wollman Date: Mon, 10 Jul 1995 15:22:37 +0000 Subject: When adding a route, set rt_ifa and rt_ifp a little earlier so that the protocol-specific add routine can examine it if desired. --- sys/net/route.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'sys/net') diff --git a/sys/net/route.c b/sys/net/route.c index ca705b5..1e76436 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)route.c 8.2 (Berkeley) 11/15/93 - * $Id: route.c,v 1.22 1995/04/25 19:12:07 wollman Exp $ + * $Id: route.c,v 1.23 1995/05/30 08:08:24 rgrimes Exp $ */ #include @@ -449,18 +449,27 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt) rt_maskedcopy(dst, ndst, netmask); } else Bcopy(dst, ndst, dst->sa_len); + + /* + * This moved from below so that rnh->rnh_addaddr() can + * examine the ifa and ifp if it so desires. + */ + ifa->ifa_refcnt++; + rt->rt_ifa = ifa; + rt->rt_ifp = ifa->ifa_ifp; + rn = rnh->rnh_addaddr((caddr_t)ndst, (caddr_t)netmask, rnh, rt->rt_nodes); if (rn == 0) { if (rt->rt_gwroute) rtfree(rt->rt_gwroute); + if (rt->rt_ifa) { + IFAFREE(rt->rt_ifa); + } Free(rt_key(rt)); Free(rt); senderr(EEXIST); } - ifa->ifa_refcnt++; - rt->rt_ifa = ifa; - rt->rt_ifp = ifa->ifa_ifp; rt->rt_parent = 0; if (req == RTM_RESOLVE) { -- cgit v1.1