Compare commits

...

47 Commits
rawhide ... f20

Author SHA1 Message Date
Dan Williams dd6a8a5afa core: fix periodic failure to remove VPN nameservers from resolv.conf 2014-11-13 13:24:18 -06:00
Dan Williams 621ae2c1e2 core: fix IP-related PropertiesChanged signal emission 2014-10-27 10:03:31 -05:00
Jiří Klimeš cb9abc8467 Do not override configuration files on updates (rh #1153901)
Rather leave modified configuration files untouched and save the new files
with .rpmnew suffix.

http://stackoverflow.com/questions/14511334/rpm-upgrade-handling-of-config-files

https://bugzilla.redhat.com/show_bug.cgi?id=1153901
2014-10-21 15:20:34 +02:00
Dan Williams 5b4311fa0f ifcfg-rh: backport DHCP_SEND_HOSTNAME=no/yes option (rh #1001529) 2014-10-17 17:16:30 -05:00
Lubomir Rintel 2c6f841a35 Backport patches that fixed extraneous route replacement on RA receipt
- core/platform: add address/route sources (rh#1059597)
- platform: don't replace routes that already exist (rh#1059597)
2014-09-25 18:47:43 +02:00
Dan Williams ab73cebb3f Fix forgotten commented-out buildreq from debugging 2014-09-04 21:38:05 -05:00
Dan Williams 3cefbded67 ifcfg-rh: write GATEWAY instead of GATEWAY0 to be ifup-compatible (rh #1062409) 2014-09-04 21:21:29 -05:00
Dan Williams 29e938dcd1 wwan: let systemd manage the ModemManager life-cycle (rh #1018017) 2014-07-29 14:13:05 -05:00
Jiří Klimeš 853145abcf libnm-glib: fix a crash in nm_client_new() (rh #1010288) (rh #1122593)
https://bugzilla.redhat.com/show_bug.cgi?id=1010288
https://bugzilla.redhat.com/show_bug.cgi?id=1122593
2014-07-24 17:59:22 +02:00
Thomas Haller edf80dcb59 fix f20 spec file, so that it builds on Fedora 21 (rawhide) 2014-07-07 22:15:28 +02:00
Thomas Haller e119727014 update spec file to make ppp_version dependent on fedora version
This way we can build f20 packages on rawhide.

To build f20 branch on rawhide, you need to specify --dist
  fedpkg --dist f21 local
2014-07-04 15:06:39 +02:00
Thomas Haller b65e919e7f fix specfile to pass proper --enable-teamdctl argument 2014-07-04 15:06:39 +02:00
Thomas Haller 32cdee1029 remove makerepo.sh script
Use instead the newest version of the makerepo.sh script from upstream.
2014-07-04 10:24:56 +02:00
Dan Williams b84e83d2f2 add new NetworkManager-config-connectivity-fedora RPM
Adds defaults for using Fedora servers for connectivity checking.
2014-07-02 19:40:48 +02:00
Dan Williams d358b2c4dd Fix connectivity property notification 2014-07-02 11:06:46 -05:00
Thomas Haller 546ae50c5a core: fix crash calling wpa_supplicant and fix setting MTU from DHCP
- core: fix crash passing wrong parameter to AddBlob for wpa_supplicant (rh #1115538)
- core: fix setting MTU from DHCP (rh #1047083)
2014-07-02 17:40:41 +02:00
Thomas Haller 58b629c589 fix dispatcher events on DHCP change (rh #1113122) and escape in nmcli bash-completion
- core: fix missing dispatcher events on DHCP change (rh #1113122)
- cli: improve escaping special characters and space for bash completion (bgo #709426)
2014-06-25 23:05:08 +02:00
Thomas Haller 55b365ece1 fix invalid patches 2014-06-25 16:25:08 +02:00
Jiří Klimeš dd398f3986 Fix several bugs: rh #1094064, rh #1095378, rh #1059494, rh #1082041
https://bugzilla.redhat.com/show_bug.cgi?id=1094064
https://bugzilla.redhat.com/show_bug.cgi?id=1095378
https://bugzilla.redhat.com/show_bug.cgi?id=1059494
https://bugzilla.redhat.com/show_bug.cgi?id=1082041
2014-06-12 15:21:38 +02:00
Jiří Klimeš 7c132a6fe6 Own some missing directories (rh #1099789)
https://bugzilla.redhat.com/show_bug.cgi?id=1099789

Based on hint from jpopelka@redhat.com
2014-05-21 16:09:03 +02:00
Dan Winship 2f1cfaf41f core: update NMManager:devices before emitting notify::devices (bgo #728367) 2014-04-17 12:11:38 -04:00
Jiří Klimeš 3f6ed554c5 Fix two crashes
policy: check device state before changing it for secondaries (rh #1055099)
team: fix crash in teamdctl (rh #1076469)
2014-04-15 13:20:53 +02:00
Jiří Klimeš bbca706eae mobile: fix crash on modems (rh #1056133)
Only move to NEED_AUTH during activation (rh #1058308)

https://bugzilla.redhat.com/show_bug.cgi?id=1058308
https://bugzilla.redhat.com/show_bug.cgi?id=1056133
2014-04-14 15:42:57 +02:00
Jiří Klimeš 35a988f91d wifi: fix possible crash in Wi-Fi utils (rh #1086132) 2014-04-10 10:56:01 +02:00
Thomas Haller a24ad21471 core: diverse fixes
Resolves: #1054364
Resolves: #1061911
Resolves: #1063885
Resolves: #1080474
Resolves: #1084556
2014-04-08 19:09:15 +02:00
Jiří Klimeš eb216eb62b keyfile: fix crash on reloading connections (rh #1046242) 2014-03-21 12:59:03 +01:00
Thomas Haller e880be9fba backport fixes from upstream to release 0.9.9.0-32.git20131003 2014-03-17 20:01:18 +01:00
Thomas Haller 67e197f566 add dbus properties to help out bindings (bgo #715186) 2014-02-24 10:36:57 +01:00
Thomas Haller fa6659072a improve platform to string functions 2014-02-24 10:36:57 +01:00
Thomas Haller 94517a4787 additional fixes 2014-02-24 10:36:57 +01:00
Thomas Haller 5fac6036b9 update *spec file to make it more similar to the base template 2014-02-24 10:22:00 +01:00
Thomas Haller 092052e86a update makerepo.gitignore file 2014-02-24 10:02:09 +01:00
Thomas Haller 37b9dd1f1b update makerepo.sh 2014-02-24 09:57:07 +01:00
Thomas Haller f5efae3b83 backport suppressing some invalid error messages and warnings (phys_port_id sysfs and firewalld zone) 2014-02-16 15:36:47 +01:00
Thomas Haller 091e68c086 backport fixes for platform libnl3 caching 2014-02-16 15:11:55 +01:00
Thomas Haller c84b54dbfe backport patches for IPv6 privacy 2014-02-16 15:11:55 +01:00
Thomas Haller d4c1522a3e Revert snapshot release 0.9.9.0-29.git20140131, again based on previous 0.9.9.0-28.git20131003
This commit is mostly similar to c9b963bc22 as
we revert to the previous release.
2014-02-16 14:24:24 +01:00
Thomas Haller 1e5b6784ae update makerepo.sh script
- properly handle several commits in one patch
- add parameter 'local' to call `fedpkg local`
2014-02-16 14:24:23 +01:00
Thomas Haller c2efef1897 Update snapshot (upstream commit 6c2f96421b1c7bfd65032bf4de2a6cfc10b3b262) 2014-02-04 23:11:03 +01:00
Thomas Haller ad27ff38eb update makerepo.sh
You can now create a symlink .git/local to a clone
of the NetworkManager repository, to speed up fetching
from upstream
2014-01-31 18:14:06 +01:00
Jiří Klimeš c9b963bc22 Update to fix a few problems:
- platform: ignore errors adding IPv6 point-to-point address
- libnm-glib: fix return value in nm_remote_settings_load_connections()
- core: fix crash when connecting to new Wi-Fi network (bgo #723163)
- systemd: add "Before=network.service" on Fedora/RHEL (rh #1034983)
2014-01-29 15:36:03 +01:00
Thomas Haller 9037aa0cb5 fix makerepo.sh not to create .orig backup files 2014-01-29 13:51:46 +01:00
Thomas Haller 5b5527f911 add makerepo.sh script to help creating patches
Makes a git repository out of the source dir NetworkManager-0.9.9.0/
2014-01-29 13:15:31 +01:00
Jiří Klimeš 25f86691e2 Fix various problems
- core: fix reading physical port id for sysfs
- libnm-glib: export get_gateway() and get_searches() functions
- libnm-glib: new functions for bindings to get nameservers
- libnm-glib: chain up the parent constructed() of NMRemoteConnection
- core: exit cleanly if D-Bus cannot be initialized (rh #1057738)
- dhcp: don't add an IPv6 address if one wasn't given (rh #1048046)
- core: Add host route for DHCP4 server if outside assigned subnet (bgo #721767) (rh #983325)
- vpn: handle missing tunnel interface for IP-based VPNs (bgo #721724) (rh #1030068) (rh #865883)
- core: only log about IPv6 Commit the first time (rh #1044757)
2014-01-28 15:23:07 +01:00
Jiří Klimeš d112c5a56c Add physical-port-id property for devices and fix GI for IPv6
- core: improve handling of NPAR/SR-IOV devices (rh #804527)
- libnm-glib: add NMDevice:physical-port-id property
- libnm-glib: fix introspection annotations so that <ipv6>.get_address() worked
2014-01-21 12:13:42 +01:00
Dan Winship 99fa633396 core: fix NMManager:primary-connection when a VPN has the default route (rh #1031574) 2014-01-18 11:31:42 -05:00
Jiří Klimeš 7fa9195ebf core/cli: display proper information for active VPN connections (rh #1036132) 2014-01-14 16:50:44 +01:00
60 changed files with 22957 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,3 +1,4 @@
*.makerepo-split.*
network-manager-applet-0.6.5.tar.bz2
NetworkManager-0.6.5.tar.bz2
NetworkManager-0.7.0.svn2736.tar.gz
@ -296,3 +297,4 @@ network-manager-applet-0.8.1.tar.bz2
/NetworkManager-0.9.9.0.git20130913.tar.bz2
/NetworkManager-0.9.9.0.git20131001.tar.bz2
/NetworkManager-0.9.9.0.git20131003.tar.bz2
/NetworkManager-0.9.9.0.git20140131.tar.bz2

1739
0044-ipv6-privacy.patch Normal file

File diff suppressed because it is too large Load Diff

1795
0045-platform-caching.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,285 @@
From eec3d95eb286a6cb57430714d0f16a1a414251f4 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 21 Jan 2014 11:23:16 +0100
Subject: [PATCH 1/3] platform: add parameter to nm_platform_sysctl_get() to
suppress logging error
In some cases, an error when reading the sysctl value can be expected.
In this case, we want to suppress the error message
(cherry picked from commit 634e4c99c3907f1b9fc0dbff4a6d4065182e9b09)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-fake-platform.c | 6 +++---
src/platform/nm-linux-platform.c | 15 ++++++++-------
src/platform/nm-platform.c | 8 +++++---
src/platform/nm-platform.h | 4 ++--
src/platform/tests/platform.c | 2 +-
5 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 803015c..dbad71e 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -72,7 +72,7 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
}
static char *
-sysctl_get (NMPlatform *platform, const char *path)
+sysctl_get (NMPlatform *platform, const char *path, gboolean silent_on_error)
{
NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform);
@@ -566,7 +566,7 @@ master_get_option (NMPlatform *platform, int master, const char *option)
{
auto_g_free char *path = g_strdup_printf ("master:%d:%s", master, option);
- return sysctl_get (platform, path);
+ return sysctl_get (platform, path, FALSE);
}
static gboolean
@@ -582,7 +582,7 @@ slave_get_option (NMPlatform *platform, int slave, const char *option)
{
auto_g_free char *path = g_strdup_printf ("slave:%d:%s", slave, option);
- return sysctl_get (platform, path);
+ return sysctl_get (platform, path, FALSE);
}
static gboolean
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index df1b33a..f935af4 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1454,13 +1454,14 @@ sysctl_set (NMPlatform *platform, const char *path, const char *value)
}
static char *
-sysctl_get (NMPlatform *platform, const char *path)
+sysctl_get (NMPlatform *platform, const char *path, gboolean silent_on_error)
{
GError *error = NULL;
char *contents;
if (!g_file_get_contents (path, &contents, NULL, &error)) {
- error ("error reading %s: %s", path, error->message);
+ if (!silent_on_error)
+ error ("error reading %s: %s", path, error->message);
g_clear_error (&error);
return NULL;
}
@@ -1869,7 +1870,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
if (g_file_test (path, G_FILE_TEST_EXISTS))
- id = sysctl_get (platform, path);
+ id = sysctl_get (platform, path, FALSE);
else
id = NULL;
g_free (path);
@@ -1990,7 +1991,7 @@ link_get_option (int master, const char *category, const char *option)
{
auto_g_free char *path = link_option_path (master, category, option);
- return path ? nm_platform_sysctl_get (path) : NULL;
+ return path ? nm_platform_sysctl_get (path, FALSE) : NULL;
}
static const char *
@@ -2116,7 +2117,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
return FALSE;
path = g_strdup_printf ("/sys/class/net/%s/owner", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
@@ -2124,7 +2125,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
g_free (val);
path = g_strdup_printf ("/sys/class/net/%s/group", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
@@ -2132,7 +2133,7 @@ tun_get_properties (NMPlatform *platform, int ifindex, NMPlatformTunProperties *
g_free (val);
path = g_strdup_printf ("/sys/class/net/%s/tun_flags", ifname);
- val = nm_platform_sysctl_get (path);
+ val = nm_platform_sysctl_get (path, FALSE);
g_free (path);
if (!val)
return FALSE;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 87a7ef9..0b56464 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -267,18 +267,20 @@ nm_platform_sysctl_set (const char *path, const char *value)
/**
* nm_platform_sysctl_get:
* @path: Absolute path to sysctl
+ * @silent_on_error: don't log an error message when the value
+ * could not be read.
*
* Returns: (transfer full): Contents of the virtual sysctl file.
*/
char *
-nm_platform_sysctl_get (const char *path)
+nm_platform_sysctl_get (const char *path, gboolean silent_on_error)
{
reset_error ();
g_return_val_if_fail (path, NULL);
g_return_val_if_fail (klass->sysctl_get, NULL);
- return klass->sysctl_get (platform, path);
+ return klass->sysctl_get (platform, path, silent_on_error);
}
/**
@@ -300,7 +302,7 @@ nm_platform_sysctl_get_int32 (const char *path, gint32 fallback)
g_return_val_if_fail (path, fallback);
if (path)
- value = nm_platform_sysctl_get (path);
+ value = nm_platform_sysctl_get (path, FALSE);
if (!value) {
errno = EINVAL;
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index d5b3672..9375148 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -231,7 +231,7 @@ typedef struct {
gboolean (*setup) (NMPlatform *);
gboolean (*sysctl_set) (NMPlatform *, const char *path, const char *value);
- char * (*sysctl_get) (NMPlatform *, const char *path);
+ char * (*sysctl_get) (NMPlatform *, const char *path, gboolean silent_on_error);
GArray *(*link_get_all) (NMPlatform *);
gboolean (*link_add) (NMPlatform *, const char *name, NMLinkType type);
@@ -350,7 +350,7 @@ const char *nm_platform_get_error_msg (void);
void nm_platform_query_devices (void);
gboolean nm_platform_sysctl_set (const char *path, const char *value);
-char *nm_platform_sysctl_get (const char *path);
+char *nm_platform_sysctl_get (const char *path, gboolean silent_on_error);
gint32 nm_platform_sysctl_get_int32 (const char *path, gint32 fallback);
GArray *nm_platform_link_get_all (void);
diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c
index 7ca2cb5..3c636f5 100644
--- a/src/platform/tests/platform.c
+++ b/src/platform/tests/platform.c
@@ -47,7 +47,7 @@ do_sysctl_set (char **argv)
static gboolean
do_sysctl_get (char **argv)
{
- auto_g_free char *value = nm_platform_sysctl_get (argv[0]);
+ auto_g_free char *value = nm_platform_sysctl_get (argv[0], FALSE);
printf ("%s\n", value);
--
1.8.5.3
From 4901ef3d1259c7038c1011ced874773cfe4dfbaf Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 30 Jan 2014 16:33:55 +0100
Subject: [PATCH 2/3] core/platform: silence error about reading sysctl file
phys_port_id
It is common that the file exists, but cannot be read
(Operation not supported). So, silence any error when
reading the phys_port_id file.
(cherry picked from commit 2fd8d40a5a009aaf33365a9a985d1c72fb20324d)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-linux-platform.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index f935af4..55646d4 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1869,10 +1869,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
return NULL;
path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
- if (g_file_test (path, G_FILE_TEST_EXISTS))
- id = sysctl_get (platform, path, FALSE);
- else
- id = NULL;
+ id = sysctl_get (platform, path, TRUE);
g_free (path);
return id;
--
1.8.5.3
From 4f128334dad91cff426bc3ca44e5500ce3950277 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 13 Feb 2014 12:32:58 +0100
Subject: [PATCH 3/3] core: suppress error message ZONE_ALREADY_SET when adding
firewalld zone
See also https://bugzilla.redhat.com/show_bug.cgi?id=886432, where
firewalld was changed, not to return ZONE_ALREADY_SET for 'changeZone'.
However, 'addInterface' can still fail with this error.
Suppress the following error lines:
<debug> [1392290031.179280] [firewall-manager/nm-firewall-manager.c:117] nm_firewall_manager_add_or_change_zone(): (em1) firewall zone add -> (null)
...
<warn> (em1) firewall zone add/change failed: (32) ZONE_ALREADY_SET
(cherry picked from commit 71cce80f1f54da76766af4105211608bd50ab44d)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/firewall-manager/nm-firewall-manager.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/firewall-manager/nm-firewall-manager.c b/src/firewall-manager/nm-firewall-manager.c
index d73069f..ffe0649 100644
--- a/src/firewall-manager/nm-firewall-manager.c
+++ b/src/firewall-manager/nm-firewall-manager.c
@@ -82,8 +82,13 @@ add_or_change_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data
G_TYPE_STRING, &zone,
G_TYPE_INVALID)) {
g_assert (error);
- nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
- info->iface, error->code, error->message);
+ if (g_strcmp0 (error->message, "ZONE_ALREADY_SET") != 0) {
+ nm_log_warn (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
+ info->iface, error->code, error->message);
+ } else {
+ nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone add/change failed: (%d) %s",
+ info->iface, error->code, error->message);
+ }
}
info->callback (error, info->user_data);
@@ -114,7 +119,8 @@ nm_firewall_manager_add_or_change_zone (NMFirewallManager *self,
info->callback = callback;
info->user_data = user_data;
- nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone %s -> %s", iface, add ? "add" : "change", zone);
+ nm_log_dbg (LOGD_FIREWALL, "(%s) firewall zone %s -> %s%s%s", iface, add ? "add" : "change",
+ zone?"\"":"", zone ? zone : "default", zone?"\"":"");
return dbus_g_proxy_begin_call_with_timeout (priv->proxy,
add ? "addInterface" : "changeZone",
add_or_change_cb,
--
1.8.5.3

View File

@ -0,0 +1,60 @@
From 739faab9f5d8c2b5542da733df6fece45f8873d6 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 16 Jan 2014 20:20:35 +0100
Subject: [PATCH 1/1] core/platform: fix wrong calculation of address
lifetime/preferred for kernel addresses
When receiving an IPv4/IPv6 address from the kernel, platform set the
timestamp to an invalid value before. The address timestamp must be set
to *now*, because the lifetime and preferred arguments are counting from
now.
(cherry picked from commit 177c767320578c490ff94e723115d830d1753ae1)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-linux-platform.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 55646d4..b5e3618 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -834,6 +834,16 @@ hack_empty_master_iff_lower_up (NMPlatform *platform, struct nl_object *object)
rtnl_link_unset_flags (rtnllink, IFF_LOWER_UP);
}
+static guint32
+get_time (void)
+{
+ struct timespec tp;
+
+ clock_gettime (CLOCK_MONOTONIC, &tp);
+
+ return tp.tv_sec;
+}
+
static void
init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
{
@@ -846,7 +856,7 @@ init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr)
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
- address->timestamp = rtnl_addr_get_create_time (rtnladdr);
+ address->timestamp = get_time ();
address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr);
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
g_assert (nl_addr_get_len (nladdr) == sizeof (address->address));
@@ -867,7 +877,7 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr)
address->ifindex = rtnl_addr_get_ifindex (rtnladdr);
address->plen = rtnl_addr_get_prefixlen (rtnladdr);
- address->timestamp = rtnl_addr_get_create_time (rtnladdr);
+ address->timestamp = get_time ();
address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr);
address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr);
address->flags = rtnl_addr_get_flags (rtnladdr);
--
1.8.5.3

View File

@ -0,0 +1,384 @@
From 21a9b646ed49d1269c65a7ffca946c9340972bab Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 21 Oct 2013 14:36:59 +0200
Subject: [PATCH 1/3] core: omit "dev -" for *_to_string of NMPlatformIP*
addresses and routes
The NMPlatformIP[46]Address and NMPlatformIP[46]Route structs have a
field 'dev'. Before this field was always printed in the *_to_string
functions and a missing device was signaled as ' dev -'.
This had the advantage, that the output contained the same fields
regardless whether there was a device set or not.
Change it, not to print the device if it is not set. This has the
advantage, that it looks better in the logfiles.
(cherry picked from commit 69d154012d5f144c97d07f965bad35e1d9306900)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0b56464..da6c72d 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1714,15 +1714,20 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET, &address->address, s_address, sizeof (s_address));
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
- (guint)address->timestamp, s_dev ? s_dev : "-");
+ (guint)address->timestamp,
+ str_dev ? str_dev : "");
+ g_free (str_dev);
return buffer;
}
@@ -1746,11 +1751,14 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
char s_address[INET6_ADDRSTRLEN];
const char *s_dev;
char *str_flags;
+ char *str_dev;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET6, &address->address, s_address, sizeof (s_address));
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
rtnl_addr_flags2str(address->flags, s_flags, sizeof (s_flags));
@@ -1770,11 +1778,13 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_flags = s_flags[0] ? g_strconcat (" flags ", s_flags, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
- (guint)address->timestamp, s_dev ? s_dev : "-",
+ (guint)address->timestamp,
+ str_dev ? str_dev : "",
str_flags ? str_flags : "");
g_free (str_flags);
+ g_free (str_dev);
return buffer;
}
@@ -1796,16 +1806,21 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route)
static char buffer[256];
char s_network[INET_ADDRSTRLEN], s_gateway[INET_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET, &route->gateway, s_gateway, sizeof(s_gateway));
+
s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d via %s dev %s metric %u mss %u",
- s_network, route->plen, s_gateway, s_dev ? s_dev : "-",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
+ s_network, route->plen, s_gateway,
+ str_dev ? str_dev : "",
route->metric, route->mss);
+ g_free (str_dev);
return buffer;
}
@@ -1827,16 +1842,21 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route)
static char buffer[256];
char s_network[INET6_ADDRSTRLEN], s_gateway[INET6_ADDRSTRLEN];
const char *s_dev;
+ char *str_dev;
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET6, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET6, &route->gateway, s_gateway, sizeof(s_gateway));
+
s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
+ str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d via %s dev %s metric %u mss %u",
- s_network, route->plen, s_gateway, s_dev ? s_dev : "-",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
+ s_network, route->plen, s_gateway,
+ str_dev ? str_dev : "",
route->metric, route->mss);
+ g_free (str_dev);
return buffer;
}
--
1.8.5.3
From 442d7195c74e415f15fa0264eca6e7bcf7f278e6 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 2 Dec 2013 21:12:05 +0100
Subject: [PATCH 2/3] core: print peer_address in NMPlatform address_to_string
(cherry picked from commit 1b0f832c7f7c02d29b9421005c78d52ad6a47905)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index da6c72d..677c23a 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1713,21 +1713,30 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
{
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
+ char s_peer[INET_ADDRSTRLEN];
const char *s_dev;
char *str_dev;
+ char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET, &address->address, s_address, sizeof (s_address));
+ if (address->peer_address) {
+ inet_ntop (AF_INET, &address->peer_address, s_peer, sizeof (s_peer));
+ str_peer = g_strconcat (" ptp ", s_peer, NULL);
+ }
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
+ str_peer ? str_peer : "",
str_dev ? str_dev : "");
g_free (str_dev);
+ g_free (str_peer);
return buffer;
}
@@ -1749,14 +1758,21 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
static char buffer[256];
char s_flags[256];
char s_address[INET6_ADDRSTRLEN];
+ char s_peer[INET6_ADDRSTRLEN];
const char *s_dev;
char *str_flags;
char *str_dev;
+ char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
inet_ntop (AF_INET6, &address->address, s_address, sizeof (s_address));
+ if (!IN6_IS_ADDR_UNSPECIFIED (&address->peer_address)) {
+ inet_ntop (AF_INET6, &address->peer_address, s_peer, sizeof (s_peer));
+ str_peer = g_strconcat (" ptp ", s_peer, NULL);
+ }
+
s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
@@ -1778,13 +1794,15 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_flags = s_flags[0] ? g_strconcat (" flags ", s_flags, NULL) : NULL;
- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
+ g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
+ str_peer ? str_peer : "",
str_dev ? str_dev : "",
str_flags ? str_flags : "");
g_free (str_flags);
g_free (str_dev);
+ g_free (str_peer);
return buffer;
}
--
1.8.5.3
From aaa86cd61058c8a97c8149b2ebd6eca449aae5b7 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 18 Feb 2014 12:52:16 +0100
Subject: [PATCH 3/3] platform: refactor address_to_string() to return device
as numeric if ifname is unknown
(cherry picked from commit a6767f215e0b7ab55949e4410d399f315a225578)
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
src/platform/nm-platform.c | 57 +++++++++++++++++++++++++++-------------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 677c23a..37d4318 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1696,6 +1696,27 @@ nm_platform_route_flush (int ifindex)
/******************************************************************/
+#define TO_STRING_DEV_BUF_SIZE (5+15+1)
+static void
+_to_string_dev (int ifindex, char *buf, size_t size)
+{
+ g_assert (buf && size >= TO_STRING_DEV_BUF_SIZE);
+
+ if (ifindex){
+ const char *name = ifindex > 0 ? nm_platform_link_get_name (ifindex) : NULL;
+
+ strcpy (buf, " dev ");
+ buf += 5;
+ size -= 5;
+
+ if (name)
+ g_strlcpy (buf, name, size);
+ else
+ g_snprintf (buf, size, "%d", ifindex);
+ } else
+ buf[0] = 0;
+}
+
/**
* nm_platform_ip4_address_to_string:
* @route: pointer to NMPlatformIP4Address address structure
@@ -1714,8 +1735,7 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
static char buffer[256];
char s_address[INET_ADDRSTRLEN];
char s_peer[INET_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
@@ -1727,15 +1747,13 @@ nm_platform_ip4_address_to_string (const NMPlatformIP4Address *address)
str_peer = g_strconcat (" ptp ", s_peer, NULL);
}
- s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (address->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u%s%s",
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
str_peer ? str_peer : "",
- str_dev ? str_dev : "");
- g_free (str_dev);
+ str_dev);
g_free (str_peer);
return buffer;
}
@@ -1759,9 +1777,8 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
char s_flags[256];
char s_address[INET6_ADDRSTRLEN];
char s_peer[INET6_ADDRSTRLEN];
- const char *s_dev;
char *str_flags;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
char *str_peer = NULL;
g_return_val_if_fail (address, "(unknown)");
@@ -1773,8 +1790,7 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
str_peer = g_strconcat (" ptp ", s_peer, NULL);
}
- s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (address->ifindex, str_dev, sizeof (str_dev));
rtnl_addr_flags2str(address->flags, s_flags, sizeof (s_flags));
@@ -1798,10 +1814,9 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
s_address, address->plen, (guint)address->lifetime, (guint)address->preferred,
(guint)address->timestamp,
str_peer ? str_peer : "",
- str_dev ? str_dev : "",
+ str_dev,
str_flags ? str_flags : "");
g_free (str_flags);
- g_free (str_dev);
g_free (str_peer);
return buffer;
}
@@ -1823,22 +1838,19 @@ nm_platform_ip4_route_to_string (const NMPlatformIP4Route *route)
{
static char buffer[256];
char s_network[INET_ADDRSTRLEN], s_gateway[INET_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET, &route->gateway, s_gateway, sizeof(s_gateway));
- s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (route->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
s_network, route->plen, s_gateway,
- str_dev ? str_dev : "",
+ str_dev,
route->metric, route->mss);
- g_free (str_dev);
return buffer;
}
@@ -1859,22 +1871,19 @@ nm_platform_ip6_route_to_string (const NMPlatformIP6Route *route)
{
static char buffer[256];
char s_network[INET6_ADDRSTRLEN], s_gateway[INET6_ADDRSTRLEN];
- const char *s_dev;
- char *str_dev;
+ char str_dev[TO_STRING_DEV_BUF_SIZE];
g_return_val_if_fail (route, "(unknown)");
inet_ntop (AF_INET6, &route->network, s_network, sizeof(s_network));
inet_ntop (AF_INET6, &route->gateway, s_gateway, sizeof(s_gateway));
- s_dev = route->ifindex > 0 ? nm_platform_link_get_name (route->ifindex) : NULL;
- str_dev = s_dev ? g_strconcat (" dev ", s_dev, NULL) : NULL;
+ _to_string_dev (route->ifindex, str_dev, sizeof (str_dev));
g_snprintf (buffer, sizeof (buffer), "%s/%d via %s%s metric %u mss %u",
s_network, route->plen, s_gateway,
- str_dev ? str_dev : "",
+ str_dev,
route->metric, route->mss);
- g_free (str_dev);
return buffer;
}
--
1.8.5.3

3981
0049-dbus-bindings.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,708 @@
From ee9be9cef769cdfb3a14ec65741f1c36d0b1ac32 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:32:46 +0100
Subject: [PATCH 01/10] core: fix adding gateway routes within the own subnet
Before, when adding a gateway route to a destination within the
current subnets, it would be skipped because of the wrong assumption
that we already have a prefix route to that destination.
This assumption is wrong, because we want to reach the more specific
subnet via a gateway and not directly on the link.
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 4f7b1cabc063bfda96cb5c129d6a233e5d5cff68)
---
src/nm-ip4-config.c | 3 ++-
src/nm-ip6-config.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index bb85926..b7ae161 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -169,7 +169,8 @@ nm_ip4_config_commit (const NMIP4Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
- if (nm_ip4_config_destination_is_direct (config, route.network, route.plen))
+ if ( route.gateway == 0
+ && nm_ip4_config_destination_is_direct (config, route.network, route.plen))
continue;
/* Don't add the default route when and the connection
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 3a56f4f..2a6c8a3 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -168,7 +168,8 @@ nm_ip6_config_commit (const NMIP6Config *config, int ifindex, int priority)
/* Don't add the route if it's more specific than one of the subnets
* the device already has an IP address on.
*/
- if (nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
+ if ( IN6_IS_ADDR_UNSPECIFIED (&route.gateway)
+ && nm_ip6_config_destination_is_direct (config, &route.network, route.plen))
continue;
/* Don't add the default route when and the connection
--
1.8.5.3
From 9efbadda08792db99d708a89586be31445d61f83 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:30:01 +0100
Subject: [PATCH 02/10] tivial/core: move common #defines to header file
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 8cd0de231a27d26e719f1b747f95ae53f5fec59e)
---
src/devices/nm-device.c | 8 --------
src/platform/nm-platform.c | 8 --------
src/platform/nm-platform.h | 8 ++++++++
3 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 7757153..6f3213a 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -69,14 +69,6 @@
#include "nm-config.h"
#include "nm-platform.h"
-/* workaround for older libnl version, that does not define these flags. */
-#ifndef IFA_F_MANAGETEMPADDR
-#define IFA_F_MANAGETEMPADDR 0x100
-#endif
-#ifndef IFA_F_NOPREFIXROUTE
-#define IFA_F_NOPREFIXROUTE 0x200
-#endif
-
static void impl_device_disconnect (NMDevice *device, DBusGMethodInvocation *context);
#include "nm-device-glue.h"
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 37d4318..97540fc 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -33,14 +33,6 @@
#include "nm-logging.h"
#include "nm-enum-types.h"
-/* workaround for older libnl version, that does not define these flags. */
-#ifndef IFA_F_MANAGETEMPADDR
-#define IFA_F_MANAGETEMPADDR 0x100
-#endif
-#ifndef IFA_F_NOPREFIXROUTE
-#define IFA_F_NOPREFIXROUTE 0x200
-#endif
-
#define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__)
#define NM_PLATFORM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_PLATFORM, NMPlatformPrivate))
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index 9375148..2725dd9 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -35,6 +35,14 @@
/******************************************************************/
+/* workaround for older libnl version, that does not define these flags. */
+#ifndef IFA_F_MANAGETEMPADDR
+#define IFA_F_MANAGETEMPADDR 0x100
+#endif
+#ifndef IFA_F_NOPREFIXROUTE
+#define IFA_F_NOPREFIXROUTE 0x200
+#endif
+
typedef enum {
/* no error specified, sometimes this means the arguments were wrong */
NM_PLATFORM_ERROR_NONE,
--
1.8.5.3
From b35e2118ac4c4380e3b7536b98f64bec195898ff Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 14:34:12 +0100
Subject: [PATCH 03/10] core: fix adding gateway route for IPv6
Setting the address flag IFA_F_NOPREFIXROUTE broke adding the device route to
the IPv6 prefix because the check for nm_ip6_config_destination_is_direct()
caused the route to be skipped. This, together with the kernel no
longer adding the prefix route resulted in no device route for autoconf
/64 prefixes.
https://bugzilla.redhat.com/show_bug.cgi?id=1068632
https://bugzilla.redhat.com/show_bug.cgi?id=1072410
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit d6f6ccef432fb45a30b0b642975acd36d08410fb)
---
src/devices/nm-device.c | 9 +++++----
src/nm-ip6-config.c | 3 ++-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 6f3213a..c7f72b8 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -3282,13 +3282,14 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device
nm_platform_check_support_kernel_extended_ifa_flags ();
}
- /* without system_support, these flags will be ignored.
- * Still, we set them (why not?).
- **/
- ifa_flags = IFA_F_NOPREFIXROUTE;
+ if (system_support)
+ ifa_flags = IFA_F_NOPREFIXROUTE;
if (priv->rdisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR
|| priv->rdisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR)
+ {
+ /* without system_support, this flag will be ignored. Still set it, doesn't seem to do any harm. */
ifa_flags |= IFA_F_MANAGETEMPADDR;
+ }
g_return_if_fail (priv->act_request);
connection = nm_device_get_connection (device);
diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c
index 2a6c8a3..58ad2e0 100644
--- a/src/nm-ip6-config.c
+++ b/src/nm-ip6-config.c
@@ -398,7 +398,8 @@ nm_ip6_config_destination_is_direct (const NMIP6Config *config, const struct in6
for (i = 0; i < num; i++) {
const NMPlatformIP6Address *item = nm_ip6_config_get_address (config, i);
- if (item->plen <= plen && same_prefix (&item->address, network, item->plen))
+ if (item->plen <= plen && same_prefix (&item->address, network, item->plen) &&
+ !(item->flags & IFA_F_NOPREFIXROUTE))
return TRUE;
}
--
1.8.5.3
From cf576344d6f2e7616daf50b5e3dcd1dd1bbbf663 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 6 Mar 2014 11:58:50 -0500
Subject: [PATCH 04/10] rdisc: set the expiration timer correctly (rh #1073560)
check_timestamps() was mixing up absolute and relative timestamps,
which meant that IPv6 expiration checks more-or-less stopped happening
after a while, allowing expired IPv6 routes, etc, to remain applied.
(cherry picked from commit 5ec9b9e97c1e1647c7bb45c79518f1c49cb23cd6)
---
src/rdisc/nm-lndp-rdisc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c
index 7d61b59..048cae9 100644
--- a/src/rdisc/nm-lndp-rdisc.c
+++ b/src/rdisc/nm-lndp-rdisc.c
@@ -380,8 +380,10 @@ check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed)
g_signal_emit_by_name (rdisc, NM_RDISC_CONFIG_CHANGED, changed);
if (nextevent != never) {
- debug ("(%s): scheduling next now/lifetime check: %u seconds", rdisc->ifname, nextevent);
- priv->timeout_id = g_timeout_add_seconds (nextevent, timeout_cb, rdisc);
+ g_return_if_fail (nextevent > now);
+ debug ("(%s): scheduling next now/lifetime check: %u seconds",
+ rdisc->ifname, nextevent - now);
+ priv->timeout_id = g_timeout_add_seconds (nextevent - now, timeout_cb, rdisc);
}
}
--
1.8.5.3
From 97aefecea0465f0a56733d42cf19393e42c4fa03 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Tue, 4 Mar 2014 18:18:13 -0500
Subject: [PATCH 05/10] libnm-glib: fix a double free in NMDeviceVlan
(cherry picked from commit 6300ea57ab4ee57a1afa4c76cb1d9503d78385a7)
---
libnm-glib/nm-device-vlan.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libnm-glib/nm-device-vlan.c b/libnm-glib/nm-device-vlan.c
index bd4cb78..3e20240 100644
--- a/libnm-glib/nm-device-vlan.c
+++ b/libnm-glib/nm-device-vlan.c
@@ -198,7 +198,6 @@ connection_compatible (NMDevice *device, NMConnection *connection, GError **erro
if (!g_strcmp0 (mac_address_str, NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address)) {
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_MAC_MISMATCH,
"The hardware address of the device and the connection didn't match.");
- g_free (mac_address_str);
}
g_free (mac_address_str);
}
--
1.8.5.3
From e2ba3d96521c032dc88f6e9a8ae77d2c381f3cbc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 15:27:20 +0100
Subject: [PATCH 06/10] ifcfg-rh: add missing functionality for reading/writing
subject matches
subject-match - IEEE_8021X_SUBJECT_MATCH
altsubject-matches - IEEE_8021X_ALTSUBJECT_MATCHES
phase2-subject-match - IEEE_8021X_PHASE2_SUBJECT_MATCH
phase2-altsubject-matches - IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES
And a testcase of course.
(cherry picked from commit cb680c5b54fdb5453d04e3dcdb3d33f445f00a95)
---
src/settings/plugins/ifcfg-rh/reader.c | 46 ++++++++++++++
.../ifcfg-rh/tests/network-scripts/Makefile.am | 1 +
.../ifcfg-test-wired-802-1X-subj-matches | 17 +++++
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 74 ++++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 38 ++++++++++-
5 files changed, 175 insertions(+), 1 deletion(-)
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 4586b5c..e512402 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -2720,6 +2720,39 @@ static EAPReader eap_readers[] = {
{ NULL, NULL }
};
+static void
+read_8021x_list_value (shvarFile *ifcfg,
+ const char *ifcfg_var_name,
+ NMSetting8021x *setting,
+ const char *prop_name)
+{
+ char *value;
+ char **strv, **iter;
+ GSList *gslist = NULL;
+
+ g_return_if_fail (ifcfg != NULL);
+ g_return_if_fail (ifcfg_var_name != NULL);
+ g_return_if_fail (prop_name != NULL);
+
+ value = svGetValue (ifcfg, ifcfg_var_name, FALSE);
+ if (!value)
+ return;
+
+ strv = g_strsplit_set (value, " \t", 0);
+ for (iter = strv; iter && *iter; iter++) {
+ if (*iter[0] == '\0')
+ continue;
+ gslist = g_slist_prepend (gslist, *iter);
+ }
+ if (gslist) {
+ gslist = g_slist_reverse (gslist);
+ g_object_set (setting, prop_name, gslist, NULL);
+ g_slist_free (gslist);
+ }
+ g_strfreev (strv);
+ g_free (value);
+}
+
static NMSetting8021x *
fill_8021x (shvarFile *ifcfg,
const char *file,
@@ -2796,6 +2829,19 @@ fill_8021x (shvarFile *ifcfg,
goto error;
}
+ value = svGetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH", FALSE);
+ g_object_set (s_8021x, NM_SETTING_802_1X_SUBJECT_MATCH, value, NULL);
+ g_free (value);
+
+ value = svGetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH", FALSE);
+ g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, value, NULL);
+ g_free (value);
+
+ read_8021x_list_value (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES",
+ s_8021x, NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
+ read_8021x_list_value (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES",
+ s_8021x, NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
+
if (list)
g_strfreev (list);
if (keys)
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
index 9f0c733..2f24fc3 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -17,6 +17,7 @@ EXTRA_DIST = \
keys-test-wired-8021x-peap-mschapv2 \
ifcfg-test-wired-8021x-tls-agent \
ifcfg-test-wired-8021x-tls-always \
+ ifcfg-test-wired-802-1X-subj-matches \
ifcfg-test-onboot-no \
ifcfg-test-noip \
ifcfg-test-wifi-open \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
new file mode 100644
index 0000000..70d69bf
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-802-1X-subj-matches
@@ -0,0 +1,17 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Ethernet
+DEVICE=eth0
+HWADDR=00:11:22:33:44:ee
+BOOTPROTO=dhcp
+ONBOOT=yes
+NM_CONTROLLED=yes
+KEY_MGMT=IEEE8021X
+IEEE_8021X_EAP_METHODS=PEAP
+IEEE_8021X_IDENTITY="Jara Cimrman"
+IEEE_8021X_PEAP_VERSION=1
+IEEE_8021X_INNER_AUTH_METHODS=GTC
+IEEE_8021X_PASSWORD_FLAGS="user ask"
+IEEE_8021X_SUBJECT_MATCH=server1.yourdomain.tld
+IEEE_8021X_ALTSUBJECT_MATCHES="a.yourdomain.tld b.yourdomain.tld c.yourdomain.tld"
+IEEE_8021X_PHASE2_SUBJECT_MATCH=server2.yourdomain.tld
+IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES="x.yourdomain.tld y.yourdomain.tld"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 7c3d989..fc7119d 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -2614,6 +2614,79 @@ test_read_wired_8021x_tls_secret_flags (const char *ifcfg, NMSettingSecretFlags
g_object_unref (connection);
}
+static void
+test_read_write_802_1X_subj_matches (void)
+{
+ NMConnection *connection, *reread;
+ NMSetting8021x *s_8021x;
+ char *written = NULL;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-802-1X-subj-matches",
+ NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ g_assert_no_error (error);
+ g_assert (connection != NULL);
+
+ /* ===== 802.1x SETTING ===== */
+ s_8021x = nm_connection_get_setting_802_1x (connection);
+ g_assert (s_8021x);
+ g_assert_cmpint (nm_setting_802_1x_get_num_eap_methods (s_8021x), ==, 1);
+ g_assert_cmpstr (nm_setting_802_1x_get_eap_method (s_8021x, 0), ==, "peap");
+ g_assert_cmpstr (nm_setting_802_1x_get_identity (s_8021x), ==, "Jara Cimrman");
+ g_assert_cmpstr (nm_setting_802_1x_get_subject_match (s_8021x), ==, "server1.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_subject_match (s_8021x), ==, "server2.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_altsubject_matches (s_8021x), ==, 3);
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 0), ==, "a.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 1), ==, "b.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 2), ==, "c.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x), ==, 2);
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 0), ==, "x.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 1), ==, "y.yourdomain.tld");
+
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &written,
+ &error);
+ g_assert (success);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (written, NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ unlink (written);
+ g_free (written);
+
+ g_assert_no_error (error);
+ g_assert (reread != NULL);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT);
+ g_assert (success);
+
+ /* Check 802.1X stuff of the re-read connection. */
+ s_8021x = nm_connection_get_setting_802_1x (reread);
+ g_assert (s_8021x);
+ g_assert_cmpint (nm_setting_802_1x_get_num_eap_methods (s_8021x), ==, 1);
+ g_assert_cmpstr (nm_setting_802_1x_get_eap_method (s_8021x, 0), ==, "peap");
+ g_assert_cmpstr (nm_setting_802_1x_get_identity (s_8021x), ==, "Jara Cimrman");
+ g_assert_cmpstr (nm_setting_802_1x_get_subject_match (s_8021x), ==, "server1.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_subject_match (s_8021x), ==, "server2.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_altsubject_matches (s_8021x), ==, 3);
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 0), ==, "a.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 1), ==, "b.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_altsubject_match (s_8021x, 2), ==, "c.yourdomain.tld");
+ g_assert_cmpint (nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x), ==, 2);
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 0), ==, "x.yourdomain.tld");
+ g_assert_cmpstr (nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, 1), ==, "y.yourdomain.tld");
+
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
#define TEST_IFCFG_WIFI_OPEN TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wifi-open"
static void
@@ -12522,6 +12595,7 @@ int main (int argc, char **argv)
test_read_wired_8021x_tls_secret_flags (TEST_IFCFG_WIRED_8021X_TLS_AGENT, NM_SETTING_SECRET_FLAG_AGENT_OWNED);
test_read_wired_8021x_tls_secret_flags (TEST_IFCFG_WIRED_8021X_TLS_ALWAYS,
NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED);
+ g_test_add_func (TPATH "802-1x/subj-mathes", test_read_write_802_1X_subj_matches);
test_read_wifi_open ();
test_read_wifi_open_auto ();
test_read_wifi_open_ssid_hex ();
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 11e1d7b..4a18d14 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -447,10 +447,12 @@ write_8021x_setting (NMConnection *connection,
GError **error)
{
NMSetting8021x *s_8021x;
- const char *value;
+ const char *value, *match;
char *tmp = NULL;
gboolean success = FALSE;
GString *phase2_auth;
+ GString *str;
+ guint32 i, num;
s_8021x = nm_connection_get_setting_802_1x (connection);
if (!s_8021x) {
@@ -545,6 +547,40 @@ write_8021x_setting (NMConnection *connection,
g_string_free (phase2_auth, TRUE);
+ svSetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH",
+ nm_setting_802_1x_get_subject_match (s_8021x),
+ FALSE);
+
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH",
+ nm_setting_802_1x_get_phase2_subject_match (s_8021x),
+ FALSE);
+
+ svSetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", NULL, FALSE);
+ str = g_string_new (NULL);
+ num = nm_setting_802_1x_get_num_altsubject_matches (s_8021x);
+ for (i = 0; i < num; i++) {
+ if (i > 0)
+ g_string_append_c (str, ' ');
+ match = nm_setting_802_1x_get_altsubject_match (s_8021x, i);
+ g_string_append (str, match);
+ }
+ if (str->len > 0)
+ svSetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str, FALSE);
+ g_string_free (str, TRUE);
+
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", NULL, FALSE);
+ str = g_string_new (NULL);
+ num = nm_setting_802_1x_get_num_phase2_altsubject_matches (s_8021x);
+ for (i = 0; i < num; i++) {
+ if (i > 0)
+ g_string_append_c (str, ' ');
+ match = nm_setting_802_1x_get_phase2_altsubject_match (s_8021x, i);
+ g_string_append (str, match);
+ }
+ if (str->len > 0)
+ svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str, FALSE);
+ g_string_free (str, TRUE);
+
success = write_8021x_certs (s_8021x, FALSE, ifcfg, error);
if (success) {
/* phase2/inner certs */
--
1.8.5.3
From b0e648e7f40d16943e2e531e220b926993b2f7f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 18:40:13 +0100
Subject: [PATCH 07/10] libnm-util: fix adding values to
'phase2-altsubject-matches'
It was mixed up with 'altsubject-matches'.
(cherry picked from commit 37894121605014781810add19169ba8cbbe4394c)
---
libnm-util/nm-setting-8021x.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index 58b2a44..ae03cd2 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -638,7 +638,7 @@ nm_setting_802_1x_get_altsubject_match (NMSetting8021x *setting, guint32 i)
**/
gboolean
nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
- const char *altsubject_match)
+ const char *altsubject_match)
{
NMSetting8021xPrivate *priv;
GSList *iter;
@@ -652,7 +652,8 @@ nm_setting_802_1x_add_altsubject_match (NMSetting8021x *setting,
return FALSE;
}
- priv->altsubject_matches = g_slist_append (priv->altsubject_matches, g_strdup (altsubject_match));
+ priv->altsubject_matches = g_slist_append (priv->altsubject_matches,
+ g_strdup (altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_ALTSUBJECT_MATCHES);
return TRUE;
}
@@ -1184,7 +1185,7 @@ nm_setting_802_1x_get_phase2_altsubject_match (NMSetting8021x *setting, guint32
**/
gboolean
nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
- const char *phase2_altsubject_match)
+ const char *phase2_altsubject_match)
{
NMSetting8021xPrivate *priv;
GSList *iter;
@@ -1198,8 +1199,8 @@ nm_setting_802_1x_add_phase2_altsubject_match (NMSetting8021x *setting,
return FALSE;
}
- priv->phase2_altsubject_matches = g_slist_append (priv->altsubject_matches,
- g_strdup (phase2_altsubject_match));
+ priv->phase2_altsubject_matches = g_slist_append (priv->phase2_altsubject_matches,
+ g_strdup (phase2_altsubject_match));
g_object_notify (G_OBJECT (setting), NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES);
return TRUE;
}
--
1.8.5.3
From 01198ca5c733624d6a4238e00b067a173679588a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Feb 2014 15:52:45 +0100
Subject: [PATCH 08/10] libnm-util: fix verify_identity() in '802-1x' setting
We need to return FALSE on error, otherwise we pile GErrors and assert in
nm_setting_verify().
(cherry picked from commit 68066b40f2704ee069201cfa7f9c0f3b976e690f)
---
libnm-util/nm-setting-8021x.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index ae03cd2..7777e02 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -2363,12 +2363,14 @@ verify_identity (NMSetting8021x *self, gboolean phase2, GError **error)
NM_SETTING_802_1X_ERROR_MISSING_PROPERTY,
_("property is missing"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_802_1X_SETTING_NAME, NM_SETTING_802_1X_IDENTITY);
+ return FALSE;
} else if (!strlen (priv->identity)) {
g_set_error_literal (error,
NM_SETTING_802_1X_ERROR,
NM_SETTING_802_1X_ERROR_INVALID_PROPERTY,
_("property is empty"));
g_prefix_error (error, "%s.%s: ", NM_SETTING_802_1X_SETTING_NAME, NM_SETTING_802_1X_IDENTITY);
+ return FALSE;
}
return TRUE;
--
1.8.5.3
From 044309eae71b908cdc01852e22ed2a5127293c40 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Tue, 4 Mar 2014 21:44:07 +0100
Subject: [PATCH 09/10] platform: fix converting address flags in
nm_platform_ip6_address_to_string()
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit eca6a49e2d91c21ff9f525dd34259e3ad6c12272)
---
src/platform/nm-platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 97540fc..0477477 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1791,11 +1791,11 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address)
* These two flags were introduced together with the extended ifa_flags,
* so, check for that.
**/
- if ((address->flags && IFA_F_MANAGETEMPADDR) & !nm_platform_check_support_libnl_extended_ifa_flags ()) {
+ if ((address->flags & IFA_F_MANAGETEMPADDR) && !nm_platform_check_support_libnl_extended_ifa_flags ()) {
strncat (s_flags, s_flags[0] ? "," IFA_F_MANAGETEMPADDR_STR : IFA_F_MANAGETEMPADDR_STR,
sizeof (s_flags) - strlen (s_flags) - 1);
}
- if ((address->flags && IFA_F_NOPREFIXROUTE) & !nm_platform_check_support_libnl_extended_ifa_flags ()) {
+ if ((address->flags & IFA_F_NOPREFIXROUTE) && !nm_platform_check_support_libnl_extended_ifa_flags ()) {
strncat (s_flags, s_flags[0] ? "," IFA_F_NOPREFIXROUTE_STR : IFA_F_NOPREFIXROUTE_STR,
sizeof (s_flags) - strlen (s_flags) - 1);
}
--
1.8.5.3
From 917b799a1ce86963d41834c3bd5d24f945855ec0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 4 Mar 2014 16:51:01 +0100
Subject: [PATCH 10/10] policy: fix crash caused by calling functions on
connection==NULL
Crash appeared in:
nm_settings_connection_set_autoconnect_blocked_reason()
(partially cherry picked from commit b8915dae3c5d2a077a0615941cfa363c0efcb428)
---
src/nm-policy.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index a5a372a..408056e 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1307,7 +1307,7 @@ reset_connections_retries (gpointer user_data)
static void schedule_activate_all (NMPolicy *policy);
static void
-activate_slave_connections (NMPolicy *policy, NMConnection *connection,
+activate_slave_connections (NMPolicy *policy,
NMDevice *device)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
@@ -1414,7 +1414,7 @@ device_state_changed (NMDevice *device,
const char *ip_iface = nm_device_get_ip_iface (device);
NMIP4Config *ip4_config;
NMIP6Config *ip6_config;
- NMSettingConnection *s_con;
+ NMSettingConnection *s_con = NULL;
if (connection)
g_object_set_data (G_OBJECT (connection), FAILURE_REASON_TAG, GUINT_TO_POINTER (0));
@@ -1506,10 +1506,11 @@ device_state_changed (NMDevice *device,
case NM_DEVICE_STATE_PREPARE:
/* Reset auto-connect retries of all slaves and schedule them for
* activation. */
- activate_slave_connections (policy, connection, device);
+ activate_slave_connections (policy, device);
break;
case NM_DEVICE_STATE_SECONDARIES:
- s_con = nm_connection_get_setting_connection (connection);
+ if (connection)
+ s_con = nm_connection_get_setting_connection (connection);
if (s_con && nm_setting_connection_get_num_secondaries (s_con) > 0) {
/* Make routes and DNS up-to-date before activating dependent connections */
update_routing_and_dns (policy, FALSE);
--
1.8.5.3

View File

@ -0,0 +1,50 @@
From 07bf4eb802166edc737f2c742f3987a1aa39189e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 12 Nov 2013 15:04:15 +0100
Subject: [PATCH] keyfile: don't crash when in-memory-only connections don't
have paths
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the connection has never been saved to disk, it won't have a path yet,
but that doesn't mean we should crash. Next, when reloading connections,
only try to do connection matching on connections that have paths, otherwise
all in-memory-only connections would be removed at the end of
read_connections().
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/plugins/keyfile/plugin.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/settings/plugins/keyfile/plugin.c b/src/settings/plugins/keyfile/plugin.c
index c5fb9e0..950f566 100644
--- a/src/settings/plugins/keyfile/plugin.c
+++ b/src/settings/plugins/keyfile/plugin.c
@@ -16,7 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2008 Novell, Inc.
- * Copyright (C) 2008 - 2012 Red Hat, Inc.
+ * Copyright (C) 2008 - 2013 Red Hat, Inc.
*/
#include <config.h>
@@ -345,8 +345,11 @@ read_connections (NMSystemConfigInterface *config)
oldconns = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
g_hash_table_iter_init (&iter, priv->connections);
- while (g_hash_table_iter_next (&iter, NULL, &data))
- g_hash_table_insert (oldconns, g_strdup (nm_keyfile_connection_get_path (data)), data);
+ while (g_hash_table_iter_next (&iter, NULL, &data)) {
+ const char *con_path = nm_keyfile_connection_get_path (data);
+ if (con_path)
+ g_hash_table_insert (oldconns, g_strdup (con_path), data);
+ }
while ((item = g_dir_read_name (dir))) {
NMKeyfileConnection *connection;
--
1.7.11.7

View File

@ -0,0 +1,272 @@
From fafbc0388636379414caa3b8cb9de14b9a60c551 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 12 Mar 2014 13:34:13 +0100
Subject: [PATCH 1/4] nm-online: fix nm-online to report online status
correctly (rh #1054364)
This fixes a behaviour change made by 44ac1020daccfeeb1dc88566adda6e5d8bd87aea.
That commit make nm-online to wait for NM finishing startup instead of waiting
for a real connection. So for NetworkManager fully initialized, but
disconnected nm-online would return 0.
$ nmcli -f RUNNING,STATE,STARTUP,CONNECTIVITY gen status
RUNNING STATE STARTUP CONNECTIVITY
running disconnected started none
Revert back to the original behaviour of waiting for a connection. And
introduce a new option '--wait-for-startup' waiting for NetworkManager
finishing its startup, which is useful in some cases, like
NetworkManager-wait-online.service.
https://bugzilla.redhat.com/show_bug.cgi?id=1054364
(cherry picked from commit 20fb078dd6b10c10539f62449ac2a0b36f0e67ce)
---
man/nm-online.1.in | 7 +++++--
test/nm-online.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/man/nm-online.1.in b/man/nm-online.1.in
index 941f006..ddb2b17 100644
--- a/man/nm-online.1.in
+++ b/man/nm-online.1.in
@@ -19,9 +19,9 @@
.\" with this manual; if not, write to the Free Software Foundation, Inc.,
.\" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\"
-.\" Copyright (C) 2010 Red Hat, Inc.
+.\" Copyright (C) 2010 - 2014 Red Hat, Inc.
.\"
-.TH NM-ONLINE "1" "11 July 2013"
+.TH NM-ONLINE "1" "25 March 2014"
.SH NAME
nm-online \- ask NetworkManager whether the network is connected
@@ -47,6 +47,9 @@ Exit immediately if NetworkManager is not running or connecting.
.TP
.B \-q, \-\-quiet
Don't print anything.
+.TP
+.B \-s, \-\-wait-for-startup
+Wait for NetworkManager finishing its startup instead of establishing a connection.
.SH EXIT STATUS
diff --git a/test/nm-online.c b/test/nm-online.c
index 7df66c2..03737b2 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -15,6 +15,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright (C) 2006 - 2008 Novell, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*
*/
@@ -42,6 +43,7 @@
#include "nm-client.h"
#define PROGRESS_STEPS 15
+#define WAIT_STARTUP_TAG "wait-startup"
typedef struct
{
@@ -56,11 +58,22 @@ client_properties_changed (GObject *object,
gpointer loop)
{
NMClient *client = NM_CLIENT (object);
+ NMState state;
+ gboolean wait_startup = GPOINTER_TO_UINT (g_object_get_data (object, WAIT_STARTUP_TAG));
if (!nm_client_get_manager_running (client))
return;
- if (!nm_client_get_startup (client))
- g_main_loop_quit (loop);
+
+ if (wait_startup) {
+ if (!nm_client_get_startup (client))
+ g_main_loop_quit (loop);
+ } else {
+ state = nm_client_get_state (client);
+ if ( state == NM_STATE_CONNECTED_LOCAL
+ || state == NM_STATE_CONNECTED_SITE
+ || state == NM_STATE_CONNECTED_GLOBAL)
+ g_main_loop_quit (loop);
+ }
}
static gboolean
@@ -94,16 +107,19 @@ main (int argc, char *argv[])
gint t_secs = -1;
gboolean exit_no_nm = FALSE;
gboolean quiet = FALSE;
+ gboolean wait_startup = FALSE;
Timeout timeout;
GOptionContext *opt_ctx = NULL;
gboolean success;
NMClient *client;
+ NMState state = NM_STATE_UNKNOWN;
GMainLoop *loop;
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running"), NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
+ {"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
};
@@ -147,13 +163,35 @@ main (int argc, char *argv[])
client = nm_client_new ();
+ g_object_set_data (G_OBJECT (client), WAIT_STARTUP_TAG, GUINT_TO_POINTER (wait_startup));
+ state = nm_client_get_state (client);
if (!nm_client_get_manager_running (client)) {
- if (exit_no_nm)
+ if (exit_no_nm) {
+ g_object_unref (client);
return 1;
- } else if (!nm_client_get_startup (client))
- return 0;
- if (!timeout.value)
+ }
+ } else if (wait_startup) {
+ if (!nm_client_get_startup (client)) {
+ g_object_unref (client);
+ return 0;
+ }
+ } else {
+ if ( state == NM_STATE_CONNECTED_LOCAL
+ || state == NM_STATE_CONNECTED_SITE
+ || state == NM_STATE_CONNECTED_GLOBAL) {
+ g_object_unref (client);
+ return 0;
+ }
+ }
+ if (exit_no_nm && (state != NM_STATE_CONNECTING)) {
+ g_object_unref (client);
return 1;
+ }
+
+ if (!timeout.value) {
+ g_object_unref (client);
+ return 1;
+ }
timeout.norm = (double) timeout.value / (double) PROGRESS_STEPS;
g_timeout_add_seconds (1, handle_timeout, &timeout);
--
1.9.0
From f247a3c86e71d7ae419c3401fff310d2e836a2ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 26 Mar 2014 18:14:04 +0100
Subject: [PATCH 2/4] systemd: update NetworkManager-wait-online.service to
wait for startup
(cherry picked from commit 520d2814ba720cf8aee9d6f91fca4e3ea0d8555f)
---
data/NetworkManager-wait-online-systemd-pre200.service.in | 2 +-
data/NetworkManager-wait-online.service.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/data/NetworkManager-wait-online-systemd-pre200.service.in b/data/NetworkManager-wait-online-systemd-pre200.service.in
index fd9be41..d145a79 100644
--- a/data/NetworkManager-wait-online-systemd-pre200.service.in
+++ b/data/NetworkManager-wait-online-systemd-pre200.service.in
@@ -7,7 +7,7 @@ Before=network.target
[Service]
Type=oneshot
-ExecStart=@bindir@/nm-online -q --timeout=30
+ExecStart=@bindir@/nm-online -s -q --timeout=30
[Install]
WantedBy=network.target
diff --git a/data/NetworkManager-wait-online.service.in b/data/NetworkManager-wait-online.service.in
index b81c5b0..6ad6942 100644
--- a/data/NetworkManager-wait-online.service.in
+++ b/data/NetworkManager-wait-online.service.in
@@ -7,7 +7,7 @@ Before=network.target network-online.target
[Service]
Type=oneshot
-ExecStart=@bindir@/nm-online -q --timeout=30
+ExecStart=@bindir@/nm-online -s -q --timeout=30
[Install]
WantedBy=multi-user.target
--
1.9.0
From 749647f7ab034eb7eb43877fe957cc71a82d9773 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 25 Mar 2014 10:13:08 +0100
Subject: [PATCH 3/4] trivial: correct nm-online's '--exit' option description
(cherry picked from commit ea962ce4112ccf3b25efe5b9661c1a48090dc4e4)
---
test/nm-online.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/nm-online.c b/test/nm-online.c
index 03737b2..53b0465 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -117,7 +117,7 @@ main (int argc, char *argv[])
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
- {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running"), NULL},
+ {"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
--
1.9.0
From f3804ce1e2a0229a6ef32cb1ddb0d750822fb2d8 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 12 Mar 2014 14:44:27 +0100
Subject: [PATCH 4/4] nm-online: fix considering the --quiet option
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit 0a85bff70a65d5a205b56bc9f74fc2b0237ad05a)
---
test/nm-online.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/nm-online.c b/test/nm-online.c
index 53b0465..681df18 100644
--- a/test/nm-online.c
+++ b/test/nm-online.c
@@ -106,7 +106,6 @@ main (int argc, char *argv[])
{
gint t_secs = -1;
gboolean exit_no_nm = FALSE;
- gboolean quiet = FALSE;
gboolean wait_startup = FALSE;
Timeout timeout;
GOptionContext *opt_ctx = NULL;
@@ -118,11 +117,13 @@ main (int argc, char *argv[])
GOptionEntry options[] = {
{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, N_("Time to wait for a connection, in seconds (without the option, default value is 30)"), "<timeout>"},
{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, N_("Exit immediately if NetworkManager is not running or connecting"), NULL},
- {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, N_("Don't print anything"), NULL},
+ {"quiet", 'q', 0, G_OPTION_ARG_NONE, &timeout.quiet, N_("Don't print anything"), NULL},
{"wait-for-startup", 's', 0, G_OPTION_ARG_NONE, &wait_startup, N_("Wait for NetworkManager startup instead of a connection"), NULL},
{NULL}
};
+ timeout.quiet = FALSE;
+
/* Set locale to be able to use environment variables */
setlocale (LC_ALL, "");
--
1.9.0

View File

@ -0,0 +1,81 @@
From 2cea29f22882571ac92fedccd3cbe664d31eab10 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 11 Feb 2014 13:58:17 +0100
Subject: [PATCH 1/1] settings: free memory in finalize(), not in dispose() in
NMSecretAgent (rh #1061911)
Even if the code changed in master compared to the bug report, the issues would
still occur when we freed members in dispose.
https://bugzilla.redhat.com/show_bug.cgi?id=1061911
(cherry picked from commit 4141e69b3a368f5b450fbc99a37557f77ef2fd08)
Conflicts:
src/settings/nm-secret-agent.c
---
src/settings/nm-secret-agent.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/src/settings/nm-secret-agent.c b/src/settings/nm-secret-agent.c
index 5a8a73f..c7c1a26 100644
--- a/src/settings/nm-secret-agent.c
+++ b/src/settings/nm-secret-agent.c
@@ -40,8 +40,6 @@ G_DEFINE_TYPE (NMSecretAgent, nm_secret_agent, G_TYPE_OBJECT)
NMSecretAgentPrivate))
typedef struct {
- gboolean disposed;
-
char *description;
char *owner;
char *identifier;
@@ -499,25 +497,25 @@ nm_secret_agent_init (NMSecretAgent *self)
static void
dispose (GObject *object)
{
- NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
-
- if (!priv->disposed) {
- priv->disposed = TRUE;
+ proxy_cleanup (NM_SECRET_AGENT (object));
- g_free (priv->description);
- g_free (priv->owner);
- g_free (priv->identifier);
- g_free (priv->owner_username);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+}
- g_slist_foreach (priv->permissions, (GFunc) g_free, NULL);
- g_slist_free (priv->permissions);
+static void
+finalize (GObject *object)
+{
+ NMSecretAgentPrivate *priv = NM_SECRET_AGENT_GET_PRIVATE (object);
- g_hash_table_destroy (priv->requests);
+ g_free (priv->description);
+ g_free (priv->owner);
+ g_free (priv->identifier);
+ g_free (priv->owner_username);
- proxy_cleanup (NM_SECRET_AGENT (object));
- }
+ g_slist_free_full (priv->permissions, g_free);
+ g_hash_table_destroy (priv->requests);
- G_OBJECT_CLASS (nm_secret_agent_parent_class)->dispose (object);
+ G_OBJECT_CLASS (nm_secret_agent_parent_class)->finalize (object);
}
static void
@@ -529,5 +527,6 @@ nm_secret_agent_class_init (NMSecretAgentClass *config_class)
/* virtual methods */
object_class->dispose = dispose;
+ object_class->finalize = finalize;
}
--
1.9.0

View File

@ -0,0 +1,55 @@
From d4e54f22ff4550b27f0c2953191f65a69bdb814c Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 4 Apr 2014 16:14:46 +0200
Subject: [PATCH 1/1] platform: workaround older kernels that don't accept
extended address flags via netlink
Extended address flags are represented by the additional netlink
attribute IFA_FLAGS. Older kernels don't know this flag and refuse
the messages RTM_NEWADDR and RTMDEL_ADDR when it contains unknown
attributes. See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was
fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.
libnl was fixed in commit 5206c050504f8676a24854519b9c351470fb7cc6 only to
send the additional netlink attribute, when there are actually flags
that make this necessary.
This commit changes nm-platform to strip the flags to &= 0xFF, if we detect
that the kernel does not understand extended address flags.
https://bugzilla.redhat.com/show_bug.cgi?id=1063885
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit dac51747ab5853b00557d7d97d4b2eae05968c03)
---
src/platform/nm-linux-platform.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index b5e3618..dacdc16 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2405,8 +2405,19 @@ build_rtnl_addr (int family,
rtnl_addr_set_valid_lifetime (rtnladdr, lifetime);
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
}
- if (flags)
+ if (flags) {
+ if ((flags & ~0xFF) && !check_support_kernel_extended_ifa_flags (nm_platform_get ())) {
+ /* Older kernels don't accept unknown netlink attributes.
+ *
+ * With commit libnl commit 5206c050504f8676a24854519b9c351470fb7cc6, libnl will only set
+ * the extended address flags attribute IFA_FLAGS when necessary (> 8 bit). But it's up to
+ * us not to shove those extended flags on to older kernels.
+ *
+ * Just silently clear them. The kernel should ignore those unknown flags anyway. */
+ flags &= 0xFF;
+ }
rtnl_addr_set_flags (rtnladdr, flags);
+ }
return (struct nl_object *) rtnladdr;
}
--
1.9.0

View File

@ -0,0 +1,873 @@
From c1dfa412dccec7ce2a27a1da36b2e0e4679cbc6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 14:53:00 +0200
Subject: [PATCH 1/5] trivial: make clear the maximum bitrate is in kbit/s
(cherry picked from commit 759236681ca1d1a472c136aef4c571a0ee954056)
---
libnm-glib/nm-access-point.c | 6 +++---
libnm-glib/nm-device-wifi.c | 6 +++---
src/nm-wifi-ap.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c
index 56dcb11..6c090c0 100644
--- a/libnm-glib/nm-access-point.c
+++ b/libnm-glib/nm-access-point.c
@@ -236,9 +236,9 @@ nm_access_point_get_mode (NMAccessPoint *ap)
* nm_access_point_get_max_bitrate:
* @ap: a #NMAccessPoint
*
- * Gets the maximum bit rate of the access point.
+ * Gets the maximum bit rate of the access point in kbit/s.
*
- * Returns: the maximum bit rate
+ * Returns: the maximum bit rate (kbit/s)
**/
guint32
nm_access_point_get_max_bitrate (NMAccessPoint *ap)
@@ -661,7 +661,7 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
/**
* NMAccessPoint:max-bitrate:
*
- * The maximum bit rate of the access point.
+ * The maximum bit rate of the access point in kbit/s.
**/
g_object_class_install_property
(object_class, PROP_MAX_BITRATE,
diff --git a/libnm-glib/nm-device-wifi.c b/libnm-glib/nm-device-wifi.c
index cda8eb0..8ffdf42 100644
--- a/libnm-glib/nm-device-wifi.c
+++ b/libnm-glib/nm-device-wifi.c
@@ -185,9 +185,9 @@ nm_device_wifi_get_mode (NMDeviceWifi *device)
* nm_device_wifi_get_bitrate:
* @device: a #NMDeviceWifi
*
- * Gets the bit rate of the #NMDeviceWifi.
+ * Gets the bit rate of the #NMDeviceWifi in kbit/s.
*
- * Returns: the bit rate
+ * Returns: the bit rate (kbit/s)
**/
guint32
nm_device_wifi_get_bitrate (NMDeviceWifi *device)
@@ -744,7 +744,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
/**
* NMDeviceWifi:bitrate:
*
- * The bit rate of the device.
+ * The bit rate of the device in kbit/s.
**/
g_object_class_install_property
(object_class, PROP_BITRATE,
diff --git a/src/nm-wifi-ap.c b/src/nm-wifi-ap.c
index fb12754..06be315 100644
--- a/src/nm-wifi-ap.c
+++ b/src/nm-wifi-ap.c
@@ -1023,7 +1023,7 @@ nm_ap_set_freq (NMAccessPoint *ap,
/*
- * Get/set functions for max bitrate
+ * Get/set functions for max bitrate (in kbit/s)
*
*/
guint32 nm_ap_get_max_bitrate (NMAccessPoint *ap)
--
1.9.0
From 0bcda31fe413ee681b02ce131fa3d47f319861f1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 14:56:32 +0200
Subject: [PATCH 2/5] nmcli: use correct Mbit/s units for maximal bitrate (rh
#1080474)
https://bugzilla.redhat.com/show_bug.cgi?id=1080474
(cherry picked from commit c1e5493117dac1c57e02b0f30c12a0f8903133c3)
---
cli/src/devices.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cli/src/devices.c b/cli/src/devices.c
index bcbf287..03eefbc 100644
--- a/cli/src/devices.c
+++ b/cli/src/devices.c
@@ -433,7 +433,7 @@ fill_output_access_point (gpointer data, gpointer user_data)
}
channel_str = g_strdup_printf ("%u", nm_utils_wifi_freq_to_channel (freq));
freq_str = g_strdup_printf (_("%u MHz"), freq);
- bitrate_str = g_strdup_printf (_("%u MB/s"), bitrate/1000);
+ bitrate_str = g_strdup_printf (_("%u Mbit/s"), bitrate/1000);
strength_str = g_strdup_printf ("%u", strength);
wpa_flags_str = ap_wpa_rsn_flags_to_string (wpa_flags);
rsn_flags_str = ap_wpa_rsn_flags_to_string (rsn_flags);
--
1.9.0
From 73abea116465955c64550e49629159ed7098a63f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:07:22 +0200
Subject: [PATCH 3/5] examples: use correct Mbit/s for bitrates
(cherry picked from commit 7211d82f7726824f7967242a104aa3a1f2fed4b3)
---
examples/C/glib/get-ap-info-libnm-glib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/examples/C/glib/get-ap-info-libnm-glib.c b/examples/C/glib/get-ap-info-libnm-glib.c
index e72ce54..c144be2 100644
--- a/examples/C/glib/get-ap-info-libnm-glib.c
+++ b/examples/C/glib/get-ap-info-libnm-glib.c
@@ -105,7 +105,7 @@ show_access_point_info (NMAccessPoint *ap)
/* Convert to strings */
ssid_str = nm_utils_ssid_to_utf8 (ssid);
freq_str = g_strdup_printf ("%u MHz", freq);
- bitrate_str = g_strdup_printf ("%u MB/s", bitrate/1000);
+ bitrate_str = g_strdup_printf ("%u Mbit/s", bitrate/1000);
strength_str = g_strdup_printf ("%u", strength);
wpa_flags_str = ap_wpa_rsn_flags_to_string (wpa_flags);
rsn_flags_str = ap_wpa_rsn_flags_to_string (rsn_flags);
@@ -178,7 +178,7 @@ show_wifi_device_info (NMDevice *device)
speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (device));
speed /= 1000;
- printf ("Device: %s ---- Driver: %s ---- Speed: %d MB/s ---- Active AP: %s\n",
+ printf ("Device: %s ---- Driver: %s ---- Speed: %d Mbit/s ---- Active AP: %s\n",
iface, driver, speed, active_ssid_str ? active_ssid_str : "none");
printf ("=================================================================================\n");
g_free (active_ssid_str);
--
1.9.0
From 884fb928636176fd9dc6c6e6bc5e0935c2411e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:09:34 +0200
Subject: [PATCH 4/5] man: use correct Mbit/s for maximum bitrate in
nmcli-examples
(cherry picked from commit b3cbb260ef601a37a7d986563f02646e1b00d660)
Conflicts:
man/nmcli-examples.xml
---
man/nmcli-examples.5 | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/man/nmcli-examples.5 b/man/nmcli-examples.5
index 9d05ec6..44b5f4e 100644
--- a/man/nmcli-examples.5
+++ b/man/nmcli-examples.5
@@ -64,17 +64,17 @@ $ nmcli device wifi list
.\}
.nf
* SSID MODE CHAN RATE SIGNAL BARS SECURITY
- netdatacomm_local Infra 6 54 MB/s 37 ▂▄__ WEP
-* F1 Infra 11 54 MB/s 98 ▂▄▆█ WPA1
- LoremCorp Infra 1 54 MB/s 62 ▂▄▆_ WPA2 802\&.1X
- Internet Infra 6 54 MB/s 29 ▂___ WPA1
- HPB110a\&.F2672A Ad\-Hoc 6 54 MB/s 22 ▂___ \-\-
- Jozinet Infra 1 54 MB/s 19 ▂___ WEP
- VOIP Infra 1 54 MB/s 20 ▂___ WEP
- MARTINA Infra 4 54 MB/s 32 ▂▄__ WPA2
- N24PU1 Infra 7 11 MB/s 22 ▂___ \-\-
- alfa Infra 1 54 MB/s 67 ▂▄▆_ WPA2
- bertnet Infra 5 54 MB/s 20 ▂___ WPA1 WPA2
+ netdatacomm_local Infra 6 54 MBit/s 37 ▂▄__ WEP
+* F1 Infra 11 54 MBit/s 98 ▂▄▆█ WPA1
+ LoremCorp Infra 1 54 MBit/s 62 ▂▄▆_ WPA2 802\&.1X
+ Internet Infra 6 54 MBit/s 29 ▂___ WPA1
+ HPB110a\&.F2672A Ad\-Hoc 6 54 MBit/s 22 ▂___ \-\-
+ Jozinet Infra 1 54 MBit/s 19 ▂___ WEP
+ VOIP Infra 1 54 MBit/s 20 ▂___ WEP
+ MARTINA Infra 4 54 MBit/s 32 ▂▄__ WPA2
+ N24PU1 Infra 7 11 MBit/s 22 ▂___ \-\-
+ alfa Infra 1 54 MBit/s 67 ▂▄▆_ WPA2
+ bertnet Infra 5 54 MBit/s 20 ▂___ WPA1 WPA2
.fi
.if n \{\
--
1.9.0
From 88c40d47437cfa25d7a5075923096ba6c067bcfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 1 Apr 2014 15:12:09 +0200
Subject: [PATCH 5/5] po: fix "MB/s" -> "Mbit/s"
(cherry picked from commit cb80daa94225b5ef459b503768fa63463b33a5de)
Conflicts:
po/as.po
po/uk.po
---
po/as.po | 4 ++--
po/bg.po | 4 ++--
po/bn_IN.po | 2 +-
po/ca.po | 4 ++--
po/cs.po | 4 ++--
po/da.po | 4 ++--
po/de.po | 4 ++--
po/el.po | 4 ++--
po/en_GB.po | 4 ++--
po/eo.po | 4 ++--
po/es.po | 4 ++--
po/eu.po | 4 ++--
po/fi.po | 2 +-
po/fr.po | 2 +-
po/gl.po | 4 ++--
po/gu.po | 4 ++--
po/hi.po | 4 ++--
po/hr.po | 4 ++--
po/hu.po | 4 ++--
po/id.po | 4 ++--
po/it.po | 4 ++--
po/ja.po | 4 ++--
po/kn.po | 4 ++--
po/ko.po | 4 ++--
po/lt.po | 4 ++--
po/ml.po | 4 ++--
po/mr.po | 4 ++--
po/or.po | 4 ++--
po/pa.po | 4 ++--
po/pl.po | 4 ++--
po/pt_BR.po | 4 ++--
po/ru.po | 2 +-
po/sl.po | 4 ++--
po/sr.po | 4 ++--
po/sr@latin.po | 4 ++--
po/sv.po | 4 ++--
po/ta.po | 4 ++--
po/te.po | 4 ++--
po/tr.po | 4 ++--
po/uk.po | 2 +-
po/zh_CN.po | 4 ++--
po/zh_TW.po | 4 ++--
42 files changed, 79 insertions(+), 79 deletions(-)
diff --git a/po/as.po b/po/as.po
index 2e62dff..c6dc17b 100644
--- a/po/as.po
+++ b/po/as.po
@@ -1723,8 +1723,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u MBit/s"
+msgstr "%u MBit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/bg.po b/po/bg.po
index cda45f1..0269643 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -774,8 +774,8 @@ msgstr "%uMHz"
#: ../cli/src/devices.c:431
#, c-format
-msgid "%u MB/s"
-msgstr "%uMB/s"
+msgid "%u Mbit/s"
+msgstr "%uMbit/s"
#: ../cli/src/devices.c:440
msgid "Encrypted: "
diff --git a/po/bn_IN.po b/po/bn_IN.po
index 6d3f830..02a511d 100644
--- a/po/bn_IN.po
+++ b/po/bn_IN.po
@@ -1170,7 +1170,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:401
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u মেগাবাইট/সেকেন্ড"
#: ../cli/src/devices.c:410
diff --git a/po/ca.po b/po/ca.po
index d4e6c8e..c3940b9 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -766,8 +766,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:431
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:440
msgid "Encrypted: "
diff --git a/po/cs.po b/po/cs.po
index 0cb1482..25b2be1 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -820,8 +820,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:470
msgid "Encrypted: "
diff --git a/po/da.po b/po/da.po
index bbcde42..82f456c 100644
--- a/po/da.po
+++ b/po/da.po
@@ -797,8 +797,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:395
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:404
msgid "Encrypted: "
diff --git a/po/de.po b/po/de.po
index 3eb730e..2162091 100644
--- a/po/de.po
+++ b/po/de.po
@@ -2701,8 +2701,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/el.po b/po/el.po
index 355249d..db8cf54 100644
--- a/po/el.po
+++ b/po/el.po
@@ -1160,8 +1160,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/en_GB.po b/po/en_GB.po
index 32235ce..3997ed5 100644
--- a/po/en_GB.po
+++ b/po/en_GB.po
@@ -1157,8 +1157,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/eo.po b/po/eo.po
index 0284ae6..c466a5d 100644
--- a/po/eo.po
+++ b/po/eo.po
@@ -1122,8 +1122,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:557
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:566
msgid "Encrypted: "
diff --git a/po/es.po b/po/es.po
index 5c1bde6..7b72529 100644
--- a/po/es.po
+++ b/po/es.po
@@ -814,8 +814,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:470
msgid "Encrypted: "
diff --git a/po/eu.po b/po/eu.po
index 68b8204..20026f9 100644
--- a/po/eu.po
+++ b/po/eu.po
@@ -638,8 +638,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:863
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:869 ../cli/src/devices.c:871
msgid "AP parameters"
diff --git a/po/fi.po b/po/fi.po
index 8a7517f..b4deae7 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -761,7 +761,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr ""
#: ../cli/src/devices.c:470
diff --git a/po/fr.po b/po/fr.po
index b56bf3f..378831e 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -787,7 +787,7 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:461
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u Mo/s"
#: ../cli/src/devices.c:470
diff --git a/po/gl.po b/po/gl.po
index 310b66f..5dc613d 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -1210,8 +1210,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:404
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:413
msgid "Encrypted: "
diff --git a/po/gu.po b/po/gu.po
index 9459218..eb3a185 100644
--- a/po/gu.po
+++ b/po/gu.po
@@ -1713,8 +1713,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/hi.po b/po/hi.po
index aa0b3bf..c6e7938 100644
--- a/po/hi.po
+++ b/po/hi.po
@@ -1267,8 +1267,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/hr.po b/po/hr.po
index 4e24565..3cc5e45 100644
--- a/po/hr.po
+++ b/po/hr.po
@@ -794,8 +794,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:471
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:480
msgid "Encrypted: "
diff --git a/po/hu.po b/po/hu.po
index 237cce7..00d95bc 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -1257,8 +1257,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/id.po b/po/id.po
index 42cc406..0288338 100644
--- a/po/id.po
+++ b/po/id.po
@@ -1135,8 +1135,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/it.po b/po/it.po
index 6b2eb9e..867109a 100644
--- a/po/it.po
+++ b/po/it.po
@@ -2400,8 +2400,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ja.po b/po/ja.po
index 02d7515..ddf8578 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -2671,8 +2671,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/kn.po b/po/kn.po
index e19c121..a1891fd 100644
--- a/po/kn.po
+++ b/po/kn.po
@@ -1665,8 +1665,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ko.po b/po/ko.po
index ba6bb0b..a5e95b4 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -780,8 +780,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:471
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:480
msgid "Encrypted: "
diff --git a/po/lt.po b/po/lt.po
index 8b17832..bfa26a1 100644
--- a/po/lt.po
+++ b/po/lt.po
@@ -2837,8 +2837,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ml.po b/po/ml.po
index f5d6841..7a289a2 100644
--- a/po/ml.po
+++ b/po/ml.po
@@ -1211,8 +1211,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/mr.po b/po/mr.po
index 45c81fc..e202592 100644
--- a/po/mr.po
+++ b/po/mr.po
@@ -2491,8 +2491,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/or.po b/po/or.po
index ed220ec..5801d61 100644
--- a/po/or.po
+++ b/po/or.po
@@ -1727,8 +1727,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:417
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:426
msgid "Encrypted: "
diff --git a/po/pa.po b/po/pa.po
index 0fd0275..3b8ee45 100644
--- a/po/pa.po
+++ b/po/pa.po
@@ -1213,8 +1213,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/pl.po b/po/pl.po
index 7686ae4..9711670 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -2743,8 +2743,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index e188af3..b4008b5 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -2753,8 +2753,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/ru.po b/po/ru.po
index 56f3fce..490f69d 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -1165,7 +1165,7 @@ msgstr "%u МГц"
#: ../cli/src/devices.c:400
#, c-format
-msgid "%u MB/s"
+msgid "%u Mbit/s"
msgstr "%u МБ/с"
#: ../cli/src/devices.c:409
diff --git a/po/sl.po b/po/sl.po
index 744beb3..ddd4e08 100644
--- a/po/sl.po
+++ b/po/sl.po
@@ -1274,8 +1274,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:380
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:389
msgid "Encrypted: "
diff --git a/po/sr.po b/po/sr.po
index 160630c..baefbaf 100644
--- a/po/sr.po
+++ b/po/sr.po
@@ -711,8 +711,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/sr@latin.po b/po/sr@latin.po
index 3158fac..b4f9f28 100644
--- a/po/sr@latin.po
+++ b/po/sr@latin.po
@@ -711,8 +711,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/sv.po b/po/sv.po
index 9f66eb6..7bcc960 100644
--- a/po/sv.po
+++ b/po/sv.po
@@ -1229,8 +1229,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:557
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:566
msgid "Encrypted: "
diff --git a/po/ta.po b/po/ta.po
index 058b8fd..16ba218 100644
--- a/po/ta.po
+++ b/po/ta.po
@@ -1266,8 +1266,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/te.po b/po/te.po
index 5ba12a0..d4fa28d 100644
--- a/po/te.po
+++ b/po/te.po
@@ -1753,8 +1753,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:433
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:452
msgid "WPA1"
diff --git a/po/tr.po b/po/tr.po
index 867c95e..713163b 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -1231,8 +1231,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:427
msgid "Encrypted: "
diff --git a/po/uk.po b/po/uk.po
index 8891829..c92e757 100644
--- a/po/uk.po
+++ b/po/uk.po
@@ -1215,7 +1215,7 @@ msgstr "%u МГц"
#: ../cli/src/devices.c:418
#, c-format
-msgid "%u MB/s"
+msgid "%u MBit/s"
msgstr "%u МБ/с"
#: ../cli/src/devices.c:427
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 5f4b64f..742e084 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -708,8 +708,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:394
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:403
msgid "Encrypted: "
diff --git a/po/zh_TW.po b/po/zh_TW.po
index d6e530f..7d5e1fe 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -698,8 +698,8 @@ msgstr "%u MHz"
#: ../cli/src/devices.c:350
#, c-format
-msgid "%u MB/s"
-msgstr "%u MB/s"
+msgid "%u Mbit/s"
+msgstr "%u Mbit/s"
#: ../cli/src/devices.c:359
msgid "Encrypted: "
--
1.9.0

View File

@ -0,0 +1,67 @@
From 6e99f5d9850d06cb2743c906843b429cb02173d2 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Fri, 4 Apr 2014 14:55:37 +0200
Subject: [PATCH] core: fix hanging pending_action "queued state lock"
This bug caused nm-online to hang because "startup complete" state
is never reached. Sometimes you also see this error in the logfile:
<warn> (em1): add_pending_action (3): 'queued state lock' already added
file devices/nm-device.c: line 7178 (nm_device_add_pending_action): should not be reached
https://bugzilla.redhat.com/show_bug.cgi?id=1084554
https://bugzilla.redhat.com/show_bug.cgi?id=1084556
Related: https://bugzilla.redhat.com/show_bug.cgi?id=1082045
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit fc1351504db557b942c121b480fca661162702f7)
---
src/devices/nm-device.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index c7f72b8..9cb79f2 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -6485,29 +6485,25 @@ nm_device_queue_state (NMDevice *self,
priv = NM_DEVICE_GET_PRIVATE (self);
- /* "lock" the pending actions so that if there was a previously
- * queued action that's about to be cleared, that doesn't drop
- * the pending actions to 0 before we add the new pending action.
- */
- nm_device_add_pending_action (self, "queued state lock");
+ if (priv->queued_state.id && priv->queued_state.state == state)
+ return;
+
+ /* Add pending action for the new state before clearing the queued states, so
+ * that we don't accidently pop all pending states and reach 'startup complete' */
+ nm_device_add_pending_action (self, queued_state_to_string (state));
/* We should only ever have one delayed state transition at a time */
if (priv->queued_state.id) {
- if (priv->queued_state.state == state)
- return;
nm_log_warn (LOGD_DEVICE, "(%s): overwriting previously queued state change to %s (%s)",
- nm_device_get_iface (self),
- state_to_string (priv->queued_state.state),
- reason_to_string (priv->queued_state.reason));
+ nm_device_get_iface (self),
+ state_to_string (priv->queued_state.state),
+ reason_to_string (priv->queued_state.reason));
nm_device_queued_state_clear (self);
}
priv->queued_state.state = state;
priv->queued_state.reason = reason;
priv->queued_state.id = g_idle_add (queued_set_state, self);
- nm_device_add_pending_action (self, queued_state_to_string (state));
-
- nm_device_remove_pending_action (self, "queued state lock");
nm_log_dbg (LOGD_DEVICE, "(%s): queued state change to %s due to %s (id %d)",
nm_device_get_iface (self), state_to_string (state), reason_to_string (reason),
--
1.9.0

View File

@ -0,0 +1,29 @@
From 12b46b77359115a32ac406794586b886d8cb2587 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 18 Mar 2014 15:37:12 -0500
Subject: [PATCH 1/1] core: emit PropertyChanged signal for ActiveConnection
when disconnecting
(cherry picked from commit 73d128bbd17120225bb4986e3f05566f10fab581)
Conflicts:
src/devices/nm-device.c
---
src/devices/nm-device.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 9cb79f2..e50e1c2 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4364,6 +4364,7 @@ clear_act_request (NMDevice *self)
g_object_unref (priv->act_request);
priv->act_request = NULL;
+ g_object_notify (G_OBJECT (self), NM_DEVICE_ACTIVE_CONNECTION);
}
static void
--
1.9.0

View File

@ -0,0 +1,32 @@
This patch fixes rh #1086132. It is an extracted part of bigger upstream patch 97935382.
diff -up NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c.foo
--- NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c 2013-10-01 20:43:57.000000000 +0200
+++ NetworkManager-0.9.9.0/src/nm-wifi-ap-utils.c.foo 2014-04-10 10:33:52.556199775 +0200
@@ -302,7 +302,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
/* Ad-Hoc WPA requires 'wpa' proto, 'none' pairwise, and 'tkip' group */
n = nm_setting_wireless_security_get_num_protos (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_proto (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "wpa")) {
+ if (n > 1 || g_strcmp0 (tmp, "wpa")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
@@ -312,7 +312,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
n = nm_setting_wireless_security_get_num_pairwise (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_pairwise (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "none")) {
+ if (n > 1 || g_strcmp0 (tmp, "none")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,
@@ -322,7 +322,7 @@ verify_wpa_psk (NMSettingWirelessSecurit
n = nm_setting_wireless_security_get_num_groups (s_wsec);
tmp = (n > 0) ? nm_setting_wireless_security_get_group (s_wsec, 0) : NULL;
- if (n > 1 || strcmp (tmp, "tkip")) {
+ if (n > 1 || g_strcmp0 (tmp, "tkip")) {
g_set_error_literal (error,
NM_SETTING_WIRELESS_SECURITY_ERROR,
NM_SETTING_WIRELESS_SECURITY_ERROR_INVALID_PROPERTY,

View File

@ -0,0 +1,70 @@
From 5c1dee10cde3cc7cf74718650702dd124d46aa75 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Sun, 9 Feb 2014 03:31:21 -0600
Subject: [PATCH] mobile: only change state to NEED_AUTH during activation (rh
#1058308)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Auth requests only happen during activation and there's no need to
request secrets at any other time. Ensure that the device state
won't change to NEED_AUTH except when activating.
(There's a case in NMModemBroadband where set_mm_enabled()
when the modem is locked may cause this, but we'll solve this
a different way later.)
https://bugzilla.redhat.com/show_bug.cgi?id=1058308
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-bt.c | 10 +++++++++-
src/devices/nm-device-modem.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/devices/nm-device-bt.c b/src/devices/nm-device-bt.c
index e22c96e..3e5b693 100644
--- a/src/devices/nm-device-bt.c
+++ b/src/devices/nm-device-bt.c
@@ -423,7 +423,15 @@ ppp_failed (NMModem *modem, NMDeviceStateReason reason, gpointer user_data)
static void
modem_auth_requested (NMModem *modem, gpointer user_data)
{
- nm_device_state_changed (NM_DEVICE (user_data),
+ NMDevice *device = NM_DEVICE (user_data);
+
+ /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled
+ * during activation.
+ */
+ if (!nm_device_is_activating (device))
+ return;
+
+ nm_device_state_changed (device,
NM_DEVICE_STATE_NEED_AUTH,
NM_DEVICE_STATE_REASON_NONE);
}
diff --git a/src/devices/nm-device-modem.c b/src/devices/nm-device-modem.c
index 0bed60c..e047c03 100644
--- a/src/devices/nm-device-modem.c
+++ b/src/devices/nm-device-modem.c
@@ -113,7 +113,15 @@ modem_prepare_result (NMModem *modem,
static void
modem_auth_requested (NMModem *modem, gpointer user_data)
{
- nm_device_state_changed (NM_DEVICE (user_data),
+ NMDevice *device = NM_DEVICE (user_data);
+
+ /* Auth requests (PIN, PAP/CHAP passwords, etc) only get handled
+ * during activation.
+ */
+ if (!nm_device_is_activating (device))
+ return;
+
+ nm_device_state_changed (device,
NM_DEVICE_STATE_NEED_AUTH,
NM_DEVICE_STATE_REASON_NONE);
}
--
1.7.11.7

View File

@ -0,0 +1,52 @@
From e7570b398c6a658732cdc5cc0566beaf2f23e6fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Tue, 15 Apr 2014 11:51:56 +0200
Subject: [PATCH] policy: check device state before changing it for
secondaries (rh #1055099)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check the previous base device state in process_secondaries() when
making a state change. The device might got disconnected in the meantime and
thus the transition from DISCONNECTED to ACTIVATED or FAILED would have been
incorrect.
https://bugzilla.redhat.com/show_bug.cgi?id=1055099
https://bugzilla.redhat.com/show_bug.cgi?id=1055101
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index f454d90..fa31d6c 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -1087,7 +1087,8 @@ process_secondaries (NMPolicy *policy,
/* None secondary UUID remained -> remove the secondary data item */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
+ if (nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_ACTIVATED, NM_DEVICE_STATE_REASON_NONE);
return;
}
} else {
@@ -1098,8 +1099,10 @@ process_secondaries (NMPolicy *policy,
/* Secondary connection failed -> do not watch other connections */
priv->pending_secondaries = g_slist_remove (priv->pending_secondaries, secondary_data);
pending_secondary_data_free (secondary_data);
- nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
- NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
+ if ( nm_device_get_state (item_device) == NM_DEVICE_STATE_SECONDARIES
+ || nm_device_get_state (item_device) == NM_DEVICE_STATE_ACTIVATED)
+ nm_device_state_changed (item_device, NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_SECONDARY_CONNECTION_FAILED);
return;
}
}
--
1.7.11.7

View File

@ -0,0 +1,33 @@
From 6b6265ebebd7342a0d414bd1370e7af0e472d522 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 8 Nov 2013 15:34:55 -0600
Subject: [PATCH] team: fix possible crash by ensuring teamd context is
cleared
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
teamd_cleanup() might get called multiple times, and since the rest
of the function is safe against multi-calls, make priv->tdc safe
against being called again too.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device-team.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 734cf4d..1fe7caf 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -270,6 +270,7 @@ teamd_cleanup (NMDevice *dev, gboolean device_state_failed)
if (priv->tdc) {
teamdctl_disconnect (priv->tdc);
teamdctl_free (priv->tdc);
+ priv->tdc = NULL;
}
#endif
--
1.7.11.7

View File

@ -0,0 +1,37 @@
From acb6a0d305dddccb6d73575c88aefad60faa173a Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 27 Mar 2014 12:16:46 -0400
Subject: [PATCH] core: update NMManager:devices before emitting
notify::devices (rh #1078720)
NMClient's "devices" property was getting out of sync because the
daemon was emitting "notify" before actually changing the property
value. This resulted in problems with re-activating virtual devices
that had previously been deactivated in gnome-control-center and
anaconda. (And probably gnome-shell and nm-applet?)
---
src/nm-manager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index be2f118..48ce061 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -752,12 +752,12 @@ remove_device (NMManager *manager, NMDevice *device)
g_signal_handlers_disconnect_matched (device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, manager);
nm_settings_device_removed (priv->settings, device);
+ priv->devices = g_slist_remove (priv->devices, device);
+
g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
g_object_unref (device);
- priv->devices = g_slist_remove (priv->devices, device);
-
if (priv->startup)
check_if_startup_complete (manager);
}
--
1.9.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
From f6151a2d43f60414589910357cb6e4ee7cfa0f9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 12 Jun 2014 12:00:33 +0200
Subject: [PATCH] bluetooth: don't crash on switching off bluetooth
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Reproducer:
- activate bluetooth on a computer and a phone
- pair the devices
- $ nmcli con add type blue con-name myphone bt-type panu addr 00:17:EA:84:E7:41
- turn off bluetooth on computer (either with a hardware or software switch)
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/bluetooth/nm-bluez-device.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/bluez-manager/nm-bluez-device.c b/src/bluez-manager/nm-bluez-device.c
index e04e8d4..d81343b 100644
--- a/src/bluez-manager/nm-bluez-device.c
+++ b/src/bluez-manager/nm-bluez-device.c
@@ -410,6 +410,8 @@ bluez_disconnect_cb (GDBusConnection *dbus_connection,
g_error_free (error);
} else
g_variant_unref (variant);
+
+ g_object_unref (NM_BLUEZ_DEVICE (user_data));
}
void
@@ -449,7 +451,7 @@ nm_bluez_device_disconnect (NMBluezDevice *self)
10000,
NULL,
(GAsyncReadyCallback) bluez_disconnect_cb,
- self);
+ g_object_ref (self));
priv->connection_bt_type = NM_BT_CAPABILITY_NONE;
}
--
1.7.11.7

View File

@ -0,0 +1,209 @@
From 593f1aadec7536944efe21a1e8941ced4746df86 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 21 Nov 2013 10:31:28 +0100
Subject: [PATCH 1/2] agents: fix removing requests from hash table while
iterating it
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GLib-CRITICAL **: g_hash_table_iter_next: assertion 'ri->version == ri->hash_table->version' failed
It is not allowed to modify hash table while it is iterated. Unfortunately,
request_remove_agent() may remove the request from the 'requests' hash table,
making it not usable in the loop hash table looping.
We need to store the request into a temporary list and call request_next_agent()
on them later (after the hash loop).
Test case:
1. start NM and nm-applet
2. activate a Wi-Fi WPA connection
3. nm-applet displays a dialog asking for a password
4. kill nm-applet
5. NetworkManager removes the nm-applet's secret agent
and runs into removing the request from hash table in the
iterating loop (via get_complete_cb)
#0 get_complete_cb (parent=0x7f3f250f2970, secrets=0x0, agent_dbus_owner=0x0, agent_username=0x0, error=0x7f3f250f7830, user_data=0x7f3f25020e10)
at settings/nm-agent-manager.c:1111
#1 0x00007f3f23b46ea5 in req_complete_error (error=0x7f3f250f7830, req=0x7f3f250f2970) at settings/nm-agent-manager.c:509
#2 request_next_agent (req=0x7f3f250f2970) at settings/nm-agent-manager.c:615
#3 0x00007f3f23b48596 in request_remove_agent (agent=0x7f3f250f4a20, req=0x7f3f250f2970) at settings/nm-agent-manager.c:631
#4 remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:130
#5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374
#0 0x00007f3f1fb9c4e9 in g_logv (log_domain=0x7f3f1fbfef4e "GLib", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7fff156b77c0) at gmessages.c:989
#1 0x00007f3f1fb9c63f in g_log (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL,
format=format@entry=0x7f3f1fc0889a "%s: assertion '%s' failed") at gmessages.c:1025
#2 0x00007f3f1fb9c679 in g_return_if_fail_warning (log_domain=log_domain@entry=0x7f3f1fbfef4e "GLib",
pretty_function=pretty_function@entry=0x7f3f1fc03c30 <__PRETTY_FUNCTION__.4571> "g_hash_table_iter_next",
expression=expression@entry=0x7f3f1fc038f0 "ri->version == ri->hash_table->version") at gmessages.c:1034
#3 0x00007f3f1fb849c0 in g_hash_table_iter_next (iter=<optimized out>, key=<optimized out>, value=<optimized out>) at ghash.c:733
#4 0x00007f3f23b484e5 in remove_agent (self=<optimized out>, owner=0x7f3f250dbff0 ":1.275") at settings/nm-agent-manager.c:129
#5 0x00007f3f23b4868d in impl_agent_manager_unregister (self=0x7f3f25020e10, context=0x7f3f250f5480) at settings/nm-agent-manager.c:374
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/nm-agent-manager.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 89cfd30..8644293 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2010 - 2011 Red Hat, Inc.
+ * Copyright (C) 2010 - 2013 Red Hat, Inc.
*/
#include <config.h>
@@ -74,7 +74,9 @@ static void request_add_agent (Request *req,
NMSecretAgent *agent,
NMSessionMonitor *session_monitor);
-static void request_remove_agent (Request *req, NMSecretAgent *agent);
+static void request_remove_agent (Request *req, NMSecretAgent *agent, GSList **pending_reqs);
+
+static void request_next_agent (Request *req);
static void impl_agent_manager_register (NMAgentManager *self,
const char *identifier,
@@ -113,6 +115,7 @@ remove_agent (NMAgentManager *self, const char *owner)
NMSecretAgent *agent;
GHashTableIter iter;
gpointer data;
+ GSList *pending_reqs = NULL;
g_return_val_if_fail (owner != NULL, FALSE);
@@ -124,10 +127,17 @@ remove_agent (NMAgentManager *self, const char *owner)
nm_log_dbg (LOGD_AGENTS, "(%s) agent unregistered or disappeared",
nm_secret_agent_get_description (agent));
- /* Remove this agent to any in-progress secrets requests */
+ /* Remove this agent from any in-progress secrets requests */
g_hash_table_iter_init (&iter, priv->requests);
while (g_hash_table_iter_next (&iter, NULL, &data))
- request_remove_agent ((Request *) data, agent);
+ request_remove_agent ((Request *) data, agent, &pending_reqs);
+
+ /* We cannot call request_next_agent() from from within hash iterating loop,
+ * because it may remove the request from the hash table, which invalidates
+ * the iterator. So, only remove the agent from requests. And store the requests
+ * that should be sent to other agent to a temporary list to proceed afterwards.
+ */
+ g_slist_free_full (pending_reqs, (GDestroyNotify) request_next_agent);
/* And dispose of the agent */
g_hash_table_remove (priv->agents, owner);
@@ -619,7 +629,7 @@ request_next_agent (Request *req)
}
static void
-request_remove_agent (Request *req, NMSecretAgent *agent)
+request_remove_agent (Request *req, NMSecretAgent *agent, GSList **pending_reqs)
{
g_return_if_fail (req != NULL);
g_return_if_fail (agent != NULL);
@@ -629,7 +639,7 @@ request_remove_agent (Request *req, NMSecretAgent *agent)
if (agent == req->current) {
nm_log_dbg (LOGD_AGENTS, "(%s) current agent removed from secrets request %p/%s",
nm_secret_agent_get_description (agent), req, req->detail);
- request_next_agent (req);
+ *pending_reqs = g_slist_prepend (*pending_reqs, req);
} else {
nm_log_dbg (LOGD_AGENTS, "(%s) agent removed from secrets request %p/%s",
nm_secret_agent_get_description (agent), req, req->detail);
--
1.7.11.7
From 91a95dd9165023966b4377ad49cd8342eab5d776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 21 Nov 2013 13:40:04 +0100
Subject: [PATCH 2/2] agents: fix crash in nm_secret_agent_cancel_secrets()
(rh #922855)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When request for getting secrets is being freed in request_free(),
cancel_callback is get_cancel_cb(). It uses parent->current as a secret agent
object. However, this object can be already freed and thus there is a problem
getting priv in nm_secret_agent_cancel_secrets:
g_return_if_fail (self != NULL);
priv = NM_SECRET_AGENT_GET_PRIVATE (self);
(gdb) p self
$66 = (NMSecretAgent *) 0x7fae9afd42e0
(gdb) p *self
$67 = {parent = {g_type_instance = {g_class = 0x0}, ref_count = 0, qdata = 0x0}}
#0 nm_secret_agent_cancel_secrets (self=0x7fae9afd42e0, call=0x1) at settings/nm-secret-agent.c:325
#1 0x00007fae9a774882 in request_free (req=0x7fae9afc48f0) at settings/nm-agent-manager.c:496
#2 0x00007fae967b251a in g_hash_table_remove_internal (hash_table=0x7fae9aefdf00, key=0x2, notify=1) at ghash.c:1276
#3 0x00007fae9a72b340 in dispose (object=0x7fae9af77200) at nm-activation-request.c:446
#4 0x00007fae96cbeee8 in g_object_unref (_object=0x7fae9af77200) at gobject.c:3160
#5 0x00007fae9a73d87c in _active_connection_cleanup (user_data=<optimized out>) at nm-manager.c:359
#6 0x00007fae967c32a6 in g_main_dispatch (context=0x7fae9aedb180) at gmain.c:3066
#7 g_main_context_dispatch (context=context@entry=0x7fae9aedb180) at gmain.c:3642
#8 0x00007fae967c3628 in g_main_context_iterate (context=0x7fae9aedb180, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at gmain.c:3713
#9 0x00007fae967c3a3a in g_main_loop_run (loop=0x7fae9aedb860) at gmain.c:3907
So we need to ref() 'agent' when adding it to pending list, so that the object
is not freed if the secret agent unregisters and is removed.
Test case:
1. run NM and nm-applet
2. activate a Wi-Fi network
3. nm-applet will ask for a password; ignore the popup window and kill nm-applet
4. start nm-applet again
5. click the same Wi-Fi network in nm-applet
6. NM will experience problems in nm_secret_agent_cancel_secrets() or crashes
(the procedure may not be 100%, but reproduces most of the time)
https://bugzilla.redhat.com/show_bug.cgi?id=922855
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/settings/nm-agent-manager.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/settings/nm-agent-manager.c b/src/settings/nm-agent-manager.c
index 8644293..7fb8aea 100644
--- a/src/settings/nm-agent-manager.c
+++ b/src/settings/nm-agent-manager.c
@@ -492,7 +492,7 @@ request_free (Request *req)
g_free (req->detail);
g_free (req->verb);
- g_slist_free (req->pending);
+ g_slist_free_full (req->pending, g_object_unref);
g_slist_free (req->asked);
memset (req, 0, sizeof (Request));
g_free (req);
@@ -582,7 +582,7 @@ request_add_agent (Request *req,
/* Add this agent to the list, preferring active sessions */
req->pending = g_slist_insert_sorted_with_data (req->pending,
- agent,
+ g_object_ref (agent),
(GCompareDataFunc) agent_compare_func,
session_monitor);
}
@@ -607,6 +607,8 @@ request_next_agent (Request *req)
if (req->pending) {
/* Send the request to the next agent */
req->current_call_id = NULL;
+ if (req->current)
+ g_object_unref (req->current);
req->current = req->pending->data;
req->pending = g_slist_remove (req->pending, req->current);
--
1.7.11.7

View File

@ -0,0 +1,50 @@
From d90b9ff2c855bf4350070957a72b267f7edb7898 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Mon, 31 Mar 2014 11:19:45 +0200
Subject: [PATCH] platform: fix setting preferred time for address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Before nm_platform_ip4_address_sync() set the preferred time to the same value
as the address lifetime. The result was that the preferred time was
always identical to valid lifetime.
This will lead to the kernel using the address longer then the desired
preferred time (until validity of the address expires).
https://bugzilla.redhat.com/show_bug.cgi?id=1082041
https://bugzilla.redhat.com/show_bug.cgi?id=1083283
Reported-by: Kai Engert <kengert@redhat.com>
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-platform.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index 0477477..c7e5d2b 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1354,7 +1354,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses)
guint32 shift = subtract_guint32 (now, known_address->timestamp + 5);
lifetime = subtract_guint32 (known_address->lifetime, shift);
- preferred = subtract_guint32 (known_address->lifetime, shift);
+ preferred = subtract_guint32 (known_address->preferred, shift);
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
@@ -1411,7 +1411,7 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses)
guint32 shift = subtract_guint32 (now, known_address->timestamp + 5);
lifetime = subtract_guint32 (known_address->lifetime, shift);
- preferred = subtract_guint32 (known_address->lifetime, shift);
+ preferred = subtract_guint32 (known_address->preferred, shift);
} else
lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT;
--
1.7.11.7

View File

@ -0,0 +1,75 @@
From 0103063caa63d4fa72ca6e78399569416465030d Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Tue, 29 Apr 2014 16:42:57 -0500
Subject: [PATCH 1/1] core: emit dhcp4/dhcp6-change dispatcher events if other
IP completes first (rh #1091296) (bgo #729284)
If IPv6 completes first it would emit the "up" dispatcher event with IPv6
details and move the device to ACTIVATED state. But if DHCPv4 was still
running, no dispatcher event would be emitted with the DHCPv4 information
until the first lease renew. Thus dispatcher scripts would not receive
DHCPv4 information for quite some time.
Ensure that if the other IP version completes first, that when the slower
method's DHCP completes, that it emits the appropriate dhcp4-change
or dhcp6-change event so that dispatcher scripts get the information
as soon as it's available.
https://bugzilla.gnome.org/show_bug.cgi?id=729284
(cherry picked from commit 11f9855223966c4fd927fe83e2cd9a623a74acad)
Conflicts:
src/devices/nm-device.c
---
src/devices/nm-device.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 1e8704c..5fc6cb7 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -4219,6 +4219,20 @@ nm_device_activate_ip4_config_commit (gpointer user_data)
}
}
+ /* If IPv4 wasn't the first to complete, and DHCP was used, then ensure
+ * dispatcher scripts get the DHCP lease information.
+ */
+ if ( priv->dhcp4_client
+ && nm_device_activate_ip4_state_in_conf (self)
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
+ /* Notify dispatcher scripts of new DHCP4 config */
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP4_CHANGE,
+ nm_device_get_connection (self),
+ self,
+ NULL,
+ NULL);
+ }
+
/* Enter the IP_CHECK state if this is the first method to complete */
priv->ip4_state = IP_DONE;
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
@@ -4297,6 +4311,20 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self);
if (ip6_config_merge_and_apply (self, TRUE, &reason)) {
+ /* If IPv6 wasn't the first IP to complete, and DHCP was used,
+ * then ensure dispatcher scripts get the DHCP lease information.
+ */
+ if ( priv->dhcp6_client
+ && nm_device_activate_ip6_state_in_conf (self)
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
+ /* Notify dispatcher scripts of new DHCP6 config */
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE,
+ nm_device_get_connection (self),
+ self,
+ NULL,
+ NULL);
+ }
+
/* Enter the IP_CHECK state if this is the first method to complete */
priv->ip6_state = IP_DONE;
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
--
1.9.3

View File

@ -0,0 +1,61 @@
From 92a4443a0f9645a6147ded3d3d799eb264c4af38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 14 Apr 2014 13:00:35 +0200
Subject: [PATCH 1/1] cli/bash-completion: escape spaces in profile names (rh
#1041901) (bgo #709426)
We need to escape spaces and quotes in connection names, so that a connection
name containing spaces (quotes) is regarded as a single argument by bash.
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
https://bugzilla.redhat.com/show_bug.cgi?id=1041901
https://bugzilla.gnome.org/show_bug.cgi?id=709426
(cherry picked from commit b911d663d8a9df739a9311efe99c21af362c5738)
---
cli/completion/nmcli | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/cli/completion/nmcli b/cli/completion/nmcli
index 9ed1c03..e5a1555 100644
--- a/cli/completion/nmcli
+++ b/cli/completion/nmcli
@@ -11,6 +11,36 @@ _nmcli_list_nl()
{
local IFS=$'\n'
COMPREPLY=( $( compgen -W '$1' -- $cur ) )
+
+ # Now escape special characters (spaces, single and double quotes),
+ # so that the argument is really regarded a single argument by bash.
+ # See http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
+ local escaped_single_quote="'\''"
+ local i=0
+ local entry
+ for entry in ${COMPREPLY[*]}
+ do
+ if [[ "${cur:0:1}" == "'" ]]; then
+ # started with single quote, escaping only other single quotes
+ # [']bla'bla"bla\bla bla --> [']bla'\''bla"bla\bla bla
+ COMPREPLY[$i]="${entry//\'/${escaped_single_quote}}"
+ elif [[ "${cur:0:1}" == '"' ]]; then
+ # started with double quote, escaping all double quotes and all backslashes
+ # ["]bla'bla"bla\bla bla --> ["]bla'bla\"bla\\bla bla
+ entry="${entry//\\/\\\\}"
+ entry="${entry//\"/\\\"}"
+ COMPREPLY[$i]="$entry"
+ else
+ # no quotes in front, escaping _everything_
+ # [ ]bla'bla"bla\bla bla --> [ ]bla\'bla\"bla\\bla\ bla
+ entry="${entry//\\/\\\\}"
+ entry="${entry//\'/\'}"
+ entry="${entry//\"/\\\"}"
+ entry="${entry// /\\ }"
+ COMPREPLY[$i]="$entry"
+ fi
+ (( i++ ))
+ done
}
_nmcli_con_id()
--
1.9.3

View File

@ -0,0 +1,36 @@
From c3f062a63a732d55abf7e090b13743677e81f214 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Wed, 2 Jul 2014 10:58:49 +0200
Subject: [PATCH 1/1] supplicant: fix crash passing invalid parameter to
AddBlob when adding network
The DBUS method 'AddBlob' expects a data argument of type 'ay'.
Instead we passed the hash table 'blobs'.
This must be broken for a long time and surprisingly stayed unnoticed.
https://mail.gnome.org/archives/networkmanager-list/2014-July/msg00001.html
Fixes: fb6cde508c1417765684ae940f72d639067ddf0a
Signed-off-by: Thomas Haller <thaller@redhat.com>
(cherry picked from commit e343c45ebbb7976e15241a241f2876de8619ca3c)
---
src/supplicant-manager/nm-supplicant-interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/supplicant-manager/nm-supplicant-interface.c b/src/supplicant-manager/nm-supplicant-interface.c
index 4063085..e81dd61 100644
--- a/src/supplicant-manager/nm-supplicant-interface.c
+++ b/src/supplicant-manager/nm-supplicant-interface.c
@@ -1080,7 +1080,7 @@ add_network_cb (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_data)
self,
NULL,
DBUS_TYPE_STRING, name,
- DBUS_TYPE_G_UCHAR_ARRAY, blobs,
+ DBUS_TYPE_G_UCHAR_ARRAY, data,
G_TYPE_INVALID);
nm_call_store_add (priv->assoc_pcalls, priv->iface_proxy, call);
}
--
1.9.3

View File

@ -0,0 +1,156 @@
From e8be37613784c96c48c18e23790c7c246d2c750b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 17 Apr 2014 11:15:36 +0200
Subject: [PATCH 1/1] core: fix MTU handling while merging/subtracting IP
configs (bgo #721420)
https://bugzilla.gnome.org/show_bug.cgi?id=721420
https://bugzilla.redhat.com/show_bug.cgi?id=1047083
(cherry picked from commit 0757e33e746f0a203b4a4c5f386307e3a8ed9766)
Conflicts:
src/tests/test-ip4-config.c
---
src/nm-ip4-config.c | 12 ++++++++++-
src/tests/test-ip4-config.c | 50 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c
index b7ae161..23be6d7 100644
--- a/src/nm-ip4-config.c
+++ b/src/nm-ip4-config.c
@@ -15,7 +15,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2005 - 2013 Red Hat, Inc.
+ * Copyright (C) 2005 - 2014 Red Hat, Inc.
* Copyright (C) 2006 - 2008 Novell, Inc.
*/
@@ -386,9 +386,14 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src)
for (i = 0; i < nm_ip4_config_get_num_searches (src); i++)
nm_ip4_config_add_search (dst, nm_ip4_config_get_search (src, i));
+ /* MSS */
if (!nm_ip4_config_get_mss (dst))
nm_ip4_config_set_mss (dst, nm_ip4_config_get_mss (src));
+ /* MTU */
+ if (!nm_ip4_config_get_mtu (dst))
+ nm_ip4_config_set_mtu (dst, nm_ip4_config_get_mtu (src));
+
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++)
nm_ip4_config_add_nis_server (dst, nm_ip4_config_get_nis_server (src, i));
@@ -495,9 +500,14 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src)
}
}
+ /* MSS */
if (nm_ip4_config_get_mss (src) == nm_ip4_config_get_mss (dst))
nm_ip4_config_set_mss (dst, 0);
+ /* MTU */
+ if (nm_ip4_config_get_mtu (src) == nm_ip4_config_get_mtu (dst))
+ nm_ip4_config_set_mtu (dst, 0);
+
/* NIS */
for (i = 0; i < nm_ip4_config_get_num_nis_servers (src); i++) {
guint32 src_nis = nm_ip4_config_get_nis_server (src, i);
diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c
index fde4a40..1f2c968 100644
--- a/src/tests/test-ip4-config.c
+++ b/src/tests/test-ip4-config.c
@@ -14,7 +14,7 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (C) 2013 - 2014 Red Hat, Inc.
*
*/
@@ -116,6 +116,8 @@ test_subtract (void)
const char *expected_search = "somewhere.com";
guint32 expected_nis = addr_to_num ("1.2.3.13");
guint32 expected_wins = addr_to_num ("2.3.4.5");
+ guint32 expected_mss = 1400;
+ guint32 expected_mtu = 1492;
src = build_test_config ();
@@ -135,6 +137,9 @@ test_subtract (void)
nm_ip4_config_add_nis_server (dst, expected_nis);
nm_ip4_config_add_wins (dst, expected_wins);
+ nm_ip4_config_set_mss (dst, expected_mss);
+ nm_ip4_config_set_mtu (dst, expected_mtu);
+
nm_ip4_config_subtract (dst, src);
/* ensure what's left is what we expect */
@@ -169,10 +174,52 @@ test_subtract (void)
g_assert_cmpuint (nm_ip4_config_get_num_wins (dst), ==, 1);
g_assert_cmpuint (nm_ip4_config_get_wins (dst, 0), ==, expected_wins);
+ g_assert_cmpuint (nm_ip4_config_get_mss (dst), ==, expected_mss);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (dst), ==, expected_mtu);
+
g_object_unref (src);
g_object_unref (dst);
}
+static void
+test_merge_subtract_mss_mtu (void)
+{
+ NMIP4Config *cfg1, *cfg2, *cfg3;
+ guint32 expected_mss2 = 1400;
+ guint32 expected_mtu2 = 1492;
+ guint32 expected_mss3 = 555;
+ guint32 expected_mtu3 = 666;
+
+ cfg1 = build_test_config ();
+ cfg2 = build_test_config ();
+ cfg3 = build_test_config ();
+
+ /* add MSS, MTU to configs to test them */
+ nm_ip4_config_set_mss (cfg2, expected_mss2);
+ nm_ip4_config_set_mtu (cfg2, expected_mtu2);
+ nm_ip4_config_set_mss (cfg3, expected_mss3);
+ nm_ip4_config_set_mtu (cfg3, expected_mtu3);
+
+ nm_ip4_config_merge (cfg1, cfg2);
+ /* ensure MSS and MTU are in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+ nm_ip4_config_merge (cfg1, cfg3);
+ /* ensure again the same MSS and MTU are in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, expected_mss2);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, expected_mtu2);
+
+ nm_ip4_config_subtract (cfg1, cfg2);
+ /* ensure MSS and MTU are zero in cfg1 */
+ g_assert_cmpuint (nm_ip4_config_get_mss (cfg1), ==, 0);
+ g_assert_cmpuint (nm_ip4_config_get_mtu (cfg1), ==, 0);
+
+ g_object_unref (cfg1);
+ g_object_unref (cfg2);
+ g_object_unref (cfg3);
+}
+
/*******************************************/
int
@@ -183,6 +230,7 @@ main (int argc, char **argv)
g_type_init ();
g_test_add_func ("/ip4-config/subtract", test_subtract);
+ g_test_add_func ("/ip4-config/merge-subtract-mss-mtu", test_merge_subtract_mss_mtu);
return g_test_run ();
}
--
1.9.3

View File

@ -0,0 +1,52 @@
From f6f216f0a96942aaaacea26ffb7af72aab86f38c Mon Sep 17 00:00:00 2001
From: Giovanni Campagna <gcampagna@src.gnome.org>
Date: Mon, 17 Feb 2014 15:41:04 +0100
Subject: [PATCH] manager: fix notification of the connectivity property
Notify DBus clients at the end of a connectivity check, and when
NMConnectivity reports a change.
https://bugzilla.gnome.org/show_bug.cgi?id=724550
---
src/nm-manager.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 8d37f4b..3ae48c8 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -643,14 +643,15 @@ checked_connectivity (GObject *object, GAsyncResult *result, gpointer user_data)
connectivity = nm_connectivity_check_finish (priv->connectivity, result, NULL);
if (connectivity == NM_CONNECTIVITY_FULL)
set_state (manager, NM_STATE_CONNECTED_GLOBAL);
else if ( connectivity == NM_CONNECTIVITY_PORTAL
|| connectivity == NM_CONNECTIVITY_LIMITED)
set_state (manager, NM_STATE_CONNECTED_SITE);
+ g_object_notify (G_OBJECT (manager), NM_MANAGER_CONNECTIVITY);
}
g_object_unref (manager);
}
static void
nm_manager_update_state (NMManager *manager)
@@ -4286,14 +4287,15 @@ connectivity_changed (NMConnectivity *connectivity,
static const char *connectivity_states[] = { "UNKNOWN", "NONE", "PORTAL", "LIMITED", "FULL" };
state = nm_connectivity_get_state (connectivity);
nm_log_dbg (LOGD_CORE, "connectivity checking indicates %s",
connectivity_states[state]);
nm_manager_update_state (self);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_CONNECTIVITY);
}
static void
firmware_dir_changed (GFileMonitor *monitor,
GFile *file,
GFile *other_file,
GFileMonitorEvent event_type,
--
1.9.3

View File

@ -0,0 +1,104 @@
From 570b9b362db0372e90d1598519132ce805a01d4f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Fri, 11 Oct 2013 11:14:05 +0200
Subject: [PATCH] libnm-glib: fix a crash in nm_client_new() (rh #1010288)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We have to check if 'client' is valid when calling _nm_object_ensure_inited().
Creation of NMClient object can fail, because its parent NMObject's
constructor() returns NULL for D-Bus errors.
https://bugzilla.redhat.com/show_bug.cgi?id=1010288
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-client.c | 35 ++++++++++++++++++++++++++++++-----
1 file changed, 30 insertions(+), 5 deletions(-)
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index f34b685..15c708a 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2007 - 2012 Red Hat, Inc.
+ * Copyright (C) 2007 - 2013 Red Hat, Inc.
*/
#include <dbus/dbus-glib.h>
@@ -1616,7 +1616,7 @@ nm_client_check_connectivity_finish (NMClient *client,
* control them. To access and modify network configuration data, use the
* #NMRemoteSettings object.
*
- * Returns: a new #NMClient
+ * Returns: a new #NMClient or NULL on an error
**/
NMClient *
nm_client_new (void)
@@ -1624,7 +1624,13 @@ nm_client_new (void)
NMClient *client;
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
- _nm_object_ensure_inited (NM_OBJECT (client));
+
+ /* NMObject's constructor() can fail on a D-Bus connection error. So we can
+ * get NULL here instead of a valid NMClient object.
+ */
+ if (client)
+ _nm_object_ensure_inited (NM_OBJECT (client));
+
return client;
}
@@ -1650,7 +1656,8 @@ client_inited (GObject *source, GAsyncResult *result, gpointer user_data)
*
* Creates a new #NMClient and begins asynchronously initializing it.
* @callback will be called when it is done; use
- * nm_client_new_finish() to get the result.
+ * nm_client_new_finish() to get the result. Note that on an error,
+ * the callback can be invoked with two first parameters as NULL.
*
* NOTE: #NMClient provides information about devices and a mechanism to
* control them. To access and modify network configuration data, use the
@@ -1664,8 +1671,16 @@ nm_client_new_async (GCancellable *cancellable,
NMClient *client;
GSimpleAsyncResult *simple;
- simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
client = g_object_new (NM_TYPE_CLIENT, NM_OBJECT_DBUS_PATH, NM_DBUS_PATH, NULL);
+ /* When client is NULL, do no continue with initialization and run callback
+ * directly with result == NULL indicating NMClient creation failure.
+ */
+ if (!client) {
+ callback (NULL, NULL, user_data);
+ return;
+ }
+
+ simple = g_simple_async_result_new (NULL, callback, user_data, nm_client_new_async);
g_async_initable_init_async (G_ASYNC_INITABLE (client), G_PRIORITY_DEFAULT,
cancellable, client_inited, simple);
}
@@ -1684,6 +1699,16 @@ nm_client_new_finish (GAsyncResult *result, GError **error)
{
GSimpleAsyncResult *simple;
+ g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+ if (!result) {
+ g_set_error_literal (error,
+ NM_CLIENT_ERROR,
+ NM_CLIENT_ERROR_UNKNOWN,
+ "NMClient initialization failed (or you passed NULL 'result' by mistake)");
+ return NULL;
+ }
+
g_return_val_if_fail (g_simple_async_result_is_valid (result, NULL, nm_client_new_async), NULL);
simple = G_SIMPLE_ASYNC_RESULT (result);
--
1.7.11.7

View File

@ -0,0 +1,282 @@
From 3b76ae18a52b44dbe577557e038fdc263edc5715 Mon Sep 17 00:00:00 2001
From: Aleksander Morgado <aleksander@lanedo.com>
Date: Thu, 31 Oct 2013 09:14:13 +0100
Subject: [PATCH] modem-manager: if building systemd support, assume it manages
the MM lifecycle
We will not explicitly poke MM to start it if NetworkManager is built with
systemd support.
https://bugzilla.gnome.org/show_bug.cgi?id=703040
---
configure.ac | 3 ++
src/modem-manager/nm-modem-manager.c | 71 ++++++++++++++++++++++--------------
2 files changed, 47 insertions(+), 27 deletions(-)
diff --git a/configure.ac b/configure.ac
index 174b6bf..895ab09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -300,14 +300,17 @@ AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=
AS_IF([test -z "$with_systemdsystemunitdir" && $PKG_CONFIG systemd],
with_systemdsystemunitdir="\$(prefix)/lib/systemd/system")
AS_IF([test -z "$with_systemdsystemunitdir"], with_systemdsystemunitdir=no)
# add conditional and subst
AM_CONDITIONAL(HAVE_SYSTEMD, [test "$with_systemdsystemunitdir" != no])
if test "$with_systemdsystemunitdir" != no; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+ AC_DEFINE(HAVE_SYSTEMD, 1, [Define if systemd support is available])
+else
+ AC_DEFINE(HAVE_SYSTEMD, 0, [Define if systemd support is available])
fi
PKG_CHECK_MODULES(SYSTEMD_200, [systemd >= 200], [have_systemd_200=yes],[have_systemd_200=no])
AM_CONDITIONAL(HAVE_SYSTEMD_200, test "${have_systemd_200}" = "yes")
# session tracking support
AC_MSG_CHECKING([Session tracking support])
diff --git a/src/modem-manager/nm-modem-manager.c b/src/modem-manager/nm-modem-manager.c
index 427d98c..bb85b77 100644
--- a/src/modem-manager/nm-modem-manager.c
+++ b/src/modem-manager/nm-modem-manager.c
@@ -45,15 +45,15 @@ struct _NMModemManagerPrivate {
DBusGProxy *proxy;
guint poke_id;
#if WITH_MODEM_MANAGER_1
/* ModemManager >= 0.7 */
GDBusConnection *dbus_connection;
MMManager *modem_manager_1;
- guint modem_manager_1_poke_id;
+ guint modem_manager_1_launch_id;
gboolean old_modem_manager_found;
gboolean new_modem_manager_found;
guint modem_manager_1_name_owner_changed_id;
guint modem_manager_1_object_added_id;
guint modem_manager_1_object_removed_id;
#endif
@@ -355,17 +355,17 @@ modem_manager_1_clear_signals (NMModemManager *self)
self->priv->modem_manager_1_object_removed_id = 0;
}
}
static void
clear_modem_manager_1_support (NMModemManager *self)
{
- if (self->priv->modem_manager_1_poke_id) {
- g_source_remove (self->priv->modem_manager_1_poke_id);
- self->priv->modem_manager_1_poke_id = 0;
+ if (self->priv->modem_manager_1_launch_id) {
+ g_source_remove (self->priv->modem_manager_1_launch_id);
+ self->priv->modem_manager_1_launch_id = 0;
}
modem_manager_1_clear_signals (self);
g_clear_object (&self->priv->modem_manager_1);
g_clear_object (&self->priv->dbus_connection);
}
@@ -458,23 +458,28 @@ static void
modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
GParamSpec *pspec,
NMModemManager *self)
{
gchar *name_owner;
/* Quit poking, if any */
- if (self->priv->modem_manager_1_poke_id) {
- g_source_remove (self->priv->modem_manager_1_poke_id);
- self->priv->modem_manager_1_poke_id = 0;
+ if (self->priv->modem_manager_1_launch_id) {
+ g_source_remove (self->priv->modem_manager_1_launch_id);
+ self->priv->modem_manager_1_launch_id = 0;
}
name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (modem_manager_1));
if (!name_owner) {
nm_log_info (LOGD_MB, "ModemManager disappeared from bus");
+
+#if !HAVE_SYSTEMD
+ /* If not managed by systemd, schedule relaunch */
schedule_modem_manager_1_relaunch (self, 0);
+#endif
+
return;
}
/* Available! */
g_free (name_owner);
/* Hack alert: GDBusObjectManagerClient won't signal neither 'object-added'
@@ -486,14 +491,16 @@ modem_manager_1_name_owner_changed (MMManager *modem_manager_1,
ensure_client (self);
/* Whenever GDBusObjectManagerClient is fixed, we can just do the following:
* modem_manager_1_available (self);
*/
}
+#if !HAVE_SYSTEMD
+
static void
modem_manager_1_poke_cb (GDBusConnection *connection,
GAsyncResult *res,
NMModemManager *self)
{
GError *error = NULL;
GVariant *result;
@@ -519,40 +526,50 @@ modem_manager_1_poke_cb (GDBusConnection *connection,
/* Balance refcount */
g_object_unref (self);
}
static void
modem_manager_1_poke (NMModemManager *self)
{
- gchar *name_owner;
-
/* If there is no current owner right away, ensure we poke to get one */
- name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->modem_manager_1));
- if (name_owner) {
- /* Available! */
- modem_manager_1_available (self);
- g_free (name_owner);
- return;
- }
-
- /* Poke! */
g_dbus_connection_call (self->priv->dbus_connection,
"org.freedesktop.ModemManager1",
"/org/freedesktop/ModemManager1",
"org.freedesktop.DBus.Peer",
"Ping",
NULL, /* inputs */
NULL, /* outputs */
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL, /* cancellable */
(GAsyncReadyCallback)modem_manager_1_poke_cb, /* callback */
g_object_ref (self)); /* user_data */
}
+#endif /* HAVE_SYSTEMD */
+
+static void
+modem_manager_1_check_name_owner (NMModemManager *self)
+{
+ gchar *name_owner;
+
+ name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (self->priv->modem_manager_1));
+ if (name_owner) {
+ /* Available! */
+ modem_manager_1_available (self);
+ g_free (name_owner);
+ return;
+ }
+
+#if !HAVE_SYSTEMD
+ /* If the lifecycle is not managed by systemd, poke */
+ modem_manager_1_poke (self);
+#endif
+}
+
static void
manager_new_ready (GObject *source,
GAsyncResult *res,
NMModemManager *self)
{
/* Note we always get an extra reference to self here */
@@ -584,16 +601,16 @@ manager_new_ready (GObject *source,
G_CALLBACK (modem_object_added),
self);
self->priv->modem_manager_1_object_removed_id =
g_signal_connect (self->priv->modem_manager_1,
"object-removed",
G_CALLBACK (modem_object_removed),
self);
- /* Poke the MMManager! */
- modem_manager_1_poke (self);
+
+ modem_manager_1_check_name_owner (self);
}
/* Balance refcount */
g_object_unref (self);
}
static void
@@ -609,16 +626,16 @@ ensure_client (NMModemManager *self)
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START,
NULL,
(GAsyncReadyCallback)manager_new_ready,
g_object_ref (self));
return;
}
- /* If already available, poke! */
- modem_manager_1_poke (self);
+ /* If already available, recheck name owner! */
+ modem_manager_1_check_name_owner (self);
}
static void
bus_get_ready (GObject *source,
GAsyncResult *res,
NMModemManager *self)
{
@@ -632,27 +649,27 @@ bus_get_ready (GObject *source,
g_error_free (error);
/* Setup timeout to relaunch */
schedule_modem_manager_1_relaunch (self, MODEM_POKE_INTERVAL);
} else if (self->priv->old_modem_manager_found) {
/* If we found the old MM, abort */
clear_modem_manager_1_support (self);
} else {
- /* Got the bus, create new ModemManager client. */
+ /* Got the bus, ensure client */
ensure_client (self);
}
/* Balance refcount */
g_object_unref (self);
}
static gboolean
ensure_bus (NMModemManager *self)
{
- /* Clear poke ID */
- self->priv->modem_manager_1_poke_id = 0;
+ /* Clear launch ID */
+ self->priv->modem_manager_1_launch_id = 0;
if (!self->priv->dbus_connection)
g_bus_get (G_BUS_TYPE_SYSTEM,
NULL,
(GAsyncReadyCallback)bus_get_ready,
g_object_ref (self));
else
@@ -666,17 +683,17 @@ static void
schedule_modem_manager_1_relaunch (NMModemManager *self,
guint n_seconds)
{
/* No need to pass an extra reference to self; timeout/idle will be
* cancelled if the object gets disposed. */
if (n_seconds)
- self->priv->modem_manager_1_poke_id = g_timeout_add_seconds (n_seconds, (GSourceFunc)ensure_bus, self);
+ self->priv->modem_manager_1_launch_id = g_timeout_add_seconds (n_seconds, (GSourceFunc)ensure_bus, self);
else
- self->priv->modem_manager_1_poke_id = g_idle_add ((GSourceFunc)ensure_bus, self);
+ self->priv->modem_manager_1_launch_id = g_idle_add ((GSourceFunc)ensure_bus, self);
}
#endif /* WITH_MODEM_MANAGER_1 */
/************************************************************************/
static void
--
1.9.3

View File

@ -0,0 +1,235 @@
From e554ef606f0dfd5ab07057824bb3d3dd52170228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Jun 2014 15:43:51 +0200
Subject: [PATCH] ifcfg-rh: write GATEWAY instead of GATEWAY0 to be
ifup-compatible (rh #771673)
https://bugzilla.redhat.com/show_bug.cgi?id=771673
https://bugzilla.redhat.com/show_bug.cgi?id=1105770
---
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 147 +++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 25 +++-
2 files changed, 168 insertions(+), 4 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 0e5be5d..ff45550 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -7408,6 +7408,153 @@ test_write_wired_8021x_tls (NMSetting802
}
static void
+test_write_gateway (void)
+{
+ NMConnection *connection, *reread;
+ NMSettingConnection *s_con;
+ NMSettingWired *s_wired;
+ NMSettingIP4Config *s_ip4;
+ NMSettingIP6Config *s_ip6;
+ char *uuid, *testfile = NULL, *val;
+ gboolean success;
+ GError *error = NULL;
+ shvarFile *f;
+ NMIP4Address *addr;
+ const char *ip1_str = "1.1.1.3";
+ const char *ip2_str = "2.2.2.5";
+ const char *gw1_str = "1.1.1.254";
+ const char *gw2_str = "2.2.2.254";
+ struct in_addr ip1, ip2, gw1, gw2;
+ const guint32 prefix = 24;
+
+ connection = nm_connection_new ();
+
+ /* Connection setting */
+ s_con = (NMSettingConnection *) nm_setting_connection_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_con));
+
+ uuid = nm_utils_uuid_generate ();
+ g_object_set (s_con,
+ NM_SETTING_CONNECTION_ID, "Test Write Static Addresses Gateway",
+ NM_SETTING_CONNECTION_UUID, uuid,
+ NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
+ NULL);
+ g_free (uuid);
+
+ /* Wired setting */
+ s_wired = (NMSettingWired *) nm_setting_wired_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_wired));
+
+ /* IP4 setting */
+ s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_ip4));
+
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
+ NM_SETTING_IP4_CONFIG_MAY_FAIL, TRUE,
+ NULL);
+
+ inet_pton (AF_INET, ip1_str, &ip1);
+ inet_pton (AF_INET, ip2_str, &ip2);
+ inet_pton (AF_INET, gw1_str, &gw1);
+ inet_pton (AF_INET, gw2_str, &gw2);
+
+ addr = nm_ip4_address_new ();
+ nm_ip4_address_set_address (addr, ip1.s_addr);
+ nm_ip4_address_set_prefix (addr, prefix);
+ nm_ip4_address_set_gateway (addr, gw1.s_addr);
+ nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_ip4_address_unref (addr);
+
+ addr = nm_ip4_address_new ();
+ nm_ip4_address_set_address (addr, ip2.s_addr);
+ nm_ip4_address_set_prefix (addr, prefix);
+ nm_ip4_address_set_gateway (addr, gw2.s_addr);
+ nm_setting_ip4_config_add_address (s_ip4, addr);
+ nm_ip4_address_unref (addr);
+
+ success = nm_connection_verify (connection, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ /* IP6 setting */
+ s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
+ nm_connection_add_setting (connection, NM_SETTING (s_ip6));
+ g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO, NULL);
+
+ /* Save the ifcfg */
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &testfile,
+ &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ f = svNewFile (testfile);
+ g_assert (f);
+
+ /* re-read the file to check that the keys was written as IPADDR, GATEWAY and IPADDR1, GATEWAY1 */
+ val = svGetValue (f, "IPADDR", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, ip1_str);
+ g_free (val);
+
+ val = svGetValue (f, "IPADDR1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, ip2_str);
+ g_free (val);
+
+ val = svGetValue (f, "IPADDR0", FALSE);
+ g_assert (val == NULL);
+
+ val = svGetValue (f, "PREFIX", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, "24");
+ g_free (val);
+
+ val = svGetValue (f, "PREFIX1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, "24");
+ g_free (val);
+
+ val = svGetValue (f, "PREFIX0", FALSE);
+ g_assert (val == NULL);
+
+ val = svGetValue (f, "GATEWAY", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, gw1_str);
+ g_free (val);
+
+ val = svGetValue (f, "GATEWAY1", FALSE);
+ g_assert (val);
+ g_assert_cmpstr (val, ==, gw2_str);
+ g_free (val);
+
+ val = svGetValue (f, "GATEWAY0", FALSE);
+ g_assert (val == NULL);
+
+ svCloseFile (f);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (testfile, NULL, TYPE_WIRELESS, NULL,
+ NULL, NULL, NULL, NULL, &error, NULL);
+ unlink (testfile);
+ g_assert_no_error (error);
+ g_assert (reread);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ g_assert (nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT));
+
+ g_free (testfile);
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
+
+static void
test_write_wifi_open (void)
{
NMConnection *connection;
@@ -12643,6 +12790,7 @@ int main (int argc, char **argv)
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_NOT_SAVED);
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_PATH, NM_SETTING_SECRET_FLAG_AGENT_OWNED | NM_SETTING_SECRET_FLAG_NOT_SAVED);
test_write_wired_8021x_tls (NM_SETTING_802_1X_CK_SCHEME_BLOB, NM_SETTING_SECRET_FLAG_NONE);
+ g_test_add_func (TPATH "ipv4/write-static-addresses-GATEWAY", test_write_gateway);
test_write_wifi_open ();
test_write_wifi_open_hex_ssid ();
test_write_wifi_wep ();
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index f583366..b9c108c 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -1718,22 +1718,41 @@ write_ip4_setting (NMConnection *connect
else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED))
svSetValue (ifcfg, "BOOTPROTO", "shared", FALSE);
- /* Write out IPADDR0 .. IPADDR255, PREFIX0 .. PREFIX255, GATEWAY0 .. GATEWAY255
- * Possible NETMASK<n> is removed only (it's obsolete) */
- num = nm_setting_ip4_config_get_num_addresses (s_ip4);
+ /* Clear out un-numbered IP address fields */
svSetValue (ifcfg, "IPADDR", NULL, FALSE);
svSetValue (ifcfg, "PREFIX", NULL, FALSE);
svSetValue (ifcfg, "NETMASK", NULL, FALSE);
svSetValue (ifcfg, "GATEWAY", NULL, FALSE);
+ /* Clear out zero-indexed IP address fields */
+ svSetValue (ifcfg, "IPADDR0", NULL, FALSE);
+ svSetValue (ifcfg, "PREFIX0", NULL, FALSE);
+ svSetValue (ifcfg, "NETMASK0", NULL, FALSE);
+ svSetValue (ifcfg, "GATEWAY0", NULL, FALSE);
+
+ /* Write out IPADDR0 .. IPADDR255, PREFIX0 .. PREFIX255, GATEWAY0 .. GATEWAY255
+ * Possible NETMASK<n> is removed only (it's obsolete) */
+ num = nm_setting_ip4_config_get_num_addresses (s_ip4);
for (i = 0; i < 256; i++) {
char buf[INET_ADDRSTRLEN];
NMIP4Address *addr;
guint32 ip;
- addr_key = g_strdup_printf ("IPADDR%d", i);
- prefix_key = g_strdup_printf ("PREFIX%d", i);
- netmask_key = g_strdup_printf ("NETMASK%d", i);
- gw_key = g_strdup_printf ("GATEWAY%d", i);
+ if (i == 0) {
+ /* Instead of index 0 use un-numbered variables.
+ * It's needed for compatibility with ifup that only recognizes 'GATEAWAY'
+ * See https://bugzilla.redhat.com/show_bug.cgi?id=771673
+ * and https://bugzilla.redhat.com/show_bug.cgi?id=1105770
+ */
+ addr_key = g_strdup ("IPADDR");
+ prefix_key = g_strdup ("PREFIX");
+ netmask_key = g_strdup ("NETMASK");
+ gw_key = g_strdup ("GATEWAY");
+ } else {
+ addr_key = g_strdup_printf ("IPADDR%d", i);
+ prefix_key = g_strdup_printf ("PREFIX%d", i);
+ netmask_key = g_strdup_printf ("NETMASK%d", i);
+ gw_key = g_strdup_printf ("GATEWAY%d", i);
+ }
if (i >= num) {
svSetValue (ifcfg, addr_key, NULL, FALSE);
--
1.9.3

View File

@ -0,0 +1,127 @@
From 01b1d3de8018087114455c60b9bac53dbbffc329 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 15:24:07 -0600
Subject: [PATCH] platform: don't replace routes that already exist
If a route already exists that matches the network, prefix, gateway,
and metric of a route NM would like to add, don't try to overwrite
the route.
Unlike IP addresses, the kernel doesn't update the details, it
appears to completely replace that route, which might screw up
external tools that added the route originally.
One example of this is IPSec via openswan/libreswan. They add the
routes to the kernel upon connection, and if NM replaces those routes,
IPSec no longer works. While this may be due to kernel bugs or
bad handling of route replacement, there's no reason for NM to touch
routes that it wouldn't materially change anyway.
(yes, we could perhaps use NLM_F_REPLACE in add_kernel_object() only
when we really wanted to replace something, but why ask the kernel
to do the work when it's not required anyway?)
(cherry picked from commit 8d9bfcdd5a1d8d716e8503f88e7b2e239408f667)
---
src/platform/nm-platform.c | 48 ++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index f5a4c9b..d40e652 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -1484,6 +1484,7 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
GArray *routes;
NMPlatformIP4Route *route;
const NMPlatformIP4Route *known_route;
+ gboolean success;
int i;
/* Delete unknown routes */
@@ -1495,22 +1496,29 @@ nm_platform_ip4_route_sync (int ifindex, const GArray *known_routes)
if (!array_contains_ip4_route (known_routes, route))
nm_platform_ip4_route_delete (ifindex, route->network, route->plen, route->metric);
}
- g_array_free (routes, TRUE);
- if (!known_routes)
+ if (!known_routes) {
+ g_array_free (routes, TRUE);
return TRUE;
+ }
/* Add missing routes */
- for (i = 0; i < known_routes->len; i++) {
+ for (i = 0, success = TRUE; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP4Route, i);
- if (!nm_platform_ip4_route_add (ifindex,
- known_route->network, known_route->plen, known_route->gateway,
- known_route->metric, known_route->mss))
- return FALSE;
+ /* Ignore routes that already exist */
+ if (!array_contains_ip4_route (routes, known_route)) {
+ success = nm_platform_ip4_route_add (ifindex,
+ known_route->network,
+ known_route->plen,
+ known_route->gateway,
+ known_route->metric,
+ known_route->mss);
+ }
}
- return TRUE;
+ g_array_free (routes, TRUE);
+ return success;
}
/**
@@ -1530,6 +1538,7 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
GArray *routes;
NMPlatformIP6Route *route;
const NMPlatformIP6Route *known_route;
+ gboolean success;
int i;
/* Delete unknown routes */
@@ -1541,22 +1550,29 @@ nm_platform_ip6_route_sync (int ifindex, const GArray *known_routes)
if (!array_contains_ip6_route (known_routes, route))
nm_platform_ip6_route_delete (ifindex, route->network, route->plen, route->metric);
}
- g_array_free (routes, TRUE);
- if (!known_routes)
+ if (!known_routes) {
+ g_array_free (routes, TRUE);
return TRUE;
+ }
/* Add missing routes */
- for (i = 0; i < known_routes->len; i++) {
+ for (i = 0, success = TRUE; i < known_routes->len && success; i++) {
known_route = &g_array_index (known_routes, NMPlatformIP6Route, i);
- if (!nm_platform_ip6_route_add (ifindex,
- known_route->network, known_route->plen, known_route->gateway,
- known_route->metric, known_route->mss))
- return FALSE;
+ /* Ignore routes that already exist */
+ if (!array_contains_ip6_route (routes, known_route)) {
+ success = nm_platform_ip6_route_add (ifindex,
+ known_route->network,
+ known_route->plen,
+ known_route->gateway,
+ known_route->metric,
+ known_route->mss);
+ }
}
- return TRUE;
+ g_array_free (routes, TRUE);
+ return success;
}
gboolean
--
1.9.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,336 @@
From 98bcbd2d2417e965f673220e8ec087a8d3b22ad5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 5 Dec 2013 12:11:36 +0100
Subject: [PATCH] libnm-util: don't touch dhcp-send-hostname when setting
dhcp-hostname (rh #1001529)
It is better to leave it to user whether he wants to enable sending hostname,
because he probably disabled it manually (dhcp-send-hostname is TRUE by default).
Also, this would not work for plugins that read and set dhcp-hostname after
dhcp-send-hostname.
https://bugzilla.redhat.com/show_bug.cgi?id=1001529
---
libnm-util/nm-setting-ip4-config.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libnm-util/nm-setting-ip4-config.c b/libnm-util/nm-setting-ip4-config.c
index 5fd1cfd..b019a14 100644
--- a/libnm-util/nm-setting-ip4-config.c
+++ b/libnm-util/nm-setting-ip4-config.c
@@ -904,17 +904,14 @@ set_property (GObject *object, guint prop_id,
break;
case PROP_DHCP_SEND_HOSTNAME:
priv->dhcp_send_hostname = g_value_get_boolean (value);
break;
case PROP_DHCP_HOSTNAME:
g_free (priv->dhcp_hostname);
priv->dhcp_hostname = g_value_dup_string (value);
- /* FIXME: Is this a good idea? */
- if (priv->dhcp_hostname)
- priv->dhcp_send_hostname = TRUE;
break;
case PROP_NEVER_DEFAULT:
priv->never_default = g_value_get_boolean (value);
break;
case PROP_MAY_FAIL:
priv->may_fail = g_value_get_boolean (value);
break;
--
1.9.3
From 97af7e6ee58d8b419bc93f5d9b789b342c61a727 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 5 Dec 2013 14:27:08 +0100
Subject: [PATCH] ifcfg-rh: read/write dhcp-send-hostname as DHCP_SEND_HOSTNAME
(rh #1001529)
It is an extension compared to initscripts (not in sysconfig.txt). But it is
necessary for preserving dhcp-send-hostname. Missing DHCP_SEND_HOSTNAME is
treated as "yes", which matches dhcp-send-hostname default value being TRUE.
https://bugzilla.redhat.com/show_bug.cgi?id=1001529
---
src/settings/plugins/ifcfg-rh/reader.c | 8 ++-
.../ifcfg-rh/tests/network-scripts/Makefile.am | 1 +
.../ifcfg-test-wired-dhcp-send-hostname | 12 ++++
.../plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 70 ++++++++++++++++++++++
src/settings/plugins/ifcfg-rh/writer.c | 9 ++-
5 files changed, 97 insertions(+), 3 deletions(-)
create mode 100644 src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index e2cff0b..2c808cf 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -11,15 +11,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2008 - 2012 Red Hat, Inc.
+ * Copyright (C) 2008 - 2013 Red Hat, Inc.
*/
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -1361,15 +1361,19 @@ make_ip4_setting (shvarFile *ifcfg,
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: duplicate IP4 address");
nm_ip4_address_unref (addr);
}
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
- g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value,
+ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
+ svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
+ NULL);
g_free (value);
value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);
if (value && strlen (value))
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL);
g_free (value);
}
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
index a7d009e..113c5ca 100644
--- a/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.am
@@ -4,14 +4,15 @@ EXTRA_DIST = \
EXTRA_DIST = \
ifcfg-test-minimal \
ifcfg-test-variables-corner-cases-1 \
ifcfg-test-nm-controlled \
ifcfg-test-wired-static \
ifcfg-test-wired-static-bootproto \
ifcfg-test-wired-dhcp \
+ ifcfg-test-wired-dhcp-send-hostname \
ifcfg-test-wired-dhcp6-only \
ifcfg-test-wired-global-gateway \
network-test-wired-global-gateway \
ifcfg-test-wired-never-default \
network-test-wired-never-default \
ifcfg-test-wired-defroute-no \
ifcfg-test-wired-defroute-no-gatewaydev-yes \
diff --git a/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
new file mode 100644
index 0000000..cba380d
--- /dev/null
+++ b/src/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-wired-dhcp-send-hostname
@@ -0,0 +1,12 @@
+# Intel Corporation 82540EP Gigabit Ethernet Controller (Mobile)
+TYPE=Ethernet
+DEVICE=eth0
+HWADDR=00:11:22:33:44:ee
+BOOTPROTO=dhcp
+ONBOOT=yes
+IPV6INIT=yes
+IPV6_AUTOCONF=yes
+USERCTL=yes
+NM_CONTROLLED=yes
+PEERDNS=no
+DHCP_HOSTNAME="svata-pulec"
diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
index 14c4fb9..771cf17 100644
--- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
+++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c
@@ -6558,14 +6558,80 @@ test_write_wired_dhcp_plus_ip (void)
g_free (routefile);
g_free (route6file);
g_object_unref (connection);
g_object_unref (reread);
}
static void
+test_read_write_wired_dhcp_send_hostname (void)
+{
+ NMConnection *connection, *reread;
+ NMSettingIP4Config *s_ip4;
+ NMSettingIP6Config *s_ip6;
+ const char * dhcp_hostname = "kamil-patka";
+ char *written = NULL;
+ GError *error = NULL;
+ gboolean success = FALSE;
+
+ connection = connection_from_file (TEST_IFCFG_DIR"/network-scripts/ifcfg-test-wired-dhcp-send-hostname",
+ NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ g_assert_no_error (error);
+ g_assert (connection != NULL);
+
+ /* Check dhcp-hostname and dhcp-send-hostname */
+ s_ip4 = nm_connection_get_setting_ip4_config (connection);
+ s_ip6 = nm_connection_get_setting_ip6_config (connection);
+ g_assert (s_ip4);
+ g_assert (s_ip6);
+ g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == TRUE);
+ g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, "svata-pulec");
+ g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, "svata-pulec");
+
+ /* Set dhcp-send-hostname=false dhcp-hostname="kamil-patka" and write the connection. */
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME, FALSE, NULL);
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+ g_object_set (s_ip6, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, dhcp_hostname, NULL);
+
+ success = writer_new_connection (connection,
+ TEST_SCRATCH_DIR "/network-scripts/",
+ &written,
+ &error);
+ g_assert (success);
+
+ /* re-read the connection for comparison */
+ reread = connection_from_file (written, NULL, TYPE_ETHERNET, NULL, NULL,
+ NULL, NULL, NULL, &error, NULL);
+ unlink (written);
+ g_free (written);
+
+ g_assert_no_error (error);
+ g_assert (reread != NULL);
+
+ success = nm_connection_verify (reread, &error);
+ g_assert_no_error (error);
+ g_assert (success);
+
+ success = nm_connection_compare (connection, reread, NM_SETTING_COMPARE_FLAG_EXACT);
+ g_assert (success);
+
+ /* Check dhcp-hostname and dhcp-send-hostname from the re-read connection. */
+ s_ip4 = nm_connection_get_setting_ip4_config (reread);
+ s_ip6 = nm_connection_get_setting_ip6_config (reread);
+ g_assert (s_ip4);
+ g_assert (s_ip6);
+ g_assert (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) == FALSE);
+ g_assert_cmpstr (nm_setting_ip4_config_get_dhcp_hostname (s_ip4), ==, dhcp_hostname);
+ g_assert_cmpstr (nm_setting_ip6_config_get_dhcp_hostname (s_ip6), ==, dhcp_hostname);
+
+ g_object_unref (connection);
+ g_object_unref (reread);
+}
+
+static void
test_write_wired_static_ip6_only (void)
{
NMConnection *connection;
NMConnection *reread;
NMSettingConnection *s_con;
NMSettingWired *s_wired;
NMSettingIP4Config *s_ip4;
@@ -13211,14 +13280,15 @@ int main (int argc, char **argv)
g_test_add_data_func (TPATH "static-ip6-only-gw/::", "::", test_write_wired_static_ip6_only_gw);
g_test_add_data_func (TPATH "static-ip6-only-gw/2001:db8:8:4::2", "2001:db8:8:4::2", test_write_wired_static_ip6_only_gw);
g_test_add_data_func (TPATH "static-ip6-only-gw/ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255", "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255", test_write_wired_static_ip6_only_gw);
test_read_wired_static (TEST_IFCFG_WIRED_STATIC, "System test-wired-static", TRUE);
test_read_wired_static (TEST_IFCFG_WIRED_STATIC_BOOTPROTO, "System test-wired-static-bootproto", FALSE);
test_read_wired_dhcp ();
+ g_test_add_func (TPATH "dhcp-send-hostname", test_read_write_wired_dhcp_send_hostname);
test_read_wired_global_gateway ();
test_read_wired_never_default ();
test_read_wired_defroute_no ();
test_read_wired_defroute_no_gatewaydev_yes ();
test_read_wired_static_routes ();
test_read_wired_static_routes_legacy ();
test_read_wired_ipv4_manual (TEST_IFCFG_WIRED_IPV4_MANUAL_1, "System test-wired-ipv4-manual-1");
diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c
index 6f302b4..604d492 100644
--- a/src/settings/plugins/ifcfg-rh/writer.c
+++ b/src/settings/plugins/ifcfg-rh/writer.c
@@ -11,15 +11,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
- * Copyright (C) 2009 - 2012 Red Hat, Inc.
+ * Copyright (C) 2009 - 2013 Red Hat, Inc.
*/
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <errno.h>
@@ -1967,14 +1967,21 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
nm_setting_ip4_config_get_ignore_auto_routes (s_ip4) ? "no" : "yes",
FALSE);
value = nm_setting_ip4_config_get_dhcp_hostname (s_ip4);
if (value)
svSetValue (ifcfg, "DHCP_HOSTNAME", value, FALSE);
+ /* Missing DHCP_SEND_HOSTNAME means TRUE, and we prefer not write it explicitly
+ * in that case, because it is NM-specific variable
+ */
+ svSetValue (ifcfg, "DHCP_SEND_HOSTNAME",
+ nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no",
+ FALSE);
+
value = nm_setting_ip4_config_get_dhcp_client_id (s_ip4);
if (value)
svSetValue (ifcfg, "DHCP_CLIENT_ID", value, FALSE);
}
svSetValue (ifcfg, "IPV4_FAILURE_FATAL",
nm_setting_ip4_config_get_may_fail (s_ip4) ? "no" : "yes",
--
1.9.3
From 0b3fdd073e8665f04f480cda50df7b11955bfd80 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 16:20:48 -0600
Subject: [PATCH] ifcfg-rh: fix handling of DHCP_SEND_HOSTNAME when no hostname
is given
Move DHCP_SEND_HOSTNAME parsing out of the check for DHCP_HOSTNAME so that
users can disable NM sending the system hostname to the DHCP server when
DHCP_HOSTNAME is not defined.
---
src/settings/plugins/ifcfg-rh/reader.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 2c808cf..1650b84 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -1361,21 +1361,22 @@ make_ip4_setting (shvarFile *ifcfg,
if (!nm_setting_ip4_config_add_address (s_ip4, addr))
PLUGIN_WARN (IFCFG_PLUGIN_NAME, " warning: duplicate IP4 address");
nm_ip4_address_unref (addr);
}
} else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
value = svGetValue (ifcfg, "DHCP_HOSTNAME", FALSE);
if (value && strlen (value))
- g_object_set (s_ip4,
- NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value,
- NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
- svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
- NULL);
+ g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME, value, NULL);
g_free (value);
+ g_object_set (s_ip4,
+ NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME,
+ svTrueValue (ifcfg, "DHCP_SEND_HOSTNAME", TRUE),
+ NULL);
+
value = svGetValue (ifcfg, "DHCP_CLIENT_ID", FALSE);
if (value && strlen (value))
g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL);
g_free (value);
}
/* DNS servers
--
1.9.3

View File

@ -0,0 +1,130 @@
commit 09bde40f02c2a02f9503ca0ae430753ca81c1792
Author: Dan Williams <dcbw@redhat.com>
Date: Wed Oct 9 13:55:05 2013 -0500
core: fix PropertiesChanged signals for IP-related properties
To present a consistent API to clients, the IP-related properties
are only valid when the device has finished IP configuration. But
they are set before that happens, and their change notifications
were emitted before the IP configuration was considered valid.
Re-emit the change notifications when the device enters the IP_CHECK
state (and thus has IP configuration) and also when the device
deactivates to enusre clients have up-to-date IP-related property
information.
For the changes to has_ip_config(), the priv->ipX_state checks are
not necessary since the device will have valid IP configuration
when it enters the IP_CHECK state. The other checks can be
consolidated into a single statement.
Acked-by: Dan Winship
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 6810afc..4d61c6a 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -5282,18 +5282,11 @@ set_property (GObject *object, guint prop_id,
}
static gboolean
-has_ip_config (NMDevice *self)
+ip_config_valid (NMDeviceState state)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
-
- if (priv->ip4_state != IP_DONE && priv->ip6_state != IP_DONE)
- return FALSE;
-
- if (priv->state == NM_DEVICE_STATE_UNMANAGED)
- return TRUE;
-
- return (priv->state >= NM_DEVICE_STATE_IP_CONFIG
- && priv->state <= NM_DEVICE_STATE_DEACTIVATING);
+ return (state == NM_DEVICE_STATE_UNMANAGED) ||
+ (state >= NM_DEVICE_STATE_IP_CHECK &&
+ state <= NM_DEVICE_STATE_DEACTIVATING);
}
static void
@@ -5315,7 +5308,7 @@ get_property (GObject *object, guint prop_id,
g_value_set_string (value, priv->iface);
break;
case PROP_IP_IFACE:
- if (has_ip_config (self))
+ if (ip_config_valid (priv->state))
g_value_set_string (value, nm_device_get_ip_iface (self));
else
g_value_set_string (value, NULL);
@@ -5342,25 +5335,25 @@ get_property (GObject *object, guint prop_id,
g_value_set_boolean (value, priv->carrier);
break;
case PROP_IP4_CONFIG:
- if (has_ip_config (self) && priv->ip4_config)
+ if (ip_config_valid (priv->state) && priv->ip4_config)
g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_DHCP4_CONFIG:
- if (has_ip_config (self) && priv->dhcp4_client)
+ if (ip_config_valid (priv->state) && priv->dhcp4_client)
g_value_set_boxed (value, nm_dhcp4_config_get_dbus_path (priv->dhcp4_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_IP6_CONFIG:
- if (has_ip_config (self) && priv->ip6_config)
+ if (ip_config_valid (priv->state) && priv->ip6_config)
g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_DHCP6_CONFIG:
- if (has_ip_config (self) && priv->dhcp6_client)
+ if (ip_config_valid (priv->state) && priv->dhcp6_client)
g_value_set_boxed (value, nm_dhcp6_config_get_dbus_path (priv->dhcp6_config));
else
g_value_set_boxed (value, "/");
@@ -5918,6 +5911,16 @@ state_implies_pending_action (NMDeviceState state)
return "unknown";
}
+static void
+notify_ip_properties (NMDevice *device)
+{
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP_IFACE);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP4_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_IP6_CONFIG);
+ g_object_notify (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG);
+}
+
void
nm_device_state_changed (NMDevice *device,
NMDeviceState state,
@@ -6077,6 +6080,11 @@ nm_device_state_changed (NMDevice *device,
break;
case NM_DEVICE_STATE_IP_CHECK:
nm_device_start_ip_check (device);
+
+ /* IP-related properties are only valid when the device has IP configuration;
+ * now that it does, ensure their change notifications are emitted.
+ */
+ notify_ip_properties (device);
break;
case NM_DEVICE_STATE_SECONDARIES:
ip_check_gw_ping_cleanup (device);
@@ -6093,6 +6101,12 @@ nm_device_state_changed (NMDevice *device,
if (old_state == NM_DEVICE_STATE_ACTIVATED)
nm_dispatcher_call (DISPATCHER_ACTION_DOWN, nm_act_request_get_connection (req), device, NULL, NULL);
+ /* IP-related properties are only valid when the device has IP configuration.
+ * If it no longer does, ensure their change notifications are emitted.
+ */
+ if (ip_config_valid (old_state) && !ip_config_valid (state))
+ notify_ip_properties (device);
+
/* Dispose of the cached activation request */
if (req)
g_object_unref (req);

View File

@ -0,0 +1,4 @@
[connectivity]
uri=http://fedoraproject.org/static/hotspot.txt
response=OK

View File

@ -0,0 +1,67 @@
From 7481c64ad5068130d92066b1155e6933f8c39655 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Mon, 16 Dec 2013 14:42:40 -0500
Subject: [PATCH] systemd: add "Before=network.service" on Fedora/RHEL (rh
#1034983)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On Fedora/RHEL, NetworkManager.service needs to be started before
network.service, or else network.service may try to bring up NM's
devices itself.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
configure.ac | 6 ++++++
data/Makefile.am | 3 ++-
data/NetworkManager.service.in | 2 +-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index f19b9ad..b525de6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,12 @@ AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_RH, test "$enable_ifcfg_rh" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFCFG_SUSE, test "$enable_ifcfg_suse" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFUPDOWN, test "$enable_ifupdown" = "yes")
AM_CONDITIONAL(CONFIG_PLUGIN_IFNET, test "$enable_ifnet" = "yes")
+
+if test "$enable_ifcfg_rh" = "yes"; then
+ DISTRO_NETWORK_SERVICE=network.service
+fi
+AC_SUBST(DISTRO_NETWORK_SERVICE)
+
# Code coverage
GNOME_CODE_COVERAGE
diff --git a/data/Makefile.am b/data/Makefile.am
index df93f27..29011ef 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -38,7 +38,8 @@ edit = sed \
-e 's|@sbindir[@]|$(sbindir)|g' \
-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-e 's|@localstatedir[@]|$(localstatedir)|g' \
- -e 's|@libexecdir[@]|$(libexecdir)|g'
+ -e 's|@libexecdir[@]|$(libexecdir)|g' \
+ -e 's|@DISTRO_NETWORK_SERVICE[@]|$(DISTRO_NETWORK_SERVICE)|g'
EXTRA_DIST = \
NetworkManager.service.in \
diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in
index 8ceefad..84a9c95 100644
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -1,7 +1,7 @@
[Unit]
Description=Network Manager
Wants=network.target
-Before=network.target
+Before=network.target @DISTRO_NETWORK_SERVICE@
[Service]
Type=dbus
--
1.7.11.7

View File

@ -2,24 +2,51 @@
%define dbus_glib_version 0.94
%define glib2_version 2.24.0
%define wireless_tools_version 1:28-0pre9
%define libnl3_version 3.2.7
%define ppp_version 2.4.5
%if (0%{?fedora} && 0%{?fedora} > 20)
%define ppp_version 2.4.6
%endif
%define snapshot .git20131003
%define git_sha .xxxxxxx
%define realversion 0.9.9.0
%global with_nmtui 0
%if 0%{?fedora}
%global regen_docs 1
%else
#%global regen_docs 0
%global regen_docs 1
%endif
%global regen_docs 0
%define systemd_dir %{_prefix}/lib/systemd/system
%define udev_dir %{_prefix}/lib/udev
%if ! 0%{?rhel} && (! 0%{?fedora} || 0%{?fedora} < 20)
%ifnarch s390 s390x
# No wimax or bluetooth on s390
%global with_wimax 1
%endif
%endif
%if 0%{?rhel} || (0%{?fedora} > 19)
%global with_teamctl 1
%endif
%global _hardened_build 1
Name: NetworkManager
Summary: Network connection manager and user applications
Epoch: 1
Version: 0.9.9.0
Release: 23%{snapshot}%{?dist}
Release: 48%{snapshot}%{?dist}
Group: System Environment/Base
License: GPLv2+
URL: http://www.gnome.org/projects/NetworkManager/
@ -27,7 +54,9 @@ URL: http://www.gnome.org/projects/NetworkManager/
Source: %{name}-%{realversion}%{snapshot}.tar.bz2
Source1: NetworkManager.conf
Source2: 00-server.conf
Patch1: explain-dns1-dns2.patch
Source3: 20-connectivity-fedora.conf
Patch1: 0001-explain-dns1-dns2.patch
Patch2: rh1023571-fix-crash-ifcfg-rh-reload.patch
Patch3: rh1021112-fix-crash-never-default.patch
Patch4: rh1019021-fix-crash-ip6-routing.patch
@ -50,9 +79,69 @@ Patch20: rh1029213-ignore-RA-default-routes.patch
Patch21: rh1032819-set-broadcast-address.patch
Patch22: rh1044757-ipv6-solicit-infinity.patch
Patch23: rh1048711-bluez-crash.patch
Patch24: vpn-connection-states.patch
Patch25: nmcli-group-dot-field.patch
Patch26: rh1036132-VPN-active-con-info.patch
Patch27: rh1031574-primary-connection.patch
Patch28: physical-port-id.patch
Patch29: gi-fix-for-ipv6.patch
Patch30: fix-read-phys-port-id.patch
Patch31: export-missing-libnm-glib-funcs.patch
Patch32: get-nameservers.patch
Patch33: get-ip-examples.patch
Patch34: rem-con-constructed.patch
Patch35: rh1057738-dbus-clean-exit.patch
Patch36: rh1048046-dhcp-no-ipv6.patch
Patch37: rh983325-add-route-for-dhcp-server.patch
Patch38: rh1030068-vpn-tunnel-interface.patch
Patch39: core-log-ipv6-commit.patch
Patch40: platform-ignore-ipv6-ptp.patch
Patch41: load-connections-ret-value.patch
Patch42: bgo723163-add-and-activate-fix.patch
Patch43: NM-before-network-service.patch
Patch44: 0044-ipv6-privacy.patch
Patch45: 0045-platform-caching.patch
Patch46: 0046-suppress-invalid-warnings.patch
Patch47: 0047-fix-address-timestamps-in-platform.patch
Patch48: 0048-platform-to-string.patch
Patch49: 0049-dbus-bindings.patch
Patch50: 0050-backport-div-fixes.patch
Patch51: 0051-rh1046242-keyfile-crash-fix.patch
Patch52: 0052-rh1054364-fix-nm-online.patch
Patch53: 0053-rh1061911-crash-dispose-NMSecretAgent.patch
Patch54: 0054-rh1063885-extened-address-flags-for-old-kernel.patch
Patch55: 0055-rh1080474-nmcli-show-mbit-s.patch
Patch56: 0056-rh1084556-pending-action-queued-state-lock.patch
Patch57: 0057-emit-property-changed-for-active-conn.patch
Patch58: 0058-rh1086132-NM-crash-fix-wifi-ap-utils.patch
Patch59: 0059-rh1056133-fix-modem-enable-crash.patch
Patch60: 0060-rh1055099-secondary-connections-state.patch
Patch61: 0061-rh1076469-fix-crash-teamdctl-cli-fini.patch
Patch62: 0062-bgo728367-devices-property.patch
Patch63: 0063-rh1095378-endless-loop.patch
Patch64: 0064-rh1059494-fix-bluetooth-NM-crash.patch
Patch65: 0065-rh1094064-agent-crash-fix.patch
Patch66: 0066-rh1082041-addr-preferred-time-fix.patch
Patch67: 0067-rh1113122-missing-dispatcher-event-on-dhcp-change.patch
Patch68: 0068-cli-bash-completion-escaping.patch
Patch69: 0069-rh1115538-fix-supplicant-crash-for-AddBlob.patch
Patch70: 0070-rh1047083-handle-mtu-for-ip4-config-merge-and-subtract.patch
Patch71: 0071-fix-connectivity-notification.patch
Patch72: 0072-rh1010288-nm_client_new-fix.patch
Patch73: 0073-rh1018017-let-systemd-manage-mm.patch
Patch74: 0074-rh1062409-ifcfg-rh-GATEWAY.patch
Patch75: 0075-rh1059597-needless-route-replacement.patch
Patch76: 0076-rh1059597-route-sources.patch
Patch77: 0077-rh1001529-dhcp-send-hostname.patch
Patch78: 0078-fix-IP-PropertiesChanged-signals.patch
Patch79: 0079-fix-vpn-DNS-removal-on-failure.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%if 0%{?fedora} && 0%{?fedora} < 20
Requires(post): chkconfig
Requires(preun): chkconfig
%endif
Requires(post): systemd-sysv
Requires(post): systemd
Requires(preun): systemd
@ -82,7 +171,7 @@ Conflicts: kde-plasma-networkmanagement < 1:0.9-0.49.20110527git.nm09
BuildRequires: dbus-devel >= %{dbus_version}
BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
%if 0%{?fedora}
BuildRequires: wireless-tools-devel >= 1:28-0pre9
BuildRequires: wireless-tools-devel >= %{wireless_tools_version}
%endif
BuildRequires: glib2-devel >= %{glib2_version}
BuildRequires: gobject-introspection-devel >= 0.10.3
@ -106,10 +195,22 @@ BuildRequires: libuuid-devel
BuildRequires: libgudev1-devel >= 143
BuildRequires: vala-tools
BuildRequires: iptables
%if 0%{?with_wimax}
BuildRequires: wimax-devel
%endif
BuildRequires: systemd >= 200-3 systemd-devel
BuildRequires: libsoup-devel
BuildRequires: libndp-devel >= 1.0
%if 0%{?rhel} || (0%{?fedora} && 0%{?fedora} > 19)
BuildRequires: ModemManager-glib-devel >= 1.0
%endif
%if 0%{?with_nmtui}
BuildRequires: newt-devel
%endif
%if 0%{?with_teamctl}
BuildRequires: teamd-devel
%endif
%description
NetworkManager is a system network service that manages your network devices
@ -118,6 +219,19 @@ It manages ethernet, WiFi, mobile broadband (WWAN), and PPPoE devices, and
provides VPN integration with a variety of different VPN services.
%if 0%{?with_wimax}
%package wimax
Summary: Intel WiMAX device support for NetworkManager
Group: System Environment/Base
Requires: wimax
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description wimax
This package contains NetworkManager support for Intel WiMAX mobile broadband
devices.
%endif
%package devel
Summary: Libraries and headers for adding NetworkManager support to applications
Group: Development/Libraries
@ -155,6 +269,15 @@ Requires: dbus-glib-devel >= %{dbus_glib_version}
This package contains the header and pkg-config files for development applications using
NetworkManager functionality from applications that use glib.
%package config-connectivity-fedora
Summary: NetworkManager config file for connectivity checking via Fedora servers
Group: System Environment/Base
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
%description config-connectivity-fedora
This adds a NetworkManager configuration file to enable connectivity checking
via Fedora infrastructure.
%package config-server
Summary: NetworkManager config file for "server-like" defaults
Group: System Environment/Base
@ -170,10 +293,23 @@ ethernet devices with no carrier.
This package is intended to be installed by default for server
deployments.
%if 0%{with_nmtui}
%package tui
Summary: NetworkManager curses-based UI
Group: System Environment/Base
Requires: %{name}%{?_isa} = %{epoch}:%{version}-%{release}
Requires: %{name}-glib%{?_isa} = %{epoch}:%{version}-%{release}
%description tui
This adds a curses-based "TUI" (Text User Interface) to
NetworkManager, to allow performing some of the operations supported
by nm-connection-editor and nm-applet in a non-graphical environment.
%endif
%prep
%setup -q -n NetworkManager-%{realversion}
%patch1 -p1 -b .explain-dns1-dns2
%patch1 -p1 -b .0001.explain-dns1-dns2.orig
%patch2 -p1 -b .patch2
%patch3 -p1 -b .patch3
%patch4 -p1 -b .patch4
@ -196,6 +332,62 @@ deployments.
%patch21 -p1 -b .broadcast-addr
%patch22 -p1 -b .ipv6-solicit-infinity
%patch23 -p1 -b .bluez-crash
%patch24 -p1 -b .vpn-connection-states
%patch25 -p1 -b .nmcli-group-dot-field
%patch26 -p1 -b .VPN-active-con-info
%patch27 -p1 -b .primary-connection
%patch28 -p1 -b .physical-port-id
%patch29 -p1 -b .gi-fix-for-ipv6
%patch30 -p1 -b .fix-read-phys-port-id
%patch31 -p1 -b .export-missing-libnm-glib-funcs
%patch32 -p1 -b .get-nameservers
%patch33 -p1 -b .get-ip-examples
%patch34 -p1 -b .rem-con-constructed
%patch35 -p1 -b .rh1057738-dbus-clean-exit
%patch36 -p1 -b .rh1048046-dhcp-no-ipv6
%patch37 -p1 -b .rh983325-add-route-for-dhcp-server
%patch38 -p1 -b .rh1030068-vpn-tunnel-interface
%patch39 -p1 -b .core-log-ipv6-commit
%patch40 -p1 -b .platform-ignore-ipv6-ptp
%patch41 -p1 -b .load-connections-ret-value
%patch42 -p1 -b .bgo723163-add-and-activate-fix
%patch43 -p1 -b .NM-before-network-service
%patch44 -p1 -b .0044-ipv6-privacy.orig
%patch45 -p1 -b .0045-platform-caching.orig
%patch46 -p1 -b .0046-suppress-invalid-warnings.orig
%patch47 -p1 -b .0047-fix-address-timestamps-in-platform.orig
%patch48 -p1 -b .0048-platform-to-string.orig
%patch49 -p1 -b .0049-dbus-bindings.orig
%patch50 -p1 -b .0050-backport-div-fixes.orig
%patch51 -p1 -b .0051-rh1046242-keyfile-crash-fix.orig
%patch52 -p1 -b .0052-rh1054364-fix-nm-online.orig
%patch53 -p1 -b .0053-rh1061911-crash-dispose-NMSecretAgent.orig
%patch54 -p1 -b .0054-rh1063885-extened-address-flags.orig
%patch55 -p1 -b .0055-rh1080474-nmcli-show-mbit-s.orig
%patch56 -p1 -b .0056-rh1084556-pending-action-queued-state-lock.orig
%patch57 -p1 -b .0057-emit-property-changed-for-active-conn.orig
%patch58 -p1 -b .0058-rh1086132-NM-crash-fix-wifi-ap-utils.orig
%patch59 -p1 -b .0059-rh1056133-fix-modem-enable-crash.orig
%patch60 -p1 -b .0060-rh1055099-secondary-connections-state.orig
%patch61 -p1 -b .0061-rh1076469-fix-crash-teamdctl-cli-fini.orig
%patch62 -p1 -b .0062-bgo728367-devices-property.orig
%patch63 -p1 -b .0063-rh1095378-endless-loop.orig
%patch64 -p1 -b .0064-rh1059494-fix-bluetooth-NM-crash.orig
%patch65 -p1 -b .0065-rh1094064-agent-crash-fix.orig
%patch66 -p1 -b .0066-rh1082041-addr-preferred-time-fix.orig
%patch67 -p1 -b .0067-rh1113122-missing-dispatcher-event-on-dhcp-change.orig
%patch68 -p1 -b .0068-cli-bash-completion-escaping.orig
%patch69 -p1 -b .0069-rh1115538-fix-supplicant-crash-for-AddBlob.orig
%patch70 -p1 -b .0070-rh1047083-handle-mtu-for-ip4-config-merge-and-subtract.orig
%patch71 -p1 -b .0071-fix-connectivity-notification.orig
%patch72 -p1 -b .0072-rh1010288-nm_client_new-fix.orig
%patch73 -p1 -b .0073-rh1018017-let-systemd-manage-mm.orig
%patch74 -p1 -b .0074-rh1062409-ifcfg-rh-GATEWAY.orig
%patch75 -p1 -b .0075-rh1059597-needless-route-replacement.orig
%patch76 -p1 -b .0076-rh1059597-route-sources.orig
%patch77 -p1 -b .0077-rh1001529-dhcp-send-hostname.orig
%patch78 -p1 -b .0078-fix-IP-PropertiesChanged-signals.orig
%patch79 -p1 -b .0079-fix-vpn-DNS-removal-on-failure.orig
%build
@ -205,8 +397,9 @@ deployments.
%{__cp} -R docs ORIG-docs
%endif
autoreconf -i --force
#autopoint --force
#intltoolize --force
intltoolize --force
%configure \
--disable-static \
--with-dhclient=yes \
@ -214,17 +407,29 @@ deployments.
--with-crypto=nss \
--enable-more-warnings=error \
--enable-ppp=yes \
%if 0%{?rhel} || (0%{?fedora} > 19)
--with-modem-manager-1=yes \
--enable-bluez4=no \
%else
--with-modem-manager-1=no \
%endif
%if 0%{?with_wimax}
--enable-wimax=yes \
%else
--enable-wimax=no \
%endif
--enable-vala=yes \
%if %{regen_docs}
%if 0%{?regen_docs}
--enable-gtk-doc \
%endif
%if 0%{?fedora}
--with-wext=yes \
%else
--with-wext=no \
%endif
%if 0%{?with_teamctl}
--enable-teamdctl=yes \
%else
--enable-teamdctl=no \
%endif
--enable-polkit=yes \
--enable-modify-system=yes \
@ -253,6 +458,7 @@ make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d
%{__cp} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d
%{__cp} %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/conf.d
# create a VPN directory
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/NetworkManager/VPN
@ -345,8 +551,15 @@ fi
%{systemd_dir}/NetworkManager-wait-online.service
%{systemd_dir}/NetworkManager-dispatcher.service
%{systemd_dir}/network-online.target.wants/NetworkManager-wait-online.service
%dir %{_datadir}/doc/NetworkManager/examples
%{_datadir}/doc/NetworkManager/examples/server.conf
%if 0%{?with_wimax}
%files wimax
%defattr(-,root,root,0755)
%{_libdir}/%{name}/libnm-device-plugin-wimax.so
%endif
%files devel
%defattr(-,root,root,0755)
%doc ChangeLog docs/api/html/*
@ -389,11 +602,158 @@ fi
%dir %{_datadir}/gtk-doc/html/libnm-util
%{_datadir}/gtk-doc/html/libnm-util/*
%files config-connectivity-fedora
%defattr(-,root,root,0755)
%dir %{_sysconfdir}/%{name}/conf.d
%config(noreplace) %{_sysconfdir}/%{name}/conf.d/20-connectivity-fedora.conf
%files config-server
%defattr(-,root,root,0755)
%config %{_sysconfdir}/%{name}/conf.d/00-server.conf
%dir %{_sysconfdir}/%{name}/conf.d
%config(noreplace) %{_sysconfdir}/%{name}/conf.d/00-server.conf
%if 0%{?with_nmtui}
%files tui
%{_bindir}/nmtui
%{_bindir}/nmtui-edit
%{_bindir}/nmtui-connect
%{_bindir}/nmtui-hostname
%endif
%changelog
* Thu Nov 13 2014 Dan Williams <dcbw@redhat.com> - 0.9.9.0-48.git20131003
- core: fix periodic failure to remove VPN nameservers from resolv.conf
* Mon Oct 27 2014 Dan Williams <dcbw@redhat.com> - 0.9.9.0-47.git20131003
- core: fix IP-related PropertiesChanged signal emission
* Fri Oct 17 2014 Dan Williams <dcbw@redhat.com> - 0.9.9.0-46.git20131003
- ifcfg-rh: backport DHCP_SEND_HOSTNAME=no/yes option (rh #1001529)
* Thu Sep 25 2014 Lubomir Rintel <lkundrak@v3.sk> - 0.9.9.0-45.git20131003
- core/platform: add address/route sources (rh#1059597)
- platform: don't replace routes that already exist (rh#1059597)
* Thu Sep 04 2014 Dan Williams <dcbw@redhat.com> - 0.9.9.0-44.git20131003
- ifcfg-rh: write GATEWAY instead of GATEWAY0 to be ifup-compatible (rh #1062409)
* Tue Jul 29 2014 Dan Williams <dcbw@redhat.com> - 0.9.9.0-43.git20131003
- wwan: let systemd manage the ModemManager life-cycle (rh #1018017)
* Thu Jul 24 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-42.git20131003
- libnm-glib: fix a crash in nm_client_new() (rh #1010288) (rh #1122593)
- manager: fix notification of the connectivity property
- new NetworkManager-config-connectivity-fedora package with connectivity config
* Wed Jul 2 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-41.git20131003
- core: fix crash passing wrong parameter to AddBlob for wpa_supplicant (rh #1115538)
- core: fix setting MTU from DHCP (rh #1047083)
* Wed Jun 25 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-40.git20131003
- core: fix missing dispatcher events on DHCP change (rh #1113122)
- cli: improve escaping special characters and space for bash completion (bgo #709426)
* Thu Jun 12 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-39.git20131003
- core: fix Wi-Fi activation endless loop on missing secrets (rh #1095378)
- bluetooth: fix NM crash on bluetooth turn-off while connected to a phone (rh #1059494)
- agents: fix crash in nm_secret_agent_cancel_secrets() (rh #922855)
- platform: fix setting preferred time for address (rh #1082041)
* Thu Apr 17 2014 Dan Winship <danw@redhat.com> - 0.9.9.0-38.git20131003
- core: update NMManager:devices before emitting notify::devices (bgo #728367)
* Tue Apr 15 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-37.git20131003
- policy: check device state before changing it for secondaries (rh #1055099)
- team: fix crash in teamdctl (rh #1076469)
* Mon Apr 14 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-36.git20131003
- mobile: fix crash (only move to NEED_AUTH during activation (rh #1056133) (rh #1058308)
* Thu Apr 10 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-35.git20131003
- wifi: fix possible crash in Wi-Fi utils (rh #1086132)
* Tue Apr 8 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-34.git20131003
- fix nm-online returning success wrongly (rh #1054364)
- fix crash in NMSecretAgent dispose (rh #1061911)
- fix adding addresses with extended address flags for older kernels (rh #1063885)
- cli: show maximum bitrate in MBit/s (rh #1080474)
- fix hanging pending action queued-state-lock (rh #1084556)
- core: emit PropertyChanged signal for ActiveConnection when disconnecting
* Fri Mar 21 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-33.git20131003
- keyfile: fix crash on reloading connections (rh #1046242)
* Mon Mar 17 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-32.git20131003
- fix adding ipv6 device routes for autoconf prefixes (rh #1068632)
- fix adding gateway routes within the own subnet
- rdisc: set the expiration timer correctly (rh #1073560)
- libnm-glib: fix a double free in NMDeviceVlan
- ifcfg-rh: add missing functionality for reading/writing subject matches
- libnm-util: fix adding values to 'phase2-altsubject-matches'
- libnm-util: fix verify_identity() in '802-1x' setting
- platform: fix converting address flags in nm_platform_ip6_address_to_string()
- policy: fix crash caused by calling functions on connection==NULL
* Mon Feb 24 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-31.git20131003
- fix timestamps for addresses received from kernel/platform
- improve platform to_string functions to show all address/route paramters
- libnm-util: add dbus properties to help out bindings (bgo #715186)
* Sun Feb 16 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-30.git20131003
- revert previous snapshot release 0.9.9.0-29.git20140131, instead based on 0.9.9.0-28.git20131003
- support for ipv6 private addresses (rfc4941) (rh #1047139)
- add ipv6 autoconf addresses with /64 prefix (rh #1045118)
- wait for IPv6 LL before starting autoconf
- bugfix caching of libnl objects (caused error with new libnl3 version when activating bridges) (rh #1063290)
- suppress invalid error message about reading sysfs file phys_port_id
- suppress invalid warning message about adding firewalld zone
* Tue Feb 4 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-29.git20140131
- update to new upstream snapshot
- add nmtui package
- cli: consolidate syntax for 'connection show' with respect to active connections
- support for ipv6 private addresses (rfc4941) (rh #1047139)
- add ipv6 autoconf addresses with /64 prefix (rh #1045118)
- cleanup timestamp handling to use monotonic time
- cli: add option to update connection profiles in memory only
- bluez: detect bluez version at runtime
- wait for IPv6 LL before starting autoconf
- libnm-util: add dbus properties to help out bindings
- configurable logging levels per logging domain
- dbus: kill at_console usage in permissions
- policy: allow inactive (remote/SSH) sessions to perform some actions
- core: various fixes to autoconnect retry handling
* Wed Jan 29 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-28.git20131003
- platform: ignore errors adding IPv6 point-to-point address
- libnm-glib: fix return value in nm_remote_settings_load_connections()
- core: fix crash when connecting to new Wi-Fi network (bgo #723163)
- systemd: add "Before=network.service" on Fedora/RHEL (rh #1034983)
* Tue Jan 28 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-27.git20131003
- core: fix reading physical port id for sysfs
- libnm-glib: export get_gateway() and get_searches() functions
- libnm-glib: new functions for bindings to get nameservers
- libnm-glib: chain up the parent constructed() of NMRemoteConnection
- core: exit cleanly if D-Bus cannot be initialized (rh #1057738)
- dhcp: don't add an IPv6 address if one wasn't given (rh #1048046)
- core: Add host route for DHCP4 server if outside assigned subnet (bgo #721767) (rh #983325)
- vpn: handle missing tunnel interface for IP-based VPNs (bgo #721724) (rh #1030068) (rh #865883)
- core: only log about IPv6 Commit the first time (rh #1044757)
* Tue Jan 21 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-26.git20131003
- core: improve handling of NPAR/SR-IOV devices (rh #804527)
- libnm-glib: add NMDevice:physical-port-id property
- libnm-glib: fix introspection annotations so that <ipv6>.get_address() worked
* Sat Jan 18 2014 Dan Winship <danw@redhat.com> - 0.9.9.0-25.git20131003
- core: fix NMManager:primary-connection when a VPN has the default route (rh #1031574)
* Tue Jan 14 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-24.git20131003
- vpn: fix logging connection states
- core/cli: display proper information for active VPN connections (rh #1036132)
- cli: allow '--fields group.field' syntax
* Mon Jan 6 2014 Dan Winship <danw@redhat.com> - 0.9.9.0-23.git20131003
- bluez-manager: fix a crash (rh #1048711)

View File

@ -0,0 +1,50 @@
From ff350c04c0546383841126ea43bed93d302482fb Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Tue, 28 Jan 2014 08:39:11 -0500
Subject: [PATCH] core: fix crash when connecting to new Wi-Fi network (bgo
#723163)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
If the user is AddAndActivating a new network, the connection may not
have an NMSettingConnection yet, but we know that once it does, the
user will be authorized.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-manager-auth.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/nm-manager-auth.c b/src/nm-manager-auth.c
index 7452bc3..7f8b313 100644
--- a/src/nm-manager-auth.c
+++ b/src/nm-manager-auth.c
@@ -535,9 +535,6 @@ nm_auth_uid_in_acl (NMConnection *connection,
if (0 == uid)
return TRUE;
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
-
/* Reject the request if the request comes from no session at all */
if (!nm_session_monitor_uid_has_session (smon, uid, &user, &local)) {
if (out_error_desc) {
@@ -555,6 +552,14 @@ nm_auth_uid_in_acl (NMConnection *connection,
return FALSE;
}
+ s_con = nm_connection_get_setting_connection (connection);
+ if (!s_con) {
+ /* This can only happen when called from AddAndActivate, so we know
+ * the user will be authorized when the connection is completed.
+ */
+ return TRUE;
+ }
+
/* Match the username returned by the session check to a user in the ACL */
if (!nm_setting_connection_permissions_user_allowed (s_con, user)) {
if (out_error_desc)
--
1.7.11.7

View File

@ -0,0 +1,94 @@
From 13f4a00d4d490fb65f93c246d1c93ed56a47213f Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 23 Jan 2014 13:02:16 -0600
Subject: [PATCH] core: only log about IPv6 Commit the first time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since IPv6 configuration gets updated every time a router advertisement
comes in, it can lead NM to continuously logging:
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) scheduled...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) started...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) complete.
that's annoying. So after the initial configuration is done, make
subsequent IPv6 Commit log messages debug instead of info.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/devices/nm-device.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 035434e..4684efe 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -335,8 +335,6 @@ static gboolean nm_device_set_ip6_config (NMDevice *dev,
gboolean commit,
NMDeviceStateReason *reason);
-static gboolean nm_device_activate_ip6_config_commit (gpointer user_data);
-
static gboolean check_connection_available (NMDevice *device, NMConnection *connection);
static gboolean spec_match_list (NMDevice *device, const GSList *specs);
@@ -4232,6 +4230,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
{
NMDevice *self = NM_DEVICE (user_data);
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
NMActRequest *req;
const char *iface;
NMConnection *connection;
@@ -4241,8 +4240,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
activation_source_clear (self, FALSE, AF_INET6);
iface = nm_device_get_iface (self);
- nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...",
- iface);
+ nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...", iface);
req = nm_device_get_act_request (self);
g_assert (req);
@@ -4262,14 +4260,13 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
} else {
- nm_log_info (LOGD_DEVICE | LOGD_IP6,
+ nm_log_warn (LOGD_DEVICE | LOGD_IP6,
"Activation (%s) Stage 5 of 5 (IPv6 Commit) failed",
iface);
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
}
- nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.",
- iface);
+ nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.", iface);
return FALSE;
}
@@ -4277,13 +4274,16 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
void
nm_device_activate_schedule_ip6_config_result (NMDevice *self)
{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+ guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
+
g_return_if_fail (NM_IS_DEVICE (self));
activation_source_schedule (self, nm_device_activate_ip6_config_commit, AF_INET6);
- nm_log_info (LOGD_DEVICE | LOGD_IP6,
- "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
- nm_device_get_iface (self));
+ nm_log (LOGD_DEVICE | LOGD_IP6, level,
+ "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
+ nm_device_get_iface (self));
}
gboolean
--
1.7.11.7

View File

@ -0,0 +1,45 @@
From 3391fa810ca323203b036a68af7f3c5802280918 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 10:03:44 +0100
Subject: [PATCH] libnm-glib: export missing get_gateway() and get_searches()
functions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
They were added by db9b7e10aca5456ec4960b75617e032209b98bc1 commit.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index cb7b599..bf69db4 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -215,8 +215,10 @@ global:
nm_dhcp6_config_new;
nm_ip4_config_get_addresses;
nm_ip4_config_get_domains;
+ nm_ip4_config_get_gateway;
nm_ip4_config_get_nameservers;
nm_ip4_config_get_routes;
+ nm_ip4_config_get_searches;
nm_ip4_config_get_type;
nm_ip4_config_get_wins_servers;
nm_ip4_config_new;
@@ -224,8 +226,10 @@ global:
nm_ip6_address_object_array_get_type;
nm_ip6_config_get_addresses;
nm_ip6_config_get_domains;
+ nm_ip6_config_get_gateway;
nm_ip6_config_get_nameservers;
nm_ip6_config_get_routes;
+ nm_ip6_config_get_searches;
nm_ip6_config_get_type;
nm_ip6_config_new;
nm_ip6_route_object_array_get_type;
--
1.7.11.7

View File

@ -0,0 +1,32 @@
From 041f449a910a48716bc88fa56287c4213a2dcb11 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 22 Jan 2014 13:20:18 -0500
Subject: [PATCH] platform: fix linux nm_platform_link_get_physical_port_id()
(rh #804527)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It was reading the wrong property name
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-linux-platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 83cbc49..8e85c59 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1765,7 +1765,7 @@ link_get_physical_port_id (NMPlatform *platform, int ifindex)
if (!ifname)
return NULL;
- path = g_strdup_printf ("/sys/class/net/%s/physical_port_id", ifname);
+ path = g_strdup_printf ("/sys/class/net/%s/phys_port_id", ifname);
if (g_file_test (path, G_FILE_TEST_EXISTS))
id = sysctl_get (platform, path);
else
--
1.7.11.7

98
get-ip-examples.patch Normal file
View File

@ -0,0 +1,98 @@
From 85272df6eb89682a3d13022281085b97527955e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 15:40:22 +0100
Subject: [PATCH] examples: update get_ips.py python example for DNS
information
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
examples/python/gi/get_ips.py | 44 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/examples/python/gi/get_ips.py b/examples/python/gi/get_ips.py
index b1e59e2..6903b6d 100755
--- a/examples/python/gi/get_ips.py
+++ b/examples/python/gi/get_ips.py
@@ -24,8 +24,8 @@ import sys, socket, struct
from gi.repository import GLib, NetworkManager, NMClient
#
-# This example shows how to get get addresses and routes from NMIP4Config and NMIP6Config
-# (got out of NMDevice)
+# This example shows how to get addresses, routes and DNS information
+# from NMIP4Config and NMIP6Config (got out of NMDevice)
#
def show_addresses(self, family):
@@ -59,7 +59,6 @@ def show_addresses(self, family):
socket.inet_ntop(family, gateway_struct))
-
def show_routes(self, family):
if (family == socket.AF_INET):
ip_cfg = self.get_ip4_config()
@@ -70,7 +69,7 @@ def show_routes(self, family):
print("None")
return
- nm_routes = ip_cfg.get_routes()
+ nm_routes = ip_cfg.get_routes()
if len(nm_routes) == 0:
print("None")
return
@@ -93,6 +92,33 @@ def show_routes(self, family):
metric)
+def show_dns(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ if (family == socket.AF_INET):
+ print ("Domains: %s") % (ip_cfg.get_domains())
+ print ("Searches: %s") % (ip_cfg.get_searches())
+ print("Nameservers:")
+ nameservers = ip_cfg.get_nameservers()
+ for dns in nameservers:
+ print socket.inet_ntop(family, struct.pack("=I", dns))
+ else:
+ print ("Domains: %s") % (ip_cfg.get_domains())
+ print ("Searches: %s") % (ip_cfg.get_searches())
+ print("Nameservers:")
+ num = ip_cfg.get_num_nameservers()
+ for i in range(0,num):
+ dns = ip_cfg.get_nameserver(i)
+ print socket.inet_ntop(family, dns)
+
+
if __name__ == "__main__":
if len(sys.argv) != 2:
sys.exit('Usage: %s <interface>' % sys.argv[0])
@@ -125,3 +151,13 @@ if __name__ == "__main__":
show_routes(dev, socket.AF_INET6)
print
+ print "IPv4 DNS:"
+ print("------------")
+ show_dns(dev, socket.AF_INET)
+ print
+
+ print "IPv6 DNS:"
+ print("------------")
+ show_dns(dev, socket.AF_INET6)
+ print
+
--
1.7.11.7

145
get-nameservers.patch Normal file
View File

@ -0,0 +1,145 @@
From 8ee4f58e9ee67df2ef761a691dec55c6008ad4ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Wed, 22 Jan 2014 15:31:56 +0100
Subject: [PATCH] libnm-glib: additional functions to get nameservers (rh
#1056146)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This commit adds two new functions for introspection users to get nameservers:
guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config)
const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
The existing function can't be used due to GObject introspection limitations:
const GSList *nm_ip6_config_get_nameservers (NMIP6Config *config);
https://bugzilla.redhat.com/show_bug.cgi?id=1056146
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 2 ++
libnm-glib/nm-ip6-config.c | 52 +++++++++++++++++++++++++++++++++++++++++++++-
libnm-glib/nm-ip6-config.h | 16 +++++++-------
3 files changed, 62 insertions(+), 8 deletions(-)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index bf69db4..9f0db93 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -227,7 +227,9 @@ global:
nm_ip6_config_get_addresses;
nm_ip6_config_get_domains;
nm_ip6_config_get_gateway;
+ nm_ip6_config_get_nameserver;
nm_ip6_config_get_nameservers;
+ nm_ip6_config_get_num_nameservers;
nm_ip6_config_get_routes;
nm_ip6_config_get_searches;
nm_ip6_config_get_type;
diff --git a/libnm-glib/nm-ip6-config.c b/libnm-glib/nm-ip6-config.c
index 01e2cae..7c9cfca 100644
--- a/libnm-glib/nm-ip6-config.c
+++ b/libnm-glib/nm-ip6-config.c
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2008 - 2011 Red Hat, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*/
#include <string.h>
@@ -192,6 +192,56 @@ nm_ip6_config_get_addresses (NMIP6Config *config)
return NM_IP6_CONFIG_GET_PRIVATE (config)->addresses;
}
+/**
+ * nm_ip6_config_get_num_nameservers:
+ * @config: a #NMIP6Config
+ *
+ * Gets the number of the domain name servers in the configuration.
+ *
+ * Returns: the number of domain name servers
+ *
+ * Since: 0.9.10
+ **/
+guint32
+nm_ip6_config_get_num_nameservers (NMIP6Config *config)
+{
+ g_return_val_if_fail (NM_IS_IP6_CONFIG (config), 0);
+
+ _nm_object_ensure_inited (NM_OBJECT (config));
+ return g_slist_length (NM_IP6_CONFIG_GET_PRIVATE (config)->nameservers);
+}
+
+/**
+ * nm_ip6_config_get_nameserver:
+ * @config: a #NMIP6Config
+ * @idx: index of the nameserver to return
+ *
+ * Gets the domain name server at index @idx in the configuration.
+ *
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of domain name server at index @iidx
+ *
+ * Since: 0.9.10
+ **/
+const struct in6_addr *
+nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
+{
+ NMIP6ConfigPrivate *priv;
+ GSList *item;
+ guint32 i = 0;
+
+ g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (config));
+ priv = NM_IP6_CONFIG_GET_PRIVATE (config);
+
+ for (item = priv->nameservers; item && i < idx; i++)
+ item = item->next;
+
+ g_return_val_if_fail (item, NULL);
+ return item ? (const struct in6_addr *) item->data : NULL;
+}
+
/* FIXME: like in libnm_util, in6_addr is not introspectable, so skipping here */
/**
* nm_ip6_config_get_nameservers: (skip)
diff --git a/libnm-glib/nm-ip6-config.h b/libnm-glib/nm-ip6-config.h
index a71d74b..b6198fa 100644
--- a/libnm-glib/nm-ip6-config.h
+++ b/libnm-glib/nm-ip6-config.h
@@ -18,7 +18,7 @@
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2007 - 2008 Novell, Inc.
- * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2008 - 2014 Red Hat, Inc.
*/
#ifndef NM_IP6_CONFIG_H
@@ -65,12 +65,14 @@ GType nm_ip6_config_get_type (void);
GObject *nm_ip6_config_new (DBusGConnection *connection, const char *object_path);
-const char * nm_ip6_config_get_gateway (NMIP6Config *config);
-const GSList * nm_ip6_config_get_addresses (NMIP6Config *config);
-const GSList * nm_ip6_config_get_routes (NMIP6Config *config);
-const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config);
-const GPtrArray *nm_ip6_config_get_domains (NMIP6Config *config);
-const GPtrArray *nm_ip6_config_get_searches (NMIP6Config *config);
+const char * nm_ip6_config_get_gateway (NMIP6Config *config);
+const GSList * nm_ip6_config_get_addresses (NMIP6Config *config);
+const GSList * nm_ip6_config_get_routes (NMIP6Config *config);
+guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config);
+const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx);
+const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config);
+const GPtrArray * nm_ip6_config_get_domains (NMIP6Config *config);
+const GPtrArray * nm_ip6_config_get_searches (NMIP6Config *config);
G_END_DECLS
--
1.7.11.7

230
gi-fix-for-ipv6.patch Normal file
View File

@ -0,0 +1,230 @@
From 7ffbbae3a046dbb4c8d5089c41b143eafabed709 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 16 Jan 2014 17:29:08 +0100
Subject: [PATCH 1/2] libnm-glib; fix introspection annotations so that
<ipv6>.get_address() worked
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Without the correct annotation, the functions didn't work correctly in Python
(causing segmentation fault).
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-util/nm-setting-ip6-config.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c
index 7798db3..b02e231 100644
--- a/libnm-util/nm-setting-ip6-config.c
+++ b/libnm-util/nm-setting-ip6-config.c
@@ -1285,7 +1285,8 @@ nm_ip6_address_compare (NMIP6Address *address, NMIP6Address *other)
*
* Gets the IPv6 address property of this address object.
*
- * Returns: (transfer none): the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address
**/
const struct in6_addr *
nm_ip6_address_get_address (NMIP6Address *address)
@@ -1354,7 +1355,9 @@ nm_ip6_address_set_prefix (NMIP6Address *address, guint32 prefix)
*
* Gets the IPv6 default gateway property of this address object.
*
- * Returns: (transfer none): the IPv6 gateway address
+ * Returns: (transfer none):
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 gateway address
**/
const struct in6_addr *
nm_ip6_address_get_gateway (NMIP6Address *address)
@@ -1502,7 +1505,8 @@ nm_ip6_route_compare (NMIP6Route *route, NMIP6Route *other)
*
* Gets the IPv6 destination address property of this route object.
*
- * Returns: the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of destination
**/
const struct in6_addr *
nm_ip6_route_get_dest (NMIP6Route *route)
@@ -1571,7 +1575,8 @@ nm_ip6_route_set_prefix (NMIP6Route *route, guint32 prefix)
*
* Gets the IPv6 address of the next hop of this route.
*
- * Returns: the IPv6 address
+ * Returns: (array fixed-size=16) (element-type guint8) (transfer none):
+ * the IPv6 address of next hop
**/
const struct in6_addr *
nm_ip6_route_get_next_hop (NMIP6Route *route)
--
1.7.11.7
From 68fe50ff3a4774c0abff1d6f8c2f270b73105351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 16 Jan 2014 17:27:05 +0100
Subject: [PATCH 2/2] examples: add an python example (using GI) getting
device IPs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
examples/python/gi/Makefile.am | 3 +-
examples/python/gi/get_ips.py | 127 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 129 insertions(+), 1 deletion(-)
create mode 100755 examples/python/gi/get_ips.py
diff --git a/examples/python/gi/Makefile.am b/examples/python/gi/Makefile.am
index 78569b3..7f122a4 100644
--- a/examples/python/gi/Makefile.am
+++ b/examples/python/gi/Makefile.am
@@ -2,4 +2,5 @@ EXTRA_DIST = \
list-connections.py \
device-state-ip4config.py \
firewall-zone.py \
- show-wifi-networks.py
+ show-wifi-networks.py \
+ get_ips.py
diff --git a/examples/python/gi/get_ips.py b/examples/python/gi/get_ips.py
new file mode 100755
index 0000000..b1e59e2
--- /dev/null
+++ b/examples/python/gi/get_ips.py
@@ -0,0 +1,127 @@
+#!/usr/bin/env python
+#
+# vim: ft=python ts=4 sts=4 sw=4 et ai
+# -*- Mode: Python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+
+import sys, socket, struct
+from gi.repository import GLib, NetworkManager, NMClient
+
+#
+# This example shows how to get get addresses and routes from NMIP4Config and NMIP6Config
+# (got out of NMDevice)
+#
+
+def show_addresses(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ nm_addresses = ip_cfg.get_addresses()
+ if len(nm_addresses) == 0:
+ print("None")
+ return
+
+ for nm_address in nm_addresses:
+ addr = nm_address.get_address()
+ prefix = nm_address.get_prefix()
+ gateway = nm_address.get_gateway()
+
+ if (family == socket.AF_INET):
+ addr_struct = struct.pack("=I", addr)
+ gateway_struct = struct.pack("=I", gateway)
+ else:
+ addr_struct = addr
+ gateway_struct = gateway
+ print("%s/%d %s") % (socket.inet_ntop(family, addr_struct),
+ prefix,
+ socket.inet_ntop(family, gateway_struct))
+
+
+
+def show_routes(self, family):
+ if (family == socket.AF_INET):
+ ip_cfg = self.get_ip4_config()
+ else:
+ ip_cfg = self.get_ip6_config()
+
+ if ip_cfg is None:
+ print("None")
+ return
+
+ nm_routes = ip_cfg.get_routes()
+ if len(nm_routes) == 0:
+ print("None")
+ return
+
+ for nm_route in nm_routes:
+ dest = nm_route.get_dest()
+ prefix = nm_route.get_prefix()
+ next_hop = nm_route.get_next_hop()
+ metric = nm_route.get_metric()
+
+ if (family == socket.AF_INET):
+ dest_struct = struct.pack("=I", dest)
+ next_hop_struct = struct.pack("=I", next_hop)
+ else:
+ dest_struct = dest
+ next_hop_struct = next_hop
+ print("%s/%d %s %d") % (socket.inet_ntop(family, dest_struct),
+ prefix,
+ socket.inet_ntop(family, next_hop_struct),
+ metric)
+
+
+if __name__ == "__main__":
+ if len(sys.argv) != 2:
+ sys.exit('Usage: %s <interface>' % sys.argv[0])
+ dev_iface = sys.argv[1]
+
+ c = NMClient.Client.new()
+ dev = c.get_device_by_iface(dev_iface)
+ if dev is None:
+ sys.exit('Device \'%s\' not found' % dev_iface)
+ print "Device: %s - %s" % (dev_iface, dev.get_device_type().value_name)
+ print "---------------------------------------"
+
+ print("IPv4 addresses:")
+ print("---------------")
+ show_addresses(dev, socket.AF_INET)
+ print
+
+ print("IPv4 routes:")
+ print("------------")
+ show_routes(dev, socket.AF_INET)
+ print
+
+ print "IPv6 addresses:"
+ print("---------------")
+ show_addresses(dev, socket.AF_INET6)
+ print
+
+ print "IPv6 routes:"
+ print("------------")
+ show_routes(dev, socket.AF_INET6)
+ print
+
--
1.7.11.7

View File

@ -0,0 +1,34 @@
From de36db0af15fccf273fa05413219df23e3a07f25 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 18 Nov 2013 09:06:23 +0100
Subject: [PATCH] libnm-glib: fix return value in
nm_remote_settings_load_connections()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
when g_return_val_if_fail() fails.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-remote-settings.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index 0226e99..1110295 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -664,8 +664,8 @@ nm_remote_settings_load_connections (NMRemoteSettings *settings,
char **my_failures = NULL;
gboolean ret = FALSE;
- g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), NULL);
- g_return_val_if_fail (filenames != NULL, NULL);
+ g_return_val_if_fail (NM_IS_REMOTE_SETTINGS (settings), FALSE);
+ g_return_val_if_fail (filenames != NULL, FALSE);
priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings);
--
1.7.11.7

709
makerepo.gitignore Normal file
View File

@ -0,0 +1,709 @@
*.[0-9][0-9][0-9][0-9][.-]*.orig
aclocal.m4
autom4te.cache/output.0
autom4te.cache/output.1
autom4te.cache/requests
autom4te.cache/traces.0
autom4te.cache/traces.1
build-aux/config.sub
callouts/.libs/
callouts/libtest-dispatcher-envp.la
callouts/libtest_dispatcher_envp_la-nm-dispatcher-utils.lo
callouts/Makefile
callouts/Makefile.in
callouts/nm-avahi-autoipd.action
callouts/nm-avahi-autoipd-action.o
callouts/nm-dispatcher.action
callouts/nm-dispatcher-action.o
callouts/nm-dispatcher-glue.h
callouts/nm-dispatcher-utils.o
callouts/org.freedesktop.nm_dispatcher.service
callouts/tests/.libs/
callouts/tests/Makefile
callouts/tests/Makefile.in
callouts/tests/test-dispatcher-envp
callouts/tests/test-dispatcher-envp.o
cli/completion/Makefile
cli/completion/Makefile.in
cli/Makefile
cli/Makefile.in
cli/src/common.o
cli/src/connections.o
cli/src/devices.o
cli/src/.libs/
cli/src/Makefile
cli/src/Makefile.in
cli/src/network-manager.o
cli/src/nmcli
cli/src/nmcli.o
cli/src/settings.o
cli/src/utils.o
config.guess
config.h
config.log
config.status
config.sub
configure
data/Makefile
data/Makefile.in
data/NetworkManager-dispatcher.service
data/NetworkManager.service
data/NetworkManager-wait-online.service
data/org.freedesktop.NetworkManager.service
data/server.conf
debugfiles.list
debuglinks.list
debugsources.list
docs/api/Makefile
docs/api/Makefile.in
docs/libnm-glib/Makefile
docs/libnm-glib/Makefile.in
docs/libnm-util/Makefile
docs/libnm-util/Makefile.in
docs/Makefile
docs/Makefile.in
elfbins.list
examples/C/glib/add-connection-dbus-glib
examples/C/glib/add-connection-dbus-glib.o
examples/C/glib/add-connection-libnm-glib
examples/C/glib/add-connection-libnm-glib.o
examples/C/glib/get-active-connections-dbus-glib
examples/C/glib/get-active-connections-dbus-glib.o
examples/C/glib/get-ap-info-libnm-glib
examples/C/glib/get-ap-info-libnm-glib.o
examples/C/glib/.libs/
examples/C/glib/list-connections-dbus-glib
examples/C/glib/list-connections-dbus-glib.o
examples/C/glib/list-connections-libnm-glib
examples/C/glib/list-connections-libnm-glib.o
examples/C/glib/Makefile
examples/C/glib/Makefile.in
examples/C/glib/monitor-nm-running-dbus-glib
examples/C/glib/monitor-nm-running-dbus-glib.o
examples/C/glib/monitor-nm-running-GDBus
examples/C/glib/monitor-nm-running-GDBus.o
examples/C/glib/monitor-nm-state-GDBus
examples/C/glib/monitor-nm-state-GDBus.o
examples/C/Makefile
examples/C/Makefile.in
examples/C/qt/add-connection-wired
examples/C/qt/add-connection-wired.o
examples/C/qt/change-ipv4-addresses
examples/C/qt/change-ipv4-addresses.o
examples/C/qt/list-connections
examples/C/qt/list-connections.o
examples/C/qt/Makefile
examples/C/qt/Makefile.in
examples/C/qt/monitor-nm-running
examples/C/qt/monitor-nm-running.moc
examples/C/qt/monitor-nm-running.o
examples/dispatcher/Makefile
examples/dispatcher/Makefile.in
examples/Makefile
examples/Makefile.in
examples/python/dbus/Makefile
examples/python/dbus/Makefile.in
examples/python/gi/Makefile
examples/python/gi/Makefile.in
examples/python/Makefile
examples/python/Makefile.in
examples/ruby/Makefile
examples/ruby/Makefile.in
examples/shell/Makefile
examples/shell/Makefile.in
include/Makefile
include/Makefile.in
initscript/Arch/networkmanager
initscript/Debian/NetworkManager
initscript/linexa/networkmanager
initscript/Mandriva/networkmanager
initscript/RedHat/NetworkManager
initscript/Slackware/rc.networkmanager
initscript/SUSE/networkmanager
introspection/all.xml
introspection/Makefile
introspection/Makefile.in
libgsystem.la
libgsystem_la-gsystem-console.lo
libgsystem_la-gsystem-file-utils.lo
libgsystem_la-gsystem-local-alloc.lo
libgsystem_la-gsystem-log.lo
libgsystem_la-gsystem-shutil.lo
libgsystem_la-gsystem-subprocess-context.lo
libgsystem_la-gsystem-subprocess.lo
libndp/build-aux/config.sub
libndp/config.guess
libndp/config.log
libndp/config.status
libndp/config.sub
libndp/include/Makefile
libndp/libndp/libndp.pc
libndp/libndp/Makefile
libndp/libtool
libndp/Makefile
libndp/man/Makefile
libndp/utils/Makefile
libnm-glib/libdeprecated-nm-glib.la
libnm-glib/libdeprecated_nm_glib_la-libnm_glib.lo
libnm-glib/libnm-glib.la
libnm-glib/libnm_glib_la-nm-access-point.lo
libnm-glib/libnm_glib_la-nm-active-connection.lo
libnm-glib/libnm_glib_la-nm-client.lo
libnm-glib/libnm_glib_la-nm-dbus-helpers.lo
libnm-glib/libnm_glib_la-nm-device-adsl.lo
libnm-glib/libnm_glib_la-nm-device-bond.lo
libnm-glib/libnm_glib_la-nm-device-bridge.lo
libnm-glib/libnm_glib_la-nm-device-bt.lo
libnm-glib/libnm_glib_la-nm-device-ethernet.lo
libnm-glib/libnm_glib_la-nm-device-generic.lo
libnm-glib/libnm_glib_la-nm-device-infiniband.lo
libnm-glib/libnm_glib_la-nm-device.lo
libnm-glib/libnm_glib_la-nm-device-modem.lo
libnm-glib/libnm_glib_la-nm-device-olpc-mesh.lo
libnm-glib/libnm_glib_la-nm-device-team.lo
libnm-glib/libnm_glib_la-nm-device-vlan.lo
libnm-glib/libnm_glib_la-nm-device-wifi.lo
libnm-glib/libnm_glib_la-nm-device-wimax.lo
libnm-glib/libnm_glib_la-nm-dhcp4-config.lo
libnm-glib/libnm_glib_la-nm-dhcp6-config.lo
libnm-glib/libnm_glib_la-nm-glib-enum-types.lo
libnm-glib/libnm_glib_la-nm-ip4-config.lo
libnm-glib/libnm_glib_la-nm-ip6-config.lo
libnm-glib/libnm_glib_la-nm-object-cache.lo
libnm-glib/libnm_glib_la-nm-object.lo
libnm-glib/libnm_glib_la-nm-remote-connection.lo
libnm-glib/libnm_glib_la-nm-remote-settings.lo
libnm-glib/libnm_glib_la-nm-secret-agent.lo
libnm-glib/libnm_glib_la-nm-types.lo
libnm-glib/libnm_glib_la-nm-vpn-connection.lo
libnm-glib/libnm_glib_la-nm-wimax-nsp.lo
libnm-glib/libnm-glib.pc
libnm-glib/libnm-glib-test
libnm-glib/libnm-glib-test.la
libnm-glib/libnm_glib_test_la-nm-access-point.lo
libnm-glib/libnm_glib_test_la-nm-active-connection.lo
libnm-glib/libnm_glib_test_la-nm-client.lo
libnm-glib/libnm_glib_test_la-nm-dbus-helpers.lo
libnm-glib/libnm_glib_test_la-nm-device-adsl.lo
libnm-glib/libnm_glib_test_la-nm-device-bond.lo
libnm-glib/libnm_glib_test_la-nm-device-bridge.lo
libnm-glib/libnm_glib_test_la-nm-device-bt.lo
libnm-glib/libnm_glib_test_la-nm-device-ethernet.lo
libnm-glib/libnm_glib_test_la-nm-device-generic.lo
libnm-glib/libnm_glib_test_la-nm-device-infiniband.lo
libnm-glib/libnm_glib_test_la-nm-device.lo
libnm-glib/libnm_glib_test_la-nm-device-modem.lo
libnm-glib/libnm_glib_test_la-nm-device-olpc-mesh.lo
libnm-glib/libnm_glib_test_la-nm-device-team.lo
libnm-glib/libnm_glib_test_la-nm-device-vlan.lo
libnm-glib/libnm_glib_test_la-nm-device-wifi.lo
libnm-glib/libnm_glib_test_la-nm-device-wimax.lo
libnm-glib/libnm_glib_test_la-nm-dhcp4-config.lo
libnm-glib/libnm_glib_test_la-nm-dhcp6-config.lo
libnm-glib/libnm_glib_test_la-nm-glib-enum-types.lo
libnm-glib/libnm_glib_test_la-nm-ip4-config.lo
libnm-glib/libnm_glib_test_la-nm-ip6-config.lo
libnm-glib/libnm_glib_test_la-nm-object-cache.lo
libnm-glib/libnm_glib_test_la-nm-object.lo
libnm-glib/libnm_glib_test_la-nm-remote-connection.lo
libnm-glib/libnm_glib_test_la-nm-remote-settings.lo
libnm-glib/libnm_glib_test_la-nm-secret-agent.lo
libnm-glib/libnm_glib_test_la-nm-types.lo
libnm-glib/libnm_glib_test_la-nm-vpn-connection.lo
libnm-glib/libnm_glib_test_la-nm-wimax-nsp.lo
libnm-glib/libnm_glib_test-libnm-glib-test.o
libnm-glib/libnm-glib-vpn.la
libnm-glib/libnm_glib_vpn_la-nm-vpn-enum-types.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin-ui-interface.lo
libnm-glib/libnm_glib_vpn_la-nm-vpn-plugin-utils.lo
libnm-glib/libnm-glib-vpn.pc
libnm-glib/.libs/
libnm-glib/Makefile
libnm-glib/Makefile.in
libnm-glib/NMClient-1.0.gir
libnm-glib/NMClient-1.0.typelib
libnm-glib/nm-glib-enum-types.c.stamp
libnm-glib/nm-glib-enum-types.h.stamp
libnm-glib/nm-secret-agent-glue.h
libnm-glib/nm-vpn-enum-types.c.stamp
libnm-glib/nm-vpn-enum-types.h.stamp
libnm-glib/nm-vpn-plugin-glue.h
libnm-glib/tests/.libs/
libnm-glib/tests/Makefile
libnm-glib/tests/Makefile.in
libnm-glib/tests/test-nm-client
libnm-glib/tests/test-nm-client.o
libnm-glib/tests/test-remote-settings-client
libnm-glib/tests/test-remote-settings-client.o
libnm-util/crypto.lo
libnm-util/crypto_nss.lo
libnm-util/libnm-util.la
libnm-util/libnm-util.pc
libnm-util/.libs/
libnm-util/libtest-crypto.la
libnm-util/Makefile
libnm-util/Makefile.in
libnm-util/NetworkManager-1.0.gir
libnm-util/NetworkManager-1.0.typelib
libnm-util/nm-connection.lo
libnm-util/nm-param-spec-specialized.lo
libnm-util/nm-setting-8021x.lo
libnm-util/nm-setting-adsl.lo
libnm-util/nm-setting-bluetooth.lo
libnm-util/nm-setting-bond.lo
libnm-util/nm-setting-bridge.lo
libnm-util/nm-setting-bridge-port.lo
libnm-util/nm-setting-cdma.lo
libnm-util/nm-setting-connection.lo
libnm-util/nm-setting-generic.lo
libnm-util/nm-setting-gsm.lo
libnm-util/nm-setting-infiniband.lo
libnm-util/nm-setting-ip4-config.lo
libnm-util/nm-setting-ip6-config.lo
libnm-util/nm-setting.lo
libnm-util/nm-setting-olpc-mesh.lo
libnm-util/nm-setting-ppp.lo
libnm-util/nm-setting-pppoe.lo
libnm-util/nm-setting-serial.lo
libnm-util/nm-setting-team.lo
libnm-util/nm-setting-team-port.lo
libnm-util/nm-setting-vlan.lo
libnm-util/nm-setting-vpn.lo
libnm-util/nm-setting-wimax.lo
libnm-util/nm-setting-wired.lo
libnm-util/nm-setting-wireless.lo
libnm-util/nm-setting-wireless-security.lo
libnm-util/nm-utils-enum-types.c.stamp
libnm-util/nm-utils-enum-types.h.stamp
libnm-util/nm-utils-enum-types.lo
libnm-util/nm-utils.lo
libnm-util/nm-value-transforms.lo
libnm-util/tests/certs/Makefile
libnm-util/tests/certs/Makefile.in
libnm-util/tests/.libs/
libnm-util/tests/Makefile
libnm-util/tests/Makefile.in
libnm-util/tests/test-crypto
libnm-util/tests/test-crypto.o
libnm-util/tests/test-general
libnm-util/tests/test-general.o
libnm-util/tests/test-secrets
libnm-util/tests/test-secrets.o
libnm-util/tests/test-setting-8021x
libnm-util/tests/test-setting-8021x.o
libnm-util/tests/test-settings-defaults
libnm-util/tests/test-settings-defaults.o
.libs/libgsystem.a
.libs/libgsystem.la
.libs/libgsystem_la-gsystem-console.o
.libs/libgsystem_la-gsystem-file-utils.o
.libs/libgsystem_la-gsystem-local-alloc.o
.libs/libgsystem_la-gsystem-log.o
.libs/libgsystem_la-gsystem-shutil.o
.libs/libgsystem_la-gsystem-subprocess-context.o
.libs/libgsystem_la-gsystem-subprocess.o
libtool
Makefile
Makefile.in
man/Makefile
man/Makefile.in
man/nmcli.1
man/nm-online.1
man/nm-system-settings.conf.5
NetworkManager.lang
NetworkManager.pc
po/ar.gmo
po/as.gmo
po/be@latin.gmo
po/bg.gmo
po/bn_IN.gmo
po/bs.gmo
po/ca.gmo
po/cs.gmo
po/da.gmo
po/de.gmo
po/dz.gmo
po/el.gmo
po/en_CA.gmo
po/en_GB.gmo
po/eo.gmo
po/es.gmo
po/et.gmo
po/eu.gmo
po/fi.gmo
po/fr.gmo
po/gl.gmo
po/gu.gmo
po/he.gmo
po/hi.gmo
po/hr.gmo
po/hu.gmo
po/id.gmo
po/.intltool-merge-cache
po/it.gmo
po/ja.gmo
po/ka.gmo
po/kn.gmo
po/ko.gmo
po/ku.gmo
policy/Makefile
policy/Makefile.in
policy/org.freedesktop.NetworkManager.policy
policy/org.freedesktop.NetworkManager.policy.in
po/lt.gmo
po/lv.gmo
po/Makefile
po/Makefile.in
po/mk.gmo
po/ml.gmo
po/mr.gmo
po/nb.gmo
po/ne.gmo
po/NetworkManager.pot
po/nl.gmo
po/oc.gmo
po/or.gmo
po/pa.gmo
po/pl.gmo
po/POTFILES
po/pt_BR.gmo
po/pt.gmo
po/ru.gmo
po/rw.gmo
po/sk.gmo
po/sl.gmo
po/sq.gmo
po/sr.gmo
po/sr@latin.gmo
po/stamp-it
po/sv.gmo
po/ta.gmo
po/te.gmo
po/th.gmo
po/tr.gmo
po/uk.gmo
po/vi.gmo
po/wa.gmo
po/zh_CN.gmo
po/zh_HK.gmo
po/zh_TW.gmo
src/config/tests/.libs/
src/config/tests/Makefile
src/config/tests/Makefile.in
src/config/tests/nm-test-device.o
src/config/tests/test-config
src/config/tests/test-config.o
src/devices/wimax/Makefile
src/devices/wimax/Makefile.in
src/dhcp-manager/Makefile
src/dhcp-manager/Makefile.in
src/dhcp-manager/nm-dhcp-helper
src/dhcp-manager/nm_dhcp_helper-nm-dhcp-helper.o
src/dhcp-manager/tests/.libs/
src/dhcp-manager/tests/Makefile
src/dhcp-manager/tests/Makefile.in
src/dhcp-manager/tests/test-dhcp-dhclient
src/dhcp-manager/tests/test-dhcp-dhclient.o
src/errors.lo
src/libNetworkManager.la
src/.libs/
src/main.o
src/Makefile
src/Makefile.in
src/NetworkManager
src/NetworkManagerUtils.lo
src/nm-activation-request.lo
src/nm-active-connection-glue.h
src/nm-active-connection.lo
src/nm-agent-manager.lo
src/nm-atm-manager.lo
src/nm-bluez-device.lo
src/nm-bluez-manager.lo
src/nm-call-store.lo
src/nm-config-device.lo
src/nm-config.lo
src/nm-connection-provider.lo
src/nm-connectivity.lo
src/nm-dbus-manager.lo
src/nm-default-wired-connection.lo
src/nm-device-adsl.lo
src/nm-device-bond.lo
src/nm-device-bridge.lo
src/nm-device-bt.lo
src/nm-device-ethernet.lo
src/nm-device-generic.lo
src/nm-device-glue.h
src/nm-device-gre.lo
src/nm-device-infiniband.lo
src/nm-device.lo
src/nm-device-macvlan.lo
src/nm-device-modem.lo
src/nm-device-olpc-mesh.lo
src/nm-device-team.lo
src/nm-device-tun.lo
src/nm-device-veth.lo
src/nm-device-vlan.lo
src/nm-device-wifi-glue.h
src/nm-device-wifi.lo
src/nm-dhcp4-config.lo
src/nm-dhcp6-config.lo
src/nm-dhcp-client.lo
src/nm-dhcp-dhclient.lo
src/nm-dhcp-dhclient-utils.lo
src/nm-dhcp-dhcpcd.lo
src/nm-dhcp-manager.lo
src/nm-dispatcher.lo
src/nm-dns-dnsmasq.lo
src/nm-dns-manager.lo
src/nm-dnsmasq-manager.lo
src/nm-dns-plugin.lo
src/nm-dns-utils.lo
src/nm-enum-types.c
src/nm-enum-types.c.stamp
src/nm-enum-types.h
src/nm-enum-types.h.stamp
src/nm-enum-types.lo
src/nm-fake-platform.lo
src/nm-fake-rdisc.lo
src/nm-firewall-manager.lo
src/nm-hostname-provider.lo
src/nm-inotify-helper.lo
src/nm-ip4-config.lo
src/nm-ip6-config.lo
src/nm-keyfile-connection.lo
src/nm-linux-platform.lo
src/nm-lndp-rdisc.lo
src/nm-logging.lo
src/nm-manager-auth.lo
src/nm-manager-glue.h
src/nm-manager.lo
src/nm-modem-broadband.lo
src/nm-modem.lo
src/nm-modem-manager.lo
src/nm-modem-old.lo
src/nm-netlink-monitor.lo
src/nm-platform.lo
src/nm-policy-hosts.lo
src/nm-policy.lo
src/nm-posix-signals.lo
src/nm-ppp-manager.lo
src/nm-properties-changed-signal.lo
src/nm-rdisc.lo
src/nm-rfkill-manager.lo
src/nm-secret-agent.lo
src/nm-session-monitor-systemd.lo
src/nm-session-utils.lo
src/nm-settings-connection.lo
src/nm-settings-error.lo
src/nm-settings-glue.h
src/nm-settings.lo
src/nm-settings-utils.lo
src/nm-sleep-monitor-systemd.lo
src/nm-supplicant-config.lo
src/nm-supplicant-interface.lo
src/nm-supplicant-manager.lo
src/nm-supplicant-settings-verify.lo
src/nm-system-config-interface.lo
src/nm-vpn-connection.lo
src/nm-vpn-manager.lo
src/nm-vpn-service.lo
src/nm-wifi-ap.lo
src/nm-wifi-ap-utils.lo
src/platform/Makefile
src/platform/Makefile.in
src/platform/tests/dump
src/platform/tests/dump.o
src/platform/tests/.libs/
src/platform/tests/Makefile
src/platform/tests/Makefile.in
src/platform/tests/monitor
src/platform/tests/monitor.o
src/platform/tests/nm-fake-platform.o
src/platform/tests/nm-linux-platform.o
src/platform/tests/nm-platform.o
src/platform/tests/platform
src/platform/tests/platform.o
src/platform/tests/test-address-fake
src/platform/tests/test_address_fake-nm-fake-platform.o
src/platform/tests/test_address_fake-nm-linux-platform.o
src/platform/tests/test_address_fake-nm-platform.o
src/platform/tests/test_address_fake-test-address.o
src/platform/tests/test_address_fake-test-common.o
src/platform/tests/test-address-linux
src/platform/tests/test_address_linux-nm-fake-platform.o
src/platform/tests/test_address_linux-nm-linux-platform.o
src/platform/tests/test_address_linux-nm-platform.o
src/platform/tests/test_address_linux-test-address.o
src/platform/tests/test_address_linux-test-common.o
src/platform/tests/test-cleanup-fake
src/platform/tests/test_cleanup_fake-nm-fake-platform.o
src/platform/tests/test_cleanup_fake-nm-linux-platform.o
src/platform/tests/test_cleanup_fake-nm-platform.o
src/platform/tests/test_cleanup_fake-test-cleanup.o
src/platform/tests/test_cleanup_fake-test-common.o
src/platform/tests/test-cleanup-linux
src/platform/tests/test_cleanup_linux-nm-fake-platform.o
src/platform/tests/test_cleanup_linux-nm-linux-platform.o
src/platform/tests/test_cleanup_linux-nm-platform.o
src/platform/tests/test_cleanup_linux-test-cleanup.o
src/platform/tests/test_cleanup_linux-test-common.o
src/platform/tests/test-link-fake
src/platform/tests/test_link_fake-nm-fake-platform.o
src/platform/tests/test_link_fake-nm-linux-platform.o
src/platform/tests/test_link_fake-nm-platform.o
src/platform/tests/test_link_fake-test-common.o
src/platform/tests/test_link_fake-test-link.o
src/platform/tests/test-link-linux
src/platform/tests/test_link_linux-nm-fake-platform.o
src/platform/tests/test_link_linux-nm-linux-platform.o
src/platform/tests/test_link_linux-nm-platform.o
src/platform/tests/test_link_linux-test-common.o
src/platform/tests/test_link_linux-test-link.o
src/platform/tests/test-route-fake
src/platform/tests/test_route_fake-nm-fake-platform.o
src/platform/tests/test_route_fake-nm-linux-platform.o
src/platform/tests/test_route_fake-nm-platform.o
src/platform/tests/test_route_fake-test-common.o
src/platform/tests/test_route_fake-test-route.o
src/platform/tests/test-route-linux
src/platform/tests/test_route_linux-nm-fake-platform.o
src/platform/tests/test_route_linux-nm-linux-platform.o
src/platform/tests/test_route_linux-nm-platform.o
src/platform/tests/test_route_linux-test-common.o
src/platform/tests/test_route_linux-test-route.o
src/plugin.lo
src/ppp-manager/.libs/
src/ppp-manager/Makefile
src/ppp-manager/Makefile.in
src/ppp-manager/nm-pppd-plugin.la
src/ppp-manager/nm-pppd-plugin.lo
src/rdisc/Makefile
src/rdisc/Makefile.in
src/rdisc/tests/.libs
src/rdisc/tests/Makefile
src/rdisc/tests/Makefile.in
src/rdisc/tests/nm-fake-rdisc.o
src/rdisc/tests/nm-lndp-rdisc.o
src/rdisc/tests/nm-logging.o
src/rdisc/tests/nm-rdisc.o
src/rdisc/tests/rdisc
src/rdisc/tests/rdisc.o
src/reader.lo
src/settings/plugins/example/errors.lo
src/settings/plugins/example/libnm-settings-plugin-example.la
src/settings/plugins/example/.libs/
src/settings/plugins/example/Makefile
src/settings/plugins/example/Makefile.in
src/settings/plugins/example/nm-example-connection.lo
src/settings/plugins/example/plugin.lo
src/settings/plugins/example/reader.lo
src/settings/plugins/example/writer.lo
src/settings/plugins/ifcfg-rh/errors.lo
src/settings/plugins/ifcfg-rh/libifcfg-rh-io.la
src/settings/plugins/ifcfg-rh/libnm-settings-plugin-ifcfg-rh.la
src/settings/plugins/ifcfg-rh/.libs/
src/settings/plugins/ifcfg-rh/Makefile
src/settings/plugins/ifcfg-rh/Makefile.in
src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.lo
src/settings/plugins/ifcfg-rh/nm-ifcfg-rh-glue.h
src/settings/plugins/ifcfg-rh/plugin.lo
src/settings/plugins/ifcfg-rh/reader.lo
src/settings/plugins/ifcfg-rh/shvar.lo
src/settings/plugins/ifcfg-rh/tests/errors.o
src/settings/plugins/ifcfg-rh/tests/.libs/
src/settings/plugins/ifcfg-rh/tests/Makefile
src/settings/plugins/ifcfg-rh/tests/Makefile.in
src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile
src/settings/plugins/ifcfg-rh/tests/network-scripts/Makefile.in
src/settings/plugins/ifcfg-rh/tests/reader.o
src/settings/plugins/ifcfg-rh/tests/shvar.o
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.o
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils
src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh-utils.o
src/settings/plugins/ifcfg-rh/tests/utils.o
src/settings/plugins/ifcfg-rh/tests/writer.o
src/settings/plugins/ifcfg-rh/utils.lo
src/settings/plugins/ifcfg-rh/writer.lo
src/settings/plugins/ifcfg-suse/Makefile
src/settings/plugins/ifcfg-suse/Makefile.in
src/settings/plugins/ifnet/Makefile
src/settings/plugins/ifnet/Makefile.in
src/settings/plugins/ifnet/tests/Makefile
src/settings/plugins/ifnet/tests/Makefile.in
src/settings/plugins/ifupdown/Makefile
src/settings/plugins/ifupdown/Makefile.in
src/settings/plugins/ifupdown/tests/Makefile
src/settings/plugins/ifupdown/tests/Makefile.in
src/settings/plugins/keyfile/errors.lo
src/settings/plugins/keyfile/libkeyfile-io.la
src/settings/plugins/keyfile/libnm-settings-plugin-keyfile.la
src/settings/plugins/keyfile/.libs/
src/settings/plugins/keyfile/Makefile
src/settings/plugins/keyfile/Makefile.in
src/settings/plugins/keyfile/nm-keyfile-connection.lo
src/settings/plugins/keyfile/plugin.lo
src/settings/plugins/keyfile/reader.lo
src/settings/plugins/keyfile/tests/errors.o
src/settings/plugins/keyfile/tests/keyfiles/Makefile
src/settings/plugins/keyfile/tests/keyfiles/Makefile.in
src/settings/plugins/keyfile/tests/.libs/
src/settings/plugins/keyfile/tests/Makefile
src/settings/plugins/keyfile/tests/Makefile.in
src/settings/plugins/keyfile/tests/reader.o
src/settings/plugins/keyfile/tests/test-keyfile
src/settings/plugins/keyfile/tests/test-keyfile.o
src/settings/plugins/keyfile/tests/utils.o
src/settings/plugins/keyfile/tests/writer.o
src/settings/plugins/keyfile/utils.lo
src/settings/plugins/keyfile/writer.lo
src/settings/plugins/Makefile
src/settings/plugins/Makefile.in
src/settings/tests/.libs/
src/settings/tests/Makefile
src/settings/tests/Makefile.in
src/settings/tests/test-wired-defname
src/settings/tests/test-wired-defname.o
src/supplicant-manager/tests/.libs/
src/supplicant-manager/tests/Makefile
src/supplicant-manager/tests/Makefile.in
src/supplicant-manager/tests/test-supplicant-config
src/supplicant-manager/tests/test-supplicant-config.o
src/tests/.libs/
src/tests/Makefile
src/tests/Makefile.in
src/tests/test-dhcp-options
src/tests/test_dhcp_options-test-dhcp-options.o
src/tests/test-general
src/tests/test-general.o
src/tests/test-ip4-config
src/tests/test-ip4-config.o
src/tests/test-ip6-config
src/tests/test-ip6-config.o
src/tests/test-policy-hosts
src/tests/test-policy-hosts.o
src/tests/test-wifi-ap-utils
src/tests/test-wifi-ap-utils.o
src/utils.lo
src/wifi-utils.lo
src/wifi-utils-nl80211.lo
src/wifi-utils-wext.lo
src/writer.lo
stamp-h1
test/libnm-glib-test
test/libnm_glib_test-libnm-glib-test.o
test/.libs/
test/Makefile
test/Makefile.in
test/nm-online
test/nm-online.o
tools/generate-settings-spec
tools/generate-settings-spec.o
tools/.libs/
tools/Makefile
tools/Makefile.in
vapi/libnm-glib.vapi
vapi/libnm-util.vapi
vapi/Makefile
vapi/Makefile.in

2260
nmcli-group-dot-field.patch Normal file

File diff suppressed because it is too large Load Diff

520
physical-port-id.patch Normal file
View File

@ -0,0 +1,520 @@
From b7300bbe5a9f298ede02225b6b7e73e05aa78bc8 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Fri, 11 Oct 2013 14:59:26 -0400
Subject: [PATCH 1/2] core: improve handling of NPAR/SR-IOV devices (rh
#804527)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Use the new kernel physical_port_id interface property to recognize
when two devices are just virtual devices sharing the same physical
port, and refuse to bond/team multiple slaves on the same port.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-device.xml | 8 +++++
src/devices/nm-device-bond.c | 2 ++
src/devices/nm-device-private.h | 3 ++
src/devices/nm-device-team.c | 2 ++
src/devices/nm-device.c | 70 +++++++++++++++++++++++++++++++++++++++-
src/devices/nm-device.h | 3 ++
src/platform/nm-fake-platform.c | 11 +++++++
src/platform/nm-linux-platform.c | 22 +++++++++++++
src/platform/nm-platform.c | 18 +++++++++++
src/platform/nm-platform.h | 4 +++
10 files changed, 142 insertions(+), 1 deletion(-)
diff --git a/introspection/nm-device.xml b/introspection/nm-device.xml
index 7c63a3d..d9e7702 100644
--- a/introspection/nm-device.xml
+++ b/introspection/nm-device.xml
@@ -125,6 +125,14 @@
An array of object paths of every configured connection that is currently 'available' through this device.
</tp:docstring>
</property>
+ <property name="PhysicalPortId" type="s" access="read">
+ <tp:docstring>
+ If non-empty, an (opaque) indicator of the physical network
+ port associated with the device. This can be used to recognize
+ when two seemingly-separate hardware devices are actually just
+ different virtual interfaces to the same physical port.
+ </tp:docstring>
+ </property>
<method name="Disconnect">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_disconnect"/>
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
index 950bbb8..82e5a9d 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -364,6 +364,8 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
const char *iface = nm_device_get_ip_iface (device);
const char *slave_iface = nm_device_get_ip_iface (slave);
+ nm_device_master_check_slave_physical_port (device, slave, LOGD_BOND);
+
nm_device_take_down (slave, TRUE);
success = nm_platform_link_enslave (nm_device_get_ip_ifindex (device),
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
index dc72886..3da1479 100644
--- a/src/devices/nm-device-private.h
+++ b/src/devices/nm-device-private.h
@@ -92,6 +92,9 @@ gboolean nm_device_get_enslaved (NMDevice *device);
NMDevice *nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex);
+void nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave,
+ guint64 log_domain);
+
void nm_device_set_carrier (NMDevice *device, gboolean carrier);
#endif /* NM_DEVICE_PRIVATE_H */
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 1b3b0c0..31806bc 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -546,6 +546,8 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
const char *slave_iface = nm_device_get_ip_iface (slave);
NMSettingTeamPort *s_team_port;
+ nm_device_master_check_slave_physical_port (device, slave, LOGD_TEAM);
+
nm_device_take_down (slave, TRUE);
s_team_port = nm_connection_get_setting_team_port (connection);
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 4ef5030..a0bf465 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -129,6 +129,7 @@ enum {
PROP_RFKILL_TYPE,
PROP_IFINDEX,
PROP_AVAILABLE_CONNECTIONS,
+ PROP_PHYSICAL_PORT_ID,
PROP_IS_MASTER,
PROP_HW_ADDRESS,
PROP_HAS_PENDING_ACTION,
@@ -202,6 +203,7 @@ typedef struct {
GHashTable * available_connections;
guint8 hw_addr[NM_UTILS_HWADDR_LEN_MAX];
guint hw_addr_len;
+ char * physical_port_id;
gboolean manager_managed; /* whether managed by NMManager or not */
gboolean default_unmanaged; /* whether unmanaged by default */
@@ -589,8 +591,10 @@ constructed (GObject *object)
priv->carrier = TRUE;
}
- if (priv->ifindex > 0)
+ if (priv->ifindex > 0) {
priv->is_software = nm_platform_link_is_software (priv->ifindex);
+ priv->physical_port_id = nm_platform_link_get_physical_port_id (priv->ifindex);
+ }
if (G_OBJECT_CLASS (nm_device_parent_class)->constructed)
G_OBJECT_CLASS (nm_device_parent_class)->constructed (object);
@@ -1338,6 +1342,49 @@ nm_device_master_get_slave_by_ifindex (NMDevice *dev, int ifindex)
}
/**
+ * nm_device_master_check_slave_physical_port:
+ * @dev: the master device
+ * @slave: a slave device
+ * @log_domain: domain to log a warning in
+ *
+ * Checks if @dev already has a slave with the same #NMDevice:physical-port-id
+ * as @slave, and logs a warning if so.
+ */
+void
+nm_device_master_check_slave_physical_port (NMDevice *dev, NMDevice *slave,
+ guint64 log_domain)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (dev);
+ const char *slave_physical_port_id, *existing_physical_port_id;
+ SlaveInfo *info;
+ GSList *iter;
+
+ slave_physical_port_id = nm_device_get_physical_port_id (slave);
+ if (!slave_physical_port_id)
+ return;
+
+ for (iter = priv->slaves; iter; iter = iter->next) {
+ info = iter->data;
+ if (info->slave == slave)
+ continue;
+
+ existing_physical_port_id = nm_device_get_physical_port_id (info->slave);
+ if (!g_strcmp0 (slave_physical_port_id, existing_physical_port_id)) {
+ nm_log_warn (log_domain, "(%s): slave %s shares a physical port with existing slave %s",
+ nm_device_get_ip_iface (dev),
+ nm_device_get_ip_iface (slave),
+ nm_device_get_ip_iface (info->slave));
+ /* Since this function will get called for every slave, we only have
+ * to warn about the first match we find; if there are other matches
+ * later in the list, we will have already warned about them matching
+ * @existing earlier.
+ */
+ return;
+ }
+ }
+}
+
+/**
* nm_device_is_master:
* @dev: the device
*
@@ -5172,6 +5219,8 @@ dispose (GObject *object)
g_hash_table_unref (priv->available_connections);
priv->available_connections = NULL;
+ g_clear_pointer (&priv->physical_port_id, g_free);
+
activation_source_clear (self, TRUE, AF_INET);
activation_source_clear (self, TRUE, AF_INET6);
@@ -5432,6 +5481,9 @@ get_property (GObject *object, guint prop_id,
g_ptr_array_add (array, g_strdup (nm_connection_get_path (connection)));
g_value_take_boxed (value, array);
break;
+ case PROP_PHYSICAL_PORT_ID:
+ g_value_set_string (value, priv->physical_port_id);
+ break;
case PROP_IS_MASTER:
g_value_set_boolean (value, priv->is_master);
break;
@@ -5689,6 +5741,14 @@ nm_device_class_init (NMDeviceClass *klass)
G_PARAM_READABLE));
g_object_class_install_property
+ (object_class, PROP_PHYSICAL_PORT_ID,
+ g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID,
+ "PhysicalPortId",
+ "PhysicalPortId",
+ NULL,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property
(object_class, PROP_IS_MASTER,
g_param_spec_boolean (NM_DEVICE_IS_MASTER,
"IsMaster",
@@ -6908,3 +6968,11 @@ nm_device_has_pending_action (NMDevice *device)
return !!priv->pending_actions;
}
+
+const char *
+nm_device_get_physical_port_id (NMDevice *device)
+{
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device);
+
+ return priv->physical_port_id;
+}
diff --git a/src/devices/nm-device.h b/src/devices/nm-device.h
index 38b9bea..b593d0a 100644
--- a/src/devices/nm-device.h
+++ b/src/devices/nm-device.h
@@ -60,6 +60,7 @@
#define NM_DEVICE_AUTOCONNECT "autoconnect"
#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
+#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
#define NM_DEVICE_TYPE_DESC "type-desc" /* Internal only */
#define NM_DEVICE_RFKILL_TYPE "rfkill-type" /* Internal only */
#define NM_DEVICE_IFINDEX "ifindex" /* Internal only */
@@ -337,6 +338,8 @@ gboolean nm_device_has_pending_action (NMDevice *device);
void nm_device_remove_pending_action (NMDevice *device, const char *action);
gboolean nm_device_has_pending_action (NMDevice *device);
+const char *nm_device_get_physical_port_id (NMDevice *device);
+
G_END_DECLS
/* For testing only */
diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c
index 6d7843f..491e23e 100644
--- a/src/platform/nm-fake-platform.c
+++ b/src/platform/nm-fake-platform.c
@@ -466,6 +466,15 @@ link_get_mtu (NMPlatform *platform, int ifindex)
return device ? device->link.mtu : 0;
}
+static char *
+link_get_physical_port_id (NMPlatform *platform, int ifindex)
+{
+ /* We call link_get just to cause an error to be set if @ifindex is bad. */
+ link_get (platform, ifindex);
+
+ return NULL;
+}
+
static gboolean
link_supports_carrier_detect (NMPlatform *platform, int ifindex)
{
@@ -1189,6 +1198,8 @@ nm_fake_platform_class_init (NMFakePlatformClass *klass)
platform_class->link_get_mtu = link_get_mtu;
platform_class->link_set_mtu = link_set_mtu;
+ platform_class->link_get_physical_port_id = link_get_physical_port_id;
+
platform_class->link_supports_carrier_detect = link_supports_carrier_detect;
platform_class->link_supports_vlans = link_supports_vlans;
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index 821a8cd..23125f8 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -1725,6 +1725,26 @@ link_get_mtu (NMPlatform *platform, int ifindex)
return rtnllink ? rtnl_link_get_mtu (rtnllink) : 0;
}
+static char *
+link_get_physical_port_id (NMPlatform *platform, int ifindex)
+{
+ const char *ifname;
+ char *path, *id;
+
+ ifname = nm_platform_link_get_name (ifindex);
+ if (!ifname)
+ return NULL;
+
+ path = g_strdup_printf ("/sys/class/net/%s/physical_port_id", ifname);
+ if (g_file_test (path, G_FILE_TEST_EXISTS))
+ id = sysctl_get (platform, path);
+ else
+ id = NULL;
+ g_free (path);
+
+ return id;
+}
+
static int
vlan_add (NMPlatform *platform, const char *name, int parent, int vlan_id, guint32 vlan_flags)
{
@@ -2719,6 +2739,8 @@ nm_linux_platform_class_init (NMLinuxPlatformClass *klass)
platform_class->link_get_mtu = link_get_mtu;
platform_class->link_set_mtu = link_set_mtu;
+ platform_class->link_get_physical_port_id = link_get_physical_port_id;
+
platform_class->link_supports_carrier_detect = link_supports_carrier_detect;
platform_class->link_supports_vlans = link_supports_vlans;
diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c
index f5a4c9b..7460b12 100644
--- a/src/platform/nm-platform.c
+++ b/src/platform/nm-platform.c
@@ -734,6 +734,24 @@ nm_platform_link_get_mtu (int ifindex)
}
/**
+ * nm_platform_link_get_mtu:
+ * @ifindex: Interface index
+ *
+ * Returns: physical port ID for the interface, or %NULL on error
+ * or if the interface has no physical port ID.
+ */
+char *
+nm_platform_link_get_physical_port_id (int ifindex)
+{
+ reset_error ();
+
+ g_return_val_if_fail (ifindex >= 0, NULL);
+ g_return_val_if_fail (klass->link_get_physical_port_id, NULL);
+
+ return klass->link_get_physical_port_id (platform, ifindex);
+}
+
+/**
* nm_platform_link_enslave:
* @master: Interface index of the master
* @slave: Interface index of the slave
diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h
index b11bbc3..5494d48 100644
--- a/src/platform/nm-platform.h
+++ b/src/platform/nm-platform.h
@@ -251,6 +251,8 @@ typedef struct {
guint32 (*link_get_mtu) (NMPlatform *, int ifindex);
gboolean (*link_set_mtu) (NMPlatform *, int ifindex, guint32 mtu);
+ char * (*link_get_physical_port_id) (NMPlatform *, int ifindex);
+
gboolean (*link_supports_carrier_detect) (NMPlatform *, int ifindex);
gboolean (*link_supports_vlans) (NMPlatform *, int ifindex);
@@ -370,6 +372,8 @@ gboolean nm_platform_link_set_address (int ifindex, const void *address, size_t
guint32 nm_platform_link_get_mtu (int ifindex);
gboolean nm_platform_link_set_mtu (int ifindex, guint32 mtu);
+char *nm_platform_link_get_physical_port_id (int ifindex);
+
gboolean nm_platform_link_supports_carrier_detect (int ifindex);
gboolean nm_platform_link_supports_vlans (int ifindex);
--
1.7.11.7
From 47cc8b25f2efe015defde7e76e49e67086603bb3 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Fri, 11 Oct 2013 14:59:26 -0400
Subject: [PATCH 2/2] libnm-glib: add NMDevice:physical-port-id property
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add the physical-port-id property to NMDevice so that clients can
recognize NPAR/SR-IOV devices.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 1 +
libnm-glib/nm-device.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++
libnm-glib/nm-device.h | 2 ++
3 files changed, 58 insertions(+)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index 4727bc3..416b782 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -130,6 +130,7 @@ global:
nm_device_get_ip6_config;
nm_device_get_ip_iface;
nm_device_get_managed;
+ nm_device_get_physical_port_id;
nm_device_get_product;
nm_device_get_state;
nm_device_get_state_reason;
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index 05e59e5..d4f95ac 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -96,6 +96,8 @@ typedef struct {
GUdevClient *client;
char *product;
char *vendor;
+
+ char *physical_port_id;
} NMDevicePrivate;
enum {
@@ -121,6 +123,7 @@ enum {
PROP_DEVICE_TYPE,
PROP_ACTIVE_CONNECTION,
PROP_AVAILABLE_CONNECTIONS,
+ PROP_PHYSICAL_PORT_ID,
LAST_PROP
};
@@ -199,6 +202,7 @@ register_properties (NMDevice *device)
{ NM_DEVICE_STATE_REASON, &priv->state, demarshal_state_reason },
{ NM_DEVICE_ACTIVE_CONNECTION, &priv->active_connection, NULL, NM_TYPE_ACTIVE_CONNECTION },
{ NM_DEVICE_AVAILABLE_CONNECTIONS, &priv->available_connections, NULL, NM_TYPE_REMOTE_CONNECTION },
+ { NM_DEVICE_PHYSICAL_PORT_ID, &priv->physical_port_id },
/* Properties that exist in D-Bus but that we don't track */
{ "ip4-address", NULL },
@@ -389,6 +393,7 @@ finalize (GObject *object)
g_free (priv->product);
g_free (priv->vendor);
g_free (priv->type_description);
+ g_free (priv->physical_port_id);
G_OBJECT_CLASS (nm_device_parent_class)->finalize (object);
}
@@ -473,6 +478,9 @@ get_property (GObject *object,
case PROP_VENDOR:
g_value_set_string (value, nm_device_get_vendor (device));
break;
+ case PROP_PHYSICAL_PORT_ID:
+ g_value_set_string (value, nm_device_get_physical_port_id (device));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -804,6 +812,22 @@ nm_device_class_init (NMDeviceClass *device_class)
NULL,
G_PARAM_READABLE));
+ /**
+ * NMDevice:physical-port-id:
+ *
+ * The physical port ID of the device. (See
+ * nm_device_get_physical_port_id().)
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_PHYSICAL_PORT_ID,
+ g_param_spec_string (NM_DEVICE_PHYSICAL_PORT_ID,
+ "Physical Port ID",
+ "Physical port ID",
+ NULL,
+ G_PARAM_READABLE));
+
/* signals */
/**
@@ -1517,6 +1541,37 @@ nm_device_get_vendor (NMDevice *device)
return priv->vendor;
}
+/**
+ * nm_device_get_physical_port_id:
+ * @device: a #NMDevice
+ *
+ * Gets the physical port ID of the #NMDevice. If non-%NULL, this is
+ * an opaque string that can be used to recognize when
+ * seemingly-unrelated #NMDevices are actually just different virtual
+ * ports on a single physical port. (Eg, NPAR / SR-IOV.)
+ *
+ * Returns: the physical port ID of the device, or %NULL if the port
+ * ID is unknown. This is the internal string used by the device and
+ * must not be modified.
+ *
+ * Since: 0.9.10
+ **/
+const char *
+nm_device_get_physical_port_id (NMDevice *device)
+{
+ NMDevicePrivate *priv;
+
+ g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
+
+ priv = NM_DEVICE_GET_PRIVATE (device);
+
+ _nm_object_ensure_inited (NM_OBJECT (device));
+ if (priv->physical_port_id && *priv->physical_port_id)
+ return priv->physical_port_id;
+ else
+ return NULL;
+}
+
typedef struct {
NMDevice *device;
NMDeviceDeactivateFn fn;
diff --git a/libnm-glib/nm-device.h b/libnm-glib/nm-device.h
index ed274ca..bd746b3 100644
--- a/libnm-glib/nm-device.h
+++ b/libnm-glib/nm-device.h
@@ -80,6 +80,7 @@ GQuark nm_device_error_quark (void);
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
#define NM_DEVICE_VENDOR "vendor"
#define NM_DEVICE_PRODUCT "product"
+#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
typedef struct {
NMObject parent;
@@ -135,6 +136,7 @@ NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
const GPtrArray * nm_device_get_available_connections(NMDevice *device);
const char * nm_device_get_product (NMDevice *device);
const char * nm_device_get_vendor (NMDevice *device);
+const char * nm_device_get_physical_port_id (NMDevice *device);
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
--
1.7.11.7

View File

@ -0,0 +1,34 @@
From 90782cf023c2fc2c223203a97ca2ea56a0c61c55 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 6 Jan 2014 17:21:11 -0600
Subject: [PATCH] platform: ignore errors adding IPv6 point-to-point address
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
For now, ignore them, as libnl does not support IPv6 PtP addresses
and returns an error. In the future perhaps we'll want to add a host
route for the peer instead of using the point-to-point address.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/platform/nm-linux-platform.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c
index a633b82..a834333 100644
--- a/src/platform/nm-linux-platform.c
+++ b/src/platform/nm-linux-platform.c
@@ -2274,7 +2274,8 @@ build_rtnl_addr (int family,
auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen);
nle = rtnl_addr_set_peer (rtnladdr, nlpeer);
- g_assert (!nle);
+ /* IPv6 doesn't support peer addresses yet */
+ g_assert (!nle || (nle == -NLE_AF_NOSUPPORT));
}
rtnl_addr_set_prefixlen (rtnladdr, plen);
--
1.7.11.7

31
rem-con-constructed.patch Normal file
View File

@ -0,0 +1,31 @@
From df4c9347fc85ec2aa7ddc67e0ff39bc1d56f669a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Mon, 27 Jan 2014 17:36:30 +0100
Subject: [PATCH] libnm-glib: chain up the parent constructed() of
NMRemoteConnection
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/nm-remote-connection.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 73a2cc8..27baebd 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -508,6 +508,8 @@ constructed (GObject *object)
{
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
+ G_OBJECT_CLASS (nm_remote_connection_parent_class)->constructed (object);
+
g_assert (priv->bus);
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
--
1.7.11.7

View File

@ -0,0 +1,293 @@
From d7c369712b9e6298d62303899e372ab7d27a92d9 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Mon, 23 Dec 2013 12:21:09 -0600
Subject: [PATCH] vpn: handle missing tunnel interface for IP-based VPNs (bgo
#721724) (rh #1030068)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
IPSec-based VPNs that use the kernel IPSec stack don't have tunnel
interfaces, and the IP details (address, routes) get added directly
to the parent network device. NetworkManager previously required
a tunnel interface and failed the VPN if one was not provided.
When no tunnel interface is passed, construct the VPN IP configuration
using available details and pass that to the NMDevice as the VPN IP
config. The device will merge that config with its own and apply
any configuration that the kernel/VPN has not already applied.
https://bugzilla.gnome.org/show_bug.cgi?id=721724
https://bugzilla.redhat.com/show_bug.cgi?id=1030068
https://bugzilla.redhat.com/show_bug.cgi?id=865883
https://bugzilla.redhat.com/show_bug.cgi?id=845599
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-policy.c | 15 +++--
src/vpn-manager/nm-vpn-connection.c | 112 ++++++++++++++++++++++--------------
2 files changed, 79 insertions(+), 48 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index 92ec1ab..090cd04 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -655,17 +655,21 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
in_addr_t int_gw = nm_vpn_connection_get_ip4_internal_gateway (vpn);
int mss = nm_ip4_config_get_mss (ip4_config);
+ /* If no VPN interface, use the parent interface */
+ if (ip_ifindex <= 0)
+ ip_ifindex = parent_ifindex;
+
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss)) {
nm_platform_ip4_route_add (parent_ifindex, gw_addr, 32, 0, 0, parent_mss);
- if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss)) {
+ if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, int_gw, 0, mss))
nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route.");
- }
}
default_device = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip4_config_get_mss (ip4_config);
+ g_assert (ip_iface);
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, gw_addr, 0, mss)) {
nm_platform_ip4_route_add (ip_ifindex, gw_addr, 32, 0, 0, mss);
if (!nm_platform_ip4_route_add (ip_ifindex, 0, 0, gw_addr, 0, mss)) {
@@ -845,6 +849,10 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
if (!int_gw)
int_gw = &in6addr_any;
+ /* If no VPN interface, use the parent interface */
+ if (ip_ifindex <= 0)
+ ip_ifindex = parent_ifindex;
+
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
nm_platform_ip6_route_add (parent_ifindex, *gw_addr, 128, in6addr_any, 0, parent_mss);
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) {
@@ -858,9 +866,8 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss)) {
nm_platform_ip6_route_add (ip_ifindex, *gw_addr, 128, in6addr_any, 0, mss);
- if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss)) {
+ if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *gw_addr, 0, mss))
nm_log_err (LOGD_IP6, "Failed to set default route.");
- }
}
default_device6 = best;
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 8541f10..f1d7d46 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -301,13 +301,13 @@ device_state_changed (NMActiveConnection *active,
}
static void
-add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
+add_ip4_vpn_gateway_route (NMIP4Config *config, NMDevice *parent_device, guint32 vpn_gw)
{
NMIP4Config *parent_config;
guint32 parent_gw;
NMPlatformIP4Route route;
- NMIP4Config *vpn4_config;
+ g_return_if_fail (NM_IS_IP4_CONFIG (config));
g_return_if_fail (NM_IS_DEVICE (parent_device));
g_return_if_fail (vpn_gw != 0);
@@ -321,8 +321,6 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
if (!parent_gw)
return;
- vpn4_config = nm_ip4_config_new ();
-
memset (&route, 0, sizeof (route));
route.network = vpn_gw;
route.plen = 32;
@@ -335,7 +333,7 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
if (nm_ip4_config_destination_is_direct (parent_config, vpn_gw, 32))
route.gateway = 0;
- nm_ip4_config_add_route (vpn4_config, &route);
+ nm_ip4_config_add_route (config, &route);
/* Ensure there's a route to the parent device's gateway through the
* parent device, since if the VPN claims the default route and the VPN
@@ -346,21 +344,19 @@ add_ip4_vpn_gateway_route (NMDevice *parent_device, guint32 vpn_gw)
route.network = parent_gw;
route.plen = 32;
- nm_ip4_config_add_route (vpn4_config, &route);
-
- nm_device_set_vpn4_config (parent_device, vpn4_config);
- g_object_unref (vpn4_config);
+ nm_ip4_config_add_route (config, &route);
}
static void
-add_ip6_vpn_gateway_route (NMDevice *parent_device,
+add_ip6_vpn_gateway_route (NMIP6Config *config,
+ NMDevice *parent_device,
const struct in6_addr *vpn_gw)
{
NMIP6Config *parent_config;
const struct in6_addr *parent_gw;
NMPlatformIP6Route route;
- NMIP6Config *vpn6_config;
+ g_return_if_fail (NM_IS_IP6_CONFIG (config));
g_return_if_fail (NM_IS_DEVICE (parent_device));
g_return_if_fail (vpn_gw != NULL);
@@ -370,8 +366,6 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
if (!parent_gw)
return;
- vpn6_config = nm_ip6_config_new ();
-
memset (&route, 0, sizeof (route));
route.network = *vpn_gw;
route.plen = 128;
@@ -384,7 +378,7 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
if (nm_ip6_config_destination_is_direct (parent_config, vpn_gw, 128))
route.gateway = in6addr_any;
- nm_ip6_config_add_route (vpn6_config, &route);
+ nm_ip6_config_add_route (config, &route);
/* Ensure there's a route to the parent device's gateway through the
* parent device, since if the VPN claims the default route and the VPN
@@ -395,10 +389,7 @@ add_ip6_vpn_gateway_route (NMDevice *parent_device,
route.network = *parent_gw;
route.plen = 128;
- nm_ip6_config_add_route (vpn6_config, &route);
-
- nm_device_set_vpn6_config (parent_device, vpn6_config);
- g_object_unref (vpn6_config);
+ nm_ip6_config_add_route (config, &route);
}
NMVPNConnection *
@@ -601,7 +592,7 @@ print_vpn_config (NMVPNConnection *connection)
ip6_address_to_string (priv->ip6_external_gw));
}
- nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface);
+ nm_log_info (LOGD_VPN, "Tunnel Device: %s", priv->ip_iface ? priv->ip_iface : "(none)");
if (priv->ip4_config) {
nm_log_info (LOGD_VPN, "IPv4 configuration:");
@@ -692,25 +683,54 @@ nm_vpn_connection_apply_config (NMVPNConnection *connection)
nm_vpn_connection_apply_config (NMVPNConnection *connection)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
+ NMIP4Config *vpn4_parent_config = NULL;
+ NMIP6Config *vpn6_parent_config = NULL;
- nm_platform_link_set_up (priv->ip_ifindex);
+ if (priv->ip_ifindex > 0) {
+ nm_platform_link_set_up (priv->ip_ifindex);
- if (priv->ip4_config) {
- if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex, 0))
- return FALSE;
+ if (priv->ip4_config) {
+ if (!nm_ip4_config_commit (priv->ip4_config, priv->ip_ifindex, 0))
+ return FALSE;
+ }
+
+ if (priv->ip6_config) {
+ if (!nm_ip6_config_commit (priv->ip6_config, priv->ip_ifindex, 0))
+ return FALSE;
+ }
+
+ if (priv->ip4_config)
+ vpn4_parent_config = nm_ip4_config_new ();
+ if (priv->ip6_config)
+ vpn6_parent_config = nm_ip6_config_new ();
+ } else {
+ /* If the VPN didn't return a network interface, it is a route-based
+ * VPN (like kernel IPSec) and all IP addressing and routing should
+ * be done on the parent interface instead.
+ */
+
+ if (priv->ip4_config)
+ vpn4_parent_config = g_object_ref (priv->ip4_config);
+ if (priv->ip6_config)
+ vpn6_parent_config = g_object_ref (priv->ip6_config);
}
- if (priv->ip6_config) {
- if (!nm_ip6_config_commit (priv->ip6_config, priv->ip_ifindex, 0))
- /* FIXME: remove ip4 config */
- return FALSE;
+ if (vpn4_parent_config) {
+ /* Add any explicit route to the VPN gateway through the parent device */
+ if (priv->ip4_external_gw)
+ add_ip4_vpn_gateway_route (vpn4_parent_config, priv->parent_dev, priv->ip4_external_gw);
+
+ nm_device_set_vpn4_config (priv->parent_dev, vpn4_parent_config);
+ g_object_unref (vpn4_parent_config);
}
+ if (vpn6_parent_config) {
+ /* Add any explicit route to the VPN gateway through the parent device */
+ if (priv->ip6_external_gw)
+ add_ip6_vpn_gateway_route (vpn6_parent_config, priv->parent_dev, priv->ip6_external_gw);
- /* Add any explicit route to the VPN gateway through the parent device */
- if (priv->ip4_external_gw)
- add_ip4_vpn_gateway_route (priv->parent_dev, priv->ip4_external_gw);
- if (priv->ip6_external_gw)
- add_ip6_vpn_gateway_route (priv->parent_dev, priv->ip6_external_gw);
+ nm_device_set_vpn6_config (priv->parent_dev, vpn6_parent_config);
+ g_object_unref (vpn6_parent_config);
+ }
nm_log_info (LOGD_VPN, "VPN connection '%s' (IP Config Get) complete.",
nm_connection_get_id (priv->connection));
@@ -768,21 +788,25 @@ process_generic_config (NMVPNConnection *connection,
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
GValue *val;
+ g_clear_pointer (&priv->ip_iface, g_free);
+
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_TUNDEV);
- if (val)
- priv->ip_iface = g_strdup (g_value_get_string (val));
- else {
- nm_log_err (LOGD_VPN, "invalid or missing tunnel device received!");
- nm_vpn_connection_config_maybe_complete (connection, FALSE);
- return FALSE;
+ if (val) {
+ const char *tmp = g_value_get_string (val);
+
+ /* Backwards compat with NM-openswan */
+ if (g_strcmp0 (tmp, "_none_") != 0)
+ priv->ip_iface = g_strdup (tmp);
}
- /* Grab the interface index for address/routing operations */
- priv->ip_ifindex = nm_platform_link_get_ifindex (priv->ip_iface);
- if (!priv->ip_ifindex) {
- nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
- nm_vpn_connection_config_maybe_complete (connection, FALSE);
- return FALSE;
+ if (priv->ip_iface) {
+ /* Grab the interface index for address/routing operations */
+ priv->ip_ifindex = nm_platform_link_get_ifindex (priv->ip_iface);
+ if (!priv->ip_ifindex) {
+ nm_log_err (LOGD_VPN, "(%s): failed to look up VPN interface index", priv->ip_iface);
+ nm_vpn_connection_config_maybe_complete (connection, FALSE);
+ return FALSE;
+ }
}
val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_CONFIG_BANNER);
--
1.7.11.7

View File

@ -0,0 +1,96 @@
From 00b29b6c61c0b7bff874a1a440f59c782ea7f83d Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Sun, 20 Oct 2013 16:27:46 -0400
Subject: [PATCH] core: fix NMManager:primary-connection when a VPN has the
default route
If a VPN had the default route, :primary-connection would become NULL,
which is exactly what it's not supposed to do. Fix it to have the
value it's supposed to.
https://bugzilla.gnome.org/show_bug.cgi?id=710207
---
src/nm-policy.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/nm-policy.c b/src/nm-policy.c
index d5176ae..22f7c11 100644
--- a/src/nm-policy.c
+++ b/src/nm-policy.c
@@ -638,7 +638,7 @@ static void
update_ip4_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL;
+ NMDevice *best = NULL, *default_device;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -682,6 +682,8 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP4 | LOGD_VPN, "Failed to set default route.");
}
}
+
+ default_device = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip4_config_get_mss (ip4_config);
@@ -691,14 +693,16 @@ update_ip4_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP4, "Failed to set default route.");
}
}
+
+ default_device = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default);
- if (best == priv->default_device4)
+ if (default_device == priv->default_device4)
return;
- priv->default_device4 = best;
+ priv->default_device4 = default_device;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv4 routing and DNS.",
nm_connection_get_id (connection), ip_iface);
@@ -816,7 +820,7 @@ static void
update_ip6_routing (NMPolicy *policy, gboolean force_update)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy);
- NMDevice *best = NULL;
+ NMDevice *best = NULL, *default_device6;
NMConnection *connection = NULL;
NMVPNConnection *vpn = NULL;
NMActiveConnection *best_ac = NULL;
@@ -870,6 +874,8 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route.");
}
}
+
+ default_device6 = nm_vpn_connection_get_parent_device (vpn);
} else {
int mss = nm_ip6_config_get_mss (ip6_config);
@@ -879,14 +885,16 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update)
nm_log_err (LOGD_IP6, "Failed to set default route.");
}
}
+
+ default_device6 = best;
}
update_default_ac (policy, best_ac, nm_active_connection_set_default6);
- if (best == priv->default_device6)
+ if (default_device6 == priv->default_device6)
return;
- priv->default_device6 = best;
+ priv->default_device6 = default_device6;
connection = nm_active_connection_get_connection (best_ac);
nm_log_info (LOGD_CORE, "Policy set '%s' (%s) as default for IPv6 routing and DNS.",
nm_connection_get_id (connection), ip_iface);
--
1.8.4.2

View File

@ -0,0 +1,943 @@
From fe2fb7137c2fec59222db890d516a81a16cc0a60 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Thu, 19 Dec 2013 09:11:20 -0500
Subject: [PATCH 1/4] introspection: wrap long lines in
nm-active-connection.xml
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-active-connection.xml | 31 ++++++++++++++++++++++++-------
1 file changed, 24 insertions(+), 7 deletions(-)
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index b6a3c48..d77f0d0 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -11,7 +11,9 @@
</tp:docstring>
<property name="Connection" type="o" access="read">
- <tp:docstring>The path of the connection.</tp:docstring>
+ <tp:docstring>
+ The path of the connection.
+ </tp:docstring>
</property>
<property name="SpecificObject" type="o" access="read">
<tp:docstring>
@@ -27,22 +29,37 @@
</tp:docstring>
</property>
<property name="Devices" type="ao" access="read">
- <tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring>
+ <tp:docstring>
+ Array of object paths representing devices which are part of this active
+ connection.
+ </tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_ACTIVE_CONNECTION_STATE">
- <tp:docstring>The state of this active connection.</tp:docstring>
+ <tp:docstring>
+ The state of this active connection.
+ </tp:docstring>
</property>
<property name="Default" type="b" access="read">
- <tp:docstring>Whether this active connection is the default IPv4 connection, i.e. whether it currently owns the default IPv4 route.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is the default IPv4 connection, i.e.
+ whether it currently owns the default IPv4 route.
+ </tp:docstring>
</property>
<property name="Default6" type="b" access="read">
- <tp:docstring>Whether this active connection is the default IPv6 connection, i.e. whether it currently owns the default IPv6 route.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is the default IPv6 connection, i.e.
+ whether it currently owns the default IPv6 route.
+ </tp:docstring>
</property>
<property name="Vpn" type="b" access="read">
- <tp:docstring>Whether this active connection is also a VPN connection.</tp:docstring>
+ <tp:docstring>
+ Whether this active connection is also a VPN connection.
+ </tp:docstring>
</property>
<property name="Master" type="o" access="read">
- <tp:docstring>The path to the master device if the connection is a slave.</tp:docstring>
+ <tp:docstring>
+ The path to the master device if the connection is a slave.
+ </tp:docstring>
</property>
<signal name="PropertiesChanged">
--
1.7.11.7
From f642e88afd2bf585036ca8af54c81976cd2f259b Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 08:46:43 -0500
Subject: [PATCH 2/4] core: add IP/DHCP config properties to
o.fd.NM.Connection.Active
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add IP and DHCP config properties to the D-Bus ActiveConnection
objects.
For device connections, this is redundant with the properties already
on the Device object, but for VPN connections, this information was
not previously available.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
introspection/nm-active-connection.xml | 30 ++++++++++++++
src/nm-activation-request.c | 71 ++++++++++++++++++++++++++++++++++
src/nm-active-connection.c | 53 +++++++++++++++++++++++++
src/nm-active-connection.h | 4 ++
src/vpn-manager/nm-vpn-connection.c | 23 +++++++++++
5 files changed, 181 insertions(+)
diff --git a/introspection/nm-active-connection.xml b/introspection/nm-active-connection.xml
index d77f0d0..56a1013 100644
--- a/introspection/nm-active-connection.xml
+++ b/introspection/nm-active-connection.xml
@@ -45,12 +45,42 @@
whether it currently owns the default IPv4 route.
</tp:docstring>
</property>
+ <property name="Ip4Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Ip4Config object describing the configuration of the
+ connection. Only valid when the connection is in the
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ </tp:docstring>
+ </property>
+ <property name="Dhcp4Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Dhcp4Config object describing the DHCP options
+ returned by the DHCP server (assuming the connection used DHCP). Only
+ valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ state.
+ </tp:docstring>
+ </property>
<property name="Default6" type="b" access="read">
<tp:docstring>
Whether this active connection is the default IPv6 connection, i.e.
whether it currently owns the default IPv6 route.
</tp:docstring>
</property>
+ <property name="Ip6Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Ip6Config object describing the configuration of the
+ connection. Only valid when the connection is in the
+ NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ </tp:docstring>
+ </property>
+ <property name="Dhcp6Config" type="o" access="read">
+ <tp:docstring>
+ Object path of the Dhcp6Config object describing the DHCP options
+ returned by the DHCP server (assuming the connection used DHCP). Only
+ valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ state.
+ </tp:docstring>
+ </property>
<property name="Vpn" type="b" access="read">
<tp:docstring>
Whether this active connection is also a VPN connection.
diff --git a/src/nm-activation-request.c b/src/nm-activation-request.c
index 0f3c91e..5fa0fc3 100644
--- a/src/nm-activation-request.c
+++ b/src/nm-activation-request.c
@@ -56,6 +56,16 @@ typedef struct {
GSList *share_rules;
} NMActRequestPrivate;
+enum {
+ PROP_0,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
+
+ LAST_PROP
+};
+
/*******************************************************************/
NMConnection *
@@ -282,6 +292,14 @@ nm_act_request_add_share_rule (NMActRequest *req,
/********************************************************************/
static void
+device_notify (GObject *object,
+ GParamSpec *pspec,
+ gpointer self)
+{
+ g_object_notify (self, pspec->name);
+}
+
+static void
device_state_changed (NMDevice *device, GParamSpec *pspec, NMActRequest *self)
{
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
@@ -301,6 +319,15 @@ device_state_changed (NMActiveConnection *active,
break;
case NM_DEVICE_STATE_ACTIVATED:
ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
+
+ g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+ g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,
+ G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
break;
case NM_DEVICE_STATE_DEACTIVATING:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING;
@@ -310,6 +337,8 @@ device_state_changed (NMActiveConnection *active,
case NM_DEVICE_STATE_UNAVAILABLE:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
+ g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_notify), NM_ACTIVE_CONNECTION (self));
+
/* No longer need to pay attention to device state */
if (priv->device && priv->device_state_id) {
g_signal_handler_disconnect (priv->device, priv->device_state_id);
@@ -414,6 +443,37 @@ dispose (GObject *object)
}
static void
+get_property (GObject *object, guint prop_id,
+ GValue *value, GParamSpec *pspec)
+{
+ NMDevice *device;
+
+ device = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
+ if (!device) {
+ g_value_set_boxed (value, "/");
+ return;
+ }
+
+ switch (prop_id) {
+ case PROP_IP4_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_IP4_CONFIG, value);
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG, value);
+ break;
+ case PROP_IP6_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_IP6_CONFIG, value);
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG, value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
nm_act_request_class_init (NMActRequestClass *req_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (req_class);
@@ -423,5 +483,16 @@ nm_act_request_class_init (NMActRequestClass *req_class)
/* virtual methods */
object_class->constructed = constructed;
object_class->dispose = dispose;
+ object_class->get_property = get_property;
+
+ /* properties */
+ g_object_class_override_property (object_class, PROP_IP4_CONFIG,
+ NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_DHCP4_CONFIG,
+ NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_IP6_CONFIG,
+ NM_ACTIVE_CONNECTION_IP6_CONFIG);
+ g_object_class_override_property (object_class, PROP_DHCP6_CONFIG,
+ NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
}
diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c
index a8a422c..3631470 100644
--- a/src/nm-active-connection.c
+++ b/src/nm-active-connection.c
@@ -74,7 +74,11 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
PROP_VPN,
PROP_MASTER,
@@ -152,6 +156,14 @@ nm_active_connection_set_state (NMActiveConnection *self,
}
}
+ if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
+ g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
+ }
+
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
/* Device is no longer relevant when deactivated */
g_clear_object (&priv->device);
@@ -712,9 +724,22 @@ get_property (GObject *object, guint prop_id,
case PROP_DEFAULT:
g_value_set_boolean (value, priv->is_default);
break;
+ case PROP_IP4_CONFIG:
+ /* The IP and DHCP config properties may be overridden by a subclass */
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
case PROP_DEFAULT6:
g_value_set_boolean (value, priv->is_default6);
break;
+ case PROP_IP6_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_value_set_boxed (value, "/");
+ break;
case PROP_VPN:
g_value_set_boolean (value, priv->vpn);
break;
@@ -838,6 +863,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_IP4_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP4_CONFIG,
+ "IP4 Config",
+ "IP4 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_DHCP4_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
+ "DHCP4 Config",
+ "DHCP4 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
g_object_class_install_property (object_class, PROP_DEFAULT6,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
"Default6",
@@ -845,6 +884,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class, PROP_IP6_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP6_CONFIG,
+ "IP6 Config",
+ "IP6 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_DHCP6_CONFIG,
+ g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
+ "DHCP6 Config",
+ "DHCP6 Config",
+ DBUS_TYPE_G_OBJECT_PATH,
+ G_PARAM_READABLE));
+
g_object_class_install_property (object_class, PROP_VPN,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
"VPN",
diff --git a/src/nm-active-connection.h b/src/nm-active-connection.h
index 43b76bd..2a4df97 100644
--- a/src/nm-active-connection.h
+++ b/src/nm-active-connection.h
@@ -40,7 +40,11 @@
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_VPN "vpn"
#define NM_ACTIVE_CONNECTION_MASTER "master"
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 500c72b..a4bc431 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -105,6 +105,8 @@ enum {
PROP_0,
PROP_VPN_STATE,
PROP_BANNER,
+ PROP_IP4_CONFIG,
+ PROP_IP6_CONFIG,
PROP_MASTER = 2000,
LAST_PROP
@@ -1011,6 +1013,8 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
nm_ip4_config_merge_setting (config, nm_connection_get_setting_ip4_config (priv->connection));
priv->ip4_config = config;
+ nm_ip4_config_export (config);
+ g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP4_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@@ -1152,6 +1156,8 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
nm_ip6_config_merge_setting (config, nm_connection_get_setting_ip6_config (priv->connection));
priv->ip6_config = config;
+ nm_ip6_config_export (config);
+ g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP6_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@@ -1787,6 +1793,18 @@ get_property (GObject *object, guint prop_id,
case PROP_BANNER:
g_value_set_string (value, priv->banner ? priv->banner : "");
break;
+ case PROP_IP4_CONFIG:
+ if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip4_config)
+ g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
+ else
+ g_value_set_boxed (value, "/");
+ break;
+ case PROP_IP6_CONFIG:
+ if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip6_config)
+ g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
+ else
+ g_value_set_boxed (value, "/");
+ break;
case PROP_MASTER:
g_value_set_boxed (value, nm_device_get_path (priv->parent_dev));
break;
@@ -1832,6 +1850,11 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
NULL,
G_PARAM_READABLE));
+ g_object_class_override_property (object_class, PROP_IP4_CONFIG,
+ NM_ACTIVE_CONNECTION_IP4_CONFIG);
+ g_object_class_override_property (object_class, PROP_IP6_CONFIG,
+ NM_ACTIVE_CONNECTION_IP6_CONFIG);
+
/* signals */
signals[VPN_STATE_CHANGED] =
g_signal_new ("vpn-state-changed",
--
1.7.11.7
From 4783f43c530ba7b8d045a1d66001af4ac6463dd4 Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 10:56:09 -0500
Subject: [PATCH 3/4] libnm-glib: expose new NMActiveConnection IP/DHCP config
properties
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
libnm-glib/libnm-glib.ver | 4 +
libnm-glib/nm-active-connection.c | 184 ++++++++++++++++++++++++++++++++++++--
libnm-glib/nm-active-connection.h | 16 +++-
libnm-glib/nm-device.c | 16 ++++
4 files changed, 209 insertions(+), 11 deletions(-)
diff --git a/libnm-glib/libnm-glib.ver b/libnm-glib/libnm-glib.ver
index ac784cc..5247ce9 100644
--- a/libnm-glib/libnm-glib.ver
+++ b/libnm-glib/libnm-glib.ver
@@ -23,6 +23,10 @@ global:
nm_active_connection_get_default6;
nm_active_connection_get_default;
nm_active_connection_get_devices;
+ nm_active_connection_get_dhcp4_config;
+ nm_active_connection_get_dhcp6_config;
+ nm_active_connection_get_ip4_config;
+ nm_active_connection_get_ip6_config;
nm_active_connection_get_master;
nm_active_connection_get_specific_object;
nm_active_connection_get_state;
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index c474483..11f37cf 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -58,7 +58,11 @@ typedef struct {
GPtrArray *devices;
NMActiveConnectionState state;
gboolean is_default;
+ NMIP4Config *ip4_config;
+ NMDHCP4Config *dhcp4_config;
gboolean is_default6;
+ NMIP6Config *ip6_config;
+ NMDHCP6Config *dhcp6_config;
char *master;
} NMActiveConnectionPrivate;
@@ -70,21 +74,16 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
+ PROP_IP4_CONFIG,
+ PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
+ PROP_IP6_CONFIG,
+ PROP_DHCP6_CONFIG,
PROP_MASTER,
LAST_PROP
};
-#define DBUS_PROP_CONNECTION "Connection"
-#define DBUS_PROP_UUID "Uuid"
-#define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
-#define DBUS_PROP_DEVICES "Devices"
-#define DBUS_PROP_STATE "State"
-#define DBUS_PROP_DEFAULT "Default"
-#define DBUS_PROP_DEFAULT6 "Default6"
-#define DBUS_PROP_MASTER "Master"
-
/**
* nm_active_connection_new:
* @connection: the #DBusGConnection
@@ -308,6 +307,49 @@ nm_active_connection_get_default (NMActiveConnection *connection)
}
/**
+ * nm_active_connection_get_ip4_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMIP4Config associated with the #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMIP4Config, or %NULL if the
+ * connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ * state.
+ *
+ * Since: 0.9.10
+ **/
+NMIP4Config *
+nm_active_connection_get_ip4_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip4_config;
+}
+
+/**
+ * nm_active_connection_get_dhcp4_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMDHCP4Config (if any) associated with the
+ * #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMDHCP4Config, or %NULL if the
+ * connection does not use DHCP, or is not in the
+ * %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ *
+ * Since: 0.9.10
+ **/
+NMDHCP4Config *
+nm_active_connection_get_dhcp4_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp4_config;
+}
+
+/**
* nm_active_connection_get_default6:
* @connection: a #NMActiveConnection
*
@@ -326,6 +368,49 @@ nm_active_connection_get_default6 (NMActiveConnection *connection)
}
/**
+ * nm_active_connection_get_ip6_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMIP6Config associated with the #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMIP6Config, or %NULL if the
+ * connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
+ * state.
+ *
+ * Since: 0.9.10
+ **/
+NMIP6Config *
+nm_active_connection_get_ip6_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip6_config;
+}
+
+/**
+ * nm_active_connection_get_dhcp6_config:
+ * @connection: an #NMActiveConnection
+ *
+ * Gets the current #NMDHCP6Config (if any) associated with the
+ * #NMActiveConnection.
+ *
+ * Returns: (transfer none): the #NMDHCP6Config, or %NULL if the
+ * connection does not use DHCPv6, or is not in the
+ * %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
+ *
+ * Since: 0.9.10
+ **/
+NMDHCP6Config *
+nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
+{
+ g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
+
+ _nm_object_ensure_inited (NM_OBJECT (connection));
+ return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
+}
+
+/**
* nm_active_connection_get_master:
* @connection: a #NMActiveConnection
*
@@ -359,6 +444,11 @@ dispose (GObject *object)
priv->devices = NULL;
}
+ g_clear_object (&priv->ip4_config);
+ g_clear_object (&priv->dhcp4_config);
+ g_clear_object (&priv->ip6_config);
+ g_clear_object (&priv->dhcp6_config);
+
g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
@@ -406,9 +496,21 @@ get_property (GObject *object,
case PROP_DEFAULT:
g_value_set_boolean (value, nm_active_connection_get_default (self));
break;
+ case PROP_IP4_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_ip4_config (self));
+ break;
+ case PROP_DHCP4_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_dhcp4_config (self));
+ break;
case PROP_DEFAULT6:
g_value_set_boolean (value, nm_active_connection_get_default6 (self));
break;
+ case PROP_IP6_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_ip6_config (self));
+ break;
+ case PROP_DHCP6_CONFIG:
+ g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
+ break;
case PROP_MASTER:
g_value_set_string (value, nm_active_connection_get_master (self));
break;
@@ -429,7 +531,11 @@ register_properties (NMActiveConnection *connection)
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
+ { NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
+ { NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
+ { NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
+ { NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
/* not tracked after construction time */
@@ -551,6 +657,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
G_PARAM_READABLE));
/**
+ * NMActiveConnection:ip4-config:
+ *
+ * The #NMIP4Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IP4_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG,
+ "IP4 Config",
+ "IP4 Config",
+ NM_TYPE_IP4_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
+ * NMActiveConnection:dhcp4-config:
+ *
+ * The #NMDHCP4Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP4_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
+ "DHCP4 Config",
+ "DHCP4 Config",
+ NM_TYPE_DHCP4_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
* NMActiveConnection:default6:
*
* Whether the active connection is the default IPv6 one.
@@ -564,6 +700,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
G_PARAM_READABLE));
/**
+ * NMActiveConnection:ip6-config:
+ *
+ * The #NMIP6Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_IP6_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG,
+ "IP6 Config",
+ "IP6 Config",
+ NM_TYPE_IP6_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
+ * NMActiveConnection:dhcp6-config:
+ *
+ * The #NMDHCP6Config of the connection.
+ *
+ * Since: 0.9.10
+ **/
+ g_object_class_install_property
+ (object_class, PROP_DHCP6_CONFIG,
+ g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
+ "DHCP6 Config",
+ "DHCP6 Config",
+ NM_TYPE_DHCP6_CONFIG,
+ G_PARAM_READABLE));
+
+ /**
* NMActiveConnection:master:
*
* The path of the master device if one exists.
diff --git a/libnm-glib/nm-active-connection.h b/libnm-glib/nm-active-connection.h
index c6777f8..49f040d 100644
--- a/libnm-glib/nm-active-connection.h
+++ b/libnm-glib/nm-active-connection.h
@@ -29,6 +29,10 @@
#include "nm-object.h"
#include <nm-connection.h>
#include <NetworkManager.h>
+#include "nm-ip4-config.h"
+#include "nm-dhcp4-config.h"
+#include "nm-ip6-config.h"
+#include "nm-dhcp6-config.h"
G_BEGIN_DECLS
@@ -45,7 +49,11 @@ G_BEGIN_DECLS
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
+#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
+#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
+#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
+#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_MASTER "master"
typedef struct {
@@ -73,9 +81,13 @@ const char * nm_active_connection_get_uuid (NMActiveConnection *c
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
-gboolean nm_active_connection_get_default (NMActiveConnection *connection);
-gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
const char * nm_active_connection_get_master (NMActiveConnection *connection);
+gboolean nm_active_connection_get_default (NMActiveConnection *connection);
+NMIP4Config * nm_active_connection_get_ip4_config (NMActiveConnection *connection);
+NMDHCP4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
+gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
+NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
+NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
G_END_DECLS
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index d4f95ac..6d8e9f1 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -1253,6 +1253,10 @@ nm_device_get_firmware_missing (NMDevice *device)
*
* Gets the current #NMIP4Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_ip4_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMIP4Config or %NULL if the device is not activated.
**/
NMIP4Config *
@@ -1270,6 +1274,10 @@ nm_device_get_ip4_config (NMDevice *device)
*
* Gets the current #NMDHCP4Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_dhcp4_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMDHCP4Config or %NULL if the device is not activated or not
* using DHCP.
**/
@@ -1288,6 +1296,10 @@ nm_device_get_dhcp4_config (NMDevice *device)
*
* Gets the current #NMIP6Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_ip6_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMIP6Config or %NULL if the device is not activated.
**/
NMIP6Config *
@@ -1305,6 +1317,10 @@ nm_device_get_ip6_config (NMDevice *device)
*
* Gets the current #NMDHCP6Config associated with the #NMDevice.
*
+ * Note that as of NetworkManager 0.9.10, you can alternatively use
+ * nm_active_connection_get_dhcp6_config(), which also works with VPN
+ * connections.
+ *
* Returns: (transfer none): the #NMDHCP6Config or %NULL if the device is not activated or not
* using DHCP.
**/
--
1.7.11.7
From f1f4f32c02e724f59fcc958d08ab8d543a01311d Mon Sep 17 00:00:00 2001
From: Dan Winship <danw@gnome.org>
Date: Wed, 18 Dec 2013 11:49:39 -0500
Subject: [PATCH 4/4] cli: get IP/DHCP config directly from the
NMActiveConnection (rh #1036132)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
cli/src/connections.c | 60 ++++++++++++++-------------------------------------
1 file changed, 16 insertions(+), 44 deletions(-)
diff --git a/cli/src/connections.c b/cli/src/connections.c
index 26be72f..7376405 100644
--- a/cli/src/connections.c
+++ b/cli/src/connections.c
@@ -941,66 +941,38 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
/* IP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[1].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMIP4Config *cfg4 = nm_active_connection_get_ip4_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
-
- b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
+ was_output = was_output || b1;
}
/* DHCP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMDHCP4Config *dhcp4 = nm_active_connection_get_dhcp4_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device);
-
- b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
+ was_output = was_output || b1;
}
/* IP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[3].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMIP6Config *cfg6 = nm_active_connection_get_ip6_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
-
- b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
+ was_output = was_output || b1;
}
/* DHCP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[4].name) == 0) {
- const GPtrArray *devices;
- int j;
+ gboolean b1 = FALSE;
+ NMDHCP6Config *dhcp6 = nm_active_connection_get_dhcp6_config (acon);
- devices = nm_active_connection_get_devices (acon);
- for (j = 0; devices && (j < devices->len); j++) {
- gboolean b1 = FALSE;
- NMDevice *device = g_ptr_array_index (devices, j);
- NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device);
-
- b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
- was_output = was_output || b1;
- }
+ b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
+ was_output = was_output || b1;
}
/* VPN */
--
1.7.11.7

View File

@ -0,0 +1,61 @@
From a9f1d121783a7f3c65c9f47d3419b5a8a255fe47 Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 23 Jan 2014 12:16:02 -0600
Subject: [PATCH] dhcp: don't add an IPv6 address if one wasn't given (rh
#1048046)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In information-only mode (where RA is providing addresses), DHCPv6
may not give an address. NetworkManager was adding a blank one
anyway, which is invalid. Don't do that.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/dhcp-manager/nm-dhcp-client.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index 75cd818..57298c8 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -1404,6 +1404,12 @@ ip6_options_to_config (NMDHCPClient *self)
ip6_config = nm_ip6_config_new ();
+ str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
+ if (str) {
+ address.lifetime = address.preferred = strtoul (str, NULL, 10);
+ nm_log_info (LOGD_DHCP6, " lease time %d", address.lifetime);
+ }
+
str = g_hash_table_lookup (priv->options, "new_ip6_address");
if (str) {
if (!inet_pton (AF_INET6, str, &tmp_addr)) {
@@ -1413,21 +1419,13 @@ ip6_options_to_config (NMDHCPClient *self)
}
address.address = tmp_addr;
+ nm_ip6_config_add_address (ip6_config, &address);
nm_log_info (LOGD_DHCP6, " address %s", str);
-
} else if (priv->info_only == FALSE) {
/* No address in Managed mode is a hard error */
goto error;
}
- str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
- if (str) {
- address.lifetime = address.preferred = strtoul (str, NULL, 10);
- nm_log_info (LOGD_DHCP6, " lease time %d", address.lifetime);
- }
-
- nm_ip6_config_add_address (ip6_config, &address);
-
str = g_hash_table_lookup (priv->options, "new_host_name");
if (str)
nm_log_info (LOGD_DHCP6, " hostname '%s'", str);
--
1.7.11.7

View File

@ -0,0 +1,203 @@
From e62b212be3b51b0dc31fd12ea70d78358164063e Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Fri, 24 Jan 2014 12:49:57 -0600
Subject: [PATCH] core: exit cleanly if D-Bus cannot be initialized (rh
#1057738)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Instead of crashing, let's exit cleanly.
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/nm-manager.c | 90 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 49 insertions(+), 41 deletions(-)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index e6ff8d5..1545e72 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -217,6 +217,7 @@ typedef struct {
NMDBusManager *dbus_mgr;
guint dbus_connection_changed_id;
+ gboolean prop_filter_added;
NMAtmManager *atm_mgr;
NMRfkillManager *rfkill_mgr;
NMBluezManager *bluez_mgr;
@@ -250,7 +251,6 @@ typedef struct {
GHashTable *nm_bridges;
gboolean startup;
- gboolean disposed;
} NMManagerPrivate;
#define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate))
@@ -4503,6 +4503,16 @@ nm_manager_new (NMSettings *settings,
priv = NM_MANAGER_GET_PRIVATE (singleton);
+ bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
+ if (!bus) {
+ nm_log_err (LOGD_CORE, "Failed to initialize D-Bus connection");
+ g_object_unref (singleton);
+ return NULL;
+ }
+
+ dbus_connection = dbus_g_connection_get_connection (bus);
+ g_assert (dbus_connection);
+
priv->policy = nm_policy_new (singleton, settings);
g_signal_connect (priv->policy, "notify::" NM_POLICY_DEFAULT_IP4_DEVICE,
G_CALLBACK (policy_default_device_changed), singleton);
@@ -4517,16 +4527,12 @@ nm_manager_new (NMSettings *settings,
g_signal_connect (priv->connectivity, "notify::" NM_CONNECTIVITY_STATE,
G_CALLBACK (connectivity_changed), singleton);
- bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
- g_assert (bus);
- dbus_connection = dbus_g_connection_get_connection (bus);
- g_assert (dbus_connection);
-
if (!dbus_connection_add_filter (dbus_connection, prop_filter, singleton, NULL)) {
nm_log_err (LOGD_CORE, "failed to register DBus connection filter");
g_object_unref (singleton);
return NULL;
- }
+ }
+ priv->prop_filter_added = TRUE;
priv->settings = g_object_ref (settings);
@@ -4614,14 +4620,9 @@ dispose (GObject *object)
DBusConnection *dbus_connection;
GSList *iter;
- if (priv->disposed) {
- G_OBJECT_CLASS (nm_manager_parent_class)->dispose (object);
- return;
- }
- priv->disposed = TRUE;
-
g_slist_foreach (priv->auth_chains, (GFunc) nm_auth_chain_unref, NULL);
g_slist_free (priv->auth_chains);
+ priv->auth_chains = NULL;
nm_auth_changed_func_unregister (authority_changed_cb, manager);
@@ -4635,8 +4636,7 @@ dispose (GObject *object)
for (iter = priv->active_connections; iter; iter = g_slist_next (iter))
active_connection_removed (manager, NM_ACTIVE_CONNECTION (iter->data));
- g_slist_free (priv->active_connections);
- priv->active_connections = NULL;
+ g_clear_pointer (&priv->active_connections, g_slist_free);
g_clear_object (&priv->primary_connection);
g_clear_object (&priv->activating_connection);
@@ -4644,12 +4644,14 @@ dispose (GObject *object)
g_free (priv->hostname);
- g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_default_device_changed), singleton);
- g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_activating_device_changed), singleton);
- g_object_unref (priv->policy);
+ if (priv->policy) {
+ g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_default_device_changed), singleton);
+ g_signal_handlers_disconnect_by_func (priv->policy, G_CALLBACK (policy_activating_device_changed), singleton);
+ g_clear_object (&priv->policy);
+ }
- g_object_unref (priv->settings);
- g_object_unref (priv->vpn_manager);
+ g_clear_object (&priv->settings);
+ g_clear_object (&priv->vpn_manager);
if (priv->modem_added_id) {
g_source_remove (priv->modem_added_id);
@@ -4659,39 +4661,42 @@ dispose (GObject *object)
g_source_remove (priv->modem_removed_id);
priv->modem_removed_id = 0;
}
- g_object_unref (priv->modem_manager);
+ g_clear_object (&priv->modem_manager);
/* Unregister property filter */
- bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
- if (bus) {
- dbus_connection = dbus_g_connection_get_connection (bus);
- g_assert (dbus_connection);
- dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
+ if (priv->dbus_mgr) {
+ bus = nm_dbus_manager_get_connection (priv->dbus_mgr);
+ if (bus) {
+ dbus_connection = dbus_g_connection_get_connection (bus);
+ if (dbus_connection && priv->prop_filter_added) {
+ dbus_connection_remove_filter (dbus_connection, prop_filter, manager);
+ priv->prop_filter_added = FALSE;
+ }
+ }
+ g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
+ priv->dbus_mgr = NULL;
}
- g_signal_handler_disconnect (priv->dbus_mgr, priv->dbus_connection_changed_id);
- priv->dbus_mgr = NULL;
-
- if (priv->bluez_mgr)
- g_object_unref (priv->bluez_mgr);
-
- if (priv->aipd_proxy)
- g_object_unref (priv->aipd_proxy);
- if (priv->sleep_monitor)
- g_object_unref (priv->sleep_monitor);
+ g_clear_object (&priv->bluez_mgr);
+ g_clear_object (&priv->aipd_proxy);
+ g_clear_object (&priv->sleep_monitor);
if (priv->fw_monitor) {
- if (priv->fw_monitor_id)
+ if (priv->fw_monitor_id) {
g_signal_handler_disconnect (priv->fw_monitor, priv->fw_monitor_id);
+ priv->fw_monitor_id = 0;
+ }
- if (priv->fw_changed_id)
+ if (priv->fw_changed_id) {
g_source_remove (priv->fw_changed_id);
+ priv->fw_changed_id = 0;
+ }
g_file_monitor_cancel (priv->fw_monitor);
- g_object_unref (priv->fw_monitor);
+ g_clear_object (&priv->fw_monitor);
}
- g_slist_free (priv->factories);
+ g_clear_pointer (&priv->factories, g_slist_free);
if (priv->timestamp_update_id) {
g_source_remove (priv->timestamp_update_id);
@@ -4945,14 +4950,17 @@ dbus_connection_changed_cb (NMDBusManager *dbus_mgr,
gpointer user_data)
{
NMManager *self = NM_MANAGER (user_data);
+ gboolean success = FALSE;
if (dbus_connection) {
/* Register property filter on new connection; there's no reason this
* should fail except out-of-memory or program error; if it does fail
* then there's no Manager property access control, which is bad.
*/
- g_assert (dbus_connection_add_filter (dbus_connection, prop_filter, self, NULL));
+ success = dbus_connection_add_filter (dbus_connection, prop_filter, self, NULL);
+ g_assert (success);
}
+ NM_MANAGER_GET_PRIVATE (self)->prop_filter_added = success;
}
static void
--
1.7.11.7

View File

@ -0,0 +1,83 @@
From 31fe84e467732463eabc8f70c2a419008e7a227c Mon Sep 17 00:00:00 2001
From: Scott Shambarger <devel@shambarger.net>
Date: Thu, 9 Jan 2014 14:26:53 -0800
Subject: [PATCH] core: Add host route for DHCP4 server if outside assigned
subnet (bgo #721767)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Some ISP's provide leases from central servers that are on different
subnets that the address offered. If the host does not configure the
interface as the default route, the dhcp server may not be reachable
via unicast, and a host specific route is needed.
https://bugzilla.gnome.org/show_bug.cgi?id=721767
https://bugzilla.redhat.com/show_bug.cgi?id=983325
Signed-off-by: Thomas Haller <thaller@redhat.com>
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/dhcp-manager/nm-dhcp-client.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index edea8f8..75cd818 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -1200,8 +1200,8 @@ ip4_options_to_config (NMDHCPClient *self)
for (s = routers; *s; s++) {
/* FIXME: how to handle multiple routers? */
- if (inet_pton (AF_INET, *s, &tmp_addr) > 0) {
- nm_ip4_config_set_gateway (ip4_config, tmp_addr);
+ if (inet_pton (AF_INET, *s, &gwaddr) > 0) {
+ nm_ip4_config_set_gateway (ip4_config, gwaddr);
nm_log_info (LOGD_DHCP4, " gateway %s", *s);
break;
} else
@@ -1211,6 +1211,41 @@ ip4_options_to_config (NMDHCPClient *self)
}
}
+ /*
+ * RFC 2132, section 9.7
+ * DHCP clients use the contents of the 'server identifier' field
+ * as the destination address for any DHCP messages unicast to
+ * the DHCP server.
+ *
+ * Some ISP's provide leases from central servers that are on
+ * different subnets that the address offered. If the host
+ * does not configure the interface as the default route, the
+ * dhcp server may not be reachable via unicast, and a host
+ * specific route is needed.
+ **/
+ str = g_hash_table_lookup (priv->options, "new_dhcp_server_identifier");
+ if (str) {
+ if (inet_pton (AF_INET, str, &tmp_addr) > 0) {
+ NMPlatformIP4Route route;
+ guint32 mask = nm_utils_ip4_prefix_to_netmask (address.plen);
+
+ nm_log_info (LOGD_DHCP4, " server identifier %s", str);
+ if ((tmp_addr & mask) != (address.address & mask)) {
+ /* DHCP server not on assigned subnet, route needed */
+ memset (&route, 0, sizeof (route));
+ route.network = tmp_addr;
+ route.plen = 32;
+ /* this will be a device route if gwaddr is 0 */
+ route.gateway = gwaddr;
+ nm_ip4_config_add_route (ip4_config, &route);
+ nm_log_dbg (LOGD_IP, "adding route for server identifier: %s",
+ nm_platform_ip4_route_to_string (&route));
+ }
+ }
+ else
+ nm_log_warn (LOGD_DHCP4, "ignoring invalid server identifier '%s'", str);
+ }
+
str = g_hash_table_lookup (priv->options, "new_dhcp_lease_time");
if (str) {
address.lifetime = address.preferred = strtoul (str, NULL, 10);
--
1.7.11.7

178
vpn-connection-states.patch Normal file
View File

@ -0,0 +1,178 @@
From c72d2eb02fa05b29dbff372a3ab02a11f3a0557b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 12:49:31 +0100
Subject: [PATCH 1/2] vpn: print VPN plugin failures and VPN connection reason
changes as strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 58 ++++++++++++++++++++++++++++++++++---
1 file changed, 54 insertions(+), 4 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index e7c3e07..d0c82e4 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -438,14 +438,31 @@ nm_vpn_connection_get_service (NMVPNConnection *connection)
return nm_setting_vpn_get_service_type (s_vpn);
}
+static const char *
+vpn_plugin_failure_to_string (NMVPNPluginFailure failure)
+{
+ switch (failure) {
+ case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED:
+ return "connect-failed";
+ case NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG:
+ return "bad-ip-config";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_failed (DBusGProxy *proxy,
- NMVPNPluginFailure plugin_failure,
- gpointer user_data)
+ NMVPNPluginFailure plugin_failure,
+ gpointer user_data)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (user_data);
- nm_log_warn (LOGD_VPN, "VPN plugin failed: %d", plugin_failure);
+ nm_log_warn (LOGD_VPN, "VPN plugin failed: %s (%d)",
+ vpn_plugin_failure_to_string (plugin_failure), plugin_failure);
switch (plugin_failure) {
case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
@@ -481,6 +498,38 @@ vpn_state_to_string (NMVPNServiceState state)
return "unknown";
}
+static const char *
+vpn_reason_to_string (NMVPNConnectionStateReason reason)
+{
+ switch (reason) {
+ case NM_VPN_CONNECTION_STATE_REASON_NONE:
+ return "none";
+ case NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED:
+ return "user-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED:
+ return "device-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED:
+ return "service-stopped";
+ case NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID:
+ return "ip-config-invalid";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT:
+ return "connect-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT:
+ return "service-start-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED:
+ return "service-start-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS:
+ return "no-secrets";
+ case NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED:
+ return "connection-removed";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_state_changed (DBusGProxy *proxy,
NMVPNServiceState state,
@@ -504,7 +553,8 @@ plugin_state_changed (DBusGProxy *proxy,
case NM_VPN_CONNECTION_STATE_CONNECT:
case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
case NM_VPN_CONNECTION_STATE_ACTIVATED:
- nm_log_info (LOGD_VPN, "VPN plugin state change reason: %d", priv->failure_reason);
+ nm_log_info (LOGD_VPN, "VPN plugin state change reason: %s (%d)",
+ vpn_reason_to_string (priv->failure_reason), priv->failure_reason);
nm_vpn_connection_set_vpn_state (connection,
NM_VPN_CONNECTION_STATE_FAILED,
priv->failure_reason);
--
1.7.11.7
From 3cebf963da32c610b5607dd5c9ca77054e4fa9c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 13:17:44 +0100
Subject: [PATCH 2/2] vpn: add code2string translation for
NMVPNConnectionState and fix its logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index d0c82e4..500c72b 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -477,7 +477,7 @@ plugin_failed (DBusGProxy *proxy,
}
static const char *
-vpn_state_to_string (NMVPNServiceState state)
+vpn_service_state_to_string (NMVPNServiceState state)
{
switch (state) {
case NM_VPN_SERVICE_STATE_INIT:
@@ -499,6 +499,30 @@ vpn_state_to_string (NMVPNServiceState state)
}
static const char *
+vpn_state_to_string (NMVPNConnectionState state)
+{
+ switch (state) {
+ case NM_VPN_CONNECTION_STATE_PREPARE:
+ return "prepare";
+ case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+ return "need-auth";
+ case NM_VPN_CONNECTION_STATE_CONNECT:
+ return "connect";
+ case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+ return "ip-config-get";
+ case NM_VPN_CONNECTION_STATE_ACTIVATED:
+ return "activated";
+ case NM_VPN_CONNECTION_STATE_FAILED:
+ return "failed";
+ case NM_VPN_CONNECTION_STATE_DISCONNECTED:
+ return "disconnected";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
+static const char *
vpn_reason_to_string (NMVPNConnectionStateReason reason)
{
switch (reason) {
@@ -539,7 +563,7 @@ plugin_state_changed (DBusGProxy *proxy,
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
nm_log_info (LOGD_VPN, "VPN plugin state changed: %s (%d)",
- vpn_state_to_string (state), state);
+ vpn_service_state_to_string (state), state);
if (state == NM_VPN_SERVICE_STATE_STOPPED) {
/* Clear connection secrets to ensure secrets get requested each time the
--
1.7.11.7