GNOME Bugzilla – Bug 764689
[review] bg/dns-manager-vpn-bgo764689 - Handle multiple VPN configurations in DNS manager
Last modified: 2016-04-18 11:29:06 UTC
When multiple VPNs are active, the DNS manager considers all the VPN configurations except one as normal configurations and thus they might not be given a higher priority. Steps to reproduce: 1. activate VPN1 2. activate VPN2 3. activate connection1 Now resolv.conf contains: nameserver of VPN1 nameserver of connection1 nameserver of VPN2 Instead the two VPN nameserver should be at the top. Maybe we should also decide their order based on some other parameters?
Fix in branch bg/dns-manager-vpn-bgo764689, please review.
+static inline NMDnsManagerPrivate * +NM_DNS_MANAGER_GET_PRIVATE (NMDnsManager *self) +{ + g_assert (NM_IS_DNS_MANAGER (self)); + return self->priv; +} realistically, nobody is ever going to do a production build of NM with G_DISABLE_ASSERT. Hence, you always check the type. For me, the selling point of using a private pointer it to avoid the type lookup involved with G_TYPE_INSTANCE_GET_PRIVATE(). If you always check the type, there is not much point in doing it. Well, you cannot have it both. Either you pay for the check, or you hope for the best. I think nm_assert() would be preferably, because that one is a NOP on production builds. the switch in nm_dns_manager_add_ip4_config(), maybe it should have a g_return_if_reached() for "default"? maybe reorder the if-else-if in nm_dns_manager_remove_ip4_config()? I'd expect to see more device-configs then vpn configs there... Rest lgtm
(In reply to Thomas Haller from comment #2) > For me, the selling point of using a private pointer it to avoid the type > lookup involved with G_TYPE_INSTANCE_GET_PRIVATE(). If you always check the > type, there is not much point in doing it. > > Well, you cannot have it both. Either you pay for the check, or you hope for > the best. I was interested more in having priv available when debugging. Now I've removed the check and turned the function to a macro that returns (o)->priv. > the switch in nm_dns_manager_add_ip4_config(), maybe it should have a > g_return_if_reached() for "default"? Fixed. > maybe reorder the if-else-if in nm_dns_manager_remove_ip4_config()? I'd > expect to see more device-configs then vpn configs there... Done and repushed.
(In reply to Beniamino Galvani from comment #3) > (In reply to Thomas Haller from comment #2) > > > For me, the selling point of using a private pointer it to avoid the type > > lookup involved with G_TYPE_INSTANCE_GET_PRIVATE(). If you always check the > > type, there is not much point in doing it. > > > > Well, you cannot have it both. Either you pay for the check, or you hope for > > the best. > > I was interested more in having priv available when debugging. Now I've > removed the check and turned the function to a macro that returns (o)->priv. Ah ok. Makes sense. I don't have a preference over inline-function vs. macro :) > Done and repushed. lgtm
Merged: https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=f439f05237e1c875ebc7c417820d6bfa0b9a9570