]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/f_matchall.c
bridge: fdb: add support for src_vni option
[mirror_iproute2.git] / tc / f_matchall.c
index d78660e79dbe4f94db6758ea03ebacd0f72321b8..03dd51de1aced9ffb7d43ed6f69c1ddf30dfe1c3 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <syslog.h>
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -115,6 +114,7 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
                           struct rtattr *opt, __u32 handle)
 {
        struct rtattr *tb[TCA_MATCHALL_MAX+1];
+       struct tc_matchall_pcnt *pf = NULL;
 
        if (opt == NULL)
                return 0;
@@ -122,11 +122,11 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
        parse_rtattr_nested(tb, TCA_MATCHALL_MAX, opt);
 
        if (handle)
-               fprintf(f, "handle 0x%x ", handle);
+               print_uint(PRINT_ANY, "handle", "handle 0x%x ", handle);
 
        if (tb[TCA_MATCHALL_CLASSID]) {
                SPRINT_BUF(b1);
-               fprintf(f, "flowid %s ",
+               print_string(PRINT_ANY, "flowid", "flowid %s ",
                        sprint_tc_classid(rta_getattr_u32(tb[TCA_MATCHALL_CLASSID]), b1));
        }
 
@@ -134,16 +134,29 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
                __u32 flags = rta_getattr_u32(tb[TCA_MATCHALL_FLAGS]);
 
                if (flags & TCA_CLS_FLAGS_SKIP_HW)
-                       fprintf(f, "\n  skip_hw");
+                       print_bool(PRINT_ANY, "skip_hw", "\n  skip_hw", true);
                if (flags & TCA_CLS_FLAGS_SKIP_SW)
-                       fprintf(f, "\n  skip_sw");
+                       print_bool(PRINT_ANY, "skip_sw", "\n  skip_sw", true);
 
                if (flags & TCA_CLS_FLAGS_IN_HW)
-                       fprintf(f, "\n  in_hw");
+                       print_bool(PRINT_ANY, "in_hw", "\n  in_hw", true);
                else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
-                       fprintf(f, "\n  not_in_hw");
+                       print_bool(PRINT_ANY, "not_in_hw", "\n  not_in_hw", true);
        }
 
+       if (tb[TCA_MATCHALL_PCNT]) {
+               if (RTA_PAYLOAD(tb[TCA_MATCHALL_PCNT])  < sizeof(*pf)) {
+                       print_string(PRINT_FP, NULL, "Broken perf counters\n", NULL);
+                       return -1;
+               }
+               pf = RTA_DATA(tb[TCA_MATCHALL_PCNT]);
+       }
+
+       if (show_stats && NULL != pf)
+               print_u64(PRINT_ANY, "rule_hit", " (rule hit %llu)",
+                       (unsigned long long) pf->rhit);
+
+
        if (tb[TCA_MATCHALL_ACT])
                tc_print_action(f, tb[TCA_MATCHALL_ACT], 0);