diff --git a/netjsonconfig/backends/wireguard/wireguard.py b/netjsonconfig/backends/wireguard/wireguard.py index f8179035b..990e2b19b 100644 --- a/netjsonconfig/backends/wireguard/wireguard.py +++ b/netjsonconfig/backends/wireguard/wireguard.py @@ -36,6 +36,6 @@ def auto_client(cls, host='', pub_key='', server={}, port=51820, **kwargs): 'public_key': pub_key, 'endpoint_host': host, 'endpoint_port': server.get('port', 51820), - 'allowed_ips': [kwargs.get('server_ip_max_prefix', '')], + 'allowed_ips': [kwargs.get('server_ip_network', '')], }, } diff --git a/tests/openwrt/test_backend.py b/tests/openwrt/test_backend.py index 197d6829a..9f647d96f 100644 --- a/tests/openwrt/test_backend.py +++ b/tests/openwrt/test_backend.py @@ -505,7 +505,7 @@ def test_wireguard_auto_client(self): host='0.0.0.0', pub_key='server_public_key', server={'name': 'wg', 'port': 51820}, - server_ip_max_prefix='10.0.0.1/24', + server_ip_network='10.0.0.1/24', ip_address='10.0.0.2', ), expected, @@ -536,7 +536,7 @@ def test_vxlan_wireguard_auto_client(self): host='0.0.0.0', pub_key='server_public_key', server={'name': 'wg', 'port': 51820}, - server_ip_max_prefix='10.0.0.1/24', + server_ip_network='10.0.0.1/24', vni=1, server_ip_address='10.0.0.1', ), diff --git a/tests/openwrt/test_wireguard.py b/tests/openwrt/test_wireguard.py index b68335504..aa4446dbb 100644 --- a/tests/openwrt/test_wireguard.py +++ b/tests/openwrt/test_wireguard.py @@ -163,7 +163,7 @@ def test_render_wireguard_peer_with_variables(self): "interface": "wg0", "public_key": "{{pub_key_8097b09be57a4b278e2ef2ea9ea809f3}}", "allowed_ips": [ - "{{server_ip_max_prefix_8097b09be57a4b278e2ef2ea9ea809f3}}" + "{{server_ip_network_8097b09be57a4b278e2ef2ea9ea809f3}}" ], "endpoint_host": "{{vpn_host_8097b09be57a4b278e2ef2ea9ea809f3}}", "endpoint_port": 40840, @@ -174,7 +174,7 @@ def test_render_wireguard_peer_with_variables(self): ] }, context={ - "server_ip_max_prefix_8097b09be57a4b278e2ef2ea9ea809f3": "10.0.0.1/32", + "server_ip_network_8097b09be57a4b278e2ef2ea9ea809f3": "10.0.0.1/32", "vpn_host_8097b09be57a4b278e2ef2ea9ea809f3": "192.168.1.42", "pub_key_8097b09be57a4b278e2ef2ea9ea809f3": "rn+isMBpyQ4HX6ZzE709bKnZw5IaLZoIS3hIjmfKCkk=", "pre_key_8097b09be57a4b278e2ef2ea9ea809f3": "oPZmGdHBseaV1TF0julyElNuJyeKs2Eo+o62R/09IB4=", diff --git a/tests/wireguard/test_backend.py b/tests/wireguard/test_backend.py index 48b7901d5..7041438cb 100644 --- a/tests/wireguard/test_backend.py +++ b/tests/wireguard/test_backend.py @@ -171,7 +171,7 @@ def test_auto_client(self): host='0.0.0.0', pub_key='server_public_key', server={'name': 'wg', 'port': 51820}, - server_ip_max_prefix='10.0.0.1/24', + server_ip_network='10.0.0.1/24', ip_address='10.0.0.2', ), expected,