From: Ben Pfaff Date: Wed, 18 Mar 2009 23:32:19 +0000 (-0700) Subject: secchan: Make NetFlow work with any flow, not just exact-match. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b04ae49fe25f280db7135b41330895f9b758a610;p=openvswitch secchan: Make NetFlow work with any flow, not just exact-match. NetFlow only worked with exact-match flows until now. This commit extends it to also work with wildcarded flows, which is increasingly important now that NOX sets up a lot of these. --- diff --git a/secchan/ofproto.c b/secchan/ofproto.c index 781cd98c..979dfeaa 100644 --- a/secchan/ofproto.c +++ b/secchan/ofproto.c @@ -997,9 +997,6 @@ ofproto_delete_flow(struct ofproto *ofproto, const flow_t *flow, if (rule) { classifier_remove(&ofproto->cls, &rule->cr); rule_destroy(rule); - /* We don't call back to the flow_expired_cb because our caller would - * explode, but perhaps we should fix that. At any rate should we sent - * out a netflow message? */ } } @@ -1452,6 +1449,18 @@ rule_uninstall(struct ofproto *p, struct rule *rule) ? rule->super : rule, &odp_flow.stats); } rule->installed = false; + + if (p->netflow) { + struct ofexpired expired; + expired.flow = rule->cr.flow; + expired.packet_count = rule->packet_count; + expired.byte_count = rule->byte_count; + expired.used = rule->used; + expired.created = rule->created; + expired.tcp_flags = rule->tcp_flags; + expired.ip_tos = rule->ip_tos; + netflow_expire(p->netflow, &expired); + } } } @@ -2905,26 +2914,6 @@ send_flow_exp(struct ofproto *p, struct rule *rule, if (prev) { queue_tx(buf, prev); } - - if (!rule->cr.wc.wildcards - && (p->netflow || p->ofhooks->flow_expired_cb)) { - struct ofexpired expired; - expired.flow = rule->cr.flow; - expired.packet_count = rule->packet_count; - expired.byte_count = rule->byte_count; - expired.used = rule->used; - expired.created = rule->created; - expired.tcp_flags = rule->tcp_flags; - expired.ip_tos = rule->ip_tos; - - if (p->netflow) { - netflow_expire(p->netflow, &expired); - } - - if (p->ofhooks->flow_expired_cb) { - p->ofhooks->flow_expired_cb(&expired, p->aux); - } - } } static void