On Mon, Nov 02, 2009 at 01:34:14PM -0800, Dan Williams wrote: > On Mon, 2009-11-02 at 22:18 +0100, Benoit Boissinot wrote: > > > > Yes, so I guess I should get the gateway by iterating the NMIP4Address's > > from the config, and pick the first one with a gateway? > > If you have the NMVPNConnection object internally, you'd use > nm_vpn_connection_get_ip4_internal_gateway() to get it. You don't want > to use the external public IP of the VPN gateway, you want to use the > internal gateway that tun0 will actually forward packets to I think. We > should do the same thing for other device types though, so what you'd > really want to do is perform the substitution in nm-vpn-connection.c > around here: > > /* Merge in user overrides from the NMConnection's IPv4 setting */ > s_ip4 = NM_SETTING_IP4_CONFIG (nm_connection_get_setting > (priv->connection, NM_TYPE_SETTING_IP4_CONFIG)); > nm_utils_merge_ip4_config (config, s_ip4);
Since we want to do that for all devices, why can't we change the NMIP4Address used by the vpn connection to have a non-null gateway field? Wouldn't that make sense? (what is the semantic of the gateway field in the address?) Then redirecting networks to a specific interface would be easy, not specifying the gateway would use the default gateway for the interface. And that would work even in the non-vpn case. (this could be done either in nm_utils_merge_ip4_config() or in nm_system_apply_ip4_config()) > > the user-specified routes will be in the "s_ip4" which is an > NMSettingIP4Config object (libnm-util/nm-setting-ip4-config.c). Maybe > add a new parameter to nm_utils_merge_ip4_config() that takes a default > gateway to be used if any ip-address gateway is 0. > > Care to take a stab at it? If that's the way to go, sure. regards, Benoit -- :wq _______________________________________________ NetworkManager-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/networkmanager-list
