FreeBSD Bugzilla – Attachment 7550 Details for
Bug 16318
Fix for wrong interface when adding new routes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 1.60 KB, created by
william.a
on 2000-01-23 22:00:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
william.a
Created:
2000-01-23 22:00:01 UTC
Size:
1.60 KB
patch
obsolete
>--- src/sys/net/route.c.orig Wed Jan 19 23:17:12 2000 >+++ src/sys/net/route.c Thu Jan 20 19:55:00 2000 >@@ -398,6 +398,9 @@ > struct sockaddr *dst, *gateway; > { > register struct ifaddr *ifa; >+ struct rtentry *rt; >+ >+ ifa = 0; > if ((flags & RTF_GATEWAY) == 0) { > /* > * If we are adding a route to an interface, >@@ -406,7 +409,6 @@ > * as our clue to the interface. Otherwise > * we can use the local address. > */ >- ifa = 0; > if (flags & RTF_HOST) { > ifa = ifa_ifwithdstaddr(dst); > } >@@ -423,18 +425,33 @@ > if (ifa == 0) > ifa = ifa_ifwithnet(gateway); > if (ifa == 0) { >- struct rtentry *rt = rtalloc1(dst, 0, 0UL); >- if (rt == 0) >- return (0); >- rt->rt_refcnt--; >- if ((ifa = rt->rt_ifa) == 0) >- return (0); >+ rt = rtalloc1(dst, 0, 0UL); >+ if (rt) { >+ rt->rt_refcnt--; >+ if (rt->rt_ifa) >+ ifa = rt->rt_ifa; >+ } > } >- if (ifa->ifa_addr->sa_family != dst->sa_family) { >+ if ((ifa) && (ifa->ifa_addr->sa_family != dst->sa_family)) { > struct ifaddr *oifa = ifa; > ifa = ifaof_ifpforaddr(dst, ifa->ifa_ifp); > if (ifa == 0) > ifa = oifa; >+ } >+ /* >+ * If we are adding a gateway, it is quite >+ * possible that the routing table has a static >+ * entry in place for the gateway, that may >+ * not agree with info garnered from the interfaces. >+ * The routing table should carry more precedence >+ * than the interfaces in this matter. >+ * Must be careful not to stomp on new entries from >+ * rtinit, hence (ifa->ifa_addr != gateway). >+ */ >+ if ((ifa == 0 || ifa->ifa_addr != gateway) && >+ (rt = rtalloc1(gateway,0,0UL))) { >+ rt->rt_refcnt--; >+ ifa = rt->rt_ifa; > } > return (ifa); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 16318
: 7550