]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Fix ip monitor since it is special and can't reuse
authorshemminger <shemminger>
Wed, 7 Sep 2005 17:43:00 +0000 (17:43 +0000)
committershemminger <shemminger>
Wed, 7 Sep 2005 17:43:00 +0000 (17:43 +0000)
rtnl_open handle.

ip/ip.c
ip/ipmonitor.c

diff --git a/ip/ip.c b/ip/ip.c
index c5df825d226c98164d7ea8af47f3f189aec29762..b6ff2df02bee31d6aa1e4996255d6890d15e89fd 100644 (file)
--- a/ip/ip.c
+++ b/ip/ip.c
@@ -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 }
 };
 
index 9f7256370a3c0d7561e46bb37d4bd29f7a0a59dc..50b63279144d1340fa67d1adc96c307667d2d9a8 100644 (file)
@@ -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;