From 70e7beba72bdc725cab33ba84f2052588e91f8df Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Thu, 12 Nov 2009 16:52:17 -0800 Subject: [PATCH] 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. --- ofproto/ofproto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); -- 2.45.2