diff options
author | ru <ru@FreeBSD.org> | 2002-12-25 10:21:02 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2002-12-25 10:21:02 +0000 |
commit | 2719b5ea8cf3644f875ec6613f32325ff39ad4fe (patch) | |
tree | f8da1f036cd1db39f17ea82b59d8c9fc9ac6dabf /sys/netinet6 | |
parent | 94490dce08e3e41b8f099a608f0151bd9f408fc0 (diff) | |
download | FreeBSD-src-2719b5ea8cf3644f875ec6613f32325ff39ad4fe.zip FreeBSD-src-2719b5ea8cf3644f875ec6613f32325ff39ad4fe.tar.gz |
If the caller of rtrequest*(RTM_DELETE, ...) asked for a copy of
the entry being removed (ret_nrt != NULL), increment the entry's
rt_refcnt like we do it for RTM_ADD and RTM_RESOLVE, rather than
messing around with 1->0 transitions for rtfree() all over.
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6.c | 6 | ||||
-rw-r--r-- | sys/netinet6/nd6_rtr.c | 18 |
2 files changed, 4 insertions, 20 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index c450dea..945ab65 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -197,11 +197,7 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa) if (nrt) { rt_newaddrmsg(cmd, ifa, e, nrt); if (cmd == RTM_DELETE) { - if (nrt->rt_refcnt <= 0) { - /* XXX: we should free the entry ourselves. */ - nrt->rt_refcnt++; - rtfree(nrt); - } + RTFREE(nrt); } else { /* the cmd must be RTM_ADD here */ nrt->rt_refcnt--; diff --git a/sys/netinet6/nd6_rtr.c b/sys/netinet6/nd6_rtr.c index c920636..338a00c 100644 --- a/sys/netinet6/nd6_rtr.c +++ b/sys/netinet6/nd6_rtr.c @@ -574,14 +574,7 @@ defrouter_delreq(dr, dofree) RTF_GATEWAY, &oldrt); if (oldrt) { nd6_rtmsg(RTM_DELETE, oldrt); - if (oldrt->rt_refcnt <= 0) { - /* - * XXX: borrowed from the RTM_DELETE case of - * rtrequest(). - */ - oldrt->rt_refcnt++; - rtfree(oldrt); - } + RTFREE(oldrt); } if (dofree) /* XXX: necessary? */ @@ -1583,13 +1576,8 @@ nd6_prefix_offlink(pr) error)); } - if (rt != NULL) { - if (rt->rt_refcnt <= 0) { - /* XXX: we should free the entry ourselves. */ - rt->rt_refcnt++; - rtfree(rt); - } - } + if (rt != NULL) + RTFREE(rt); return(error); } |