lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1468530653-19773-1-git-send-email-phil@nwl.cc>
Date:	Thu, 14 Jul 2016 23:10:53 +0200
From:	Phil Sutter <phil@....cc>
To:	Stephen Hemminger <shemming@...cade.com>
Cc:	netdev@...r.kernel.org, Thomas Graf <tgraf@...g.ch>
Subject: [iproute PATCH] tc: ematch: Ignore all-zero mask value when printing filters

The optional mask which may be added to int values is considered by the
kernel only if it is non-zero, therefore tc should only then also print
it.

Without this, not passing a mask value like so:

| # tc filter add dev d0 parent 8001: \
| 	basic match meta\(vlan eq 1\) \
| 	classid 8001:1

Would lead to tc printing an all-zero mask later:

| # tc filter show dev d0
| filter parent 8001: protocol all pref 49151 basic
| filter parent 8001: protocol all pref 49151 basic handle 0x1 flowid 8001:1
|   meta(vlan mask 0x00000000 eq 1)

This is obviously confusing as an all-zero mask strictly means to
eliminate all bits from the value, but the opposite is the case.

Cc: Thomas Graf <tgraf@...g.ch>
Signed-off-by: Phil Sutter <phil@....cc>
---
 tc/em_meta.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tc/em_meta.c b/tc/em_meta.c
index 9ce5a78a628ac..ce98386082b86 100644
--- a/tc/em_meta.c
+++ b/tc/em_meta.c
@@ -485,8 +485,9 @@ static int print_object(FILE *fd, struct tcf_meta_val *obj, struct rtattr *rta)
 				if (RTA_PAYLOAD(rta) < sizeof(__u32))
 					goto size_mismatch;
 
-				fprintf(fd, " mask 0x%08x",
-				    rta_getattr_u32(rta));
+				if (rta_getattr_u32(rta))
+					fprintf(fd, " mask 0x%08x",
+						rta_getattr_u32(rta));
 			}
 			break;
 	}
-- 
2.8.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ