convert net_route to use net_address_t
This commit is contained in:
1 parent
972f3855dd
commit
ee37d10b2c
5 files changed
+25
-17
No files matched your search
@@ -1613,9 +1613,10 @@ int sigar_net_route_list_get(sigar_t *sigar,
|
||||
}
|
||||
|
||||
route->flags = flags;
|
||||
route->destination = hex2int(net_addr, HEX_ENT_LEN);
|
||||
route->gateway = hex2int(gate_addr, HEX_ENT_LEN);
|
||||
route->mask = hex2int(mask_addr, HEX_ENT_LEN);
|
||||
|
||||
sigar_net_address_set(route->destination, hex2int(net_addr, HEX_ENT_LEN));
|
||||
sigar_net_address_set(route->gateway, hex2int(gate_addr, HEX_ENT_LEN));
|
||||
sigar_net_address_set(route->mask, hex2int(mask_addr, HEX_ENT_LEN));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
@@ -1633,9 +1633,15 @@ int sigar_net_route_list_get(sigar_t *sigar,
|
||||
SIGAR_NET_ROUTE_LIST_GROW(routelist);
|
||||
route = &routelist->data[routelist->number++];
|
||||
|
||||
route->destination = entry->ipRouteDest;
|
||||
route->gateway = entry->ipRouteNextHop;
|
||||
route->mask = entry->ipRouteMask;
|
||||
sigar_net_address_set(route->destination,
|
||||
entry->ipRouteDest);
|
||||
|
||||
sigar_net_address_set(route->gateway,
|
||||
entry->ipRouteNextHop);
|
||||
|
||||
sigar_net_address_set(route->mask,
|
||||
entry->ipRouteMask);
|
||||
|
||||
route->refcnt = entry->ipRouteInfo.re_ref;
|
||||
route->irtt = entry->ipRouteInfo.re_rtt;
|
||||
route->metric = entry->ipRouteMetric1;
|
||||
@@ -1643,8 +1649,8 @@ int sigar_net_route_list_get(sigar_t *sigar,
|
||||
SIGAR_SSTRCPY(route->ifname, entry->ipRouteIfIndex.o_bytes);
|
||||
|
||||
route->flags = RTF_UP;
|
||||
if ((route->destination == 0) &&
|
||||
(route->mask == 0))
|
||||
if ((route->destination.addr.in == 0) &&
|
||||
(route->mask.addr.in == 0))
|
||||
{
|
||||
route->flags |= RTF_GATEWAY;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user