mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
wireguard: Accept/use netmask with IP address for server connection
- Currently, the value is hard-coded as /24. Instead take this as input and use that value. Tests: - Entering invalid IPv4 address results in 'Enter a valid IPv4 address' error message during form submission. - Entering invalid prefix such as /33 results in 'Enter a valid network prefix or net mask.' error during form submission. - Both /32 and /255.255.255.255 formats are accepted. - The description text for the form field 'IP address' is as expected. - Changing the value of default route and IP address + netmask reflects in the status page. Correct values is shown in the edit server and server status page. - Not providing a netmask results in /32 being assigned. - Unit and functional tests for wireguard pass. There are some intermittent failures with functional tests that are unrelated to the patch. - Setting the /32 prefix results in correct routing table as shown by 'ip route show table all'. No default routes are network routes are present. 'traceroute 1.1.1.1' shows route taken via regular network. - Setting the /24 prefix results in correct routing table. No default routes are present. However, for the /24 network a route is present with device wg1. 'traceroute 1.1.1.1' shows route taken via regular network. - Enabling the default route results in correct routing table. Default route is shown for device wg1 with high priority. 'traceroute 1.1.1.1' shows route taken via WireGuard network. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
ad9ebe2301
commit
4b24fda3f5
7 files changed
+83
-30
No files matched your search
@@ -65,7 +65,9 @@ def get_nm_info():
|
||||
|
||||
settings_ipv4 = connection.get_setting_ip4_config()
|
||||
if settings_ipv4 and settings_ipv4.get_num_addresses():
|
||||
info['ip_address'] = settings_ipv4.get_address(0).get_address()
|
||||
address = settings_ipv4.get_address(0)
|
||||
info['ip_address_and_network'] = (address.get_address() + '/' +
|
||||
str(address.get_prefix()))
|
||||
|
||||
connections[info['interface']] = info
|
||||
|
||||
|
||||
Reference in new issue
Block a user