From: Justin Pettit Date: Fri, 13 Nov 2009 00:52:17 +0000 (-0800) Subject: ofproto: Use active time for Flow Expiration duration (OpenFlow 0.9) X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=70e7beba72bdc725cab33ba84f2052588e91f8df;p=sliver-openvswitch.git ofproto: Use active time for Flow Expiration duration (OpenFlow 0.9) In pre-0.9 versions of OpenFlow, the duration field in the flow expiration message was the amount of time that the flow was in a table. If a long idle timeout was set, it could be difficult to determine how long the flow was actually active. In OpenFlow 0.9, this was changed to only be the length of time that the flow was active. NOTE: OVS at this point is not wire-compatible with OpenFlow 0.9 until the final commit in this OpenFlow 0.9 set. --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index dbb1a2121..f25813f1f 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3264,12 +3264,13 @@ compose_flow_exp(const struct rule *rule, long long int now, uint8_t reason) { struct ofp_flow_expired *ofe; struct ofpbuf *buf; + long long int last_used = rule->used ? now - rule->used : 0; ofe = make_openflow(sizeof *ofe, OFPT_FLOW_EXPIRED, &buf); flow_to_match(&rule->cr.flow, rule->cr.wc.wildcards, &ofe->match); ofe->priority = htons(rule->cr.priority); ofe->reason = reason; - ofe->duration = htonl((now - rule->created) / 1000); + ofe->duration = htonl((now - rule->created - last_used) / 1000); ofe->packet_count = htonll(rule->packet_count); ofe->byte_count = htonll(rule->byte_count);