From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QsjSf-0002ve-Cg for garchives@archives.gentoo.org; Sun, 14 Aug 2011 22:47:18 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DDA2F21C076; Sun, 14 Aug 2011 22:47:09 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 5963321C076 for ; Sun, 14 Aug 2011 22:47:09 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ACED31B406F for ; Sun, 14 Aug 2011 22:47:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id AE64F80040 for ; Sun, 14 Aug 2011 22:47:07 +0000 (UTC) From: "Alexey Shvetsov" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Alexey Shvetsov" Message-ID: <98838c11d9002dd0c89ee2d6774bf220d0786d78.alexxy@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: net-misc/networkmanager-vpnc/, net-misc/networkmanager-openvpn/, ... X-VCS-Repository: proj/kde X-VCS-Files: net-misc/networkmanager-openswan/networkmanager-openswan-0.8.999.ebuild net-misc/networkmanager-openvpn/networkmanager-openvpn-0.8.9997.ebuild net-misc/networkmanager-pptp/networkmanager-pptp-0.8.999.ebuild net-misc/networkmanager-vpnc/networkmanager-vpnc-0.8.999.ebuild net-misc/networkmanager/files/0.8.9997/0001-core-reset-auto-retries-counter-when-cable-is-replug.patch net-misc/networkmanager/files/0.8.9997/0002-core-fix-auto-connect-to-hidden-SSIDs-rh-707406.patch net-misc/networkmanager/files/0.8.9997/0003-libnm-glib-fix-crash-for-AddAndActivateConnection-D-.patch net-misc/networkmanager/files/0.8.9997/0004-policy-remove-invalid-mark-for-failed-connections-af.patch net-misc/networkmanager/files/0.8.9997/0005-core-connections-failed-due-to-missing-secrets-are-r.patch net-misc/networkmanager/files/0.8.9997/0006-settings-do-not-crash-on-GetSecrets-in-case-of-missi.patch net-misc/networkmanager/files/0.8.9997/0007-keyfile-distinguish-better-between-string-x-int-l ist.patch net-misc/networkmanager/files/0.8.9997/0008-keyfile-fix-integer-list-SSID-parsing-after-30c41a4b.patch net-misc/networkmanager/files/0.8.9997/0009-libnm-util-default-to-allowing-IPv6-connections-to-f.patch net-misc/networkmanager/files/networkmanager-fix-tests.patch net-misc/networkmanager/files/nm-system-settings.conf-ifnet net-misc/networkmanager/metadata.xml net-misc/networkmanager/networkmanager-0.8.9997-r1.ebuild net-misc/networkmanager/networkmanager-0.8.9997.ebuild net-misc/networkmanager/networkmanager-9999.ebuild X-VCS-Directories: net-misc/networkmanager-vpnc/ net-misc/networkmanager-openvpn/ net-misc/networkmanager/ net-misc/networkmanager-openswan/ net-misc/networkmanager/files/ net-misc/networkmanager/files/0.8.9997/ net-misc/networkmanager-pptp/ X-VCS-Committer: alexxy X-VCS-Committer-Name: Alexey Shvetsov X-VCS-Revision: 98838c11d9002dd0c89ee2d6774bf220d0786d78 Date: Sun, 14 Aug 2011 22:47:07 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: a098808e1f26f44977e9707d886123b5 commit: 98838c11d9002dd0c89ee2d6774bf220d0786d78 Author: Alexey Shvetsov gentoo org> AuthorDate: Sun Aug 14 22:46:03 2011 +0000 Commit: Alexey Shvetsov gentoo org> CommitDate: Sun Aug 14 22:46:03 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/kde.git;a=3Dc= ommit;h=3D98838c11 [net-misc] Sync nm ebuilds with gnome overlay --- .../networkmanager-openswan-0.8.999.ebuild | 52 ++ .../networkmanager-openvpn-0.8.9997.ebuild | 50 ++ .../networkmanager-pptp-0.8.999.ebuild | 54 +++ .../networkmanager-vpnc-0.8.999.ebuild | 56 +++ ...auto-retries-counter-when-cable-is-replug.patch | 80 +++ ...ix-auto-connect-to-hidden-SSIDs-rh-707406.patch | 502 ++++++++++++++= ++++++ ...fix-crash-for-AddAndActivateConnection-D-.patch | 29 ++ ...ve-invalid-mark-for-failed-connections-af.patch | 109 +++++ ...tions-failed-due-to-missing-secrets-are-r.patch | 280 +++++++++++ ...-not-crash-on-GetSecrets-in-case-of-missi.patch | 29 ++ ...tinguish-better-between-string-x-int-list.patch | 70 +++ ...-integer-list-SSID-parsing-after-30c41a4b.patch | 211 ++++++++ ...default-to-allowing-IPv6-connections-to-f.patch | 32 ++ .../files/networkmanager-fix-tests.patch | 18 + .../files/nm-system-settings.conf-ifnet | 6 + net-misc/networkmanager/metadata.xml | 15 +- ...97.ebuild =3D> networkmanager-0.8.9997-r1.ebuild} | 80 ++-- net-misc/networkmanager/networkmanager-9999.ebuild | 148 ------ 18 files changed, 1620 insertions(+), 201 deletions(-) diff --git a/net-misc/networkmanager-openswan/networkmanager-openswan-0.8= .999.ebuild b/net-misc/networkmanager-openswan/networkmanager-openswan-0.= 8.999.ebuild new file mode 100644 index 0000000..3fe1c4d --- /dev/null +++ b/net-misc/networkmanager-openswan/networkmanager-openswan-0.8.999.eb= uild @@ -0,0 +1,52 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3D"4" +GNOME_TARBALL_SUFFIX=3D"bz2" +GNOME_ORG_MODULE=3D"NetworkManager-${PN##*-}" + +inherit gnome.org + +# NetworkManager likes itself with capital letters +MY_PN=3D"${GNOME_ORG_MODULE}" + +DESCRIPTION=3D"NetworkManager Openswan plugin" +HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" + +LICENSE=3D"GPL-2" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86" +IUSE=3D"gnome" + +RDEPEND=3D" + >=3Dnet-misc/networkmanager-${PV} + >=3Ddev-libs/dbus-glib-0.74 + >=3Dnet-misc/vpnc-0.5 + gnome? ( + >=3Dx11-libs/gtk+-3.0.0:3 + gnome-base/gnome-keyring + )" + +DEPEND=3D"${RDEPEND} + sys-devel/gettext + dev-util/intltool + dev-util/pkgconfig" + +S=3D"${WORKDIR}/${MY_PN}-${PV}" + +src_configure() { + ECONF=3D"--disable-more-warnings + --disable-static + --with-dist-version=3DGentoo + --with-gtkver=3D3.0 + $(use_with gnome)" + + econf ${ECONF} +} + +src_install() { + default + # Remove useless .la files + find "${D}" -name '*.la' -exec rm -f {} + +} diff --git a/net-misc/networkmanager-openvpn/networkmanager-openvpn-0.8.9= 997.ebuild b/net-misc/networkmanager-openvpn/networkmanager-openvpn-0.8.9= 997.ebuild new file mode 100644 index 0000000..e4d0bdd --- /dev/null +++ b/net-misc/networkmanager-openvpn/networkmanager-openvpn-0.8.9997.ebu= ild @@ -0,0 +1,50 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3D"4" +GNOME_ORG_MODULE=3D"NetworkManager-${PN##*-}" + +inherit gnome.org + +DESCRIPTION=3D"NetworkManager OpenVPN plugin" +HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" + +LICENSE=3D"GPL-2" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86" +IUSE=3D"gnome test" + +RDEPEND=3D" + >=3Ddev-libs/dbus-glib-0.74 + >=3Dnet-misc/networkmanager-${PV} + >=3Dnet-misc/openvpn-2.1_rc9 + gnome? ( + >=3Dx11-libs/gtk+-2.91.4:3 + gnome-base/gnome-keyring + )" + +DEPEND=3D"${RDEPEND} + sys-devel/gettext + >=3Ddev-util/intltool-0.35 + dev-util/pkgconfig" + +# FAIL: (tls-import-data) unexpected 'ca' secret value +#RESTRICT=3D"test" + +src_configure() { + ECONF=3D"--disable-more-warnings + --disable-static + --with-dist-version=3DGentoo + --with-gtkver=3D3.0 + $(use_with gnome) + $(use_with test tests)" + + econf ${ECONF} +} + +src_install() { + default + # Remove useless .la files + find "${D}" -name '*.la' -exec rm -f {} + +} diff --git a/net-misc/networkmanager-pptp/networkmanager-pptp-0.8.999.ebu= ild b/net-misc/networkmanager-pptp/networkmanager-pptp-0.8.999.ebuild new file mode 100644 index 0000000..8f5d0cb --- /dev/null +++ b/net-misc/networkmanager-pptp/networkmanager-pptp-0.8.999.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3D"4" +GNOME_TARBALL_SUFFIX=3D"bz2" +GNOME_ORG_MODULE=3D"NetworkManager-${PN##*-}" + +inherit gnome.org + +# NetworkManager likes itself with capital letters +MY_PN=3D"${GNOME_ORG_MODULE}" + +DESCRIPTION=3D"NetworkManager PPTP plugin" +HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" + +LICENSE=3D"GPL-2" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86" +IUSE=3D"gnome test" + +RDEPEND=3D" + >=3Dnet-misc/networkmanager-${PV} + >=3Ddev-libs/dbus-glib-0.74 + net-dialup/ppp + net-dialup/pptpclient + gnome? ( + >=3Dx11-libs/gtk+-2.91.4:3 + gnome-base/gnome-keyring + )" + +DEPEND=3D"${RDEPEND} + sys-devel/gettext + dev-util/intltool + dev-util/pkgconfig" + +S=3D"${WORKDIR}/${MY_PN}-${PV}" + +src_configure() { + ECONF=3D"--disable-more-warnings + --disable-static + --with-dist-version=3DGentoo + --with-gtkver=3D3.0 + $(use_with gnome) + $(use_with test tests)" + + econf ${ECONF} +} + +src_install() { + default + # Remove useless .la files + find "${D}" -name '*.la' -exec rm -f {} + +} diff --git a/net-misc/networkmanager-vpnc/networkmanager-vpnc-0.8.999.ebu= ild b/net-misc/networkmanager-vpnc/networkmanager-vpnc-0.8.999.ebuild new file mode 100644 index 0000000..fa09413 --- /dev/null +++ b/net-misc/networkmanager-vpnc/networkmanager-vpnc-0.8.999.ebuild @@ -0,0 +1,56 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3D"4" +GNOME_TARBALL_SUFFIX=3D"bz2" +GNOME_ORG_MODULE=3D"NetworkManager-${PN##*-}" + +inherit gnome.org + +# NetworkManager likes itself with capital letters +MY_PN=3D"${GNOME_ORG_MODULE}" + +DESCRIPTION=3D"NetworkManager VPNC plugin" +HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" + +LICENSE=3D"GPL-2" +SLOT=3D"0" +KEYWORDS=3D"~amd64 ~x86" +IUSE=3D"gnome test" + +RDEPEND=3D" + >=3Dnet-misc/networkmanager-${PV} + >=3Ddev-libs/dbus-glib-0.74 + >=3Dnet-misc/vpnc-0.5 + gnome? ( + >=3Dx11-libs/gtk+-2.91.4:3 + gnome-base/gnome-keyring + )" + +DEPEND=3D"${RDEPEND} + sys-devel/gettext + dev-util/intltool + dev-util/pkgconfig" + +S=3D"${WORKDIR}/${MY_PN}-${PV}" + +# XXX: https://bugzilla.gnome.org/show_bug.cgi?id=3D608348 +RESTRICT=3D"test" + +src_configure() { + ECONF=3D"--disable-more-warnings + --disable-static + --with-dist-version=3DGentoo + --with-gtkver=3D3.0 + $(use_with gnome) + $(use_with test tests)" + + econf ${ECONF} +} + +src_install() { + default + # Remove useless .la files + find "${D}" -name '*.la' -exec rm -f {} + +} diff --git a/net-misc/networkmanager/files/0.8.9997/0001-core-reset-auto-= retries-counter-when-cable-is-replug.patch b/net-misc/networkmanager/file= s/0.8.9997/0001-core-reset-auto-retries-counter-when-cable-is-replug.patc= h new file mode 100644 index 0000000..f6eb6bc --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0001-core-reset-auto-retries= -counter-when-cable-is-replug.patch @@ -0,0 +1,80 @@ +From 9aa7efcf28a0230876fc6fc5be6dfee5f35d0630 Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Mon, 30 May 2011 12:07:41 +0100 +Subject: [PATCH] core: reset auto retries counter when cable is replugge= d + +When re-plugging we may be in a different network. So we should try the +compatible connections again. + +Based on a patch from Mikhail Efremov. +--- + src/nm-policy.c | 21 +++++++++++++++------ + 1 files changed, 15 insertions(+), 6 deletions(-) + +diff --git a/src/nm-policy.c b/src/nm-policy.c +index 194d111..b98fe32 100644 +--- a/src/nm-policy.c ++++ b/src/nm-policy.c +@@ -817,13 +817,17 @@ hostname_changed (NMManager *manager, GParamSpec *= pspec, gpointer user_data) + } +=20 + static void +-reset_retries_all (NMSettings *settings) ++reset_retries_all (NMSettings *settings, NMDevice *device) + { + GSList *connections, *iter; ++ GError *error =3D NULL; +=20 + connections =3D nm_settings_get_connections (settings); +- for (iter =3D connections; iter; iter =3D g_slist_next (iter)) +- set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEFA= ULT); ++ for (iter =3D connections; iter; iter =3D g_slist_next (iter)) { ++ if (!device || nm_device_interface_check_connection_compatible (NM_DE= VICE_INTERFACE (device), iter->data, &error)) ++ set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEF= AULT); ++ g_clear_error (&error); ++ } + g_slist_free (connections); + } +=20 +@@ -838,7 +842,7 @@ sleeping_changed (NMManager *manager, GParamSpec *ps= pec, gpointer user_data) +=20 + /* Reset retries on all connections so they'll checked on wakeup */ + if (sleeping || !enabled) +- reset_retries_all (policy->settings); ++ reset_retries_all (policy->settings, NULL); + } +=20 + static void +@@ -932,6 +936,11 @@ device_state_changed (NMDevice *device, + update_routing_and_dns (policy, FALSE); + break; + case NM_DEVICE_STATE_DISCONNECTED: ++ /* Clear INVALID_TAG when carrier on. If cable was unplugged ++ * and plugged again, we should try to reconnect */ ++ if (reason =3D=3D NM_DEVICE_STATE_REASON_CARRIER && old_state =3D=3D = NM_DEVICE_STATE_UNAVAILABLE) ++ reset_retries_all (policy->settings, device); ++ + /* Device is now available for auto-activation */ + update_routing_and_dns (policy, FALSE); + schedule_activate_check (policy, device, 0); +@@ -1058,7 +1067,7 @@ connections_loaded (NMSettings *settings, gpointer= user_data) + // that by calling reset_retries_all() in nm_policy_new() + =09 + /* Initialize connections' auto-retries */ +- reset_retries_all (settings); ++ reset_retries_all (settings, NULL); +=20 + schedule_activate_all ((NMPolicy *) user_data); + } +@@ -1188,7 +1197,7 @@ nm_policy_new (NMManager *manager, + connection_visibility_changed); +=20 + /* Initialize connections' auto-retries */ +- reset_retries_all (policy->settings); ++ reset_retries_all (policy->settings, NULL); +=20 + initialized =3D TRUE; + return policy; +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0002-core-fix-auto-co= nnect-to-hidden-SSIDs-rh-707406.patch b/net-misc/networkmanager/files/0.8= .9997/0002-core-fix-auto-connect-to-hidden-SSIDs-rh-707406.patch new file mode 100644 index 0000000..565b01b --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0002-core-fix-auto-connect-t= o-hidden-SSIDs-rh-707406.patch @@ -0,0 +1,502 @@ +From 9549c70d943e3709694c4b0eb2595af11962c0eb Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Fri, 27 May 2011 17:32:40 +0200 +Subject: [PATCH] core: fix auto-connect to hidden SSIDs (rh #707406) +MIME-Version: 1.0 +Content-Type: text/plain; charset=3DUTF-8 +Content-Transfer-Encoding: 8bit + +Previously (in NM 0.8.x) most WiFi connection were from user settings se= rvice. +And the service updated 'seen-bssids' property when got connected. +But the settings service in 0.9 don't do that. That inhibits auto-connec= ting to +hidden networks. This commit takes care of updating 'seen-bssids'. Howev= er, we +don't want to write out the conection each time it's activated (touching= /etc). +So, seen BSSIDs are kept separately from the connection in a look-aside = file. + +Signed-off-by: Ji=C5=99=C3=AD Klime=C5=A1 +--- + src/nm-device-wifi.c | 30 +++++- + src/nm-manager.c | 44 ++----- + src/settings/nm-settings-connection.c | 216 ++++++++++++++++++++++++++= +++++-- + src/settings/nm-settings-connection.h | 9 ++ + src/settings/nm-settings.c | 3 + + 5 files changed, 256 insertions(+), 46 deletions(-) + +diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c +index 7a6e752..7f9b5d2 100644 +--- a/src/nm-device-wifi.c ++++ b/src/nm-device-wifi.c +@@ -55,6 +55,7 @@ + #include "nm-setting-ip4-config.h" + #include "nm-setting-ip6-config.h" + #include "nm-system.h" ++#include "nm-settings-connection.h" +=20 + static gboolean impl_device_get_access_points (NMDeviceWifi *device, + GPtrArray **aps, +@@ -978,6 +979,28 @@ get_active_ap (NMDeviceWifi *self, + } +=20 + static void ++update_seen_bssids_cache (NMDeviceWifi *self, NMAccessPoint *ap) ++{ ++ NMActRequest *req; ++ NMConnection *connection; ++ ++ g_return_if_fail (ap !=3D NULL); ++ ++ /* Don't cache the BSSID for Ad-Hoc APs */ ++ if (nm_ap_get_mode (ap) !=3D NM_802_11_MODE_INFRA) ++ return; ++ ++ if (nm_device_get_state (NM_DEVICE (self)) =3D=3D NM_DEVICE_STATE_ACTI= VATED) { ++ req =3D nm_device_get_act_request (NM_DEVICE (self)); ++ if (req) { ++ connection =3D nm_act_request_get_connection (req); ++ nm_settings_connection_add_seen_bssid (NM_SETTINGS_CONNECTION (conne= ction), ++ nm_ap_get_address (ap)); ++ } ++ } ++} ++ ++static void + set_current_ap (NMDeviceWifi *self, NMAccessPoint *new_ap) + { + NMDeviceWifiPrivate *priv; +@@ -1003,6 +1026,9 @@ set_current_ap (NMDeviceWifi *self, NMAccessPoint = *new_ap) + */ + priv->ap_list =3D g_slist_remove (priv->ap_list, new_ap); + priv->ap_list =3D g_slist_prepend (priv->ap_list, new_ap); ++ ++ /* Update seen BSSIDs cache */ ++ update_seen_bssids_cache (self, priv->current_ap); + } +=20 + /* Unref old AP here to ensure object lives if new_ap =3D=3D old_ap */ +@@ -3436,11 +3462,13 @@ activation_success_handler (NMDevice *dev) + done: + periodic_update (self); +=20 ++ /* Update seen BSSIDs cache with the connected AP */ ++ update_seen_bssids_cache (self, priv->current_ap); ++ + /* Reset scan interval to something reasonable */ + priv->scan_interval =3D SCAN_INTERVAL_MIN + (SCAN_INTERVAL_STEP * 2); + } +=20 +- + static void + activation_failure_handler (NMDevice *dev) + { +diff --git a/src/nm-manager.c b/src/nm-manager.c +index 5a3f7f7..a15e4b7 100644 +--- a/src/nm-manager.c ++++ b/src/nm-manager.c +@@ -63,6 +63,7 @@ + #include "nm-settings-connection.h" + #include "nm-manager-auth.h" + #include "NetworkManagerUtils.h" ++#include "nm-utils.h" +=20 + #define NM_AUTOIP_DBUS_SERVICE "org.freedesktop.nm_avahi_autoipd" + #define NM_AUTOIP_DBUS_IFACE "org.freedesktop.nm_avahi_autoipd" +@@ -1040,52 +1041,27 @@ manager_hidden_ap_found (NMDeviceInterface *devi= ce, + { + NMManager *manager =3D NM_MANAGER (user_data); + NMManagerPrivate *priv =3D NM_MANAGER_GET_PRIVATE (manager); +- const struct ether_addr *ap_addr; +- const GByteArray *ap_ssid; ++ const struct ether_addr *bssid; + GSList *iter; + GSList *connections; + gboolean done =3D FALSE; +=20 +- ap_ssid =3D nm_ap_get_ssid (ap); +- if (ap_ssid && ap_ssid->len) +- return; ++ g_return_if_fail (nm_ap_get_ssid (ap) =3D=3D NULL); +=20 +- ap_addr =3D nm_ap_get_address (ap); +- g_assert (ap_addr); ++ bssid =3D nm_ap_get_address (ap); ++ g_assert (bssid); +=20 + /* Look for this AP's BSSID in the seen-bssids list of a connection, + * and if a match is found, copy over the SSID */ + connections =3D nm_settings_get_connections (priv->settings); +- + for (iter =3D connections; iter && !done; iter =3D g_slist_next (iter)= ) { + NMConnection *connection =3D NM_CONNECTION (iter->data); +- NMSettingWireless *s_wireless; +- const GByteArray *ssid; +- guint32 num_bssids; +- guint32 i; +- +- s_wireless =3D (NMSettingWireless *) nm_connection_get_setting (conne= ction, NM_TYPE_SETTING_WIRELESS); +- if (!s_wireless) +- continue; +- +- num_bssids =3D nm_setting_wireless_get_num_seen_bssids (s_wireless); +- if (num_bssids < 1) +- continue; +- +- ssid =3D nm_setting_wireless_get_ssid (s_wireless); +- g_assert (ssid); +- +- for (i =3D 0; i < num_bssids && !done; i++) { +- const char *seen_bssid =3D nm_setting_wireless_get_seen_bssid (s_wir= eless, i); +- struct ether_addr seen_addr; ++ NMSettingWireless *s_wifi; +=20 +- if (ether_aton_r (seen_bssid, &seen_addr)) { +- if (memcmp (ap_addr, &seen_addr, sizeof (struct ether_addr)) =3D=3D= 0) { +- /* Copy the SSID from the connection to the AP */ +- nm_ap_set_ssid (ap, ssid); +- done =3D TRUE; +- } +- } ++ s_wifi =3D nm_connection_get_setting_wireless (connection); ++ if (s_wifi) { ++ if (nm_settings_connection_has_seen_bssid (NM_SETTINGS_CONNECTION (c= onnection), bssid)) ++ nm_ap_set_ssid (ap, nm_setting_wireless_get_ssid (s_wifi)); + } + } + g_slist_free (connections); +diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-set= tings-connection.c +index 828a036..c20ba82 100644 +--- a/src/settings/nm-settings-connection.c ++++ b/src/settings/nm-settings-connection.c +@@ -22,6 +22,7 @@ + #include "config.h" +=20 + #include ++#include +=20 + #include + #include +@@ -38,8 +39,10 @@ + #include "nm-manager-auth.h" + #include "nm-marshal.h" + #include "nm-agent-manager.h" ++#include "NetworkManagerUtils.h" +=20 + #define SETTINGS_TIMESTAMPS_FILE LOCALSTATEDIR"/lib/NetworkManager/tim= estamps" ++#define SETTINGS_SEEN_BSSIDS_FILE LOCALSTATEDIR"/lib/NetworkManager/see= n-bssids" +=20 + static void impl_settings_connection_get_settings (NMSettingsConnection= *connection, + DBusGMethodInvocatio= n *context); +@@ -91,7 +94,8 @@ typedef struct { + NMSessionMonitor *session_monitor; + guint session_changed_id; +=20 +- guint64 timestamp; /* Up-to-date timestamp of connection use */ ++ guint64 timestamp; /* Up-to-date timestamp of connection use */ ++ GHashTable *seen_bssids; /* Up-to-date BSSIDs that's been seen for the= connection */ + } NMSettingsConnectionPrivate; +=20 + /**************************************************************/ +@@ -455,12 +459,20 @@ commit_changes (NMSettingsConnection *connection, + } +=20 + static void +-remove_timestamp_from_db (NMSettingsConnection *connection) ++remove_entry_from_db (NMSettingsConnection *connection, const char* db_= name) + { +- GKeyFile *timestamps_file; ++ GKeyFile *key_file; ++ const char *db_file; +=20 +- timestamps_file =3D g_key_file_new (); +- if (g_key_file_load_from_file (timestamps_file, SETTINGS_TIMESTAMPS_FI= LE, G_KEY_FILE_KEEP_COMMENTS, NULL)) { ++ if (strcmp (db_name, "timestamps") =3D=3D 0) ++ db_file =3D SETTINGS_TIMESTAMPS_FILE; ++ else if (strcmp (db_name, "seen-bssids") =3D=3D 0) ++ db_file =3D SETTINGS_SEEN_BSSIDS_FILE; ++ else ++ return; ++ ++ key_file =3D g_key_file_new (); ++ if (g_key_file_load_from_file (key_file, db_file, G_KEY_FILE_KEEP_COMM= ENTS, NULL)) { + const char *connection_uuid; + char *data; + gsize len; +@@ -468,18 +480,18 @@ remove_timestamp_from_db (NMSettingsConnection *co= nnection) +=20 + connection_uuid =3D nm_connection_get_uuid (NM_CONNECTION (connection= )); +=20 +- g_key_file_remove_key (timestamps_file, "timestamps", connection_uuid= , NULL); +- data =3D g_key_file_to_data (timestamps_file, &len, &error); ++ g_key_file_remove_key (key_file, db_name, connection_uuid, NULL); ++ data =3D g_key_file_to_data (key_file, &len, &error); + if (data) { +- g_file_set_contents (SETTINGS_TIMESTAMPS_FILE, data, len, &error); ++ g_file_set_contents (db_file, data, len, &error); + g_free (data); + } + if (error) { +- nm_log_warn (LOGD_SETTINGS, "error writing timestamps file '%s': %s"= , SETTINGS_TIMESTAMPS_FILE, error->message); ++ nm_log_warn (LOGD_SETTINGS, "error writing %s file '%s': %s", db_nam= e, db_file, error->message); + g_error_free (error); + } + } +- g_key_file_free (timestamps_file); ++ g_key_file_free (key_file); + } +=20 + static void +@@ -499,7 +511,10 @@ do_delete (NMSettingsConnection *connection, + nm_agent_manager_delete_secrets (priv->agent_mgr, for_agents, FALSE, 0= ); +=20 + /* Remove timestamp from timestamps database file */ +- remove_timestamp_from_db (connection); ++ remove_entry_from_db (connection, "timestamps"); ++ ++ /* Remove connection from seen-bssids database file */ ++ remove_entry_from_db (connection, "seen-bssids"); +=20 + /* Signal the connection is removed and deleted */ + g_signal_emit (connection, signals[REMOVED], 0); +@@ -1440,6 +1455,181 @@ nm_settings_connection_read_and_fill_timestamp (= NMSettingsConnection *connection + g_key_file_free (timestamps_file); + } +=20 ++static guint ++mac_hash (gconstpointer v) ++{ ++ const guint8 *p =3D v; ++ guint32 i, h =3D 5381; ++ ++ for (i =3D 0; i < ETH_ALEN; i++) ++ h =3D (h << 5) + h + p[i]; ++ return h; ++} ++ ++static gboolean ++mac_equal (gconstpointer a, gconstpointer b) ++{ ++ return memcmp (a, b, ETH_ALEN) =3D=3D 0; ++} ++ ++static guint8 * ++mac_dup (const struct ether_addr *old) ++{ ++ guint8 *new; ++ ++ g_return_val_if_fail (old !=3D NULL, NULL); ++ ++ new =3D g_malloc0 (ETH_ALEN); ++ memcpy (new, old, ETH_ALEN); ++ return new; ++} ++ ++/** ++ * nm_settings_connection_has_seen_bssid: ++ * @connection: the #NMSettingsConnection ++ * @bssid: the BSSID to check the seen BSSID list for ++ * ++ * Returns: TRUE if the given @bssid is in the seen BSSIDs list ++ **/ ++gboolean ++nm_settings_connection_has_seen_bssid (NMSettingsConnection *connection= , ++ const struct ether_addr *bssid) ++{ ++ g_return_val_if_fail (connection !=3D NULL, FALSE); ++ g_return_val_if_fail (NM_IS_SETTINGS_CONNECTION (connection), FALSE); ++ g_return_val_if_fail (bssid !=3D NULL, FALSE); ++ ++ return !!g_hash_table_lookup (NM_SETTINGS_CONNECTION_GET_PRIVATE (conn= ection)->seen_bssids, bssid); ++} ++ ++/** ++ * nm_settings_connection_add_seen_bssid: ++ * @connection: the #NMSettingsConnection ++ * @seen_bssid: BSSID to set into the connection and to store into ++ * the seen-bssids database ++ * ++ * Updates the connection and seen-bssids database with the provided BS= SID. ++ **/ ++void ++nm_settings_connection_add_seen_bssid (NMSettingsConnection *connection= , ++ const struct ether_addr *seen_bs= sid) ++{ ++ NMSettingsConnectionPrivate *priv =3D NM_SETTINGS_CONNECTION_GET_PRIVA= TE (connection); ++ const char *connection_uuid; ++ GKeyFile *seen_bssids_file; ++ char *data, *bssid_str; ++ const char **list; ++ gsize len; ++ GError *error =3D NULL; ++ GHashTableIter iter; ++ guint n; ++ ++ g_return_if_fail (seen_bssid !=3D NULL); ++ ++ if (g_hash_table_lookup (priv->seen_bssids, seen_bssid)) ++ return; /* Already in the list */ ++ ++ /* Add the new BSSID; let the hash take ownership of the allocated BSS= ID string */ ++ bssid_str =3D nm_ether_ntop (seen_bssid); ++ g_return_if_fail (bssid_str !=3D NULL); ++ g_hash_table_insert (priv->seen_bssids, mac_dup (seen_bssid), bssid_st= r); ++ ++ /* Build up a list of all the BSSIDs in string form */ ++ n =3D 0; ++ list =3D g_malloc0 (g_hash_table_size (priv->seen_bssids) * sizeof (ch= ar *)); ++ g_hash_table_iter_init (&iter, priv->seen_bssids); ++ while (g_hash_table_iter_next (&iter, NULL, (gpointer) &bssid_str)) ++ list[n++] =3D bssid_str; ++ ++ /* Save BSSID to seen-bssids file */ ++ seen_bssids_file =3D g_key_file_new (); ++ g_key_file_set_list_separator (seen_bssids_file, ','); ++ if (!g_key_file_load_from_file (seen_bssids_file, SETTINGS_SEEN_BSSIDS= _FILE, G_KEY_FILE_KEEP_COMMENTS, &error)) { ++ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) { ++ nm_log_warn (LOGD_SETTINGS, "error parsing seen-bssids file '%s': %s= ", ++ SETTINGS_SEEN_BSSIDS_FILE, error->message); ++ } ++ g_clear_error (&error); ++ } ++ ++ connection_uuid =3D nm_connection_get_uuid (NM_CONNECTION (connection)= ); ++ g_key_file_set_string_list (seen_bssids_file, "seen-bssids", connectio= n_uuid, list, n); ++ g_free (list); ++ ++ data =3D g_key_file_to_data (seen_bssids_file, &len, &error); ++ if (data) { ++ g_file_set_contents (SETTINGS_SEEN_BSSIDS_FILE, data, len, &error); ++ g_free (data); ++ } ++ g_key_file_free (seen_bssids_file); ++ ++ if (error) { ++ nm_log_warn (LOGD_SETTINGS, "error saving seen-bssids to file '%s': %= s", ++ SETTINGS_SEEN_BSSIDS_FILE, error->message); ++ g_error_free (error); ++ } ++} ++ ++static void ++add_seen_bssid_string (NMSettingsConnection *self, const char *bssid) ++{ ++ struct ether_addr mac; ++ ++ g_return_if_fail (bssid !=3D NULL); ++ if (ether_aton_r (bssid, &mac)) { ++ g_hash_table_insert (NM_SETTINGS_CONNECTION_GET_PRIVATE (self)->seen_= bssids, ++ mac_dup (&mac), ++ g_strdup (bssid)); ++ } ++} ++ ++/** ++ * nm_settings_connection_read_and_fill_seen_bssids: ++ * @connection: the #NMSettingsConnection ++ * ++ * Retrieves seen BSSIDs of the connection from database file and store= s then into the ++ * connection private data. ++ **/ ++void ++nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnection = *connection) ++{ ++ NMSettingsConnectionPrivate *priv =3D NM_SETTINGS_CONNECTION_GET_PRIVA= TE (connection); ++ const char *connection_uuid; ++ GKeyFile *seen_bssids_file; ++ char **tmp_strv =3D NULL; ++ gsize i, len =3D 0; ++ NMSettingWireless *s_wifi; ++ ++ /* Get seen BSSIDs from database file */ ++ seen_bssids_file =3D g_key_file_new (); ++ g_key_file_set_list_separator (seen_bssids_file, ','); ++ if (g_key_file_load_from_file (seen_bssids_file, SETTINGS_SEEN_BSSIDS_= FILE, G_KEY_FILE_KEEP_COMMENTS, NULL)) { ++ connection_uuid =3D nm_connection_get_uuid (NM_CONNECTION (connection= )); ++ tmp_strv =3D g_key_file_get_string_list (seen_bssids_file, "seen-bssi= ds", connection_uuid, &len, NULL); ++ } ++ g_key_file_free (seen_bssids_file); ++ ++ /* Update connection's seen-bssids */ ++ if (tmp_strv) { ++ g_hash_table_remove_all (priv->seen_bssids); ++ for (i =3D 0; i < len; i++) ++ add_seen_bssid_string (connection, tmp_strv[i]); ++ g_strfreev (tmp_strv); ++ } else { ++ /* If this connection didn't have an entry in the seen-bssids databas= e, ++ * maybe this is the first time we've read it in, so populate the ++ * seen-bssids list from the deprecated seen-bssids property of the ++ * wifi setting. ++ */ ++ s_wifi =3D nm_connection_get_setting_wireless (NM_CONNECTION (connect= ion)); ++ if (s_wifi) { ++ len =3D nm_setting_wireless_get_num_seen_bssids (s_wifi); ++ for (i =3D 0; i < len; i++) ++ add_seen_bssid_string (connection, nm_setting_wireless_get_seen_bss= id (s_wifi, i)); ++ } ++ } ++} ++ + /**************************************************************/ +=20 + static void +@@ -1463,6 +1653,8 @@ nm_settings_connection_init (NMSettingsConnection = *self) + self); +=20 + priv->agent_mgr =3D nm_agent_manager_get (); ++ ++ priv->seen_bssids =3D g_hash_table_new_full (mac_hash, mac_equal, g_fr= ee, g_free); + } +=20 + static void +@@ -1490,6 +1682,8 @@ dispose (GObject *object) + nm_agent_manager_cancel_secrets (priv->agent_mgr, GPOINTER_TO_UINT (i= ter->data)); + g_slist_free (priv->reqs); +=20 ++ g_hash_table_destroy (priv->seen_bssids); ++ + set_visible (self, FALSE); +=20 + if (priv->session_changed_id) +diff --git a/src/settings/nm-settings-connection.h b/src/settings/nm-set= tings-connection.h +index 116bfdc..af90c51 100644 +--- a/src/settings/nm-settings-connection.h ++++ b/src/settings/nm-settings-connection.h +@@ -24,6 +24,7 @@ +=20 + #include + #include "nm-settings-flags.h" ++#include +=20 + G_BEGIN_DECLS +=20 +@@ -124,6 +125,14 @@ void nm_settings_connection_update_timestamp (NMSet= tingsConnection *connection, +=20 + void nm_settings_connection_read_and_fill_timestamp (NMSettingsConnecti= on *connection); +=20 ++gboolean nm_settings_connection_has_seen_bssid (NMSettingsConnection *c= onnection, ++ const struct ether_addr= *bssid); ++ ++void nm_settings_connection_add_seen_bssid (NMSettingsConnection *conne= ction, ++ const struct ether_addr *se= en_bssid); ++ ++void nm_settings_connection_read_and_fill_seen_bssids (NMSettingsConnec= tion *connection); ++ + G_END_DECLS +=20 + #endif /* NM_SETTINGS_CONNECTION_H */ +diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c +index e23e8d1..8329780 100644 +--- a/src/settings/nm-settings.c ++++ b/src/settings/nm-settings.c +@@ -773,6 +773,9 @@ claim_connection (NMSettings *self, + /* Read timestamp from look-aside file and put it into the connection'= s data */ + nm_settings_connection_read_and_fill_timestamp (connection); +=20 ++ /* Read seen-bssids from look-aside file and put it into the connectio= n's data */ ++ nm_settings_connection_read_and_fill_seen_bssids (connection); ++ + /* Ensure it's initial visibility is up-to-date */ + nm_settings_connection_recheck_visibility (connection); +=20 +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0003-libnm-glib-fix-c= rash-for-AddAndActivateConnection-D-.patch b/net-misc/networkmanager/file= s/0.8.9997/0003-libnm-glib-fix-crash-for-AddAndActivateConnection-D-.patc= h new file mode 100644 index 0000000..8cc16c4 --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0003-libnm-glib-fix-crash-fo= r-AddAndActivateConnection-D-.patch @@ -0,0 +1,29 @@ +From b4a72d1ad794aef4c623fd530fc38ceb9b95456d Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Tue, 14 Jun 2011 19:39:23 +0200 +Subject: [PATCH] libnm-glib: fix crash for AddAndActivateConnection() D-= Bus + call (bgo #652512) + +When a partial connection is passed to nm_client_add_and_activate_connec= tion(), +but it doesn't contain any settings, nm_connection_to_hash() returns NUL= L and +there's a crash later on the NULL hash. +--- + libnm-glib/nm-client.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c +index 644af3e..752510a 100644 +--- a/libnm-glib/nm-client.c ++++ b/libnm-glib/nm-client.c +@@ -763,7 +763,7 @@ nm_client_add_and_activate_connection (NMClient *cli= ent, +=20 + if (partial) + hash =3D nm_connection_to_hash (partial, NM_SETTING_HASH_FLAG_ALL); +- else ++ if (!hash) + hash =3D g_hash_table_new (g_str_hash, g_str_equal); +=20 + priv =3D NM_CLIENT_GET_PRIVATE (client); +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0004-policy-remove-in= valid-mark-for-failed-connections-af.patch b/net-misc/networkmanager/file= s/0.8.9997/0004-policy-remove-invalid-mark-for-failed-connections-af.patc= h new file mode 100644 index 0000000..f2af25e --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0004-policy-remove-invalid-m= ark-for-failed-connections-af.patch @@ -0,0 +1,109 @@ +From fdfbe00aac3f17b19bb8d84cba1c8f210d90e8a0 Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Fri, 17 Jun 2011 12:43:28 +0200 +Subject: [PATCH] policy: remove "invalid mark" for failed connections af= ter 5 + mins + +If there is a temporary connection failure (e.g. due to unavailable DHCP= ), the +connection is marked as invalid after several retries. Reset the flag af= ter +5 mins to allow next auto-reconnection. +--- + src/nm-policy.c | 47 +++++++++++++++++++++++++++++++++++++++++++++-- + 1 files changed, 45 insertions(+), 2 deletions(-) + +diff --git a/src/nm-policy.c b/src/nm-policy.c +index 3eead41..e3c899f 100644 +--- a/src/nm-policy.c ++++ b/src/nm-policy.c +@@ -66,12 +66,16 @@ struct NMPolicy { +=20 + HostnameThread *lookup; +=20 ++ gint reset_retries_id; /* idle handler for resetting the retries coun= t */ ++ + char *orig_hostname; /* hostname at NM start time */ + char *cur_hostname; /* hostname we want to assign */ + }; +=20 + #define RETRIES_TAG "autoconnect-retries" + #define RETRIES_DEFAULT 4 ++#define RESET_RETRIES_TIMESTAMP_TAG "reset-retries-timestamp-tag" ++#define RESET_RETRIES_TIMER 300 +=20 + static NMDevice * + get_best_ip4_device (NMManager *manager, NMActRequest **out_req) +@@ -870,6 +874,37 @@ schedule_activate_check (NMPolicy *policy, NMDevice= *device, guint delay_seconds + } + } +=20 ++static gboolean ++reset_connections_retries (gpointer user_data) ++{ ++ NMPolicy *policy =3D (NMPolicy *) user_data; ++ GSList *connections, *iter; ++ time_t con_stamp, min_stamp, now; ++ ++ policy->reset_retries_id =3D 0; ++ ++ min_stamp =3D now =3D time (NULL); ++ connections =3D nm_settings_get_connections (policy->settings); ++ for (iter =3D connections; iter; iter =3D g_slist_next (iter)) { ++ con_stamp =3D GPOINTER_TO_SIZE (g_object_get_data (G_OBJECT (iter->da= ta), RESET_RETRIES_TIMESTAMP_TAG)); ++ if (con_stamp =3D=3D 0) ++ continue; ++ if (con_stamp + RESET_RETRIES_TIMER <=3D now) { ++ set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEF= AULT); ++ g_object_set_data (G_OBJECT (iter->data), RESET_RETRIES_TIMESTAMP_TA= G, GSIZE_TO_POINTER (0)); ++ continue; ++ } ++ if (con_stamp < min_stamp) ++ min_stamp =3D con_stamp; ++ } ++ g_slist_free (connections); ++ ++ /* Schedule the handler again if there are some stamps left */ ++ if (min_stamp !=3D now) ++ policy->reset_retries_id =3D g_timeout_add_seconds (RESET_RETRIES_TIM= ER - (now - min_stamp), reset_connections_retries, policy); ++ return FALSE; ++} ++ + static NMConnection * + get_device_connection (NMDevice *device) + { +@@ -914,8 +949,13 @@ device_state_changed (NMDevice *device, + set_connection_auto_retries (connection, tries - 1); + } +=20 +- if (get_connection_auto_retries (connection) =3D=3D 0) ++ if (get_connection_auto_retries (connection) =3D=3D 0) { + nm_log_info (LOGD_DEVICE, "Marking connection '%s' invalid.", nm_co= nnection_get_id (connection)); ++ /* Schedule a handler to reset retries count */ ++ g_object_set_data (G_OBJECT (connection), RESET_RETRIES_TIMESTAMP_T= AG, GSIZE_TO_POINTER ((gsize) time (NULL))); ++ if (!policy->reset_retries_id) ++ policy->reset_retries_id =3D g_timeout_add_seconds (RESET_RETRIES_= TIMER, reset_connections_retries, policy); ++ } + nm_connection_clear_secrets (connection); + } + schedule_activate_check (policy, device, 3); +@@ -938,7 +978,7 @@ device_state_changed (NMDevice *device, + update_routing_and_dns (policy, FALSE); + break; + case NM_DEVICE_STATE_DISCONNECTED: +- /* Clear INVALID_TAG when carrier on. If cable was unplugged ++ /* Reset RETRIES_TAG when carrier on. If cable was unplugged + * and plugged again, we should try to reconnect */ + if (reason =3D=3D NM_DEVICE_STATE_REASON_CARRIER && old_state =3D=3D = NM_DEVICE_STATE_UNAVAILABLE) + reset_retries_all (policy->settings, device); +@@ -1246,6 +1286,9 @@ nm_policy_destroy (NMPolicy *policy) + } + g_slist_free (policy->dev_ids); +=20 ++ if (policy->reset_retries_id) ++ g_source_remove (policy->reset_retries_id); ++ + g_free (policy->orig_hostname); + g_free (policy->cur_hostname); +=20 +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0005-core-connections= -failed-due-to-missing-secrets-are-r.patch b/net-misc/networkmanager/file= s/0.8.9997/0005-core-connections-failed-due-to-missing-secrets-are-r.patc= h new file mode 100644 index 0000000..f43cf24 --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0005-core-connections-failed= -due-to-missing-secrets-are-r.patch @@ -0,0 +1,280 @@ +From 69b767bbf0ef8e038dd8bd0bcb35586c0f91ade7 Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Tue, 28 Jun 2011 15:48:12 +0200 +Subject: [PATCH] core: connections failed due to missing secrets are re-= tried + when an secret agent registers (rh #706204) +MIME-Version: 1.0 +Content-Type: text/plain; charset=3DUTF-8 +Content-Transfer-Encoding: 8bit + +Use case: +A user has an auto-activatable connection with secrets in a keyring. Whi= le +booting NM starts and tries to activate the connection, but it fails bec= ause of +missing secrets. Then the user logs in, but the connection is marked as = invalid +and is not tried again. + +This commit solves the issue by removing invalid flag and activating the +connection when a secret agent registers. + +Signed-off-by: Ji=C5=99=C3=AD Klime=C5=A1 +--- + src/nm-policy.c | 40 ++++++++++++++++++++++++++++++++= +++++++ + src/settings/nm-agent-manager.c | 22 +++++++++++++++++++++ + src/settings/nm-agent-manager.h | 4 +++ + src/settings/nm-settings.c | 25 ++++++++++++++++++++++++ + src/settings/nm-settings.h | 6 ++++- + 5 files changed, 96 insertions(+), 1 deletions(-) + +diff --git a/src/nm-policy.c b/src/nm-policy.c +index e3c899f..44f5e1f 100644 +--- a/src/nm-policy.c ++++ b/src/nm-policy.c +@@ -76,6 +76,7 @@ struct NMPolicy { + #define RETRIES_DEFAULT 4 + #define RESET_RETRIES_TIMESTAMP_TAG "reset-retries-timestamp-tag" + #define RESET_RETRIES_TIMER 300 ++#define FAILURE_REASON_TAG "failure-reason" +=20 + static NMDevice * + get_best_ip4_device (NMManager *manager, NMActRequest **out_req) +@@ -838,6 +839,23 @@ reset_retries_all (NMSettings *settings, NMDevice *= device) + } +=20 + static void ++reset_retries_for_failed_secrets (NMSettings *settings) ++{ ++ GSList *connections, *iter; ++ ++ connections =3D nm_settings_get_connections (settings); ++ for (iter =3D connections; iter; iter =3D g_slist_next (iter)) { ++ NMDeviceStateReason reason =3D GPOINTER_TO_UINT (g_object_get_data (G= _OBJECT (iter->data), FAILURE_REASON_TAG)); ++ ++ if (reason =3D=3D NM_DEVICE_STATE_REASON_NO_SECRETS) { ++ set_connection_auto_retries (NM_CONNECTION (iter->data), RETRIES_DEF= AULT); ++ g_object_set_data (G_OBJECT (iter->data), FAILURE_REASON_TAG, GUINT_= TO_POINTER (0)); ++ } ++ } ++ g_slist_free (connections); ++} ++ ++static void + sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_= data) + { + NMPolicy *policy =3D user_data; +@@ -927,6 +945,9 @@ device_state_changed (NMDevice *device, + NMPolicy *policy =3D (NMPolicy *) user_data; + NMConnection *connection =3D get_device_connection (device); +=20 ++ if (connection) ++ g_object_set_data (G_OBJECT (connection), FAILURE_REASON_TAG, GUINT_T= O_POINTER (0)); ++ + switch (new_state) { + case NM_DEVICE_STATE_FAILED: + /* Mark the connection invalid if it failed during activation so that +@@ -941,6 +962,11 @@ device_state_changed (NMDevice *device, + * automatically retrying because it's just going to fail anyway. + */ + set_connection_auto_retries (connection, 0); ++ ++ /* Mark the connection as failed due to missing secrets so that we = can reset ++ * RETRIES_TAG and automatically re-try when an secret agent regist= ers. ++ */ ++ g_object_set_data (G_OBJECT (connection), FAILURE_REASON_TAG, GUINT= _TO_POINTER (NM_DEVICE_STATE_REASON_NO_SECRETS)); + } else if (tries > 0) { + /* Otherwise if it's a random failure, just decrease the number + * of automatic retries so that the connection gets tried again +@@ -1173,6 +1199,19 @@ connection_visibility_changed (NMSettings *settin= gs, + } +=20 + static void ++secret_agent_registered (NMSettings *settings, ++ NMSecretAgent *agent, ++ gpointer user_data) ++{ ++ /* The registered secret agent may provide some missing secrets. Thus = we ++ * reset retries count here and schedule activation, so that the ++ * connections failed due to missing secrets may re-try auto-connectio= n. ++ */ ++ reset_retries_for_failed_secrets (settings); ++ schedule_activate_all ((NMPolicy *) user_data); ++} ++ ++static void + _connect_manager_signal (NMPolicy *policy, const char *name, gpointer c= allback) + { + guint id; +@@ -1240,6 +1279,7 @@ nm_policy_new (NMManager *manager, + _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_REMOVE= D, connection_removed); + _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_CONNECTION_VISIBI= LITY_CHANGED, + connection_visibility_changed); ++ _connect_settings_signal (policy, NM_SETTINGS_SIGNAL_AGENT_REGISTERED,= secret_agent_registered); +=20 + /* Initialize connections' auto-retries */ + reset_retries_all (policy->settings, NULL); +diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-man= ager.c +index 9b9e189..1693ae2 100644 +--- a/src/settings/nm-agent-manager.c ++++ b/src/settings/nm-agent-manager.c +@@ -57,6 +57,14 @@ typedef struct { + GHashTable *requests; + } NMAgentManagerPrivate; +=20 ++enum { ++ AGENT_REGISTERED, ++ ++ LAST_SIGNAL ++}; ++static guint signals[LAST_SIGNAL] =3D { 0 }; ++ ++ + typedef struct _Request Request; +=20 + static void request_add_agent (Request *req, +@@ -277,6 +285,9 @@ impl_agent_manager_register (NMAgentManager *self, + nm_secret_agent_get_description (agent)); + dbus_g_method_return (context); +=20 ++ /* Signal an agent was registered */ ++ g_signal_emit (self, signals[AGENT_REGISTERED], 0, agent); ++ + /* Add this agent to any in-progress secrets requests */ + g_hash_table_iter_init (&iter, priv->requests); + while (g_hash_table_iter_next (&iter, NULL, &data)) +@@ -1363,6 +1374,17 @@ nm_agent_manager_class_init (NMAgentManagerClass = *agent_manager_class) + /* virtual methods */ + object_class->dispose =3D dispose; +=20 ++ /* Signals */ ++ signals[AGENT_REGISTERED] =3D ++ g_signal_new ("agent-registered", ++ G_OBJECT_CLASS_TYPE (object_class), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET (NMAgentManagerClass, agent_registered)= , ++ NULL, NULL, ++ g_cclosure_marshal_VOID__OBJECT, ++ G_TYPE_NONE, 1, ++ G_TYPE_OBJECT); ++ + dbus_g_object_type_install_info (G_TYPE_FROM_CLASS (agent_manager_clas= s), + &dbus_glib_nm_agent_manager_object_in= fo); +=20 +diff --git a/src/settings/nm-agent-manager.h b/src/settings/nm-agent-man= ager.h +index 788a917..287413a 100644 +--- a/src/settings/nm-agent-manager.h ++++ b/src/settings/nm-agent-manager.h +@@ -25,6 +25,7 @@ + #include + #include + #include "nm-settings-flags.h" ++#include "nm-secret-agent.h" +=20 + #define NM_TYPE_AGENT_MANAGER (nm_agent_manager_get_type ()) + #define NM_AGENT_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((= obj), NM_TYPE_AGENT_MANAGER, NMAgentManager)) +@@ -39,6 +40,9 @@ typedef struct { +=20 + typedef struct { + GObjectClass parent; ++ ++ /* Signals */ ++ void (*agent_registered) (NMAgentManager *agent_mgr, NMSecretAgent *= agent); + } NMAgentManagerClass; +=20 + GType nm_agent_manager_get_type (void); +diff --git a/src/settings/nm-settings.c b/src/settings/nm-settings.c +index 8329780..733e914 100644 +--- a/src/settings/nm-settings.c ++++ b/src/settings/nm-settings.c +@@ -135,6 +135,7 @@ enum { + CONNECTION_REMOVED, + CONNECTION_VISIBILITY_CHANGED, + CONNECTIONS_LOADED, ++ AGENT_REGISTERED, +=20 + NEW_CONNECTION, /* exported, not used internally */ + LAST_SIGNAL +@@ -699,6 +700,18 @@ connection_visibility_changed (NMSettingsConnection= *connection, + connection); + } +=20 ++static void ++secret_agent_registered (NMAgentManager *agent_mgr, ++ NMSecretAgent *agent, ++ gpointer user_data) ++{ ++ /* Re-emit for listeners like NMPolicy */ ++ g_signal_emit (NM_SETTINGS (user_data), ++ signals[AGENT_REGISTERED], ++ 0, ++ agent); ++} ++ + #define NM_DBUS_SERVICE_OPENCONNECT "org.freedesktop.NetworkManager.= openconnect" + #define NM_OPENCONNECT_KEY_GATEWAY "gateway" + #define NM_OPENCONNECT_KEY_COOKIE "cookie" +@@ -1530,6 +1543,8 @@ nm_settings_init (NMSettings *self) + * recreated often. + */ + priv->agent_mgr =3D nm_agent_manager_get (); ++ ++ g_signal_connect (priv->agent_mgr, "agent-registered", G_CALLBACK (sec= ret_agent_registered), self); + } +=20 + static void +@@ -1693,6 +1708,16 @@ nm_settings_class_init (NMSettingsClass *class) + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); +=20 ++ signals[AGENT_REGISTERED] =3D ++ g_signal_new (NM_SETTINGS_SIGNAL_AGENT_REGISTERED, ++ G_OBJECT_CLASS_TYPE (object_class), ++ G_SIGNAL_RUN_FIRST, ++ G_STRUCT_OFFSET (NMSettingsClass, agent_registered), ++ NULL, NULL, ++ g_cclosure_marshal_VOID__OBJECT, ++ G_TYPE_NONE, 1, G_TYPE_OBJECT); ++ ++ + signals[NEW_CONNECTION] =3D=20 + g_signal_new ("new-connection", + G_OBJECT_CLASS_TYPE (object_class), +diff --git a/src/settings/nm-settings.h b/src/settings/nm-settings.h +index a5cb4d7..66d41cc 100644 +--- a/src/settings/nm-settings.h ++++ b/src/settings/nm-settings.h +@@ -19,7 +19,7 @@ + * with this program; if not, write to the Free Software Foundation, In= c., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * +- * (C) Copyright 2007 - 2010 Red Hat, Inc. ++ * (C) Copyright 2007 - 2011 Red Hat, Inc. + * (C) Copyright 2008 Novell, Inc. + */ +=20 +@@ -31,6 +31,7 @@ + #include "nm-settings-connection.h" + #include "nm-system-config-interface.h" + #include "nm-device.h" ++#include "nm-secret-agent.h" +=20 + #define NM_TYPE_SETTINGS (nm_settings_get_type ()) + #define NM_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),= NM_TYPE_SETTINGS, NMSettings)) +@@ -48,6 +49,7 @@ + #define NM_SETTINGS_SIGNAL_CONNECTION_REMOVED "connection-re= moved" + #define NM_SETTINGS_SIGNAL_CONNECTION_VISIBILITY_CHANGED "connection-vi= sibility-changed" + #define NM_SETTINGS_SIGNAL_CONNECTIONS_LOADED "connections-l= oaded" ++#define NM_SETTINGS_SIGNAL_AGENT_REGISTERED "agent-registe= red" +=20 + typedef struct { + GObject parent_instance; +@@ -68,6 +70,8 @@ typedef struct { + void (*connection_visibility_changed) (NMSettings *self, NMSettingsCon= nection *connection); +=20 + void (*connections_loaded) (NMSettings *self); ++ ++ void (*agent_registered) (NMSettings *self, NMSecretAgent *agent); + } NMSettingsClass; +=20 + GType nm_settings_get_type (void); +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0006-settings-do-not-= crash-on-GetSecrets-in-case-of-missi.patch b/net-misc/networkmanager/file= s/0.8.9997/0006-settings-do-not-crash-on-GetSecrets-in-case-of-missi.patc= h new file mode 100644 index 0000000..b01842f --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0006-settings-do-not-crash-o= n-GetSecrets-in-case-of-missi.patch @@ -0,0 +1,29 @@ +From 5b650f9ae3c5a2972b0b018b8b75d02d815f2c3a Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Thu, 7 Jul 2011 12:51:22 +0200 +Subject: [PATCH] settings: do not crash on GetSecrets() in case of missi= ng + secrets + +When secrets are flagged as agent-owned in a connection configuration fi= le, but +actually not available, we have to return an empty hash (nm_connection_t= o_hash() +returns NULL). +--- + src/settings/nm-settings-connection.c | 2 ++ + 1 files changed, 2 insertions(+), 0 deletions(-) + +diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-set= tings-connection.c +index a14b159..f0f9c1a 100644 +--- a/src/settings/nm-settings-connection.c ++++ b/src/settings/nm-settings-connection.c +@@ -1339,6 +1339,8 @@ dbus_get_agent_secrets_cb (NMSettingsConnection *s= elf, + update_secrets_cache (self); +=20 + hash =3D nm_connection_to_hash (NM_CONNECTION (self), NM_SETTING_HASH= _FLAG_ONLY_SECRETS); ++ if (!hash) ++ hash =3D g_hash_table_new (NULL, NULL); + dbus_g_method_return (context, hash); + g_hash_table_destroy (hash); + } +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0007-keyfile-distingu= ish-better-between-string-x-int-list.patch b/net-misc/networkmanager/file= s/0.8.9997/0007-keyfile-distinguish-better-between-string-x-int-list.patc= h new file mode 100644 index 0000000..4206df1 --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0007-keyfile-distinguish-bet= ter-between-string-x-int-list.patch @@ -0,0 +1,70 @@ +From 30c41a4b800408150edcca9047a3996fa1d6ae68 Mon Sep 17 00:00:00 2001 +From: =3D?UTF-8?q?Ji=3DC5=3D99=3DC3=3DAD=3D20Klime=3DC5=3DA1?=3D +Date: Thu, 7 Jul 2011 15:25:11 +0200 +Subject: [PATCH] keyfile: distinguish better between string x int list + formats (bgo #649422) + +This commit enhances get_uchar_array() to better differentiate between s= tring +ad integer list formats. This allows using ';' character in SSIDs. +--- + src/settings/plugins/keyfile/reader.c | 28 +++++++++++++-------------= -- + 1 files changed, 13 insertions(+), 15 deletions(-) + +diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugin= s/keyfile/reader.c +index 4b28965..7da6e1a 100644 +--- a/src/settings/plugins/keyfile/reader.c ++++ b/src/settings/plugins/keyfile/reader.c +@@ -16,7 +16,7 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright (C) 2008 - 2009 Novell, Inc. +- * Copyright (C) 2008 - 2010 Red Hat, Inc. ++ * Copyright (C) 2008 - 2011 Red Hat, Inc. + */ +=20 + #include +@@ -736,29 +736,27 @@ get_uchar_array (GKeyFile *keyfile, + const char *key) + { + GByteArray *array =3D NULL; +- char *p, *tmp_string; ++ char *tmp_string; + gint *tmp_list; + gsize length; + int i; +=20 +- /* New format: just a string. We try parsing the new format if there = are +- * no ';' in the string or it's not just numbers. ++ /* New format: just a string ++ * Old format: integer list; e.g. 11;25;38 + */ +- p =3D tmp_string =3D g_key_file_get_string (keyfile, setting_name, key= , NULL); ++ tmp_string =3D g_key_file_get_string (keyfile, setting_name, key, NULL= ); + if (tmp_string) { + gboolean new_format =3D FALSE; ++ GRegex *regex; ++ GMatchInfo *match_info; ++ const char *pattern =3D "^[[:space:]]*[[:digit:]]+[[:space:]]*(;[[:sp= ace:]]*[[:digit:]]+[[:space:]]*)*(;[[:space:]]*)?$"; +=20 +- if (strchr (p, ';') =3D=3D NULL) +- new_format =3D TRUE; +- else { ++ regex =3D g_regex_new (pattern, 0, 0, NULL); ++ g_regex_match (regex, tmp_string, 0, &match_info); ++ if (!g_match_info_matches (match_info)) + new_format =3D TRUE; +- while (p && *p) { +- if (!isdigit (*p++)) { +- new_format =3D FALSE; +- break; +- } +- } +- } ++ g_match_info_free (match_info); ++ g_regex_unref (regex); +=20 + if (new_format) { + array =3D g_byte_array_sized_new (strlen (tmp_string)); +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0008-keyfile-fix-inte= ger-list-SSID-parsing-after-30c41a4b.patch b/net-misc/networkmanager/file= s/0.8.9997/0008-keyfile-fix-integer-list-SSID-parsing-after-30c41a4b.patc= h new file mode 100644 index 0000000..b4e0ef0 --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0008-keyfile-fix-integer-lis= t-SSID-parsing-after-30c41a4b.patch @@ -0,0 +1,211 @@ +From 9cdc5021ab0b94dbf1a0d1994bc2e5ba4049caf9 Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Wed, 20 Jul 2011 17:44:14 -0500 +Subject: [PATCH 1/2] keyfile: fix integer list SSID parsing after + 30c41a4b800408150edcca9047a3996fa1d6ae68 + +The regex was capturing integers larger than 3 digits, which aren't +valid SSID integer list items because each byte of the SSID cannot be +larger than 255. Add an explicit testcase for intlist SSIDs too. +The previous regex was causing a testcase failure with an SSID of +'1337' which it was interpreting as a single element intlist, but +should have been interpreted as a string since it's clear > 255. +--- + src/settings/plugins/keyfile/reader.c | 2 +- + .../plugins/keyfile/tests/keyfiles/Makefile.am | 1 + + .../keyfile/tests/keyfiles/Test_Intlist_SSID | 11 ++ + src/settings/plugins/keyfile/tests/test-keyfile.c | 128 +++++++++++++= +++++++ + 4 files changed, 141 insertions(+), 1 deletions(-) + create mode 100644 src/settings/plugins/keyfile/tests/keyfiles/Test_Int= list_SSID + +diff --git a/src/settings/plugins/keyfile/reader.c b/src/settings/plugin= s/keyfile/reader.c +index 7da6e1a..c4136e0 100644 +--- a/src/settings/plugins/keyfile/reader.c ++++ b/src/settings/plugins/keyfile/reader.c +@@ -749,7 +749,7 @@ get_uchar_array (GKeyFile *keyfile, + gboolean new_format =3D FALSE; + GRegex *regex; + GMatchInfo *match_info; +- const char *pattern =3D "^[[:space:]]*[[:digit:]]+[[:space:]]*(;[[:sp= ace:]]*[[:digit:]]+[[:space:]]*)*(;[[:space:]]*)?$"; ++ const char *pattern =3D "^[[:space:]]*[[:digit:]]{1,3}[[:space:]]*(;[= [:space:]]*[[:digit:]]{1,3}[[:space:]]*)*(;[[:space:]]*)?$"; +=20 + regex =3D g_regex_new (pattern, 0, 0, NULL); + g_regex_match (regex, tmp_string, 0, &match_info); +diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am b/s= rc/settings/plugins/keyfile/tests/keyfiles/Makefile.am +index ce5ff99..302db86 100644 +--- a/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am ++++ b/src/settings/plugins/keyfile/tests/keyfiles/Makefile.am +@@ -7,6 +7,7 @@ KEYFILES =3D \ + ATT_Data_Connect_BT \ + ATT_Data_Connect_Plain \ + Test_String_SSID \ ++ Test_Intlist_SSID \ + Test_Wired_TLS_Old \ + Test_Wired_TLS_New \ + Test_Wired_TLS_Blob \ +diff --git a/src/settings/plugins/keyfile/tests/keyfiles/Test_Intlist_SS= ID b/src/settings/plugins/keyfile/tests/keyfiles/Test_Intlist_SSID +new file mode 100644 +index 0000000..6d2bc0f +--- /dev/null ++++ b/src/settings/plugins/keyfile/tests/keyfiles/Test_Intlist_SSID +@@ -0,0 +1,11 @@ ++[connection] ++id=3DTest=20 ++uuid=3D2f962388-e5f3-45af-a62c-ac220b8f7baa ++type=3D802-11-wireless ++ ++[802-11-wireless] ++ssid=3D98;108;97;104;49;50;51;52; ++ ++[ipv4] ++method=3Dauto ++ +diff --git a/src/settings/plugins/keyfile/tests/test-keyfile.c b/src/set= tings/plugins/keyfile/tests/test-keyfile.c +index 6cdd198..3bbaaae 100644 +--- a/src/settings/plugins/keyfile/tests/test-keyfile.c ++++ b/src/settings/plugins/keyfile/tests/test-keyfile.c +@@ -1438,6 +1438,131 @@ test_write_string_ssid (void) + g_object_unref (connection); + } +=20 ++#define TEST_INTLIST_SSID_FILE TEST_KEYFILES_DIR"/Test_Intlist_SSID" ++ ++static void ++test_read_intlist_ssid (void) ++{ ++ NMConnection *connection; ++ NMSettingWireless *s_wifi; ++ GError *error =3D NULL; ++ gboolean success; ++ const GByteArray *array; ++ const char *expected_ssid =3D "blah1234"; ++ ++ connection =3D nm_keyfile_plugin_connection_from_file (TEST_INTLIST_SS= ID_FILE, &error); ++ g_assert_no_error (error); ++ g_assert (connection); ++ ++ success =3D nm_connection_verify (connection, &error); ++ g_assert_no_error (error); ++ g_assert (success); ++ ++ /* SSID */ ++ s_wifi =3D nm_connection_get_setting_wireless (connection); ++ g_assert (s_wifi); ++ ++ array =3D nm_setting_wireless_get_ssid (s_wifi); ++ g_assert (array !=3D NULL); ++ g_assert_cmpint (array->len, =3D=3D, strlen (expected_ssid)); ++ g_assert_cmpint (memcmp (array->data, expected_ssid, strlen (expected_= ssid)), =3D=3D, 0); ++ ++ g_object_unref (connection); ++} ++ ++static void ++test_write_intlist_ssid (void) ++{ ++ NMConnection *connection; ++ NMSettingConnection *s_con; ++ NMSettingWireless *s_wifi; ++ NMSettingIP4Config *s_ip4; ++ char *uuid, *testfile =3D NULL; ++ GByteArray *ssid; ++ unsigned char tmpssid[] =3D { 65, 49, 50, 51, 0, 50, 50 }; ++ gboolean success; ++ NMConnection *reread; ++ GError *error =3D NULL; ++ pid_t owner_grp; ++ uid_t owner_uid; ++ GKeyFile *keyfile; ++ gint *intlist; ++ gsize len =3D 0, i; ++ ++ connection =3D nm_connection_new (); ++ g_assert (connection); ++ ++ /* Connection setting */ ++ ++ s_con =3D NM_SETTING_CONNECTION (nm_setting_connection_new ()); ++ g_assert (s_con); ++ nm_connection_add_setting (connection, NM_SETTING (s_con)); ++ ++ uuid =3D nm_utils_uuid_generate (); ++ g_object_set (s_con, ++ NM_SETTING_CONNECTION_ID, "Intlist SSID Test", ++ NM_SETTING_CONNECTION_UUID, uuid, ++ NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRELESS_SETTING_= NAME, ++ NULL); ++ g_free (uuid); ++ ++ /* Wireless setting */ ++ s_wifi =3D NM_SETTING_WIRELESS (nm_setting_wireless_new ()); ++ g_assert (s_wifi); ++ nm_connection_add_setting (connection, NM_SETTING (s_wifi)); ++ ++ ssid =3D g_byte_array_sized_new (sizeof (tmpssid)); ++ g_byte_array_append (ssid, &tmpssid[0], sizeof (tmpssid)); ++ g_object_set (s_wifi, NM_SETTING_WIRELESS_SSID, ssid, NULL); ++ g_byte_array_free (ssid, TRUE); ++ ++ /* IP4 setting */ ++ s_ip4 =3D NM_SETTING_IP4_CONFIG (nm_setting_ip4_config_new ()); ++ g_assert (s_ip4); ++ nm_connection_add_setting (connection, NM_SETTING (s_ip4)); ++ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONF= IG_METHOD_AUTO, NULL); ++ ++ /* Write out the connection */ ++ owner_uid =3D geteuid (); ++ owner_grp =3D getegid (); ++ success =3D nm_keyfile_plugin_write_test_connection (connection, TEST_= SCRATCH_DIR, owner_uid, owner_grp, &testfile, &error); ++ g_assert_no_error (error); ++ g_assert (success); ++ g_assert (testfile !=3D NULL); ++ ++ /* Ensure the SSID was written out as an int list */ ++ keyfile =3D g_key_file_new (); ++ success =3D g_key_file_load_from_file (keyfile, testfile, 0, &error); ++ g_assert_no_error (error); ++ g_assert (success); ++ ++ intlist =3D g_key_file_get_integer_list (keyfile, NM_SETTING_WIRELESS_= SETTING_NAME, NM_SETTING_WIRELESS_SSID, &len, &error); ++ g_assert_no_error (error); ++ g_assert (intlist); ++ g_assert_cmpint (len, =3D=3D, sizeof (tmpssid)); ++ ++ for (i =3D 0; i < len; i++) ++ g_assert_cmpint (intlist[i], =3D=3D, tmpssid[i]); ++ g_free (intlist); ++ ++ g_key_file_free (keyfile); ++ ++ /* Read the connection back in and compare it to the one we just wrote= out */ ++ reread =3D nm_keyfile_plugin_connection_from_file (testfile, &error); ++ g_assert_no_error (error); ++ g_assert (reread); ++ ++ success =3D nm_connection_compare (connection, reread, NM_SETTING_COMP= ARE_FLAG_EXACT); ++ g_assert (success); ++ ++ g_clear_error (&error); ++ unlink (testfile); ++ g_free (testfile); ++ ++ g_object_unref (reread); ++ g_object_unref (connection); ++} ++ + #define TEST_BT_DUN_FILE TEST_KEYFILES_DIR"/ATT_Data_Connect_BT" +=20 + static void +@@ -2488,6 +2613,9 @@ int main (int argc, char **argv) + test_read_string_ssid (); + test_write_string_ssid (); +=20 ++ test_read_intlist_ssid (); ++ test_write_intlist_ssid (); ++ + test_read_bt_dun_connection (); + test_write_bt_dun_connection (); +=20 +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/0.8.9997/0009-libnm-util-defau= lt-to-allowing-IPv6-connections-to-f.patch b/net-misc/networkmanager/file= s/0.8.9997/0009-libnm-util-default-to-allowing-IPv6-connections-to-f.patc= h new file mode 100644 index 0000000..4a3c6fc --- /dev/null +++ b/net-misc/networkmanager/files/0.8.9997/0009-libnm-util-default-to-a= llowing-IPv6-connections-to-f.patch @@ -0,0 +1,32 @@ +From 36db194ae95e35cc7b8f431ab984780dea24656d Mon Sep 17 00:00:00 2001 +From: Mathieu Trudel-Lapierre +Date: Wed, 20 Jul 2011 23:56:48 -0500 +Subject: [PATCH 2/2] libnm-util: default to allowing IPv6 connections to= fail + +Allow IPv6 connections to fail by changing the default value of the may-= fail +property for ipv6 settings to TRUE. + +This makes sure connections created manually using nm-connection-editor +will default to having the "Require ..." checkbox unchecked; in other wo= rds, +IPv6 timing out will still allow the interface to be configured if +IPv4 succeeds. +--- + libnm-util/nm-setting-ip6-config.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-= ip6-config.c +index e911639..4dc8f46 100644 +--- a/libnm-util/nm-setting-ip6-config.c ++++ b/libnm-util/nm-setting-ip6-config.c +@@ -1056,7 +1056,7 @@ nm_setting_ip6_config_class_init (NMSettingIP6Conf= igClass *setting_class) + "this property to TRUE allows the overall network " + "configuration to succeed if IPv6 configuration " + "fails but IPv4 configuration completes successfully.", +- FALSE, ++ TRUE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIA= LIZE)); + } +=20 +--=20 +1.7.6 + diff --git a/net-misc/networkmanager/files/networkmanager-fix-tests.patch= b/net-misc/networkmanager/files/networkmanager-fix-tests.patch new file mode 100644 index 0000000..7bd8a2b --- /dev/null +++ b/net-misc/networkmanager/files/networkmanager-fix-tests.patch @@ -0,0 +1,18 @@ +--- configure.ac ++++ configure.ac +@@ -577,7 +577,6 @@ + src/settings/plugins/ifupdown/Makefile + src/settings/plugins/ifupdown/tests/Makefile + src/settings/plugins/ifnet/Makefile +-src/settings/plugins/ifnet/tests/Makefile + src/settings/plugins/ifcfg-rh/Makefile + src/settings/plugins/ifcfg-rh/tests/Makefile + src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile +--- src/settings/plugins/ifnet/Makefile.am ++++ src/settings/plugins/ifnet/Makefile.am +@@ -1,4 +1,4 @@ +-SUBDIRS =3D . tests ++SUBDIRS =3D . + INCLUDES =3D \ + -I$(top_srcdir)/src/settings \ + -I$(top_srcdir)/include \ diff --git a/net-misc/networkmanager/files/nm-system-settings.conf-ifnet = b/net-misc/networkmanager/files/nm-system-settings.conf-ifnet new file mode 100644 index 0000000..4d14ee7 --- /dev/null +++ b/net-misc/networkmanager/files/nm-system-settings.conf-ifnet @@ -0,0 +1,6 @@ +[main] +plugins=3Difnet,keyfile + +[ifnet] +managed=3Dtrue +auto_refresh=3Dfalse diff --git a/net-misc/networkmanager/metadata.xml b/net-misc/networkmanag= er/metadata.xml index 7d8b3b4..7d32aff 100644 --- a/net-misc/networkmanager/metadata.xml +++ b/net-misc/networkmanager/metadata.xml @@ -10,18 +10,17 @@ rbu@gentoo.org Robert Buchholz - - dagger@gentoo.org - Robert Piasek - + + dagger@gentoo.org + Robert Piasek + - Use net-dns/dnsmasq and <= pkg>net-firewall/iptables for connection sharing - Use dhclient from net-misc/= dhcp for getting ip. + Enable support for mobile broadband and PPPoE conne= ctions using net-dialup/ppp. + Use dhclient from net-misc/dhcp for= getting ip. Use net-misc/dhcpcd for getting ip. - Use dev-libs/gobject-introspection for introspection Use dev-libs/nss for cryptography. - Enable support for mobile broadband and PPPoE conne= ctions using net-dialup/ppp. Use net-dns/openresolv for managi= ng DNS information + Use net-dns/dnsmasq and <= pkg>net-firewall/iptables for connection sharing Enable WiMAX support. Requires net-wireless/= wimax. diff --git a/net-misc/networkmanager/networkmanager-0.8.9997.ebuild b/net= -misc/networkmanager/networkmanager-0.8.9997-r1.ebuild similarity index 67% rename from net-misc/networkmanager/networkmanager-0.8.9997.ebuild rename to net-misc/networkmanager/networkmanager-0.8.9997-r1.ebuild index 12617d7..0a1b561 100644 --- a/net-misc/networkmanager/networkmanager-0.8.9997.ebuild +++ b/net-misc/networkmanager/networkmanager-0.8.9997-r1.ebuild @@ -1,44 +1,34 @@ # Copyright 1999-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: $ +# $Header: /var/cvsroot/gentoo-x86/net-misc/networkmanager/networkmanage= r-0.8.995.ebuild,v 1.1 2011/03/09 07:56:21 qiaomuf Exp $ =20 EAPI=3D"4" +GNOME_ORG_MODULE=3D"NetworkManager" =20 -# NetworkManager likes itself with capital letters -MY_PN=3D${PN/networkmanager/NetworkManager} -MY_P=3D${MY_PN}-${PV} - -if [[ ${PV} =3D=3D *9999 ]]; then - git_eclass=3D"git-2" - EGIT_REPO_URI=3D"git://anongit.freedesktop.org/${MY_PN}/${MY_PN}" - KEYWORDS=3D"" -else - SRC_URI=3D"http://cgit.freedesktop.org/${MY_PN}/${MY_PN}/snapshot/${MY_= P}.tar.bz2" - KEYWORDS=3D"~amd64 ~arm ~x86" -fi - -inherit autotools eutils linux-info ${git_eclass} +inherit autotools eutils gnome.org linux-info systemd =20 DESCRIPTION=3D"Network configuration and management in an easy way. Desk= top environment independent." HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" -SRC_URI=3D"${SRC_URI} - http://dev.gentoo.org/~dagger/files/ifnet-0.9.tar.bz2 - " =20 LICENSE=3D"GPL-2" SLOT=3D"0" -IUSE=3D"avahi bluetooth doc +nss gnutls dhclient +dhcpcd +introspection = kernel_linux +ppp resolvconf connection-sharing wimax" +IUSE=3D"avahi bluetooth doc +nss gnutls dhclient +dhcpcd +introspection +kernel_linux +ppp resolvconf connection-sharing wimax" +KEYWORDS=3D"~amd64 ~arm ~ppc ~ppc64 ~x86" =20 REQUIRED_USE=3D" - nss? ( !gnutls ) !nss? ( gnutls ) - dhcpcd? ( !dhclient ) !dhcpcd? ( dhclient )" + ^^ ( nss gnutls ) + ^^ ( dhclient dhcpcd )" =20 -RDEPEND=3D">=3Dsys-apps/dbus-1.2 +# gobject-introspection-0.10.3 is needed due to gnome bug 642300 +# wpa_supplicant-0.7.3-r3 is needed due to bug 359271 +# make consolekit and/or polkit support optional ? +COMMON_DEPEND=3D">=3Dsys-apps/dbus-1.2 >=3Ddev-libs/dbus-glib-0.75 >=3Dnet-wireless/wireless-tools-28_pre9 - >=3Dsys-fs/udev-147[extras] + || ( >=3Dsys-fs/udev-171[gudev] >=3Dsys-fs/udev-147[extras] ) >=3Ddev-libs/glib-2.26 - >=3Dsys-auth/polkit-0.96 + >=3Dsys-auth/polkit-0.97 >=3Ddev-libs/libnl-1.1 >=3Dnet-misc/modemmanager-0.4 >=3Dnet-wireless/wpa_supplicant-0.7.3-r3[dbus] @@ -58,14 +48,15 @@ RDEPEND=3D">=3Dsys-apps/dbus-1.2 net-firewall/iptables ) wimax? ( >=3Dnet-wireless/wimax-1.5.1 )" =20 -DEPEND=3D"${RDEPEND} +RDEPEND=3D"${COMMON_DEPEND} + sys-auth/consolekit" + +DEPEND=3D"${COMMON_DEPEND} dev-util/pkgconfig - dev-util/intltool - >=3Ddev-util/gtk-doc-1.15 + >=3Ddev-util/intltool-0.40 + >=3Dsys-devel/gettext-0.17 doc? ( >=3Ddev-util/gtk-doc-1.8 )" =20 -S=3D${WORKDIR}/${MY_P} - sysfs_deprecated_check() { ebegin "Checking for SYSFS_DEPRECATED support" =20 @@ -78,7 +69,7 @@ sysfs_deprecated_check() { eend $? } =20 -pkg_setup() { +pkg_pretend() { if use kernel_linux; then get_version if linux_config_exists; then @@ -93,10 +84,14 @@ pkg_setup() { } =20 src_prepare() { - gtkdocize - eautopoint --force - intltoolize --force --automake --copy - eautoreconf + # Add useful patches from upstream git (fixing crashes, SSID parsing bu= gs, + # and significant usability problems). + epatch "${FILESDIR}/${PV}/"*.patch + + # Don't build tests + epatch "${FILESDIR}/${PN}-fix-tests.patch" + eautoreconf + default } =20 src_configure() { @@ -104,7 +99,7 @@ src_configure() { --localstatedir=3D/var --with-distro=3Dgentoo --with-dbus-sys-dir=3D/etc/dbus-1/system.d - --with-udev-dir=3D/etc/udev + --with-udev-dir=3D/lib/udev --with-iptables=3D/sbin/iptables $(use_enable doc gtk-doc) $(use_enable introspection) @@ -113,7 +108,8 @@ src_configure() { $(use_with dhclient) $(use_with dhcpcd) $(use_with doc docs) - $(use_with resolvconf)" + $(use_with resolvconf) + $(systemd_with_unitdir)" =20 if use nss ; then ECONF=3D"${ECONF} $(use_with nss crypto=3Dnss)" @@ -132,17 +128,11 @@ src_install() { # Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scri= pts keepdir /etc/NetworkManager/dispatcher.d =20 - dodoc AUTHORS ChangeLog NEWS README TODO || die "dodoc failed" - # Add keyfile plugin support keepdir /etc/NetworkManager/system-connections insinto /etc/NetworkManager - newins "${FILESDIR}/nm-system-settings.conf" nm-system-settings.conf \ - || die "newins failed" -} + newins "${FILESDIR}/nm-system-settings.conf-ifnet" nm-system-settings.c= onf =20 -pkg_postinst() { - elog "You will need to reload DBus if this is your first time installin= g" - elog "NetworkManager, or if you're upgrading from 0.7 or older." - elog "" + # Remove useless .la files + find "${D}" -name '*.la' -exec rm -f {} + } diff --git a/net-misc/networkmanager/networkmanager-9999.ebuild b/net-mis= c/networkmanager/networkmanager-9999.ebuild deleted file mode 100644 index 12617d7..0000000 --- a/net-misc/networkmanager/networkmanager-9999.ebuild +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright 1999-2011 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ - -EAPI=3D"4" - -# NetworkManager likes itself with capital letters -MY_PN=3D${PN/networkmanager/NetworkManager} -MY_P=3D${MY_PN}-${PV} - -if [[ ${PV} =3D=3D *9999 ]]; then - git_eclass=3D"git-2" - EGIT_REPO_URI=3D"git://anongit.freedesktop.org/${MY_PN}/${MY_PN}" - KEYWORDS=3D"" -else - SRC_URI=3D"http://cgit.freedesktop.org/${MY_PN}/${MY_PN}/snapshot/${MY_= P}.tar.bz2" - KEYWORDS=3D"~amd64 ~arm ~x86" -fi - -inherit autotools eutils linux-info ${git_eclass} - -DESCRIPTION=3D"Network configuration and management in an easy way. Desk= top environment independent." -HOMEPAGE=3D"http://www.gnome.org/projects/NetworkManager/" -SRC_URI=3D"${SRC_URI} - http://dev.gentoo.org/~dagger/files/ifnet-0.9.tar.bz2 - " - -LICENSE=3D"GPL-2" -SLOT=3D"0" -IUSE=3D"avahi bluetooth doc +nss gnutls dhclient +dhcpcd +introspection = kernel_linux +ppp resolvconf connection-sharing wimax" - -REQUIRED_USE=3D" - nss? ( !gnutls ) !nss? ( gnutls ) - dhcpcd? ( !dhclient ) !dhcpcd? ( dhclient )" - -RDEPEND=3D">=3Dsys-apps/dbus-1.2 - >=3Ddev-libs/dbus-glib-0.75 - >=3Dnet-wireless/wireless-tools-28_pre9 - >=3Dsys-fs/udev-147[extras] - >=3Ddev-libs/glib-2.26 - >=3Dsys-auth/polkit-0.96 - >=3Ddev-libs/libnl-1.1 - >=3Dnet-misc/modemmanager-0.4 - >=3Dnet-wireless/wpa_supplicant-0.7.3-r3[dbus] - bluetooth? ( >=3Dnet-wireless/bluez-4.82 ) - avahi? ( net-dns/avahi[autoipd] ) - gnutls? ( - dev-libs/libgcrypt - net-libs/gnutls ) - nss? ( >=3Ddev-libs/nss-3.11 ) - dhclient? ( net-misc/dhcp ) - dhcpcd? ( >=3Dnet-misc/dhcpcd-4.0.0_rc3 ) - introspection? ( >=3Ddev-libs/gobject-introspection-0.10.3 ) - ppp? ( >=3Dnet-dialup/ppp-2.4.5 ) - resolvconf? ( net-dns/openresolv ) - connection-sharing? ( - net-dns/dnsmasq - net-firewall/iptables ) - wimax? ( >=3Dnet-wireless/wimax-1.5.1 )" - -DEPEND=3D"${RDEPEND} - dev-util/pkgconfig - dev-util/intltool - >=3Ddev-util/gtk-doc-1.15 - doc? ( >=3Ddev-util/gtk-doc-1.8 )" - -S=3D${WORKDIR}/${MY_P} - -sysfs_deprecated_check() { - ebegin "Checking for SYSFS_DEPRECATED support" - - if { linux_chkconfig_present SYSFS_DEPRECATED_V2; }; then - eerror "Please disable SYSFS_DEPRECATED_V2 support in your kernel conf= ig and recompile your kernel" - eerror "or NetworkManager will not work correctly." - eerror "See http://bugs.gentoo.org/333639 for more info." - die "CONFIG_SYSFS_DEPRECATED_V2 support detected!" - fi - eend $? -} - -pkg_setup() { - if use kernel_linux; then - get_version - if linux_config_exists; then - sysfs_deprecated_check - else - ewarn "Was unable to determine your kernel .config" - ewarn "Please note that if CONFIG_SYSFS_DEPRECATED_V2 is set in your = kernel .config, NetworkManager will not work correctly." - ewarn "See http://bugs.gentoo.org/333639 for more info." - fi - - fi -} - -src_prepare() { - gtkdocize - eautopoint --force - intltoolize --force --automake --copy - eautoreconf -} - -src_configure() { - ECONF=3D"--disable-more-warnings - --localstatedir=3D/var - --with-distro=3Dgentoo - --with-dbus-sys-dir=3D/etc/dbus-1/system.d - --with-udev-dir=3D/etc/udev - --with-iptables=3D/sbin/iptables - $(use_enable doc gtk-doc) - $(use_enable introspection) - $(use_enable ppp) - $(use_enable wimax) - $(use_with dhclient) - $(use_with dhcpcd) - $(use_with doc docs) - $(use_with resolvconf)" - - if use nss ; then - ECONF=3D"${ECONF} $(use_with nss crypto=3Dnss)" - else - ECONF=3D"${ECONF} $(use_with gnutls crypto=3Dgnutls)" - fi - - econf ${ECONF} -} - -src_install() { - default - # Need to keep the /var/run/NetworkManager directory - keepdir /var/run/NetworkManager - - # Need to keep the /etc/NetworkManager/dispatched.d for dispatcher scri= pts - keepdir /etc/NetworkManager/dispatcher.d - - dodoc AUTHORS ChangeLog NEWS README TODO || die "dodoc failed" - - # Add keyfile plugin support - keepdir /etc/NetworkManager/system-connections - insinto /etc/NetworkManager - newins "${FILESDIR}/nm-system-settings.conf" nm-system-settings.conf \ - || die "newins failed" -} - -pkg_postinst() { - elog "You will need to reload DBus if this is your first time installin= g" - elog "NetworkManager, or if you're upgrading from 0.7 or older." - elog "" -}