Date: Sun, 3 Jun 2001 12:52:43 +0300 (EEST) From: tbyte@tbyte.org To: FreeBSD-gnats-submit@freebsd.org Subject: kern/27852: Adding default route Message-ID: <200106030952.f539qhc10077@shadow.otel.net>
next in thread | raw e-mail | index | archive | help
>Number: 27852
>Category: kern
>Synopsis: Kernel can't add default route from network that none of its int
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Jun 03 03:00:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Iasen Kostoff
>Release: FreeBSD 4.3-STABLE i386
>Organization:
OTEL.net
>Environment:
System: FreeBSD sat.fury.lan 4.3-STABLE FreeBSD 4.3-STABLE #13: Sun Jun 3 11:23:
>Description:
You have one interface xl0 with ip 100.1.1.10 and netmask 255.255.255.0
and your gateway is 150.1.1.1. To add this gateway you should add a
route to this host lets say: route add -net 150.1.1.0/24 -iface xl0;
and then we should add the default : route add default 150.1.1.1.
That's the right way but what the kernel say ? - "Network Unreachable" ?!?
But we have route to that network , aren't we ?
And here is one way this could be done :
route add default 100.1.1.10
route add -net 150.1.1.0/24 -iface xl0
route change default 150.1.1.1
Wow everithing works ! :)
But do you think that's the right way to be done ?
>How-To-Repeat:
just try do add default gw from network that none of your
interfaces is.
>Fix:
I looked in the kernel source and found this in rtrequest :
if ((ifa = ifa_ifwithroute(flags, dst, gateway)) == 0)
senderr(ENETUNREACH);
ifa_ifwithroute() can't find a route that exest ?
Then I look at ifa_ifwithroute() and saw this :
if (ifa == 0) {
struct rtentry *rt = rtalloc1(dst, 0, 0UL);
Why we search a route to a destination but not to a gateway ?
I change it ofcourse and now everything works fine.
And this is the changed line just one variable changed :
if (ifa == 0) {
struct rtentry *rt = rtalloc1(gateway, 0, 0UL);
And here is the patch (hum :)) for this :
--- route.c.old Thu May 17 02:14:03 2001
+++ route.c Sun Jun 3 11:18:07 2001
@@ -425,7 +425,7 @@
if (ifa == 0)
ifa = ifa_ifwithnet(gateway);
if (ifa == 0) {
- struct rtentry *rt = rtalloc1(dst, 0, 0UL);
+ struct rtentry *rt = rtalloc1(gateway, 0, 0UL);
if (rt == 0)
return (0);
rt->rt_refcnt--;
A long long patch. If you have any sugestions I'd like to hear it
as soon as posible because there are some other things in the kernel
routing that I want to discuss.
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106030952.f539qhc10077>
