match: Only print tp_src and tp_dst for TCP and UDP.
authorJustin Pettit <jpettit@nicira.com>
Fri, 22 Feb 2013 02:46:20 +0000 (18:46 -0800)
committerJustin Pettit <jpettit@nicira.com>
Fri, 22 Feb 2013 02:46:20 +0000 (18:46 -0800)
When printing a match, we would print "tp_src" and "tp_dst" if the
packet wasn't ICMPv4 or ICMPv6.  Unfortunately, this doesn't cover ARP.
This changes the check to only print those keys if the network protocol
is TCP or UDP.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
lib/match.c

index f4b0a6c..2395fb4 100644 (file)
@@ -1053,7 +1053,8 @@ match_format(const struct match *match, struct ds *s, unsigned int priority)
                             &wc->masks.nd_target);
         format_eth_masked(s, "nd_sll", f->arp_sha, wc->masks.arp_sha);
         format_eth_masked(s, "nd_tll", f->arp_tha, wc->masks.arp_tha);
-    } else {
+    } else if (f->nw_proto == IPPROTO_TCP ||
+               f->nw_proto == IPPROTO_UDP) {
         format_be16_masked(s, "tp_src", f->tp_src, wc->masks.tp_src);
         format_be16_masked(s, "tp_dst", f->tp_dst, wc->masks.tp_dst);
     }