Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Dec 2002 21:41:52 +0200
From:      Ruslan Ermilov <ru@freebsd.org>
To:        Garrett Wollman <wollman@freebsd.org>, Julian Elischer <julian@freebsd.org>, ume@freebsd.org
Cc:        net@freebsd.org
Subject:   Re: Broken logic in rtrequest1(RTM_DELETE, ..., ret_nrt)
Message-ID:  <20021222194152.GA40093@sunbay.com>
In-Reply-To: <20021222193329.GA37916@sunbay.com>
References:  <20021222193329.GA37916@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--s/l3CgOIzMHHjg/5
Content-Type: multipart/mixed; boundary="2fHTh5uZTiUOsy+g"
Content-Disposition: inline


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Dec 22, 2002 at 09:33:29PM +0200, Ruslan Ermilov wrote:
> Hi!
>=20
> The attached patch fixes the logic of rtrequest1()
> when handling RTM_DELETE requests and the caller
> asked for a copy of the removed entry.
>=20
> Reviewers are highly welcome.
>=20
> This makes the code more natural, similar to the
> RTM_ADD and RTM_RESOLVE cases (wrt to handling
> the returned rtentry's refcnt), and reduces some
> code bloat in applications.
>=20
> It also makes it safe to turn the RTF_UP bit before
> rt_fixdelete() walk -- that was the start of my
> looking at this part of code.
>=20
Oops, missed one.


Cheers,
--=20
Ruslan Ermilov		Sysadmin and DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p

Index: route.c
===================================================================
RCS file: /home/ncvs/src/sys/net/route.c,v
retrieving revision 1.72
diff -u -p -r1.72 route.c
--- route.c	18 Dec 2002 11:45:27 -0000	1.72
+++ route.c	22 Dec 2002 19:39:54 -0000
@@ -1117,10 +1112,7 @@ rtinit(ifa, cmd, flags)
 			 * If we are deleting, and we found an entry, then
 			 * it's been removed from the tree.. now throw it away.
 			 */
-			if (rt->rt_refcnt <= 0) {
-				rt->rt_refcnt++; /* make a 1->0 transition */
-				rtfree(rt);
-			}
+			RTFREE(rt);
 		} else if (cmd == RTM_ADD) {
 			/*
 			 * We just wanted to add it.. we don't actually

--2fHTh5uZTiUOsy+g--

--s/l3CgOIzMHHjg/5
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (FreeBSD)

iD8DBQE+BhWAUkv4P6juNwoRAg6KAJ9SbGtshhHYaQwreyhPtcwTn2AfcgCfUqLj
BIcjKB1bjbAZpE1ft9ls4/k=
=sUVB
-----END PGP SIGNATURE-----

--s/l3CgOIzMHHjg/5--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021222194152.GA40093>