[ovs-dev] [PATCH] ovn: fix tunnel id overflow
Wei Li
liwei at anbutu.com
Wed Apr 4 06:57:38 UTC 2018
Need to check tnlid dosen't exceed max and wrap it when it dose.
Signed-off-by: Wei Li <liwei at anbutu.com>
---
ovn/northd/ovn-northd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index 396381049..f286322b1 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -298,7 +298,7 @@ allocate_tnlid(struct hmap *set, const char *name, uint32_t max,
{
for (uint32_t tnlid = *hint + 1; tnlid != *hint;
tnlid = tnlid + 1 <= max ? tnlid + 1 : 1) {
- if (!tnlid_in_use(set, tnlid)) {
+ if (tnlid <= max && !tnlid_in_use(set, tnlid)) {
add_tnlid(set, tnlid);
*hint = tnlid;
return tnlid;
--
2.16.3
More information about the dev
mailing list