Commit bcd7abdd authored by Stephen Hemminger's avatar Stephen Hemminger

tc filter: fix dport/sport in pretty print output

Problem reported by Peter Lebbing on Debian.
The decode of source and destination port filters in pretty print
mode was backwards.
parent f78e316f
...@@ -860,15 +860,15 @@ static void print_ipv4(FILE *f, const struct tc_u32_key *key) ...@@ -860,15 +860,15 @@ static void print_ipv4(FILE *f, const struct tc_u32_key *key)
case 20: case 20:
switch (ntohl(key->mask)) { switch (ntohl(key->mask)) {
case 0x0000ffff: case 0x0000ffff:
fprintf(f, "\n match sport %u", fprintf(f, "\n match dport %u",
ntohl(key->val) & 0xffff); ntohl(key->val) & 0xffff);
return; return;
case 0xffff0000: case 0xffff0000:
fprintf(f, "\n match dport %u", fprintf(f, "\n match sport %u",
ntohl(key->val) >> 16); ntohl(key->val) >> 16);
return; return;
case 0xffffffff: case 0xffffffff:
fprintf(f, "\n match sport %u, match dport %u", fprintf(f, "\n match dport %u, match sport %u",
ntohl(key->val) & 0xffff, ntohl(key->val) & 0xffff,
ntohl(key->val) >> 16); ntohl(key->val) >> 16);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment