Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2005 00:36:12 +0200
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Vladimir Grebenschikov <vova@fbsd.ru>
Cc:        net@FreeBSD.org
Subject:   Re: Invalid 'route change' functioning
Message-ID:  <20050117223612.GA64358@ip.net.ua>
In-Reply-To: <1105978853.1229.18.camel@localhost>
References:  <1105974518.1229.9.camel@localhost> <20050117160523.GA77421@ip.net.ua> <1105978853.1229.18.camel@localhost>

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

--/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--



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