]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip-monitor: Include stats events in default and "all" cases
authorBenjamin Poirier <bpoirier@nvidia.com>
Thu, 22 Sep 2022 06:19:37 +0000 (15:19 +0900)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 30 Sep 2022 19:36:40 +0000 (12:36 -0700)
It seems that stats were omitted from `ip monitor` and `ip monitor all`.
Since all other event types are included, include stats as well. Use the
same logic as for nexthops.

Fixes: a05a27c07cbf ("ipmonitor: Add monitoring support for stats events")
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
ip/ipmonitor.c

index 380ab526b402633a4d187293de10bd3dc120fdbb..cb2195d14fb921b11a846d40134db3e3a0d09efb 100644 (file)
@@ -180,6 +180,7 @@ static int accept_msg(struct rtnl_ctrl_data *ctrl,
 
 int do_ipmonitor(int argc, char **argv)
 {
+       int lstats = 0, stats_set = 1;
        int lnexthop = 0, nh_set = 1;
        char *file = NULL;
        unsigned int groups = 0;
@@ -190,7 +191,6 @@ int do_ipmonitor(int argc, char **argv)
        int lprefix = 0;
        int lneigh = 0;
        int lnetconf = 0;
-       int lstats = 0;
        int lrule = 0;
        int lnsid = 0;
        int ifindex = 0;
@@ -224,41 +224,51 @@ int do_ipmonitor(int argc, char **argv)
                        llink = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "address") == 0) {
                        laddr = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "route") == 0) {
                        lroute = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "mroute") == 0) {
                        lmroute = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "prefix") == 0) {
                        lprefix = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "neigh") == 0) {
                        lneigh = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "netconf") == 0) {
                        lnetconf = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "rule") == 0) {
                        lrule = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "nsid") == 0) {
                        lnsid = 1;
                        groups = 0;
                        nh_set = 0;
+                       stats_set = 0;
                } else if (matches(*argv, "nexthop") == 0) {
                        lnexthop = 1;
                        groups = 0;
+                       stats_set = 0;
                } else if (strcmp(*argv, "stats") == 0) {
                        lstats = 1;
                        groups = 0;
@@ -336,6 +346,8 @@ int do_ipmonitor(int argc, char **argv)
        }
        if (nh_set)
                lnexthop = 1;
+       if (stats_set)
+               lstats = 1;
 
        if (file) {
                FILE *fp;