diff options
author | shemminger <shemminger> | 2005-09-07 17:43:00 +0000 |
---|---|---|
committer | shemminger <shemminger> | 2005-09-07 17:43:00 +0000 |
commit | fc57a9df1bee719c86a4f0bc82bafae05bb92fc2 (patch) | |
tree | b8aa10ec741a51a7dd3229293cba00c3ccee97ff | |
parent | ce715cd94cd5272ab4bd106c964ebe215a4e1791 (diff) |
Fix ip monitor since it is special and can't reuse
rtnl_open handle.
-rw-r--r-- | ip/ip.c | 6 | ||||
-rw-r--r-- | ip/ipmonitor.c | 7 |
2 files changed, 11 insertions, 2 deletions
@@ -53,6 +53,11 @@ static void usage(void) exit(-1); } +static int do_help(int argc, char **argv) +{ + usage(); +} + static const struct cmd { const char *cmd; int (*func)(int argc, char **argv); @@ -66,6 +71,7 @@ static const struct cmd { { "tunnel", do_iptunnel }, { "monitor", do_ipmonitor }, { "xfrm", do_xfrm }, + { "help", do_help }, { 0 } }; diff --git a/ip/ipmonitor.c b/ip/ipmonitor.c index 9f725637..50b63279 100644 --- a/ip/ipmonitor.c +++ b/ip/ipmonitor.c @@ -95,6 +95,7 @@ int do_ipmonitor(int argc, char **argv) int lroute=0; int lprefix=0; + rtnl_close(&rth); ipaddr_reset_filter(1); iproute_reset_filter(); ipneigh_reset_filter(); @@ -152,12 +153,14 @@ int do_ipmonitor(int argc, char **argv) perror("Cannot fopen"); exit(-1); } - return rtnl_from_file(fp, accept_msg, (void*)stdout); + return rtnl_from_file(fp, accept_msg, stdout); } + if (rtnl_open(&rth, groups) < 0) + exit(1); ll_init_map(&rth); - if (rtnl_listen(&rth, accept_msg, (void*)stdout) < 0) + if (rtnl_listen(&rth, accept_msg, stdout) < 0) exit(2); return 0; |