[ovs-dev] [PATCH 5/5] netflow: Only un-wildcard IPv4 packets.

Justin Pettit jpettit at nicira.com
Fri Jun 28 01:16:18 UTC 2013


NetFlow v5 only supports IPv4, so don't bother un-wildcarding
non-IPv4 packets.

Signed-off-by: Justin Pettit <jpettit at nicira.com>
---
 ofproto/netflow.c            |    5 ++++-
 ofproto/netflow.h            |    2 +-
 ofproto/ofproto-dpif-xlate.c |    2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/ofproto/netflow.c b/ofproto/netflow.c
index c7eb2b5..19ca80f 100644
--- a/ofproto/netflow.c
+++ b/ofproto/netflow.c
@@ -52,8 +52,11 @@ struct netflow {
 };
 
 void
-netflow_mask_wc(struct flow_wildcards *wc)
+netflow_mask_wc(struct flow *flow, struct flow_wildcards *wc)
 {
+    if (flow->dl_type != htons(ETH_TYPE_IP)) {
+        return;
+    }
     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);
diff --git a/ofproto/netflow.h b/ofproto/netflow.h
index 7e6debc..e2366f6 100644
--- a/ofproto/netflow.h
+++ b/ofproto/netflow.h
@@ -62,7 +62,7 @@ void netflow_expire(struct netflow *, struct netflow_flow *,
 bool netflow_run(struct netflow *);
 void netflow_wait(struct netflow *);
 
-void netflow_mask_wc(struct flow_wildcards *);
+void netflow_mask_wc(struct flow *, struct flow_wildcards *);
 
 void netflow_flow_init(struct netflow_flow *);
 void netflow_flow_clear(struct netflow_flow *);
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index e338fc4..2033844 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -1902,7 +1902,7 @@ xlate_actions(struct xlate_in *xin, struct xlate_out *xout)
         memset(&wc->masks.tunnel, 0xff, sizeof wc->masks.tunnel);
     }
     if (xin->ofproto->netflow) {
-        netflow_mask_wc(wc);
+        netflow_mask_wc(flow, wc);
     }
 
     ctx.xout->tags = 0;
-- 
1.7.5.4




More information about the dev mailing list