[ovs-dev] [threaded-put 10/21] netflow: Don't unwildcard missing ICMP bits.

Ethan Jackson ethan at nicira.com
Mon Dec 9 02:45:16 UTC 2013


This patch changes netflow_mask_wc() so it doesn't unwildcard the
upper half of tp_src and tp_dst with ICMP packets.  Unfortunately,
this matters in future patches when we compare masks carefully to
determine if flows should be evicted from the datapath.

Signed-off-by: Ethan Jackson <ethan at nicira.com>
---
 ofproto/netflow.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/ofproto/netflow.c b/ofproto/netflow.c
index 1206ae6..a9052a2 100644
--- a/ofproto/netflow.c
+++ b/ofproto/netflow.c
@@ -97,9 +97,15 @@ netflow_mask_wc(struct flow *flow, struct flow_wildcards *wc)
     memset(&wc->masks.nw_proto, 0xff, sizeof wc->masks.nw_proto);
     memset(&wc->masks.nw_src, 0xff, sizeof wc->masks.nw_src);
     memset(&wc->masks.nw_dst, 0xff, sizeof wc->masks.nw_dst);
-    memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
-    memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
     wc->masks.nw_tos |= IP_DSCP_MASK;
+
+    if (flow->nw_proto != IPPROTO_ICMP) {
+        memset(&wc->masks.tp_src, 0xff, sizeof wc->masks.tp_src);
+        memset(&wc->masks.tp_dst, 0xff, sizeof wc->masks.tp_dst);
+    } else {
+        wc->masks.tp_src = htons(0xff);
+        wc->masks.tp_dst = htons(0xff);
+    }
 }
 
 static void
-- 
1.8.1.2




More information about the dev mailing list