Changeset View
Changeset View
Standalone View
Standalone View
sbin/route/route.c
Show First 20 Lines • Show All 1,438 Lines • ▼ Show 20 Lines | monitor(int argc, char *argv[]) | ||||
if (error) | if (error) | ||||
errx(EX_USAGE, "invalid fib number: %d", fib); | errx(EX_USAGE, "invalid fib number: %d", fib); | ||||
verbose = 1; | verbose = 1; | ||||
if (debugonly) { | if (debugonly) { | ||||
interfaces(); | interfaces(); | ||||
exit(0); | exit(0); | ||||
} | } | ||||
#ifdef SO_RERROR | |||||
n = 1; | |||||
if (setsockopt(s, SOL_SOCKET, SO_RERROR, &n, sizeof(n)) == -1) | |||||
warn("SO_RERROR"); | |||||
#endif | |||||
for (;;) { | for (;;) { | ||||
time_t now; | time_t now; | ||||
n = read(s, msg, 2048); | n = read(s, msg, sizeof(msg)); | ||||
if (n == -1) { | |||||
warn("read"); | |||||
continue; | |||||
} | |||||
now = time(NULL); | now = time(NULL); | ||||
(void)printf("\ngot message of size %d on %s", n, ctime(&now)); | (void)printf("\ngot message of size %d on %s", n, ctime(&now)); | ||||
print_rtmsg((struct rt_msghdr *)(void *)msg, n); | print_rtmsg((struct rt_msghdr *)(void *)msg, n); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
rtmsg(int cmd, int flags, int fib) | rtmsg(int cmd, int flags, int fib) | ||||
▲ Show 20 Lines • Show All 469 Lines • Show Last 20 Lines |