Commit fc57a9df authored by shemminger's avatar shemminger

Fix ip monitor since it is special and can't reuse

rtnl_open handle.
parent ce715cd9
...@@ -53,6 +53,11 @@ static void usage(void) ...@@ -53,6 +53,11 @@ static void usage(void)
exit(-1); exit(-1);
} }
static int do_help(int argc, char **argv)
{
usage();
}
static const struct cmd { static const struct cmd {
const char *cmd; const char *cmd;
int (*func)(int argc, char **argv); int (*func)(int argc, char **argv);
...@@ -66,6 +71,7 @@ static const struct cmd { ...@@ -66,6 +71,7 @@ static const struct cmd {
{ "tunnel", do_iptunnel }, { "tunnel", do_iptunnel },
{ "monitor", do_ipmonitor }, { "monitor", do_ipmonitor },
{ "xfrm", do_xfrm }, { "xfrm", do_xfrm },
{ "help", do_help },
{ 0 } { 0 }
}; };
......
...@@ -95,6 +95,7 @@ int do_ipmonitor(int argc, char **argv) ...@@ -95,6 +95,7 @@ int do_ipmonitor(int argc, char **argv)
int lroute=0; int lroute=0;
int lprefix=0; int lprefix=0;
rtnl_close(&rth);
ipaddr_reset_filter(1); ipaddr_reset_filter(1);
iproute_reset_filter(); iproute_reset_filter();
ipneigh_reset_filter(); ipneigh_reset_filter();
...@@ -152,12 +153,14 @@ int do_ipmonitor(int argc, char **argv) ...@@ -152,12 +153,14 @@ int do_ipmonitor(int argc, char **argv)
perror("Cannot fopen"); perror("Cannot fopen");
exit(-1); 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); ll_init_map(&rth);
if (rtnl_listen(&rth, accept_msg, (void*)stdout) < 0) if (rtnl_listen(&rth, accept_msg, stdout) < 0)
exit(2); exit(2);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment