Date: Tue, 7 Dec 2004 00:43:39 +0200 From: Ruslan Ermilov <ru@freebsd.org> To: Gleb Smirnoff <glebius@freebsd.org>, Andre Oppermann <andre@freebsd.org> Cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/netinet in_gif.c Message-ID: <20041206224339.GB51442@ip.net.ua> In-Reply-To: <200412061902.iB6J2hJ6000543@repoman.freebsd.org> References: <200412061902.iB6J2hJ6000543@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--XvKFcGCOAo53UbWW Content-Type: multipart/mixed; boundary="3siQDZowHQqNOShm" Content-Disposition: inline --3siQDZowHQqNOShm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 06, 2004 at 07:02:43PM +0000, Gleb Smirnoff wrote: > glebius 2004-12-06 19:02:43 UTC >=20 > FreeBSD src repository >=20 > Modified files: > sys/netinet in_gif.c=20 > Log: > - Make route cacheing optional, configurable via IFF_LINK0 flag. > - Turn it off by default. > =20 > Requested by: many > Reviewed by: andre > Approved by: julian (mentor) > MFC after: 3 days > =20 > Revision Changes Path > 1.27 +6 -0 src/sys/netinet/in_gif.c >=20 This looks suboptimal. In the !IFF_LINK0 case, I suggest not messing with sc->gif_ro at all and passing ip_output() a NULL route pointer. Loop detection here is incomplete, and the correct detection is already done in if_gif.c. Other route checks just duplicate existing functionality. By the way, I have a WIP (attached) that adds versioning to the routing table. Whenever a routing table is altered, the version is bumped. The primary intent is for cached routes, and it was invented specifically to address this gif(4) problem, but also the remnants of PR kern/10778. Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --3siQDZowHQqNOShm Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p Content-Transfer-Encoding: quoted-printable Index: radix.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/radix.c,v retrieving revision 1.36 diff -u -p -r1.36 radix.c --- radix.c 21 Apr 2004 15:27:36 -0000 1.36 +++ radix.c 30 Nov 2004 11:54:36 -0000 @@ -714,8 +714,10 @@ rn_addroute(v_arg, n_arg, head, treenode } on2: /* Add new route to highest possible ancestor's list */ - if ((netmask =3D=3D 0) || (b > t->rn_bit )) + if ((netmask =3D=3D 0) || (b > t->rn_bit )) { + head->version++; return tt; /* can't lift at all */ + } b_leaf =3D tt->rn_bit; do { x =3D t; @@ -737,6 +739,7 @@ on2: if (tt->rn_flags & RNF_NORMAL) { log(LOG_ERR, "Non-unique normal route, mask not entered\n"); + head->version++; return tt; } } else @@ -744,6 +747,7 @@ on2: if (mmask =3D=3D netmask) { m->rm_refs++; tt->rn_mklist =3D m; + head->version++; return tt; } if (rn_refines(netmask, mmask) @@ -751,6 +755,7 @@ on2: break; } *mp =3D rn_new_radix_mask(tt, *mp); + head->version++; return tt; } =20 @@ -936,6 +941,7 @@ on1: out: tt->rn_flags &=3D ~RNF_ACTIVE; tt[1].rn_flags &=3D ~RNF_ACTIVE; + head->version++; return (tt); } =20 Index: radix.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/radix.h,v retrieving revision 1.25 diff -u -p -r1.25 radix.h --- radix.h 18 Apr 2004 11:48:35 -0000 1.25 +++ radix.h 30 Nov 2004 11:45:10 -0000 @@ -132,6 +132,7 @@ struct radix_node_head { struct radix_node rnh_nodes[3]; /* empty tree for common case */ #ifdef _KERNEL struct mtx rnh_mtx; /* locks entire radix tree */ + int version; #endif }; =20 Index: route.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/route.c,v retrieving revision 1.107 diff -u -p -r1.107 route.c --- route.c 21 Aug 2004 17:38:57 -0000 1.107 +++ route.c 30 Nov 2004 12:03:41 -0000 @@ -106,15 +106,18 @@ rtalloc(struct route *ro) void rtalloc_ign(struct route *ro, u_long ignore) { + struct radix_node_head *rnh =3D rt_tables[ro->ro_dst.sa_family]; struct rtentry *rt; =20 if ((rt =3D ro->ro_rt) !=3D NULL) { - if (rt->rt_ifp !=3D NULL && rt->rt_flags & RTF_UP) + if (rt->rt_ifp !=3D NULL && rt->rt_flags & RTF_UP && + ro->version =3D=3D rnh->version) return; RTFREE(rt); ro->ro_rt =3D NULL; } ro->ro_rt =3D rtalloc1(&ro->ro_dst, 1, ignore); + ro->version =3D rnh->version; if (ro->ro_rt) RT_UNLOCK(ro->ro_rt); } Index: route.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/sys/net/route.h,v retrieving revision 1.62 diff -u -p -r1.62 route.h --- route.h 5 Oct 2004 19:48:33 -0000 1.62 +++ route.h 30 Nov 2004 12:05:12 -0000 @@ -47,6 +47,7 @@ */ struct route { struct rtentry *ro_rt; + int version; struct sockaddr ro_dst; }; =20 --3siQDZowHQqNOShm-- --XvKFcGCOAo53UbWW Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFBtOCbqRfpzJluFF4RAnRiAKCPrvPaK4fSCMHOJTc+oYBMJb474ACfeWqz DimIUuFP0OwKZzBFwgcaXuI= =3pJW -----END PGP SIGNATURE----- --XvKFcGCOAo53UbWW--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041206224339.GB51442>