NetworkManager r3260 - in trunk: . src src/ppp-manager



Author: dcbw
Date: Mon Jan 21 15:30:39 2008
New Revision: 3260
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3260&view=rev

Log:
2008-01-21  Dan Williams  <dcbw redhat com>

	* src/ppp-manager/nm-ppp-manager.c
		- (ip4_config_get): set peer address too

	* src/ppp-manager/nm-pppd-plugin.c
		- (nm_ip_up): try harder to get the peer's address

	* src/NetworkManagerSystem.c
		- (nm_system_device_set_from_ip4_config): if the IP4Config has a peer
			address, use that too.  Otherwise, some PPP connections won't work.



Modified:
   trunk/ChangeLog
   trunk/src/NetworkManagerSystem.c
   trunk/src/ppp-manager/nm-ppp-manager.c
   trunk/src/ppp-manager/nm-pppd-plugin.c

Modified: trunk/src/NetworkManagerSystem.c
==============================================================================
--- trunk/src/NetworkManagerSystem.c	(original)
+++ trunk/src/NetworkManagerSystem.c	Mon Jan 21 15:30:39 2008
@@ -195,6 +195,7 @@
 	struct rtnl_addr *	addr = NULL;
 	int				err;
 	int len, i;
+	guint32 flags;
 
 	g_return_val_if_fail (iface != NULL, FALSE);
 	g_return_val_if_fail (config != NULL, FALSE);
@@ -208,7 +209,11 @@
 	nm_system_device_flush_routes_with_iface (iface);
 	nm_system_flush_arp_cache ();
 
-	if ((addr = nm_ip4_config_to_rtnl_addr (config, NM_RTNL_ADDR_DEFAULT))) {
+	flags = NM_RTNL_ADDR_DEFAULT;
+	if (nm_ip4_config_get_ptp_address (config))
+		flags |= NM_RTNL_ADDR_PTP_ADDR;
+
+	if ((addr = nm_ip4_config_to_rtnl_addr (config, flags))) {
 		rtnl_addr_set_ifindex (addr, nm_netlink_iface_to_index (iface));
 
 		if ((err = rtnl_addr_add (nlh, addr, 0)) < 0)

Modified: trunk/src/ppp-manager/nm-ppp-manager.c
==============================================================================
--- trunk/src/ppp-manager/nm-ppp-manager.c	(original)
+++ trunk/src/ppp-manager/nm-ppp-manager.c	Mon Jan 21 15:30:39 2008
@@ -314,8 +314,10 @@
 	config = nm_ip4_config_new ();
 
 	val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_GATEWAY);
-	if (val)
+	if (val) {
 		nm_ip4_config_set_gateway (config, g_value_get_uint (val));
+		nm_ip4_config_set_ptp_address (config, g_value_get_uint (val));
+	}
 
 	val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_ADDRESS);
 	if (val)

Modified: trunk/src/ppp-manager/nm-pppd-plugin.c
==============================================================================
--- trunk/src/ppp-manager/nm-pppd-plugin.c	(original)
+++ trunk/src/ppp-manager/nm-pppd-plugin.c	Mon Jan 21 15:30:39 2008
@@ -239,6 +239,7 @@
 {
 	NMPppdPlugin *plugin = NM_PPPD_PLUGIN (data);
 	ipcp_options opts = ipcp_gotoptions[ifunit];
+	ipcp_options peer_opts = ipcp_hisoptions[ifunit];
 	GHashTable *hash;
 	GArray *array;
 	GValue *val;
@@ -253,10 +254,18 @@
 
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_INTERFACE, 
 					 str_to_gvalue (ifname));
+
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_ADDRESS, 
 					 uint_to_gvalue (opts.ouraddr));
-	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
-					 uint_to_gvalue (opts.hisaddr));
+
+	if (opts.hisaddr) {
+		g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
+						 uint_to_gvalue (opts.hisaddr));
+	} else if (peer_opts.hisaddr) {
+		g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_GATEWAY, 
+						 uint_to_gvalue (peer_opts.hisaddr));
+	}
+
 	g_hash_table_insert (hash, NM_PPP_IP4_CONFIG_NETMASK, 
 					 uint_to_gvalue (0xFFFFFFFF));
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]