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.
{
struct ofp_flow_expired *ofe;
struct ofpbuf *buf;
{
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 = 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);
ofe->packet_count = htonll(rule->packet_count);
ofe->byte_count = htonll(rule->byte_count);