Skip to content

Static configuration user interface enhancements

Pascal Hambourg requested to merge pham/netcfg:static into master

This is a collection of 4 patches for static configuration. The first one is the most important, the others are only enhancing user experience.

  1. Reject invalid input for static nameserver configuration

When using static network configuration or when no nameservers are provided by automatic network configuration, netcfg prompts for nameserver IP addresses separated by spaces. But if an input item is not a valid IP address then netcfg does not report an error to the user. It not only silently skips invalid items but also may skip subsequent valid items. Consequences:

  • If the user types a wrong separator character (comma, semicolon... instead of space) beteween IP addresses, then the nameservers are silently discarded.
  • Only the first 4 (NETCFG_NAMESERVERS_MAX) input items are considered even if some of them are not valid IP addresses.
  • If the 1st item is not a valid IP address then no "dns-nameservers" option is added to /etc/network/interfaces even though the 2nd, 3rd or 4th input items are valid IP addresses. (static:c: netcfg_write_resolvconf_options())
  • If the 1st item is not a valid IP address then no nameserver "addresses:" is added to netplan config even though the 2nd, 3rd or 4th input items are valid IP addresses. (netplan-conf.c: netplan_write_common())
  • If an item is not a valid IP address then the next items are not added to NetworkManager config. (nm-conf.c: nm_write_static_ipvX())

The obvious fix is that netcfg should reject invalid nameserver input and prompt for the nameservers again, like it does with other input (address, netmask, gateway). The proposed implementation changes the function API but avoids code duplication.

Closes: #1089036

  1. Update netcfg/get_netmask with masklen on static IP address
  2. Use separate debconf questions for IPv4 and IPv6 netmask and gateway (removed)
  3. Update netcfg/get_ipv6_netmask with masklen on static IPv6 address. This commit is needed when the previous two commits are combined. (removed)
Edited by Pascal Hambourg

Merge request reports

Loading