[ovs-dev] [PATCH] match: Only print tp_src and tp_dst for TCP and UDP.

Justin Pettit jpettit at nicira.com
Fri Feb 22 02:49:37 UTC 2013


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 at nicira.com>
---
 lib/match.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lib/match.c b/lib/match.c
index f4b0a6c..2395fb4 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -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);
     }
-- 
1.7.5.4




More information about the dev mailing list