netflow: Only un-wildcard IPv4 packets.
authorJustin Pettit <jpettit@nicira.com>
Thu, 27 Jun 2013 00:13:33 +0000 (17:13 -0700)
committerJustin Pettit <jpettit@nicira.com>
Fri, 28 Jun 2013 02:30:26 +0000 (19:30 -0700)
NetFlow v5 only supports IPv4, so don't bother un-wildcarding
non-IPv4 packets.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
ofproto/netflow.c
ofproto/netflow.h
ofproto/ofproto-dpif-xlate.c

index c7eb2b5..19ca80f 100644 (file)
@@ -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);
index 7e6debc..e2366f6 100644 (file)
@@ -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 *);
index 4ed3cdc..78617a2 100644 (file)
@@ -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;