diff options
Diffstat (limited to 'src/ifmonitor.c')
-rw-r--r-- | src/ifmonitor.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/src/ifmonitor.c b/src/ifmonitor.c index c1e05ec..9991893 100644 --- a/src/ifmonitor.c +++ b/src/ifmonitor.c @@ -28,6 +28,8 @@ #include <unistd.h> #include <errno.h> +#include <libdaemon/dlog.h> + #include "util.h" #include "nlapi.h" @@ -43,7 +45,7 @@ static int callback(struct nlmsghdr *n, void *u) { i = NLMSG_DATA(n); if (n->nlmsg_len < NLMSG_LENGTH(sizeof(struct ifinfomsg))) { - fprintf(stderr, "NETLINK: Packet too small or truncated! (2)\n"); + daemon_log(LOG_ERR, "NETLINK: Packet too small or truncated! (2)\n"); return -1; } @@ -72,33 +74,3 @@ static int callback(struct nlmsghdr *n, void *u) { int ifmonitor_init(int (*cb) (int b, int index, unsigned short type, const char *name)) { return nlapi_register(callback, cb); } - -#if 0 - -int test(int b, int index, unsigned short type, const char * name) { - printf("CALLBACK %s %s %i %i\n", b ? "new" : "del", name, index, type); - return 0; -} - -int main(int argc, char *argv[]) { - int r = 1; - - if (nlapi_open(RTMGRP_LINK) < 0) - goto finish; - - if (ifmonitor_init(test) < 0) - goto finish; - - for (;;) - if (nlapi_work() < 0) - goto finish; - - r = 0; - -finish: - nlapi_close(); - - return r; -} - -#endif |