Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Nov 2001 17:52:49 -0800 (PST)
From:      Paul Herman <pherman@frenchfries.net>
To:        Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        <freebsd-net@FreeBSD.ORG>
Subject:   Re: arp_rtrequest: bad gateway value
Message-ID:  <20011126173433.W39004-100000@tick.sc.omation.com>
In-Reply-To: <20011123160634.I49441-100000@tick.sc.omation.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 23 Nov 2001, Paul Herman wrote:

> On Thu, 22 Nov 2001, Ruslan Ermilov wrote:
>
> > On Wed, Nov 21, 2001 at 05:32:27PM -0800, Paul Herman wrote:
> > > Hi,
> > >
> > > I'd like to pick some brains before I file a PR.
> > >
> > There's already a PR open on this, kern/29170.
> >
> > [...]
> >

Here's a patch against 4.4-RELEASE that fixes this problem.  As
mentioned before, the problem happens when a gateway with the
RTF_LLINFO set gets polluted with non-link information.  routed and
route are both culprits.  BTW, KAME does this as well by putting
AF_INET6 data into gateways with the RTF_LLINFO flag set, which I
don't think is a good idea, but it calls rt_setgate() directly and
isn't affected by this patch.

I've decided to have the kernel leave the gateway untouched and
continue, rather than having the kernel return EINVAL.  This
produces the least astonishment :-)

Please review and if it's OK, I'll send it to gnats for the audit
trail.  Thanks,

-Paul.

Index: sys/net/rtsock.c
===================================================================
RCS file: /mnt/ncvs/src/sys/net/rtsock.c,v
retrieving revision 1.44.2.4
diff -u -r1.44.2.4 rtsock.c
--- sys/net/rtsock.c	2001/07/11 09:37:37	1.44.2.4
+++ sys/net/rtsock.c	2001/11/27 01:33:03
@@ -399,6 +399,14 @@
 			break;

 		case RTM_CHANGE:
+			/* Don't let the user specify non-link information
+			 * for a gateway if the RTF_LLINFO flag is set.
+			 * We'll just leave the gateway alone.
+			 */
+			if (gate && (rt->rt_flags & RTF_LLINFO) &&
+			    gate->sa_family != AF_LINK)
+				gate = rt->rt_gateway;
+
 			if (gate && (error = rt_setgate(rt, rt_key(rt), gate)))
 				senderr(error);





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?20011126173433.W39004-100000>