From 9b658910ab3c709f05f8d986f13aeae9bc53b233 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Wed, 26 Jun 2013 17:13:33 -0700 Subject: [PATCH] netflow: Only un-wildcard IPv4 packets. NetFlow v5 only supports IPv4, so don't bother un-wildcarding non-IPv4 packets. Signed-off-by: Justin Pettit Acked-by: Ethan Jackson --- 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 c7eb2b516..19ca80fc4 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 7e6debcd2..e2366f69f 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 4ed3cdcfd..78617a292 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; -- 2.43.0