Skip to content

dbus: notify errors for invalid dns, addresses and routes received via DBus

Íñigo Huguet requested to merge ih/dbus_ip_validate into main


Do not ignore invalid values for dns, addresses and routes received via DBus, and return an error instead.


Invalid values for these properties received via DBUS were just ignored and filtered out, only emitting a warning to the logs. If there were still some valid values, those were configured and the client was unaware of the errors. Only if there was not any valid value at all, an error was returned in some cases from verify, but not reflecting the real cause. Example:

  ipv4.addresses: this property cannot be empty for 'method=manual'

Check for invalid value errors in the _from_dbus functions and propagate them if there are any. The valid value are added even if there is an error, and the caller will be responsible of handling the error, making it fatal for NM_SETTING_PARSE_FLAGS_STRICT, or non-fatal for NM_SETTING_PARSE_FLAGS_BEST_EFFORT.

Actually, the invalid values were dropped in some helper functions that converts from GVariant to the proper C type. We cannot change these functions signature or behaviour because they were public API, so create new ones that accept a GError argument and set it in case of any error.

Additionally, the property address-labels could be incorrectly assigned if any address from addresses was dropped. Fix that too.

Added NMCI tests:
NetworkManager-ci!1569 (merged)


  • the subject for all commits is concise and explicative
  • the message for all commits explains the reason for the change
  • the source is properly formatted
  • any relevant documentation is up to date
  • you have added unit tests if applicable
Edited by Íñigo Huguet

Merge request reports