diff options
author | Thomas Haller <thaller@redhat.com> | 2017-12-15 12:15:05 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-01-09 14:24:53 +0100 |
commit | 9d92848ada434c9ffb8f55db2986514079f58fa3 (patch) | |
tree | 4e8b9f941b4cebd57a1cc03c2ee509bc306775d1 /src/nm-policy.c | |
parent | eec907b35a1eb85f66cf9b9e031291354d7a0bc2 (diff) |
libnm: rename MDns flag UNKNOWN to DEFAULT
"UNKNOWN" is not a good name. If you don't set the property
in the connection explicitly, it should be "DEFAULT".
Also, make "DEFAULT" -1. For one, that ensures that the enum's
underlying integer type is signed. Otherwise, it's cumbersome
to test "if (mdns >= DEFAULT)" because in case of unsigned types,
the compiler will warn about the check always being true.
Also, it allows for "NO" to be zero. These are no strong reasons,
but I tend to think this is better.
Also, don't make the property of NMSettingConnection a CONSTRUCT property.
Initialize the default manually in the init function.
Also, order the numeric values so that DEFAULT < NO < RESOLVE < YES with
YES being largest because it enables *the most*.
Diffstat (limited to 'src/nm-policy.c')
-rw-r--r-- | src/nm-policy.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c index 40bee9a58..dfc50a846 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1072,11 +1072,12 @@ add_connection_dns (NMPolicy *self, NMConnection *connection, const char *iface, if (s_con) { NMSettingConnectionMdns mdns = nm_setting_connection_get_mdns (s_con); - if (mdns != NM_SETTING_CONNECTION_MDNS_UNKNOWN) + if (mdns != NM_SETTING_CONNECTION_MDNS_DEFAULT) { nm_dns_manager_add_connection_config (NM_POLICY_GET_PRIVATE (self)->dns_manager, - iface, - ifindex, - mdns); + iface, + ifindex, + mdns); + } } } @@ -2163,9 +2164,9 @@ vpn_connection_deactivated (NMPolicy *self, NMVpnConnection *vpn) nm_dns_manager_end_updates (priv->dns_manager, __func__); - remove_connection_dns(self, - nm_vpn_connection_get_ip_iface (vpn, TRUE), - nm_vpn_connection_get_ip_ifindex (vpn, TRUE)); + remove_connection_dns (self, + nm_vpn_connection_get_ip_iface (vpn, TRUE), + nm_vpn_connection_get_ip_ifindex (vpn, TRUE)); } static void |