]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: Fix socket type check in packet_show_line()
authorPhil Sutter <phil@nwl.cc>
Tue, 22 Aug 2023 12:19:16 +0000 (14:19 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 23 Aug 2023 15:05:49 +0000 (08:05 -0700)
The field is accessed before being assigned a meaningful value,
effectively disabling the checks.

Fixes: 4a0053b606a34 ("ss: Unify packet stats output from netlink and proc")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
misc/ss.c

index c71b08f98525ddbf880b23dda31485dee723ac32..653b1512c6ba71a8c2301ce7d1a8789e6ad8c878 100644 (file)
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -4535,9 +4535,9 @@ static int packet_show_line(char *buf, const struct filter *f, int fam)
                        &type, &prot, &iface, &state,
                        &rq, &uid, &ino);
 
-       if (stat.type == SOCK_RAW && !(f->dbs&(1<<PACKET_R_DB)))
+       if (type == SOCK_RAW && !(f->dbs & (1<<PACKET_R_DB)))
                return 0;
-       if (stat.type == SOCK_DGRAM && !(f->dbs&(1<<PACKET_DG_DB)))
+       if (type == SOCK_DGRAM && !(f->dbs & (1<<PACKET_DG_DB)))
                return 0;
 
        stat.type  = type;