* When there was no link, the wrong route was chosen as a candidate when trying

to get a local connection (the first candidate must be used, not the last).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29208 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-02-15 12:59:34 +00:00
parent a1056d5fa3
commit f6874c7b31
+11 -6
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006-2008, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -164,7 +164,8 @@ find_route(net_domain *_domain, const sockaddr *address)
RouteList::Iterator iterator = domain->routes.GetIterator();
net_route_private *candidate = NULL;
TRACE(("test address %s for routes...\n", AddressString(domain, address).Data()));
TRACE(("test address %s for routes...\n",
AddressString(domain, address).Data()));
// TODO: alternate equal default routes
@@ -182,15 +183,19 @@ find_route(net_domain *_domain, const sockaddr *address)
route->destination))
continue;
TRACE((" found route: %s, flags %lx\n",
AddressString(domain, route->destination).Data(), route->flags));
// neglect routes that point to devices that have no link
if ((route->interface->device->flags & IFF_LINK) == 0) {
candidate = route;
if (candidate == NULL) {
TRACE((" found candidate: %s, flags %lx\n", AddressString(
domain, route->destination).Data(), route->flags));
candidate = route;
}
continue;
}
TRACE((" found route: %s, flags %lx\n",
AddressString(domain, route->destination).Data(), route->flags));
return route;
}