[ovs-dev] [PATCH v8 06/16] ofproto: Verify compatibility of liveness of groups with their type
Simon Horman
horms at verge.net.au
Wed Oct 30 09:17:10 UTC 2013
Require liveness for fast-failover groups as it is mandated by OpenFlow1.3.
Allow livness for select groups which is in keeping with OpenFlow1.3.
Disallow liveness it for other group types.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
v8
* First post
---
lib/ofp-util.c | 29 ++++++++++++++++++++++++++++-
lib/ofp-util.h | 7 +++++++
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index d435e99..e588c3b 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -6174,6 +6174,8 @@ ofputil_decode_group_mod(const struct ofp_header *oh,
{
const struct ofp11_group_mod *ogm;
struct ofpbuf msg;
+ struct ofputil_bucket *bucket;
+ enum ofperr err;
ofpbuf_use_const(&msg, oh, ntohs(oh->length));
ofpraw_pull_assert(&msg);
@@ -6183,7 +6185,32 @@ ofputil_decode_group_mod(const struct ofp_header *oh,
gm->type = ogm->type;
gm->group_id = ntohl(ogm->group_id);
- return ofputil_pull_buckets(&msg, oh->version, msg.size, &gm->buckets);
+ err = ofputil_pull_buckets(&msg, oh->version, msg.size, &gm->buckets);
+ if (err) {
+ return err;
+ }
+
+ LIST_FOR_EACH (bucket, list_node, &gm->buckets) {
+ switch (gm->type) {
+ case OFPGT11_ALL:
+ case OFPGT11_INDIRECT:
+ if (ofputil_bucket_has_liveness(bucket)) {
+ return OFPERR_OFPGMFC_WATCH_UNSUPPORTED;
+ }
+ break;
+ case OFPGT11_SELECT:
+ break;
+ case OFPGT11_FF:
+ if (!ofputil_bucket_has_liveness(bucket)) {
+ return OFPERR_OFPGMFC_INVALID_GROUP;
+ }
+ break;
+ default:
+ NOT_REACHED();
+ }
+ }
+
+ return 0;
}
/* Parse a queue status request message into 'oqsr'.
diff --git a/lib/ofp-util.h b/lib/ofp-util.h
index c37ab2b..177bd2e 100644
--- a/lib/ofp-util.h
+++ b/lib/ofp-util.h
@@ -1006,6 +1006,13 @@ struct ofputil_group_desc {
void ofputil_bucket_list_destroy(struct list *buckets);
+static inline bool
+ofputil_bucket_has_liveness(const struct ofputil_bucket *bucket)
+{
+ return bucket->watch_port != OFPP_ANY ||
+ bucket->watch_group != OFPG_ANY;
+}
+
struct ofpbuf *ofputil_encode_group_stats_request(enum ofp_version,
uint32_t group_id);
enum ofperr ofputil_decode_group_stats_request(
--
1.8.4
More information about the dev
mailing list