Blob Blame History Raw
diff -ur NetworkManager-0.6.5-bad/configure.in NetworkManager-0.6.5/configure.in
--- NetworkManager-0.6.5-bad/configure.in	2007-06-28 13:12:23.000000000 -0500
+++ NetworkManager-0.6.5/configure.in	2008-05-12 13:38:56.000000000 -0500
@@ -154,7 +154,7 @@
 	PKG_CHECK_MODULES(GNOME_KEYRING, gnome-keyring-1)
 fi
 
-PKG_CHECK_MODULES(LIBNL, libnl-1)
+PKG_CHECK_MODULES(LIBNL, libnl-1 >= 1.0-pre8)
 
 AC_ARG_WITH(gcrypt, AC_HELP_STRING([--with-gcrypt], [Use gcrypt library]), ac_gcrypt=$withval, ac_gcrypt=auto)
 if test x"$ac_gcrypt" != xno; then
Only in NetworkManager-0.6.5/: configure.in.commit3206
diff -ur NetworkManager-0.6.5-bad/src/NetworkManagerSystem.c NetworkManager-0.6.5/src/NetworkManagerSystem.c
--- NetworkManager-0.6.5-bad/src/NetworkManagerSystem.c	2007-07-12 13:43:41.000000000 -0500
+++ NetworkManager-0.6.5/src/NetworkManagerSystem.c	2008-05-12 14:01:45.000000000 -0500
@@ -222,18 +222,35 @@
 }
 
 
-static struct nl_handle * new_nl_handle (void)
+static struct nl_handle * new_nl_handle (gboolean recursive)
 {
-	struct nl_handle *	nlh = NULL;
+       struct nl_handle *nlh = NULL;
+       struct nl_cb *cb;
 
-	nlh = nl_handle_alloc_nondefault(NL_CB_VERBOSE);
-	nl_handle_set_pid (nlh, (pthread_self() << 16 | getpid()));
-	if (nl_connect(nlh, NETLINK_ROUTE) < 0)
-	{
-		nm_warning ("%s: couldn't connect to netlink: %s\n", __func__, nl_geterror());
-		nl_handle_destroy (nlh);
-		nlh = NULL;
-	}
+       cb = nl_cb_alloc (NL_CB_VERBOSE);
+       nlh = nl_handle_alloc_cb (cb);
+       if (!nlh) {
+               nm_warning ("%s: couldn't allocate netlink handle: %s", __func__, nl_geterror ());
+               return NULL;
+       }
+
+       if (nl_connect (nlh, NETLINK_ROUTE) < 0) {
+               /* HACK: try one more time. Because the netlink monitor for link state
+                * inits before we get here, it grabs the port that matches the PID
+                * of the NM process, which also happens to be the PID that libnl uses
+                * the first time too.  The real fix is to convert nm-netlink-monitor.c
+                * over to use libnl.
+                */
+               nl_handle_destroy (nlh);
+               if (recursive)
+                       return NULL;
+
+               nlh = new_nl_handle (TRUE);
+               if (!nlh) {
+                       nm_warning ("%s: couldn't connect to netlink: %s", __func__, nl_geterror ());
+                       return NULL;
+               }
+       }
 
 	return nlh;
 }
@@ -246,7 +263,7 @@
 	struct nl_cache *	cache = NULL;
 	int				i = RTNL_LINK_NOT_FOUND;
 
-	nlh = new_nl_handle ();
+	nlh = new_nl_handle (FALSE);
 	if (!nlh)
 		return RTNL_LINK_NOT_FOUND;
 
@@ -267,7 +284,7 @@
 	struct nl_cache *	cache = NULL;
 	char *			buf = NULL;
 
-	nlh = new_nl_handle ();
+	nlh = new_nl_handle (FALSE);
 	if (!nlh)
 		return NULL;
 
@@ -308,7 +325,7 @@
 	config = nm_device_get_ip4_config (dev);
 	g_return_val_if_fail (config != NULL, FALSE);
 
-	nlh = new_nl_handle ();
+	nlh = new_nl_handle (FALSE);
 	if (!nlh)
 		return FALSE;
 
@@ -443,7 +460,7 @@
 
 	g_return_val_if_fail (config != NULL, FALSE);
 
-	nlh = new_nl_handle ();
+	nlh = new_nl_handle (FALSE);
 	if (!nlh)
 		return FALSE;
 
@@ -560,7 +577,7 @@
 
 	g_return_val_if_fail (iface != NULL, FALSE);
 
-	if (!(nlh = new_nl_handle ()))
+	if (!(nlh = new_nl_handle (FALSE)))
 		return FALSE;
 
 	if (!(request = rtnl_link_alloc ()))
@@ -605,7 +622,7 @@
 	if (!mtu)
 		return;
 
-	nlh = new_nl_handle ();
+	nlh = new_nl_handle (FALSE);
 	if (!nlh)
 		return;
 
Only in NetworkManager-0.6.5/src: NetworkManagerSystem.c.commit3206
diff -ur NetworkManager-0.6.5-bad/src/nm-netlink-monitor.c NetworkManager-0.6.5/src/nm-netlink-monitor.c
--- NetworkManager-0.6.5-bad/src/nm-netlink-monitor.c	2007-06-28 09:58:29.000000000 -0500
+++ NetworkManager-0.6.5/src/nm-netlink-monitor.c	2008-05-12 13:38:56.000000000 -0500
@@ -174,7 +174,7 @@
 	}
 
 	monitor_address.nl_family = AF_NETLINK;
-	monitor_address.nl_pid = getpid ();
+	monitor_address.nl_pid = UINT_MAX;
 	monitor_address.nl_groups = RTMGRP_LINK;
 
 	if (bind (fd, 
@@ -365,7 +365,7 @@
 	packet.header.nlmsg_len = NLMSG_LENGTH (sizeof (struct rtgenmsg));
 	packet.header.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
 	packet.header.nlmsg_type = RTM_GETLINK;
-	packet.header.nlmsg_pid = getpid ();
+	packet.header.nlmsg_pid = UINT_MAX;
 	/* Might be good to generate a unique sequence number and track
 	   the response */
 	packet.header.nlmsg_seq = sequence_number << 16;
Only in NetworkManager-0.6.5/src: nm-netlink-monitor.c.commit3206