diff --git a/vpn-daemons/pptp/ChangeLog b/vpn-daemons/pptp/ChangeLog index 5baa51a267..69a0d5cea3 100644 --- a/vpn-daemons/pptp/ChangeLog +++ b/vpn-daemons/pptp/ChangeLog @@ -1,3 +1,8 @@ +2008-10-14 Dan Williams + + * src/nm-pptp-pppd-plugin.c + - (nm_ip_up): pass VPN gateway up to nm-pptp-service + 2008-10-12 Dan Williams Patch from Bin Li , based on patches by Tambet diff --git a/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c b/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c index 29cc70b851..0a08fe41ec 100644 --- a/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c +++ b/vpn-daemons/pptp/src/nm-pptp-pppd-plugin.c @@ -154,6 +154,7 @@ value_destroy (gpointer data) static void nm_ip_up (void *data, int arg) { + guint32 pppd_made_up_address = htonl (0x0a404040 + ifunit); ipcp_options opts = ipcp_gotoptions[0]; ipcp_options peer_opts = ipcp_hisoptions[0]; GHashTable *hash; @@ -173,6 +174,22 @@ nm_ip_up (void *data, int arg) g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV, str_to_gvalue (ifname)); + /* Prefer the peer options remote address first, _unless_ pppd made the + * address up, at which point prefer the local options remote address, + * and if that's not right, use the made-up address as a last resort. + */ + if (peer_opts.hisaddr && (peer_opts.hisaddr != pppd_made_up_address)) { + g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY, + uint_to_gvalue (peer_opts.hisaddr)); + } else if (opts.hisaddr) { + g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY, + uint_to_gvalue (opts.hisaddr)); + } else if (peer_opts.hisaddr == pppd_made_up_address) { + /* As a last resort, use the made-up address */ + g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY, + uint_to_gvalue (peer_opts.hisaddr)); + } + g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, uint_to_gvalue (opts.ouraddr)); @@ -193,23 +210,6 @@ nm_ip_up (void *data, int arg) g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_DNS, val); } -/* - if (opts.winsaddr[0] || opts.winsaddr[1]) { - array = g_array_new (FALSE, FALSE, sizeof (guint32)); - - if (opts.winsaddr[0]) - g_array_append_val (array, opts.winsaddr[0]); - if (opts.winsaddr[1]) - g_array_append_val (array, opts.winsaddr[1]); - - val = g_slice_new0 (GValue); - g_value_init (val, DBUS_TYPE_G_UINT_ARRAY); - g_value_set_boxed (val, array); - - g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_WINS, val); - } -*/ - dbus_g_proxy_call_no_reply (proxy, "SetIp4Config", DBUS_TYPE_G_MAP_OF_VARIANT, hash, G_TYPE_INVALID, G_TYPE_INVALID);