]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
misc: make the pattern matching case-insensitive
authorAnton Danilov <littlesmilingcloud@gmail.com>
Thu, 9 Jul 2020 15:03:43 +0000 (18:03 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 20 Jul 2020 20:29:55 +0000 (13:29 -0700)
To improve the usability better use case-insensitive pattern-matching
in ifstat, nstat and ss tools.

Signed-off-by: Anton Danilov <littlesmilingcloud@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
man/man8/rtacct.8
misc/ifstat.c
misc/nstat.c
misc/ss.c

index ccdbf6ca75e57b64d6b7155caea1c2c1004869d9..988a6d1b845a8c1f31d5e80816d0800e04466f81 100644 (file)
@@ -14,6 +14,13 @@ and
 .B rtacct
 are simple tools to monitor kernel snmp counters and network interface statistics.
 
+.B nstat
+can filter kernel snmp counters by name with one or several specified wildcards. Wildcards are case-insensitive and can include special symbols
+.B ?
+and
+.B *
+.
+
 .SH OPTIONS
 .B \-h, \-\-help
 Print help
index 60efe6cb60faafc78185b17bdadd9ed77f500595..03327af83ae8e6619545d5610962ad605d12b7f8 100644 (file)
@@ -104,7 +104,7 @@ static int match(const char *id)
                return 1;
 
        for (i = 0; i < npatterns; i++) {
-               if (!fnmatch(patterns[i], id, 0))
+               if (!fnmatch(patterns[i], id, FNM_CASEFOLD))
                        return 1;
        }
        return 0;
index 425e75ef461ec33146b761c29d63681c4e0fa7cd..88f52eaf8c8c266bc61f3b6ee5302c26951fd59e 100644 (file)
@@ -114,7 +114,7 @@ static int match(const char *id)
                return 1;
 
        for (i = 0; i < npatterns; i++) {
-               if (!fnmatch(patterns[i], id, 0))
+               if (!fnmatch(patterns[i], id, FNM_CASEFOLD))
                        return 1;
        }
        return 0;
index f3d01812cb06d040e0ecdfd8fae9d8dd2872607f..5aa10e4a715fd3995c54ac435a660df20b09227e 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -1670,7 +1670,7 @@ static int unix_match(const inet_prefix *a, const inet_prefix *p)
                return 1;
        if (addr == NULL)
                addr = "";
-       return !fnmatch(pattern, addr, 0);
+       return !fnmatch(pattern, addr, FNM_CASEFOLD);
 }
 
 static int run_ssfilter(struct ssfilter *f, struct sockstat *s)