[ovs-dev] [PATCH] ofproto-dpif-xlate: Do not use zero-weight buckets in select groups.
Ben Pfaff
blp at ovn.org
Fri Jun 7 18:13:00 UTC 2019
The OpenFlow specification says that buckets in select groups with a weight
of zero should not be selected, but the ofproto-dpif implementation could
select them in corner cases. This fixes the problem.
Reported-by: ychen <ychen103103 at 163.com>
Reported-at: https://mail.openvswitch.org/pipermail/ovs-dev/2019-May/359349.html
Signed-off-by: Ben Pfaff <blp at ovn.org>
---
ofproto/ofproto-dpif-xlate.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index ae8b9991c7cd..da7fa56362d3 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc.
+/* Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2019 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1929,7 +1929,7 @@ group_best_live_bucket(const struct xlate_ctx *ctx,
struct ofputil_bucket *bucket;
LIST_FOR_EACH (bucket, list_node, &group->up.buckets) {
- if (bucket_is_alive(ctx, bucket, 0)) {
+ if (bucket_is_alive(ctx, bucket, 0) && bucket->weight > 0) {
uint32_t score =
(hash_int(bucket->bucket_id, basis) & 0xffff) * bucket->weight;
if (score >= best_score) {
@@ -4535,7 +4535,7 @@ pick_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group)
for (int i = 0; i <= hash_mask; i++) {
struct ofputil_bucket *b =
group->hash_map[(dp_hash + i) & hash_mask];
- if (bucket_is_alive(ctx, b, 0)) {
+ if (bucket_is_alive(ctx, b, 0) && b->weight > 0) {
return b;
}
}
--
2.20.1
More information about the dev
mailing list