| Summary: | Kernel can't add default route from network that none of its int | ||
|---|---|---|---|
| Product: | Base System | Reporter: | tbyte <tbyte> |
| Component: | kern | Assignee: | ru <ru> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | 4.3-STABLE | ||
| Hardware: | Any | ||
| OS: | Any | ||
State Changed From-To: open->closed Committed, thanks! MFC is planned in two weeks. Responsible Changed From-To: freebsd-bugs->ru |
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 ? 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 : 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.--Jg85XgsQOodlHmCX0cZpLcuN5eHyAtz48IKCeHufPGTnGlpo Content-Type: text/plain; name="file.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="file.diff" --- 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--; How-To-Repeat: just try do add default gw from network that none of your interfaces is.