From owner-freebsd-net@FreeBSD.ORG Mon Jan 17 22:36:27 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 27BC016A4CE for ; Mon, 17 Jan 2005 22:36:27 +0000 (GMT) Received: from tigra.ip.net.ua (tigra.ip.net.ua [82.193.96.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2850A43D46 for ; Mon, 17 Jan 2005 22:36:26 +0000 (GMT) (envelope-from ru@ip.net.ua) Received: from localhost (rocky.ip.net.ua [82.193.96.2]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j0HMaN7t018876; Tue, 18 Jan 2005 00:36:23 +0200 (EET) (envelope-from ru@ip.net.ua) Received: from tigra.ip.net.ua ([82.193.96.10]) by localhost (rocky.ipnet [82.193.96.2]) (amavisd-new, port 10024) with LMTP id 08694-18; Tue, 18 Jan 2005 00:36:22 +0200 (EET) Received: from heffalump.ip.net.ua (heffalump.ip.net.ua [82.193.96.213]) by tigra.ip.net.ua (8.12.11/8.12.11) with ESMTP id j0HMaMkt018873 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Jan 2005 00:36:22 +0200 (EET) (envelope-from ru@ip.net.ua) Received: (from ru@localhost) by heffalump.ip.net.ua (8.13.1/8.13.1) id j0HMaCPX027584; Tue, 18 Jan 2005 00:36:12 +0200 (EET) (envelope-from ru) Date: Tue, 18 Jan 2005 00:36:12 +0200 From: Ruslan Ermilov To: Vladimir Grebenschikov Message-ID: <20050117223612.GA64358@ip.net.ua> References: <1105974518.1229.9.camel@localhost> <20050117160523.GA77421@ip.net.ua> <1105978853.1229.18.camel@localhost> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <1105978853.1229.18.camel@localhost> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at ip.net.ua cc: net@FreeBSD.org Subject: Re: Invalid 'route change' functioning X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Jan 2005 22:36:27 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 17, 2005 at 07:20:53PM +0300, Vladimir Grebenschikov wrote: > Ruslan Ermilov wrote: >=20 > > > Any ideas what wrong with 'route change' ?=20 > > >=20 > > The route(8) manpage says: > >=20 > > : In a change or add command where the destination and gateway are not = suf- > > : ficient to specify the route (as in the ISO case where several interf= aces > > : may have the same address), the -ifp or -ifa modifiers may be used to > > : determine the interface or interface address. > >=20 > > So try this instead: > >=20 > > route change 192.168.0/23 -ifp fxp0 >=20 > Thank you, it works. >=20 > So, as I understand, route add ... -iface fxp0 is invalid if I want > specify gateway interface ? >=20 No, it's valid. > (how this works, '-iface' flag and 'fxp0' is what ? gateway ?) >=20 When the -iface keyword is present, the route(8) utility treats the "gateway" argument specially, allowing it to be an interface name, in which case the gateway address is passed as "struct sockaddr_dl" denoting this interface. See the output of the "route -v add" command. Hence, there's no a reason (other than a kernel code bug) to prevent a "route change ... -iface fxp0" command from working. Here's a fix: %%% Index: rtsock.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/rtsock.c,v retrieving revision 1.120 diff -u -p -r1.120 rtsock.c --- rtsock.c 7 Jan 2005 01:45:35 -0000 1.120 +++ rtsock.c 17 Jan 2005 22:01:47 -0000 @@ -491,8 +491,7 @@ route_output(struct mbuf *m, struct sock * flags may also be different; ifp may be specified * by ll sockaddr when protocol address is ambiguous */ - if (((rt->rt_flags & RTF_GATEWAY) && - info.rti_info[RTAX_GATEWAY] !=3D NULL) || + if (info.rti_info[RTAX_GATEWAY] !=3D NULL || info.rti_info[RTAX_IFP] !=3D NULL || (info.rti_info[RTAX_IFA] !=3D NULL && !sa_equal(info.rti_info[RTAX_IFA], %%% Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --/04w6evG8XlLl3ft Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (FreeBSD) iD8DBQFB7D3cqRfpzJluFF4RAqbAAJ9BqpdSNfbMCuckbjRjhuQ1vBEKTgCfTACg Mcsg20VoK7LF+7CTxK2QgUI= =mHze -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft--