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@suug.ch> Signed-off-by: Phil Sutter <phil@nwl.cc>
This commit is contained in:
parent
7ffa2b557a
commit
247ace6115
|
|
@ -483,8 +483,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue