Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/route/route.c
Show First 20 Lines • Show All 517 Lines • ▼ Show 20 Lines | else { | ||||
routename(sa) : netname(sa)); | routename(sa) : netname(sa)); | ||||
sa = (struct sockaddr *)(SA_SIZE(sa) + (char *)sa); | sa = (struct sockaddr *)(SA_SIZE(sa) + (char *)sa); | ||||
printf("%-20.20s ", routename(sa)); | printf("%-20.20s ", routename(sa)); | ||||
if (fib >= 0) | if (fib >= 0) | ||||
printf("-fib %-3d ", fib); | printf("-fib %-3d ", fib); | ||||
printf("done\n"); | printf("done\n"); | ||||
} | } | ||||
} | } | ||||
free(buf); | |||||
return (error); | return (error); | ||||
} | } | ||||
static const char * | static const char * | ||||
routename(struct sockaddr *sa) | routename(struct sockaddr *sa) | ||||
{ | { | ||||
struct sockaddr_dl *sdl; | struct sockaddr_dl *sdl; | ||||
const char *cp; | const char *cp; | ||||
▲ Show 20 Lines • Show All 900 Lines • ▼ Show 20 Lines | if (sysctl(mib, nitems(mib), buf, &needed, NULL, 0) < 0) { | ||||
} | } | ||||
err(EX_OSERR, "actual retrieval of interface table"); | err(EX_OSERR, "actual retrieval of interface table"); | ||||
} | } | ||||
lim = buf + needed; | lim = buf + needed; | ||||
for (next = buf; next < lim; next += rtm->rtm_msglen) { | for (next = buf; next < lim; next += rtm->rtm_msglen) { | ||||
rtm = (struct rt_msghdr *)(void *)next; | rtm = (struct rt_msghdr *)(void *)next; | ||||
print_rtmsg(rtm, rtm->rtm_msglen); | print_rtmsg(rtm, rtm->rtm_msglen); | ||||
} | } | ||||
free(buf); | |||||
} | } | ||||
static void | static void | ||||
monitor(int argc, char *argv[]) | monitor(int argc, char *argv[]) | ||||
{ | { | ||||
int n, fib, error; | int n, fib, error; | ||||
char msg[2048], *endptr; | char msg[2048], *endptr; | ||||
▲ Show 20 Lines • Show All 514 Lines • Show Last 20 Lines |