2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

Add support for parsing and printing OFPFF_* flags.

I intend to use OFPFF_SEND_FLOW_REM in upcoming unit tests.  I threw in
OFPFF_CHECK_OVERLAP also because it didn't cost me anything.  I omitted
parsing support for OFPFF_EMERG because we opposed its inclusion from the
start and it was removed from OpenFlow 1.2.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-01-25 13:54:15 -08:00
parent c6a93eb711
commit a993007bee
4 changed files with 41 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2011 Nicira Networks.
* Copyright (c) 2010, 2011, 2012 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -492,7 +492,8 @@ parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
F_OUT_PORT = 1 << 0,
F_ACTIONS = 1 << 1,
F_TIMEOUT = 1 << 3,
F_PRIORITY = 1 << 4
F_PRIORITY = 1 << 4,
F_FLAGS = 1 << 5,
} fields;
char *string = xstrdup(str_);
char *save_ptr = NULL;
@@ -505,7 +506,7 @@ parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
break;
case OFPFC_ADD:
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY | F_FLAGS;
break;
case OFPFC_DELETE:
@@ -517,11 +518,11 @@ parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
break;
case OFPFC_MODIFY:
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY | F_FLAGS;
break;
case OFPFC_MODIFY_STRICT:
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY;
fields = F_ACTIONS | F_TIMEOUT | F_PRIORITY | F_FLAGS;
break;
default:
@@ -561,6 +562,10 @@ parse_ofp_str(struct ofputil_flow_mod *fm, int command, const char *str_,
if (p->nw_proto) {
cls_rule_set_nw_proto(&fm->cr, p->nw_proto);
}
} else if (fields & F_FLAGS && !strcmp(name, "send_flow_rem")) {
fm->flags |= OFPFF_SEND_FLOW_REM;
} else if (fields & F_FLAGS && !strcmp(name, "check_overlap")) {
fm->flags |= OFPFF_CHECK_OVERLAP;
} else {
char *value;