correct rtentry reference count in in6_ifloop_request().

if you reconfigure inet6 too much, the reference count can go
into negative by mistake.  KAME in6.c 1.98 -> 1.99.
This commit is contained in:
Jun-ichiro itojun Hagino 2000-07-12 05:20:41 +00:00
parent 3b88d2796e
commit 07632cbf66

View File

@ -1,5 +1,5 @@
/* $FreeBSD$ */
/* $KAME: in6.c,v 1.87 2000/07/03 15:44:21 itojun Exp $ */
/* $KAME: in6.c,v 1.99 2000/07/11 17:00:58 jinmei Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -165,7 +165,7 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
{
struct sockaddr_in6 lo_sa;
struct sockaddr_in6 all1_sa;
struct rtentry *nrt = NULL;
struct rtentry *nrt = NULL, **nrtp = NULL;
bzero(&lo_sa, sizeof(lo_sa));
bzero(&all1_sa, sizeof(all1_sa));
@ -180,10 +180,12 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
* This request for deletion could fail, e.g. when we remove
* an address right after adding it.
*/
if (cmd == RTM_ADD)
nrtp = &nrt;
rtrequest(cmd, ifa->ifa_addr,
(struct sockaddr *)&lo_sa,
(struct sockaddr *)&all1_sa,
RTF_UP|RTF_HOST, &nrt);
RTF_UP|RTF_HOST, nrtp);
/*
* Make sure rt_ifa be equal to IFA, the second argument of the