From 8ad719afac733c34039d87cb31b74482f4abdb89 Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Date: Tue, 3 Sep 2024 23:47:03 +0500 Subject: [PATCH] Fix subnet prefix usage (cherry picked from commit 2434e80f9ccae122effba996748f85cf14853886) --- src/middlewared/middlewared/plugins/docker/validation_utils.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/middlewared/middlewared/plugins/docker/validation_utils.py b/src/middlewared/middlewared/plugins/docker/validation_utils.py index a8c889fc100d2..f803c8e741200 100644 --- a/src/middlewared/middlewared/plugins/docker/validation_utils.py +++ b/src/middlewared/middlewared/plugins/docker/validation_utils.py @@ -16,10 +16,9 @@ def validate_address_pools(system_ips: list[dict], user_specified_networks: list seen_networks = set() for index, user_network in enumerate(user_specified_networks): base_network = ipaddress.ip_network(user_network['base'], False) - subnet_prefix = int(user_network['base'].split('/')[-1]) # Validate subnet size vs. base network - if subnet_prefix > user_network['size']: + if base_network.prefixlen > user_network['size']: verrors.add( f'docker_update.address_pools.{index}.base', f'Base network {user_network["base"]} cannot be smaller than '