]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virtportallocator: Change number of ports to 65536
authorPavel Hrdina <phrdina@redhat.com>
Thu, 14 Jun 2018 07:17:10 +0000 (09:17 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 14 Jun 2018 07:52:21 +0000 (09:52 +0200)
USHRT_MAX is not good enough because the value is 65535 which specifies
the number of bits in bitmap.  The allowed port range is 0-65535 so we
need to increase the number.

We could have USHRT_MAX + 1 but let's define the number explicitly.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1590214

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
src/util/virportallocator.c

index 004a2dab8132ba89645f2abefc04257bd8c9e016..db95a601c7d4e455dab0122257157698c92c09d6 100644 (file)
@@ -35,6 +35,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
+#define VIR_PORT_ALLOCATOR_NUM_PORTS 65536
+
 typedef struct _virPortAllocator virPortAllocator;
 typedef virPortAllocator *virPortAllocatorPtr;
 struct _virPortAllocator {
@@ -68,7 +70,7 @@ virPortAllocatorNew(void)
     if (!(pa = virObjectLockableNew(virPortAllocatorClass)))
         return NULL;
 
-    if (!(pa->bitmap = virBitmapNew(USHRT_MAX)))
+    if (!(pa->bitmap = virBitmapNew(VIR_PORT_ALLOCATOR_NUM_PORTS)))
         goto error;
 
     return pa;