Skip to content

Commit

Permalink
connmgr: Do not use OFPRR_METER_DELETE before OF1.4
Browse files Browse the repository at this point in the history
OFPRR_METER_DELETE was introduced in OF1.4 however meters were introduced
in OF1.3.

Regardless of the OF version when flows are deleted cause flows to be
deleted handle_delete_meter() calls delete_flows__() with
OFPRR_METER_DELETE as the reason.

In order to avoid sending OFPRR_METER_DELETE to controllers connected
using OF1.3 map OFPRR_METER_DELETE to OFPRR_DELETE which exists in that
version.

Signed-off-by: Simon Horman <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
horms authored and blp committed Jun 12, 2014
1 parent 290ad78 commit fa42f4f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/ofp-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -3148,6 +3148,11 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
enum ofputil_protocol protocol)
{
struct ofpbuf *msg;
enum ofp_flow_removed_reason reason = fr->reason;

if (reason == OFPRR_METER_DELETE && !(protocol & OFPUTIL_P_OF14_UP)) {
reason = OFPRR_DELETE;
}

switch (protocol) {
case OFPUTIL_P_OF11_STD:
Expand All @@ -3164,7 +3169,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
ofr = ofpbuf_put_zeros(msg, sizeof *ofr);
ofr->cookie = fr->cookie;
ofr->priority = htons(fr->priority);
ofr->reason = fr->reason;
ofr->reason = reason;
ofr->table_id = fr->table_id;
ofr->duration_sec = htonl(fr->duration_sec);
ofr->duration_nsec = htonl(fr->duration_nsec);
Expand All @@ -3186,7 +3191,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
ofputil_match_to_ofp10_match(&fr->match, &ofr->match);
ofr->cookie = fr->cookie;
ofr->priority = htons(fr->priority);
ofr->reason = fr->reason;
ofr->reason = reason;
ofr->duration_sec = htonl(fr->duration_sec);
ofr->duration_nsec = htonl(fr->duration_nsec);
ofr->idle_timeout = htons(fr->idle_timeout);
Expand All @@ -3208,7 +3213,7 @@ ofputil_encode_flow_removed(const struct ofputil_flow_removed *fr,
nfr = ofpbuf_l3(msg);
nfr->cookie = fr->cookie;
nfr->priority = htons(fr->priority);
nfr->reason = fr->reason;
nfr->reason = reason;
nfr->table_id = fr->table_id + 1;
nfr->duration_sec = htonl(fr->duration_sec);
nfr->duration_nsec = htonl(fr->duration_nsec);
Expand Down

0 comments on commit fa42f4f

Please sign in to comment.