* Made some functions static that should have been.

* Added a commented out dump_routes() function for debugging purposes.
* Removed weird spaces, fixed indentation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22722 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-10-25 15:13:34 +00:00
parent ff85245718
commit 9004a56437

View File

@ -53,6 +53,26 @@ net_route_private::~net_route_private()
// #pragma mark -
#if 0
static void
dump_routes(net_domain_private *domain)
{
RouteList::Iterator iterator = domain->routes.GetIterator();
uint32 count = 1;
while (iterator.HasNext()) {
net_route_private *route = iterator.Next();
dprintf(" [%lu] dest %s, mask %s, gw %s, flags %lx\n", count++,
AddressString(domain, route->destination ? route->destination : NULL).Data(),
AddressString(domain, route->mask ? route->mask : NULL).Data(),
AddressString(domain, route->gateway ? route->gateway : NULL).Data(),
route->flags);
}
}
#endif
static status_t
user_copy_address(const sockaddr *from, sockaddr **to)
{
@ -146,7 +166,7 @@ find_route(struct net_domain *_domain, const struct sockaddr *address)
net_route_private *route = iterator.Next();
bool found;
if (route->mask != NULL) {
if (route->mask != NULL) {
sockaddr maskedAddress;
domain->address_module->mask_address(address, route->mask,
&maskedAddress);
@ -155,7 +175,7 @@ find_route(struct net_domain *_domain, const struct sockaddr *address)
} else {
found = domain->address_module->equal_addresses(address,
route->destination);
}
}
if (found) {
TRACE((" found route: %s, flags %lx\n",
@ -182,8 +202,9 @@ put_route_internal(struct net_domain_private *domain, net_route *_route)
}
struct net_route *
get_route_internal(struct net_domain_private *domain, const struct sockaddr *address)
static struct net_route *
get_route_internal(struct net_domain_private *domain,
const struct sockaddr *address)
{
net_route_private *route = find_route(domain, address);
if (route != NULL && atomic_add(&route->ref_count, 1) == 0) {
@ -195,7 +216,7 @@ get_route_internal(struct net_domain_private *domain, const struct sockaddr *add
}
void
static void
update_route_infos(struct net_domain_private *domain)
{
RouteInfoList::Iterator iterator = domain->route_infos.GetIterator();
@ -372,10 +393,10 @@ add_route(struct net_domain *_domain, const struct net_route *newRoute)
return B_NO_MEMORY;
if (domain->address_module->copy_address(newRoute->destination,
&route->destination, (newRoute->flags & RTF_DEFAULT) != 0,
newRoute->mask) != B_OK
&route->destination, (newRoute->flags & RTF_DEFAULT) != 0,
newRoute->mask) != B_OK
|| domain->address_module->copy_address(newRoute->mask, &route->mask,
(newRoute->flags & RTF_DEFAULT) != 0, NULL) != B_OK
(newRoute->flags & RTF_DEFAULT) != 0, NULL) != B_OK
|| domain->address_module->copy_address(newRoute->gateway,
&route->gateway, false, NULL) != B_OK) {
delete route;
@ -399,7 +420,7 @@ add_route(struct net_domain *_domain, const struct net_route *newRoute)
// if the before mask is less specific than the one of the route,
// we can insert it before that route.
if (domain->address_module->first_mask_bit(before->mask)
> domain->address_module->first_mask_bit(route->mask))
> domain->address_module->first_mask_bit(route->mask))
break;
}
@ -431,6 +452,7 @@ remove_route(struct net_domain *_domain, const struct net_route *removeRoute)
put_route_internal(domain, route);
update_route_infos(domain);
return B_OK;
}