mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-01-21 07:55:00 +00:00
networks: Fix incorrect access of DNS settings
Network manager's libnm throws a critical message for when accessing DNS entries from IPv4 configuration when there are none available. See the number of entries available before accessing them.
This commit is contained in:
parent
fee14b1764
commit
74ffc8d323
@ -150,16 +150,15 @@ def edit(request, uuid):
|
||||
form_data['ipv4_netmask'] = network.ipv4_int_to_string(netmask)
|
||||
|
||||
gateway = settings_ipv4.get_gateway()
|
||||
dns = settings_ipv4.get_dns(0)
|
||||
second_dns = settings_ipv4.get_dns(1)
|
||||
if gateway:
|
||||
form_data['ipv4_gateway'] = gateway
|
||||
|
||||
if dns:
|
||||
form_data['ipv4_dns'] = dns
|
||||
number_of_dns = settings_ipv4.get_num_dns()
|
||||
if number_of_dns:
|
||||
form_data['ipv4_dns'] = settings_ipv4.get_dns(0)
|
||||
|
||||
if second_dns:
|
||||
form_data['ipv4_second_dns'] = second_dns
|
||||
if number_of_dns > 1:
|
||||
form_data['ipv4_second_dns'] = settings_ipv4.get_dns(1)
|
||||
|
||||
if settings_connection.get_connection_type() == 'generic':
|
||||
form = GenericForm(form_data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user