r10168@haiku-devel: hugo | 2007-11-03 12:35:29 +0100
find_route() is not really IPv4 specific. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22809 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -149,13 +149,9 @@ find_route(struct net_domain *_domain, const net_route *description)
|
|||||||
|
|
||||||
|
|
||||||
static net_route_private *
|
static net_route_private *
|
||||||
find_route(struct net_domain *_domain, const struct sockaddr *address)
|
find_route(net_domain *_domain, const sockaddr *address)
|
||||||
{
|
{
|
||||||
struct net_domain_private *domain = (net_domain_private *)_domain;
|
net_domain_private *domain = (net_domain_private *)_domain;
|
||||||
|
|
||||||
// TODO: the following only works for IPv4 routes!
|
|
||||||
if (domain->family != AF_INET)
|
|
||||||
panic("you should have known better...");
|
|
||||||
|
|
||||||
// find last matching route
|
// find last matching route
|
||||||
|
|
||||||
@@ -165,23 +161,21 @@ find_route(struct net_domain *_domain, const struct sockaddr *address)
|
|||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
net_route_private *route = iterator.Next();
|
net_route_private *route = iterator.Next();
|
||||||
|
|
||||||
bool found;
|
if (route->mask) {
|
||||||
if (route->mask != NULL) {
|
|
||||||
sockaddr maskedAddress;
|
sockaddr maskedAddress;
|
||||||
domain->address_module->mask_address(address, route->mask,
|
domain->address_module->mask_address(address, route->mask,
|
||||||
&maskedAddress);
|
&maskedAddress);
|
||||||
found = domain->address_module->equal_addresses(&maskedAddress,
|
if (!domain->address_module->equal_addresses(&maskedAddress,
|
||||||
route->destination);
|
route->destination))
|
||||||
} else {
|
continue;
|
||||||
found = domain->address_module->equal_addresses(address,
|
} else if (!domain->address_module->equal_addresses(address,
|
||||||
route->destination);
|
route->destination))
|
||||||
}
|
continue
|
||||||
|
|
||||||
if (found) {
|
TRACE((" found route: %s, flags %lx\n",
|
||||||
TRACE((" found route: %s, flags %lx\n",
|
AddressString(domain, route->destination).Data(), route->flags));
|
||||||
AddressString(domain, route->destination).Data(), route->flags));
|
|
||||||
return route;
|
return route;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user