Return to show.c CVS log | Up to [local] / src / usr.bin / netstat |
version 1.34, 2010/10/11 12:33:36 | version 1.35, 2011/11/01 17:30:04 | ||
---|---|---|---|
|
|
||
* Print routing tables. | * Print routing tables. | ||
*/ | */ | ||
void | void | ||
p_rttables(int af, u_int tableid, int hastable) | p_rttables(int af, u_int tableid) | ||
{ | { | ||
struct rt_msghdr *rtm; | struct rt_msghdr *rtm; | ||
struct sadb_msg *msg; | struct sadb_msg *msg; | ||
|
|
||
mib[3] = af; | mib[3] = af; | ||
mib[4] = NET_RT_DUMP; | mib[4] = NET_RT_DUMP; | ||
mib[5] = 0; | mib[5] = 0; | ||
if (hastable) { | mib[6] = tableid; | ||
mib[6] = tableid; | mcnt = 7; | ||
mcnt = 7; | |||
} else | |||
mcnt = 6; | |||
if (sysctl(mib, mcnt, NULL, &needed, NULL, 0) < 0) | if (sysctl(mib, mcnt, NULL, &needed, NULL, 0) < 0) | ||
err(1, "route-sysctl-estimate"); | err(1, "route-sysctl-estimate"); |