From c2efef1897c48cba414f7a74ba0f491286bd4d30 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Feb 04 2014 22:11:03 +0000 Subject: Update snapshot (upstream commit 6c2f96421b1c7bfd65032bf4de2a6cfc10b3b262) --- diff --git a/.gitignore b/.gitignore index 778ec86..bf8ed68 100644 --- a/.gitignore +++ b/.gitignore @@ -296,3 +296,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 diff --git a/0001-explain-dns1-dns2.patch b/0001-explain-dns1-dns2.patch new file mode 100644 index 0000000..e31a0eb --- /dev/null +++ b/0001-explain-dns1-dns2.patch @@ -0,0 +1,27 @@ +diff -up NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c +--- NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 2010-10-18 18:44:05.000000000 -0500 ++++ NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c 2010-11-03 13:51:56.614584001 -0500 +@@ -358,7 +358,7 @@ write_resolv_conf (FILE *f, const char * + + str = g_string_new (""); + +- if (nameservers) { ++ if (nameservers && g_strv_length (nameservers)) { + int num = g_strv_length (nameservers); + + for (i = 0; i < num; i++) { +@@ -374,6 +374,14 @@ write_resolv_conf (FILE *f, const char * + g_string_append (str, nameservers[i]); + g_string_append_c (str, '\n'); + } ++ } else { ++ g_string_append_printf (str, "\n\n%s%s%s%s%s%s", ++ "# No nameservers found; try putting DNS servers into your\n", ++ "# ifcfg files in /etc/sysconfig/network-scripts like so:\n", ++ "#\n", ++ "# DNS1=xxx.xxx.xxx.xxx\n", ++ "# DNS2=xxx.xxx.xxx.xxx\n", ++ "# DOMAIN=lab.foo.com bar.foo.com\n"); + } + + nameservers_str = g_string_free (str, FALSE); diff --git a/0002-libnm-glib-zero-secrets-to-prevent-crash-getting-sec.patch b/0002-libnm-glib-zero-secrets-to-prevent-crash-getting-sec.patch new file mode 100644 index 0000000..107844a --- /dev/null +++ b/0002-libnm-glib-zero-secrets-to-prevent-crash-getting-sec.patch @@ -0,0 +1,31 @@ +From 2ac35f0f2f61fd983c91f7e56219253eeea4d79a Mon Sep 17 00:00:00 2001 +From: Dan Williams +Date: Fri, 31 Jan 2014 15:22:16 -0600 +Subject: [PATCH 1/1] libnm-glib: zero 'secrets' to prevent crash getting + secrets + +If the GetSecrets call returned an error (eg, no secrets) then +'secrets' isn't set by dbus_g_proxy_end_call() and is garbage, +then gets freed. + +(cherry picked from commit e922c120a3cf1bb3bd8def11bd0f23f1e18a0751) +--- + libnm-glib/nm-remote-connection.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c +index 35c5be8..f4640c3 100644 +--- a/libnm-glib/nm-remote-connection.c ++++ b/libnm-glib/nm-remote-connection.c +@@ -313,7 +313,7 @@ get_secrets_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_dat + { + RemoteCall *call = user_data; + NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc) call->callback; +- GHashTable *secrets; ++ GHashTable *secrets = NULL; + GError *error = NULL; + + dbus_g_proxy_end_call (proxy, proxy_call, &error, +-- +1.8.5.3 + diff --git a/NM-before-network-service.patch b/NM-before-network-service.patch deleted file mode 100644 index f479deb..0000000 --- a/NM-before-network-service.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 7481c64ad5068130d92066b1155e6933f8c39655 Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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 - diff --git a/NetworkManager.spec b/NetworkManager.spec index 3c6082f..2ada22d 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -5,7 +5,7 @@ %define libnl3_version 3.2.7 %define ppp_version 2.4.5 -%define snapshot .git20131003 +%define snapshot .git20140131 %define realversion 0.9.9.0 %global regen_docs 0 @@ -19,7 +19,7 @@ Name: NetworkManager Summary: Network connection manager and user applications Epoch: 1 Version: 0.9.9.0 -Release: 28%{snapshot}%{?dist} +Release: 29%{snapshot}%{?dist} Group: System Environment/Base License: GPLv2+ URL: http://www.gnome.org/projects/NetworkManager/ @@ -27,49 +27,8 @@ 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 -Patch2: rh1023571-fix-crash-ifcfg-rh-reload.patch -Patch3: rh1021112-fix-crash-never-default.patch -Patch4: rh1019021-fix-crash-ip6-routing.patch -Patch5: rh1025007-fix-crash-ifcfg-rh.patch -Patch6: rh1012151-ipv6-disable.patch -Patch7: rh1029213-debug-netlink-add-errors.patch -Patch8: rh1015598-wifi-detect.patch -Patch9: nmcli-con-load.patch -Patch10: rh1018317-vpn-logging.patch -Patch11: rh1031170-bridge-port-crash.patch -Patch12: rh1017884-dispatcher-crash-on-exit.patch -Patch13: rh1025371-wifi-potential-crash.patch -Patch14: rh1029053-fix-crash-device-no-MAC.patch -Patch15: rh1030403-editor-crash-remote-connection.patch -Patch16: fix-ifcfg-rh-con-update.patch -Patch17: rh1018317-prereq.patch -Patch18: rh1018317-openvpn-ptp.patch -Patch19: rh1034921-startup-link-wait.patch -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 +Patch1: 0001-explain-dns1-dns2.patch +Patch2: 0002-libnm-glib-zero-secrets-to-prevent-crash-getting-sec.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -130,6 +89,8 @@ BuildRequires: systemd >= 200-3 systemd-devel BuildRequires: libsoup-devel BuildRequires: libndp-devel >= 1.0 BuildRequires: ModemManager-glib-devel >= 1.0 +BuildRequires: newt-devel +BuildRequires: teamd-devel %description NetworkManager is a system network service that manages your network devices @@ -190,52 +151,22 @@ ethernet devices with no carrier. This package is intended to be installed by default for server deployments. +%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. + %prep %setup -q -n NetworkManager-%{realversion} -%patch1 -p1 -b .explain-dns1-dns2 -%patch2 -p1 -b .patch2 -%patch3 -p1 -b .patch3 -%patch4 -p1 -b .patch4 -%patch5 -p1 -b .patch5 -%patch6 -p1 -b .patch6 -%patch7 -p1 -b .patch7 -%patch8 -p1 -b .patch8 -%patch9 -p1 -b .nmcli-con-load -%patch10 -p1 -b .vpn-log -%patch11 -p1 -b .bridge-port -%patch12 -p1 -b .dispatcher -%patch13 -p1 -b .wifi-crash -%patch14 -p1 -b .device-no-MAC -%patch15 -p1 -b .libnm-glib-editor -%patch16 -p1 -b .ifcfg-rh-update -%patch17 -p1 -b .ipv6-flags -%patch18 -p1 -b .openvpn-ptp -%patch19 -p1 -b .startup-linkwait -%patch20 -p1 -b .ignore-RA-default-routes -%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 +%patch1 -p1 -b .0001.explain-dns1-dns2.orig +%patch2 -p1 -b .0002.secrets.orig %build @@ -255,7 +186,6 @@ deployments. --enable-more-warnings=error \ --enable-ppp=yes \ --with-modem-manager-1=yes \ - --enable-bluez4=no \ --enable-wimax=no \ --enable-vala=yes \ %if %{regen_docs} @@ -433,7 +363,29 @@ fi %defattr(-,root,root,0755) %config %{_sysconfdir}/%{name}/conf.d/00-server.conf +%files tui +%{_bindir}/nmtui +%{_bindir}/nmtui-edit +%{_bindir}/nmtui-connect +%{_bindir}/nmtui-hostname + %changelog +* Tue Feb 4 2014 Thomas Haller - 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š - 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() diff --git a/bgo723163-add-and-activate-fix.patch b/bgo723163-add-and-activate-fix.patch deleted file mode 100644 index c1884d9..0000000 --- a/bgo723163-add-and-activate-fix.patch +++ /dev/null @@ -1,50 +0,0 @@ -From ff350c04c0546383841126ea43bed93d302482fb Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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 - diff --git a/core-log-ipv6-commit.patch b/core-log-ipv6-commit.patch deleted file mode 100644 index 5cbeb00..0000000 --- a/core-log-ipv6-commit.patch +++ /dev/null @@ -1,94 +0,0 @@ -From 13f4a00d4d490fb65f93c246d1c93ed56a47213f Mon Sep 17 00:00:00 2001 -From: Dan Williams -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: Activation (eth0) Stage 5 of 5 (IPv6 Commit) scheduled... -NetworkManager: Activation (eth0) Stage 5 of 5 (IPv6 Commit) started... -NetworkManager: 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š ---- - 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 - diff --git a/explain-dns1-dns2.patch b/explain-dns1-dns2.patch deleted file mode 100644 index e31a0eb..0000000 --- a/explain-dns1-dns2.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff -up NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c ---- NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c.explain-dns1-dns2 2010-10-18 18:44:05.000000000 -0500 -+++ NetworkManager-0.8.2/src/dns-manager/nm-dns-manager.c 2010-11-03 13:51:56.614584001 -0500 -@@ -358,7 +358,7 @@ write_resolv_conf (FILE *f, const char * - - str = g_string_new (""); - -- if (nameservers) { -+ if (nameservers && g_strv_length (nameservers)) { - int num = g_strv_length (nameservers); - - for (i = 0; i < num; i++) { -@@ -374,6 +374,14 @@ write_resolv_conf (FILE *f, const char * - g_string_append (str, nameservers[i]); - g_string_append_c (str, '\n'); - } -+ } else { -+ g_string_append_printf (str, "\n\n%s%s%s%s%s%s", -+ "# No nameservers found; try putting DNS servers into your\n", -+ "# ifcfg files in /etc/sysconfig/network-scripts like so:\n", -+ "#\n", -+ "# DNS1=xxx.xxx.xxx.xxx\n", -+ "# DNS2=xxx.xxx.xxx.xxx\n", -+ "# DOMAIN=lab.foo.com bar.foo.com\n"); - } - - nameservers_str = g_string_free (str, FALSE); diff --git a/export-missing-libnm-glib-funcs.patch b/export-missing-libnm-glib-funcs.patch deleted file mode 100644 index 4820929..0000000 --- a/export-missing-libnm-glib-funcs.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 3391fa810ca323203b036a68af7f3c5802280918 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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 - diff --git a/fix-ifcfg-rh-con-update.patch b/fix-ifcfg-rh-con-update.patch deleted file mode 100644 index 1c13d78..0000000 --- a/fix-ifcfg-rh-con-update.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 87041545b40fd0c0cfae16a8e605552b7715dc15 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Fri, 4 Oct 2013 23:38:31 -0500 -Subject: [PATCH] ifcfg-rh: fix ignoring updates that don't change anything -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -connection_from_file() requires the 'error' parameter. Not passing a -valid 'error' parameter causes the function to fail and return NULL, -which mean that commit_changes() would always re-write the connection -instead of ignoring commits where nothing has actually changed. - -connection_from_file() no longer requires the unmanaged, keyfile, -or routefile parameters, so remove them. - -Signed-off-by: Jiří Klimeš ---- - src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c -index 3788149..d3b93c9 100644 ---- a/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c -+++ b/src/settings/plugins/ifcfg-rh/nm-ifcfg-connection.c -@@ -246,7 +246,6 @@ commit_changes (NMSettingsConnection *connection, - NMIfcfgConnectionPrivate *priv = NM_IFCFG_CONNECTION_GET_PRIVATE (connection); - GError *error = NULL; - NMConnection *reread; -- char *unmanaged = NULL, *keyfile = NULL, *routefile = NULL, *route6file = NULL; - gboolean same = FALSE, success = FALSE; - char *ifcfg_path = NULL; - -@@ -256,13 +255,9 @@ commit_changes (NMSettingsConnection *connection, - */ - if (priv->path) { - reread = connection_from_file (priv->path, NULL, NULL, NULL, -- &unmanaged, &keyfile, &routefile, &route6file, -- NULL, NULL); -- g_free (unmanaged); -- g_free (keyfile); -- g_free (routefile); -- g_free (route6file); -- -+ NULL, NULL, NULL, NULL, -+ &error, NULL); -+ g_clear_error (&error); - if (reread) { - same = nm_connection_compare (NM_CONNECTION (connection), - reread, --- -1.7.11.7 - diff --git a/fix-read-phys-port-id.patch b/fix-read-phys-port-id.patch deleted file mode 100644 index 93252f5..0000000 --- a/fix-read-phys-port-id.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 041f449a910a48716bc88fa56287c4213a2dcb11 Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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 - diff --git a/get-ip-examples.patch b/get-ip-examples.patch deleted file mode 100644 index fa49253..0000000 --- a/get-ip-examples.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 85272df6eb89682a3d13022281085b97527955e1 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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 ' % 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 - diff --git a/get-nameservers.patch b/get-nameservers.patch deleted file mode 100644 index b7e7ace..0000000 --- a/get-nameservers.patch +++ /dev/null @@ -1,145 +0,0 @@ -From 8ee4f58e9ee67df2ef761a691dec55c6008ad4ff Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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 -@@ -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 - diff --git a/gi-fix-for-ipv6.patch b/gi-fix-for-ipv6.patch deleted file mode 100644 index c633d9a..0000000 --- a/gi-fix-for-ipv6.patch +++ /dev/null @@ -1,230 +0,0 @@ -From 7ffbbae3a046dbb4c8d5089c41b143eafabed709 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Thu, 16 Jan 2014 17:29:08 +0100 -Subject: [PATCH 1/2] libnm-glib; fix introspection annotations so that - .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š ---- - 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?= -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š ---- - 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 ' % 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 - diff --git a/load-connections-ret-value.patch b/load-connections-ret-value.patch deleted file mode 100644 index 6183b3a..0000000 --- a/load-connections-ret-value.patch +++ /dev/null @@ -1,34 +0,0 @@ -From de36db0af15fccf273fa05413219df23e3a07f25 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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 - diff --git a/nmcli-con-load.patch b/nmcli-con-load.patch deleted file mode 100644 index 96e2f12..0000000 --- a/nmcli-con-load.patch +++ /dev/null @@ -1,492 +0,0 @@ -diff -up NetworkManager-0.9.9.0/cli/completion/nmcli.nmcli-con-load NetworkManager-0.9.9.0/cli/completion/nmcli ---- NetworkManager-0.9.9.0/cli/completion/nmcli.nmcli-con-load 2013-10-03 14:14:44.000000000 -0400 -+++ NetworkManager-0.9.9.0/cli/completion/nmcli 2013-11-18 11:02:56.187304537 -0500 -@@ -833,6 +833,12 @@ _nmcli() - _nmcli_complete_COMMAND_CONNECTION - fi - ;; -+ l|lo|loa|load) -+ if [[ ${#words[@]} -gt 2 ]]; then -+ compopt -o default -+ COMPREPLY=() -+ fi -+ ;; - esac - fi - ;; -diff -up NetworkManager-0.9.9.0/cli/src/connections.c.nmcli-con-load NetworkManager-0.9.9.0/cli/src/connections.c ---- NetworkManager-0.9.9.0/cli/src/connections.c.nmcli-con-load 2013-10-03 15:00:47.000000000 -0400 -+++ NetworkManager-0.9.9.0/cli/src/connections.c 2013-11-18 11:02:56.188304537 -0500 -@@ -222,7 +222,8 @@ usage (void) - " modify [ id | uuid | path ] . \n\n" - " edit [ id | uuid | path ] | [type ] [con-name ]\n\n" - " delete [ id | uuid | path ] \n\n" -- " reload\n\n\n" -+ " reload\n\n" -+ " load [ ... ]\n\n\n" - )); - } - -@@ -308,6 +309,7 @@ static const char *real_con_commands[] = - "edit", - "delete", - "reload", -+ "load", - NULL - }; - -@@ -7006,6 +7008,50 @@ do_connection_reload (NmCli *nmc, int ar - return nmc->return_value; - } - -+static NMCResultCode -+do_connection_load (NmCli *nmc, int argc, char **argv) -+{ -+ GError *error = NULL; -+ char **filenames, **failures = NULL; -+ int i; -+ -+ nmc->return_value = NMC_RESULT_SUCCESS; -+ nmc->should_wait = FALSE; -+ -+ if (!nm_client_get_manager_running (nmc->client)) { -+ g_string_printf (nmc->return_text, _("Error: NetworkManager is not running.")); -+ nmc->return_value = NMC_RESULT_ERROR_NM_NOT_RUNNING; -+ return nmc->return_value; -+ } -+ -+ if (argc == 0) { -+ g_string_printf (nmc->return_text, _("Error: No connection specified.")); -+ nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; -+ return nmc->return_value; -+ } -+ -+ filenames = g_new (char *, argc + 1); -+ for (i = 0; i < argc; i++) -+ filenames[i] = argv[i]; -+ filenames[i] = NULL; -+ -+ nm_remote_settings_load_connections (nmc->system_settings, filenames, &failures, &error); -+ g_free (filenames); -+ if (error) { -+ g_string_printf (nmc->return_text, _("Error: %s."), error->message); -+ nmc->return_value = NMC_RESULT_ERROR_UNKNOWN; -+ g_error_free (error); -+ } -+ -+ if (failures) { -+ for (i = 0; failures[i]; i++) -+ fprintf (stderr, _("Could not load file '%s'\n"), failures[i]); -+ g_strfreev (failures); -+ } -+ -+ return nmc->return_value; -+} -+ - - typedef struct { - NmCli *nmc; -@@ -7087,6 +7133,9 @@ parse_cmd (NmCli *nmc, int argc, char ** - else if (matches(*argv, "reload") == 0) { - nmc->return_value = do_connection_reload (nmc, argc-1, argv+1); - } -+ else if (matches(*argv, "load") == 0) { -+ nmc->return_value = do_connection_load (nmc, argc-1, argv+1); -+ } - else if (matches (*argv, "modify") == 0) { - nmc->return_value = do_connection_modify (nmc, argc-1, argv+1); - } -diff -up NetworkManager-0.9.9.0/introspection/nm-settings.xml.nmcli-con-load NetworkManager-0.9.9.0/introspection/nm-settings.xml ---- NetworkManager-0.9.9.0/introspection/nm-settings.xml.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400 -+++ NetworkManager-0.9.9.0/introspection/nm-settings.xml 2013-11-18 11:02:56.188304537 -0500 -@@ -82,6 +82,40 @@ - - - -+ -+ -+ Loads or reloads the indicated connections from disk. You -+ should call this after making changes directly to an on-disk -+ connection file to make sure that NetworkManager sees the -+ changes. (If "monitor-connection-files" in NetworkManager.conf -+ is "true", then this will have no real effect, but is -+ harmless.) As with AddConnection(), this operation does not -+ necessarily start the network connection. -+ -+ -+ -+ -+ -+ Array of paths to on-disk connection profiles in directories -+ monitored by NetworkManager. -+ -+ -+ -+ -+ Success or failure of the operation as a whole. True if -+ NetworkManager at least tried to load the indicated -+ connections, even if it did not succeed. False if an error -+ occurred before trying to load the connections (eg, -+ permission denied). -+ -+ -+ -+ -+ Paths of connection files that could not be loaded. -+ -+ -+ -+ - - - Tells NetworkManager to reload all connection files from disk, -diff -up NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver ---- NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver.nmcli-con-load 2013-10-01 14:43:57.000000000 -0400 -+++ NetworkManager-0.9.9.0/libnm-glib/libnm-glib.ver 2013-11-18 11:02:56.188304537 -0500 -@@ -243,6 +243,7 @@ global: - nm_remote_settings_get_connection_by_uuid; - nm_remote_settings_get_type; - nm_remote_settings_list_connections; -+ nm_remote_settings_load_connections; - nm_remote_settings_new; - nm_remote_settings_new_async; - nm_remote_settings_new_finish; -diff -up NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c ---- NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400 -+++ NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.c 2013-11-18 11:02:56.188304537 -0500 -@@ -630,6 +630,72 @@ nm_remote_settings_add_connection_unsave - } - - /** -+ * nm_remote_settings_load_connections: -+ * @settings: the %NMRemoteSettings -+ * @filenames: %NULL-terminated array of filenames to load -+ * @failures: (out) (transfer full): on return, a %NULL-terminated array of -+ * filenames that failed to load -+ * @error: return location for #GError -+ * -+ * Requests that the remote settings service load or reload the given files, -+ * adding or updating the connections described within. -+ * -+ * The changes to the indicated files will not yet be reflected in -+ * @settings's connections array when the function returns. -+ * -+ * If all of the indicated files were successfully loaded, the -+ * function will return %TRUE, and @failures will be set to %NULL. If -+ * NetworkManager tried to load the files, but some (or all) failed, -+ * then @failures will be set to a %NULL-terminated array of the -+ * filenames that failed to load. -+ -+ * Returns: %TRUE if NetworkManager at least tried to load @filenames, -+ * %FALSE if an error occurred (eg, permission denied). -+ * -+ * Since: 0.9.10 -+ **/ -+gboolean -+nm_remote_settings_load_connections (NMRemoteSettings *settings, -+ char **filenames, -+ char ***failures, -+ GError **error) -+{ -+ NMRemoteSettingsPrivate *priv; -+ 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); -+ -+ priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings); -+ -+ _nm_remote_settings_ensure_inited (settings); -+ -+ if (!priv->service_running) { -+ g_set_error_literal (error, NM_REMOTE_SETTINGS_ERROR, -+ NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE, -+ "NetworkManager is not running."); -+ return FALSE; -+ } -+ -+ dbus_g_proxy_call (priv->proxy, "LoadConnections", error, -+ G_TYPE_STRV, filenames, -+ G_TYPE_INVALID, -+ G_TYPE_BOOLEAN, &ret, -+ G_TYPE_STRV, &my_failures, -+ G_TYPE_INVALID); -+ -+ if (failures) { -+ if (my_failures && !*my_failures) -+ g_clear_pointer (&my_failures, g_free); -+ *failures = my_failures; -+ } else -+ g_strfreev (my_failures); -+ -+ return ret; -+} -+ -+/** - * nm_remote_settings_reload_connections: - * @settings: the #NMRemoteSettings - * @error: return location for #GError -diff -up NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h.nmcli-con-load NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h ---- NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400 -+++ NetworkManager-0.9.9.0/libnm-glib/nm-remote-settings.h 2013-11-18 11:02:56.188304537 -0500 -@@ -79,6 +79,11 @@ typedef void (*NMRemoteSettingsAddConnec - GError *error, - gpointer user_data); - -+typedef void (*NMRemoteSettingsLoadConnectionsFunc) (NMRemoteSettings *settings, -+ char **failures, -+ GError *error, -+ gpointer user_data); -+ - typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings, - GError *error, - gpointer user_data); -@@ -135,6 +140,11 @@ gboolean nm_remote_settings_add_connecti - NMRemoteSettingsAddConnectionFunc callback, - gpointer user_data); - -+gboolean nm_remote_settings_load_connections (NMRemoteSettings *settings, -+ char **filenames, -+ char ***failures, -+ GError **error); -+ - gboolean nm_remote_settings_reload_connections (NMRemoteSettings *settings, - GError **error); - -diff -up NetworkManager-0.9.9.0/src/settings/nm-settings.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-settings.c ---- NetworkManager-0.9.9.0/src/settings/nm-settings.c.nmcli-con-load 2013-10-01 14:43:57.000000000 -0400 -+++ NetworkManager-0.9.9.0/src/settings/nm-settings.c 2013-11-18 11:10:31.800329234 -0500 -@@ -104,6 +104,10 @@ static void impl_settings_add_connection - GHashTable *settings, - DBusGMethodInvocation *context); - -+static void impl_settings_load_connections (NMSettings *self, -+ char **filenames, -+ DBusGMethodInvocation *context); -+ - static void impl_settings_reload_connections (NMSettings *self, - DBusGMethodInvocation *context); - -@@ -1226,33 +1230,78 @@ impl_settings_add_connection_unsaved (NM - impl_settings_add_connection_helper (self, settings, FALSE, context); - } - --static void --impl_settings_reload_connections (NMSettings *self, -- DBusGMethodInvocation *context) -+static gboolean -+ensure_root (NMDBusManager *dbus_mgr, -+ DBusGMethodInvocation *context) - { -- NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); -- GSList *iter; - gulong caller_uid; - GError *error = NULL; - -- if (!nm_dbus_manager_get_caller_info (priv->dbus_mgr, context, NULL, &caller_uid)) { -+ if (!nm_dbus_manager_get_caller_info (dbus_mgr, context, NULL, &caller_uid)) { - error = g_error_new_literal (NM_SETTINGS_ERROR, -- NM_SETTINGS_ERROR_PERMISSION_DENIED, -- "Unable to determine request UID."); -+ NM_SETTINGS_ERROR_PERMISSION_DENIED, -+ "Unable to determine request UID."); - dbus_g_method_return_error (context, error); - g_error_free (error); -- return; -+ return FALSE; - } - if (caller_uid != 0) { -- nm_log_warn (LOGD_SETTINGS, "ReloadConnections: permission denied to %lu", caller_uid); - error = g_error_new_literal (NM_SETTINGS_ERROR, - NM_SETTINGS_ERROR_PERMISSION_DENIED, - "Permission denied"); - dbus_g_method_return_error (context, error); - g_error_free (error); -+ return FALSE; -+ } -+ -+ return TRUE; -+} -+ -+static void -+impl_settings_load_connections (NMSettings *self, -+ char **filenames, -+ DBusGMethodInvocation *context) -+{ -+ NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); -+ GPtrArray *failures; -+ GSList *iter; -+ int i; -+ -+ if (!ensure_root (priv->dbus_mgr, context)) - return; -+ -+ failures = g_ptr_array_new (); -+ -+ for (i = 0; filenames[i]; i++) { -+ for (iter = priv->plugins; iter; iter = g_slist_next (iter)) { -+ NMSystemConfigInterface *plugin = NM_SYSTEM_CONFIG_INTERFACE (iter->data); -+ -+ if (nm_system_config_interface_load_connection (plugin, filenames[i])) -+ break; -+ } -+ -+ if (!iter) { -+ if (!g_path_is_absolute (filenames[i])) -+ nm_log_warn (LOGD_SETTINGS, "Connection filename '%s' is not an absolute path", filenames[i]); -+ g_ptr_array_add (failures, (char *) filenames[i]); -+ } - } - -+ g_ptr_array_add (failures, NULL); -+ dbus_g_method_return (context, failures->len == 1, failures->pdata); -+ g_ptr_array_unref (failures); -+} -+ -+static void -+impl_settings_reload_connections (NMSettings *self, -+ DBusGMethodInvocation *context) -+{ -+ NMSettingsPrivate *priv = NM_SETTINGS_GET_PRIVATE (self); -+ GSList *iter; -+ -+ if (!ensure_root (priv->dbus_mgr, context)) -+ return; -+ - if (!priv->connections_loaded) { - load_connections (self); - } else { -diff -up NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c ---- NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400 -+++ NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.c 2013-11-18 11:02:56.189304537 -0500 -@@ -137,6 +137,17 @@ nm_system_config_interface_get_connectio - return NULL; - } - -+gboolean -+nm_system_config_interface_load_connection (NMSystemConfigInterface *config, -+ const char *filename) -+{ -+ g_return_val_if_fail (config != NULL, NULL); -+ -+ if (NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection) -+ return NM_SYSTEM_CONFIG_INTERFACE_GET_INTERFACE (config)->load_connection (config, filename); -+ return FALSE; -+} -+ - void - nm_system_config_interface_reload_connections (NMSystemConfigInterface *config) - { -diff -up NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h.nmcli-con-load NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h ---- NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h.nmcli-con-load 2013-09-27 23:40:17.000000000 -0400 -+++ NetworkManager-0.9.9.0/src/settings/nm-system-config-interface.h 2013-11-18 11:02:56.189304537 -0500 -@@ -89,6 +89,12 @@ struct _NMSystemConfigInterface { - */ - GSList * (*get_connections) (NMSystemConfigInterface *config); - -+ /* Requests that the plugin load/reload a single connection, if it -+ * recognizes the filename. Returns success or failure. -+ */ -+ gboolean (*load_connection) (NMSystemConfigInterface *config, -+ const char *filename); -+ - /* Requests that the plugin reload all connection files from disk, - * and emit signals reflecting new, changed, and removed connections. - */ -@@ -142,6 +148,8 @@ void nm_system_config_interface_init (NM - - GSList *nm_system_config_interface_get_connections (NMSystemConfigInterface *config); - -+gboolean nm_system_config_interface_load_connection (NMSystemConfigInterface *config, -+ const char *filename); - void nm_system_config_interface_reload_connections (NMSystemConfigInterface *config); - - GSList *nm_system_config_interface_get_unmanaged_specs (NMSystemConfigInterface *config); -diff -up NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c ---- NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c.nmcli-con-load 2013-11-18 11:02:56.177304536 -0500 -+++ NetworkManager-0.9.9.0/src/settings/plugins/ifcfg-rh/plugin.c 2013-11-18 11:05:18.187312234 -0500 -@@ -500,6 +500,30 @@ get_connections (NMSystemConfigInterface - return list; - } - -+static gboolean -+load_connection (NMSystemConfigInterface *config, -+ const char *filename) -+{ -+ SCPluginIfcfg *plugin = SC_PLUGIN_IFCFG (config); -+ NMIfcfgConnection *connection; -+ int dir_len = strlen (IFCFG_DIR); -+ -+ if ( strncmp (filename, IFCFG_DIR, dir_len) != 0 -+ || filename[dir_len] != '/' -+ || strchr (filename + dir_len + 1, '/') != NULL) -+ return FALSE; -+ -+ if (utils_should_ignore_file (filename + dir_len + 1, TRUE)) -+ return FALSE; -+ -+ connection = find_by_path (plugin, filename); -+ connection_new_or_changed (plugin, filename, connection, NULL); -+ if (!connection) -+ connection = find_by_path (plugin, filename); -+ -+ return (connection != NULL); -+} -+ - static void - reload_connections (NMSystemConfigInterface *config) - { -@@ -939,6 +963,7 @@ system_config_interface_init (NMSystemCo - /* interface implementation */ - system_config_interface_class->get_connections = get_connections; - system_config_interface_class->add_connection = add_connection; -+ system_config_interface_class->load_connection = load_connection; - system_config_interface_class->reload_connections = reload_connections; - system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs; - system_config_interface_class->init = init; -diff -up NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c.nmcli-con-load NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c ---- NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c.nmcli-con-load 2013-10-01 14:43:58.000000000 -0400 -+++ NetworkManager-0.9.9.0/src/settings/plugins/keyfile/plugin.c 2013-11-18 11:02:56.189304537 -0500 -@@ -403,6 +403,33 @@ get_connections (NMSystemConfigInterface - return list; - } - -+static gboolean -+load_connection (NMSystemConfigInterface *config, -+ const char *filename) -+{ -+ SCPluginKeyfile *self = SC_PLUGIN_KEYFILE (config); -+ NMKeyfileConnection *connection; -+ int dir_len = strlen (KEYFILE_DIR); -+ -+ if ( strncmp (filename, KEYFILE_DIR, dir_len) != 0 -+ || filename[dir_len] != '/' -+ || strchr (filename + dir_len + 1, '/') != NULL) -+ return FALSE; -+ -+ if (nm_keyfile_plugin_utils_should_ignore_file (filename + dir_len + 1)) -+ return FALSE; -+ -+ connection = find_by_path (self, filename); -+ if (connection) -+ update_connection (self, connection, filename); -+ else { -+ new_connection (self, filename, NULL); -+ connection = find_by_path (self, filename); -+ } -+ -+ return (connection != NULL); -+} -+ - static void - reload_connections (NMSystemConfigInterface *config) - { -@@ -701,6 +728,7 @@ system_config_interface_init (NMSystemCo - { - /* interface implementation */ - system_config_interface_class->get_connections = get_connections; -+ system_config_interface_class->load_connection = load_connection; - system_config_interface_class->reload_connections = reload_connections; - system_config_interface_class->add_connection = add_connection; - system_config_interface_class->get_unmanaged_specs = get_unmanaged_specs; diff --git a/nmcli-group-dot-field.patch b/nmcli-group-dot-field.patch deleted file mode 100644 index 538145f..0000000 --- a/nmcli-group-dot-field.patch +++ /dev/null @@ -1,2260 +0,0 @@ -From 94bb83a370648dd5e3cd815e0d48125d7a491e30 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Tue, 10 Dec 2013 12:00:53 +0100 -Subject: [PATCH 1/4] cli: allow specifying 'group.name' syntax for '--fields' -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -and use it for 'nmcli device show'. - -This allows filtering output not only for whole groups, but also for individual -fields in commands that print data in groups (sections). - -Example: -$ nmcli -f general.device,general.driver,ipv4,ipv6.address device show eth0 -GENERAL.DEVICE: eth0 -GENERAL.DRIVER: e1000e -IP4.ADDRESS[1]: ip = 10.0.5.228/23, gw = 10.0.5.254 -IP4.ADDRESS[2]: ip = 5.5.5.5/32, gw = 5.5.5.1 -IP4.DNS[1]: 192.168.122.1 -IP4.DNS[2]: 8.8.8.8 -IP4.DOMAIN[1]: mycompany.com - -Signed-off-by: Jiří Klimeš ---- - cli/src/common.c | 40 ++++++++++---- - cli/src/common.h | 8 +-- - cli/src/connections.c | 47 ++++++---------- - cli/src/devices.c | 136 ++++++++++++++++++++++++---------------------- - cli/src/network-manager.c | 23 ++------ - cli/src/nmcli.h | 17 +++--- - cli/src/settings.c | 50 ++++++++--------- - cli/src/utils.c | 113 +++++++++++++++++++++++++++++++++----- - cli/src/utils.h | 6 +- - 9 files changed, 262 insertions(+), 178 deletions(-) - -diff --git a/cli/src/common.c b/cli/src/common.c -index 33c42b5..8fadbc1 100644 ---- a/cli/src/common.c -+++ b/cli/src/common.c -@@ -30,7 +30,7 @@ - #include "utils.h" - - /* Available fields for IPv4 group */ --static NmcOutputField nmc_fields_ip4_config[] = { -+NmcOutputField nmc_fields_ip4_config[] = { - {"GROUP", N_("GROUP"), 15}, /* 0 */ - {"ADDRESS", N_("ADDRESS"), 68}, /* 1 */ - {"ROUTE", N_("ROUTE"), 68}, /* 2 */ -@@ -42,7 +42,7 @@ static NmcOutputField nmc_fields_ip4_config[] = { - #define NMC_FIELDS_IP4_CONFIG_ALL "GROUP,ADDRESS,ROUTE,DNS,DOMAIN,WINS" - - /* Available fields for DHCPv4 group */ --static NmcOutputField nmc_fields_dhcp4_config[] = { -+NmcOutputField nmc_fields_dhcp4_config[] = { - {"GROUP", N_("GROUP"), 15}, /* 0 */ - {"OPTION", N_("OPTION"), 80}, /* 1 */ - {NULL, NULL, 0} -@@ -50,7 +50,7 @@ static NmcOutputField nmc_fields_dhcp4_config[] = { - #define NMC_FIELDS_DHCP4_CONFIG_ALL "GROUP,OPTION" - - /* Available fields for IPv6 group */ --static NmcOutputField nmc_fields_ip6_config[] = { -+NmcOutputField nmc_fields_ip6_config[] = { - {"GROUP", N_("GROUP"), 15}, /* 0 */ - {"ADDRESS", N_("ADDRESS"), 95}, /* 1 */ - {"ROUTE", N_("ROUTE"), 95}, /* 2 */ -@@ -61,7 +61,7 @@ static NmcOutputField nmc_fields_ip6_config[] = { - #define NMC_FIELDS_IP6_CONFIG_ALL "GROUP,ADDRESS,ROUTE,DNS,DOMAIN" - - /* Available fields for DHCPv6 group */ --static NmcOutputField nmc_fields_dhcp6_config[] = { -+NmcOutputField nmc_fields_dhcp6_config[] = { - {"GROUP", N_("GROUP"), 15}, /* 0 */ - {"OPTION", N_("OPTION"), 80}, /* 1 */ - {NULL, NULL, 0} -@@ -70,7 +70,10 @@ static NmcOutputField nmc_fields_dhcp6_config[] = { - - - gboolean --print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix) -+print_ip4_config (NMIP4Config *cfg4, -+ NmCli *nmc, -+ const char *group_prefix, -+ const char *one_field) - { - GSList *list, *iter; - const GArray *array; -@@ -89,7 +92,8 @@ print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix) - - tmpl = nmc_fields_ip4_config; - tmpl_len = sizeof (nmc_fields_ip4_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_IP4_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_IP4_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -179,7 +183,10 @@ print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix) - } - - gboolean --print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix) -+print_ip6_config (NMIP6Config *cfg6, -+ NmCli *nmc, -+ const char *group_prefix, -+ const char *one_field) - { - GSList *list, *iter; - const GPtrArray *ptr_array; -@@ -196,7 +203,8 @@ print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix) - - tmpl = nmc_fields_ip6_config; - tmpl_len = sizeof (nmc_fields_ip6_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_IP6_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_IP6_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -274,7 +282,10 @@ print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix) - } - - gboolean --print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix) -+print_dhcp4_config (NMDHCP4Config *dhcp4, -+ NmCli *nmc, -+ const char *group_prefix, -+ const char *one_field) - { - GHashTable *table; - NmcOutputField *tmpl, *arr; -@@ -292,7 +303,8 @@ print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix) - - tmpl = nmc_fields_dhcp4_config; - tmpl_len = sizeof (nmc_fields_dhcp4_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DHCP4_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_DHCP4_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -318,7 +330,10 @@ print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix) - } - - gboolean --print_dhcp6_config (NMDHCP6Config *dhcp6, NmCli *nmc, const char *group_prefix) -+print_dhcp6_config (NMDHCP6Config *dhcp6, -+ NmCli *nmc, -+ const char *group_prefix, -+ const char *one_field) - { - GHashTable *table; - NmcOutputField *tmpl, *arr; -@@ -336,7 +351,8 @@ print_dhcp6_config (NMDHCP6Config *dhcp6, NmCli *nmc, const char *group_prefix) - - tmpl = nmc_fields_dhcp6_config; - tmpl_len = sizeof (nmc_fields_dhcp6_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DHCP6_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_field ? one_field : NMC_FIELDS_DHCP6_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -diff --git a/cli/src/common.h b/cli/src/common.h -index 6683502..bb5ea5a 100644 ---- a/cli/src/common.h -+++ b/cli/src/common.h -@@ -32,10 +32,10 @@ - - #include "nmcli.h" - --gboolean print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix); --gboolean print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix); --gboolean print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix); --gboolean print_dhcp6_config (NMDHCP6Config *dhcp6, NmCli *nmc, const char *group_prefix); -+gboolean print_ip4_config (NMIP4Config *cfg4, NmCli *nmc, const char *group_prefix, const char *one_field); -+gboolean print_ip6_config (NMIP6Config *cfg6, NmCli *nmc, const char *group_prefix, const char *one_field); -+gboolean print_dhcp4_config (NMDHCP4Config *dhcp4, NmCli *nmc, const char *group_prefix, const char *one_field); -+gboolean print_dhcp6_config (NMDHCP6Config *dhcp6, NmCli *nmc, const char *group_prefix, const char *one_field); - - NMIP4Address *nmc_parse_and_build_ip4_address (const char *ip_str, const char *gw_str, GError **error); - NMIP6Address *nmc_parse_and_build_ip6_address (const char *ip_str, const char *gw_str, GError **error); -diff --git a/cli/src/connections.c b/cli/src/connections.c -index 0141b36..f837d00 100644 ---- a/cli/src/connections.c -+++ b/cli/src/connections.c -@@ -351,13 +351,9 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - else - fields_str = nmc->required_fields; - -- print_settings_array = parse_output_fields (fields_str, nmc_fields_settings_names, &error); -+ print_settings_array = parse_output_fields (fields_str, nmc_fields_settings_names, FALSE, NULL, &error); - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'list configured': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'list configured': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_SETTINGS_NAMES_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'list configured': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return FALSE; -@@ -367,7 +363,7 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - /* Main header */ - nmc->print_fields.header_name = _("Connection details"); - nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTINGS_NAMES_ALL, -- nmc_fields_settings_names, NULL); -+ nmc_fields_settings_names, FALSE, NULL, NULL); - - nmc_fields_settings_names[0].flags = NMC_OF_FLAG_MAIN_HEADER_ONLY; - print_required_fields (nmc, nmc_fields_settings_names); -@@ -499,7 +495,7 @@ do_connections_show (NmCli *nmc, int argc, char **argv) - - tmpl = nmc_fields_con_show; - tmpl_len = sizeof (nmc_fields_con_show); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error1); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error1); - /* error1 is checked later - it's not valid for connection details */ - - if (argc == 0) { -@@ -549,11 +545,7 @@ do_connections_show (NmCli *nmc, int argc, char **argv) - - error: - if (error1) { -- if (error1->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'show configured': %s"), error1->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'show configured': %s; allowed fields: %s"), -- error1->message, NMC_FIELDS_CON_SHOW_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'show configured': %s"), error1->message); - g_error_free (error1); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - } -@@ -852,13 +844,9 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - else - fields_str = nmc->required_fields; - -- print_groups = parse_output_fields (fields_str, nmc_fields_con_active_details_groups, &error); -+ print_groups = parse_output_fields (fields_str, nmc_fields_con_active_details_groups, FALSE, NULL, &error); - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'list active': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'list active': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_CON_ACTIVE_DETAILS_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'list active': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return FALSE; -@@ -868,7 +856,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - /* Main header */ - nmc->print_fields.header_name = _("Active connection details"); - nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_ALL, -- nmc_fields_con_active_details_groups, NULL); -+ nmc_fields_con_active_details_groups, FALSE, NULL, NULL); - - nmc_fields_con_active_details_groups[0].flags = NMC_OF_FLAG_MAIN_HEADER_ONLY; - print_required_fields (nmc, nmc_fields_con_active_details_groups); -@@ -890,7 +878,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - /* Add field names */ - tmpl = nmc_fields_con_show_active; - tmpl_len = sizeof (nmc_fields_con_show_active); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_GENERAL_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_GENERAL_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -916,10 +904,10 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device); - NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device); - -- b1 = print_ip4_config (cfg4, nmc, "IP4"); -- b2 = print_dhcp4_config (dhcp4, nmc, "DHCP4"); -- b3 = print_ip6_config (cfg6, nmc, "IP6"); -- b4 = print_dhcp6_config (dhcp6, nmc, "DHCP6"); -+ b1 = print_ip4_config (cfg4, nmc, "IP4", NULL); -+ b2 = print_dhcp4_config (dhcp4, nmc, "DHCP4", NULL); -+ b3 = print_ip6_config (cfg6, nmc, "IP6", NULL); -+ b4 = print_dhcp6_config (dhcp6, nmc, "DHCP6", NULL); - was_output = was_output || b1 || b2 || b3 || b4; - } - } -@@ -943,7 +931,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - - tmpl = nmc_fields_con_active_details_vpn; - tmpl_len = sizeof (nmc_fields_con_active_details_vpn); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_VPN_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_VPN_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -1025,7 +1013,7 @@ do_connections_show_active (NmCli *nmc, int argc, char **argv) - - tmpl = nmc_fields_con_show_active + 1; - tmpl_len = sizeof (nmc_fields_con_show_active) - sizeof (NmcOutputField); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &err1); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &err1); - if (err1) - goto error; - -@@ -1078,10 +1066,7 @@ do_connections_show_active (NmCli *nmc, int argc, char **argv) - - error: - if (err1) { -- if (err1->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'show active': %s"), err1->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'show active': %s; allowed fields: %s"), err1->message, NMC_FIELDS_CON_ACTIVE_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'show active': %s"), err1->message); - g_error_free (err1); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - } -diff --git a/cli/src/devices.c b/cli/src/devices.c -index 39802b6..037d880 100644 ---- a/cli/src/devices.c -+++ b/cli/src/devices.c -@@ -81,32 +81,6 @@ static NmcOutputField nmc_fields_dev_status[] = { - #define NMC_FIELDS_DEV_STATUS_COMMON "DEVICE,TYPE,STATE" - - --/* Available sections for 'device show' */ --static NmcOutputField nmc_fields_dev_show_sections[] = { -- {"GENERAL", N_("GENERAL"), 0}, /* 0 */ -- {"CAPABILITIES", N_("CAPABILITIES"), 0}, /* 1 */ -- {"WIFI-PROPERTIES", N_("WIFI-PROPERTIES"), 0}, /* 2 */ -- {"AP", N_("AP"), 0}, /* 3 */ -- {"WIRED-PROPERTIES", N_("WIRED-PROPERTIES"), 0}, /* 4 */ -- {"WIMAX-PROPERTIES", N_("WIMAX-PROPERTIES"), 0}, /* 5 */ -- {"NSP", N_("NSP"), 0}, /* 6 */ -- {"IP4", N_("IP4"), 0}, /* 7 */ -- {"DHCP4", N_("DHCP4"), 0}, /* 8 */ -- {"IP6", N_("IP6"), 0}, /* 9 */ -- {"DHCP6", N_("DHCP6"), 0}, /* 10 */ -- {"BOND", N_("BOND"), 0}, /* 11 */ -- {"VLAN", N_("VLAN"), 0}, /* 12 */ -- {"CONNECTIONS", N_("CONNECTIONS"), 0}, /* 13 */ -- {NULL, NULL, 0} --}; --#if WITH_WIMAX --#define NMC_FIELDS_DEV_SHOW_SECTIONS_ALL "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,WIMAX-PROPERTIES,NSP,IP4,DHCP4,IP6,DHCP6" --#define NMC_FIELDS_DEV_SHOW_SECTIONS_COMMON "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,WIMAX-PROPERTIES,NSP,IP4,DHCP4,IP6,DHCP6" --#else --#define NMC_FIELDS_DEV_SHOW_SECTIONS_ALL "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,IP4,DHCP4,IP6,DHCP6" --#define NMC_FIELDS_DEV_SHOW_SECTIONS_COMMON "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,IP4,DHCP4,IP6,DHCP6" --#endif -- - /* Available fields for 'device show' - GENERAL part */ - static NmcOutputField nmc_fields_dev_show_general[] = { - {"NAME", N_("NAME"), 10}, /* 0 */ -@@ -161,7 +135,6 @@ static NmcOutputField nmc_fields_dev_show_wired_prop[] = { - #define NMC_FIELDS_DEV_SHOW_WIRED_PROP_ALL "NAME,CARRIER" - #define NMC_FIELDS_DEV_SHOW_WIRED_PROP_COMMON "NAME,CARRIER" - -- - /* Available fields for 'device show' - wireless properties part */ - static NmcOutputField nmc_fields_dev_show_wifi_prop[] = { - {"NAME", N_("NAME"), 18}, /* 0 */ -@@ -192,6 +165,7 @@ static NmcOutputField nmc_fields_dev_show_wimax_prop[] = { - #define NMC_FIELDS_DEV_SHOW_WIMAX_PROP_COMMON "NAME,CTR-FREQ,RSSI,CINR,TX-POW,BSID" - #endif - -+ - /* Available fields for 'device wifi list' */ - static NmcOutputField nmc_fields_dev_wifi_list[] = { - {"NAME", N_("NAME"), 15}, /* 0 */ -@@ -253,6 +227,38 @@ static NmcOutputField nmc_fields_dev_show_vlan_prop[] = { - #define NMC_FIELDS_DEV_SHOW_VLAN_PROP_ALL "NAME,ID" - #define NMC_FIELDS_DEV_SHOW_VLAN_PROP_COMMON "NAME,ID" - -+/* defined in common.c */ -+extern NmcOutputField nmc_fields_ip4_config[]; -+extern NmcOutputField nmc_fields_ip6_config[]; -+extern NmcOutputField nmc_fields_dhcp4_config[]; -+extern NmcOutputField nmc_fields_dhcp6_config[]; -+ -+/* Available sections for 'device show' */ -+static NmcOutputField nmc_fields_dev_show_sections[] = { -+ {"GENERAL", N_("GENERAL"), 0, nmc_fields_dev_show_general + 1 }, /* 0 */ -+ {"CAPABILITIES", N_("CAPABILITIES"), 0, nmc_fields_dev_show_cap + 1 }, /* 1 */ -+ {"WIFI-PROPERTIES", N_("WIFI-PROPERTIES"), 0, nmc_fields_dev_show_wifi_prop + 1 }, /* 2 */ -+ {"AP", N_("AP"), 0, nmc_fields_dev_wifi_list + 1 }, /* 3 */ -+ {"WIRED-PROPERTIES", N_("WIRED-PROPERTIES"), 0, nmc_fields_dev_show_wired_prop + 1 }, /* 4 */ -+ {"WIMAX-PROPERTIES", N_("WIMAX-PROPERTIES"), 0, nmc_fields_dev_show_wimax_prop + 1 }, /* 5 */ -+ {"NSP", N_("NSP"), 0, nmc_fields_dev_wimax_list + 1 }, /* 6 */ -+ {"IP4", N_("IP4"), 0, nmc_fields_ip4_config + 1 }, /* 7 */ -+ {"DHCP4", N_("DHCP4"), 0, nmc_fields_dhcp4_config + 1 }, /* 8 */ -+ {"IP6", N_("IP6"), 0, nmc_fields_ip6_config + 1 }, /* 9 */ -+ {"DHCP6", N_("DHCP6"), 0, nmc_fields_dhcp6_config + 1 }, /* 10 */ -+ {"BOND", N_("BOND"), 0, nmc_fields_dev_show_bond_prop + 1 }, /* 11 */ -+ {"VLAN", N_("VLAN"), 0, nmc_fields_dev_show_vlan_prop + 1 }, /* 12 */ -+ {"CONNECTIONS", N_("CONNECTIONS"), 0, nmc_fields_dev_show_connections + 1 }, /* 13 */ -+ {NULL, NULL, 0, NULL } -+}; -+#if WITH_WIMAX -+#define NMC_FIELDS_DEV_SHOW_SECTIONS_ALL "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,WIMAX-PROPERTIES,NSP,IP4,DHCP4,IP6,DHCP6" -+#define NMC_FIELDS_DEV_SHOW_SECTIONS_COMMON "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,WIMAX-PROPERTIES,NSP,IP4,DHCP4,IP6,DHCP6" -+#else -+#define NMC_FIELDS_DEV_SHOW_SECTIONS_ALL "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,IP4,DHCP4,IP6,DHCP6" -+#define NMC_FIELDS_DEV_SHOW_SECTIONS_COMMON "GENERAL,CAPABILITIES,BOND,VLAN,CONNECTIONS,WIFI-PROPERTIES,AP,WIRED-PROPERTIES,IP4,DHCP4,IP6,DHCP6" -+#endif -+ - - /* glib main loop variable - defined in nmcli.c */ - extern GMainLoop *loop; -@@ -590,6 +596,7 @@ show_device_info (NMDevice *device, NmCli *nmc) - NMDHCP4Config *dhcp4; - NMDHCP6Config *dhcp6; - const char *base_hdr = _("Device details"); -+ GPtrArray *fields_in_section = NULL; - - if (!nmc->required_fields || strcasecmp (nmc->required_fields, "common") == 0) - fields_str = fields_common; -@@ -598,13 +605,9 @@ show_device_info (NMDevice *device, NmCli *nmc) - else - fields_str = nmc->required_fields; - -- sections_array = parse_output_fields (fields_str, nmc_fields_dev_show_sections, &error); -+ sections_array = parse_output_fields (fields_str, nmc_fields_dev_show_sections, TRUE, &fields_in_section, &error); - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'device show': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'device show': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_DEV_SHOW_SECTIONS_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'device show': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return; -@@ -613,7 +616,7 @@ show_device_info (NMDevice *device, NmCli *nmc) - /* Main header */ - nmc->print_fields.header_name = (char *) construct_header_name (base_hdr, nm_device_get_iface (device)); - nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_GENERAL_ALL, -- nmc_fields_dev_show_general, NULL); -+ nmc_fields_dev_show_general, FALSE, NULL, NULL); - - nmc_fields_dev_show_general[0].flags = NMC_OF_FLAG_MAIN_HEADER_ONLY; - print_required_fields (nmc, nmc_fields_dev_show_general); -@@ -621,6 +624,7 @@ show_device_info (NMDevice *device, NmCli *nmc) - /* Loop through the required sections and print them. */ - for (k = 0; k < sections_array->len; k++) { - int section_idx = g_array_index (sections_array, int, k); -+ char *section_fld = (char *) g_ptr_array_index (fields_in_section, k); - - if (nmc->print_output != NMC_PRINT_TERSE && !nmc->multiline_output && was_output) - printf ("\n"); /* Print empty line between groups in tabular mode */ -@@ -636,7 +640,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - if (!strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[0].name)) { - tmpl = nmc_fields_dev_show_general; - tmpl_len = sizeof (nmc_fields_dev_show_general); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_GENERAL_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_GENERAL_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -689,7 +694,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - if (!strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[1].name)) { - tmpl = nmc_fields_dev_show_cap; - tmpl_len = sizeof (nmc_fields_dev_show_cap); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_CAP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_CAP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -728,7 +734,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_show_wifi_prop; - tmpl_len = sizeof (nmc_fields_dev_show_wifi_prop); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_WIFI_PROP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_WIFI_PROP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -757,7 +764,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_wifi_list; - tmpl_len = sizeof (nmc_fields_dev_wifi_list); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -779,7 +787,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - if (!strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[4].name)) { - tmpl = nmc_fields_dev_show_wired_prop; - tmpl_len = sizeof (nmc_fields_dev_show_wired_prop); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_WIRED_PROP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_WIRED_PROP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -804,7 +813,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - /* Field names */ - tmpl = nmc_fields_dev_show_wimax_prop; - tmpl_len = sizeof (nmc_fields_dev_show_wimax_prop); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_WIMAX_PROP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_WIMAX_PROP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -848,7 +858,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_wimax_list; - tmpl_len = sizeof (nmc_fields_dev_wimax_list); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_WIMAX_LIST_FOR_DEV_LIST, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_WIMAX_LIST_FOR_DEV_LIST, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -872,19 +883,19 @@ show_device_info (NMDevice *device, NmCli *nmc) - - /* IP4 */ - if (cfg4 && !strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[7].name)) -- was_output = print_ip4_config (cfg4, nmc, nmc_fields_dev_show_sections[7].name); -+ was_output = print_ip4_config (cfg4, nmc, nmc_fields_dev_show_sections[7].name, section_fld); - - /* DHCP4 */ - if (dhcp4 && !strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[8].name)) -- was_output = print_dhcp4_config (dhcp4, nmc, nmc_fields_dev_show_sections[8].name); -+ was_output = print_dhcp4_config (dhcp4, nmc, nmc_fields_dev_show_sections[8].name, section_fld); - - /* IP6 */ - if (cfg6 && !strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[9].name)) -- was_output = print_ip6_config (cfg6, nmc, nmc_fields_dev_show_sections[9].name); -+ was_output = print_ip6_config (cfg6, nmc, nmc_fields_dev_show_sections[9].name, section_fld); - - /* DHCP6 */ - if (dhcp6 && !strcasecmp (nmc_fields_dev_show_sections[section_idx].name, nmc_fields_dev_show_sections[10].name)) -- was_output = print_dhcp6_config (dhcp6, nmc, nmc_fields_dev_show_sections[10].name); -+ was_output = print_dhcp6_config (dhcp6, nmc, nmc_fields_dev_show_sections[10].name, section_fld); - - /* Bond-specific information */ - if ((NM_IS_DEVICE_BOND (device))) { -@@ -909,7 +920,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_show_bond_prop; - tmpl_len = sizeof (nmc_fields_dev_show_bond_prop); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_BOND_PROP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_BOND_PROP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -932,7 +944,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_show_vlan_prop; - tmpl_len = sizeof (nmc_fields_dev_show_vlan_prop); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_VLAN_PROP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_VLAN_PROP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -956,7 +969,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - tmpl = nmc_fields_dev_show_connections; - tmpl_len = sizeof (nmc_fields_dev_show_connections); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_DEV_SHOW_CONNECTIONS_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (section_fld ? section_fld : NMC_FIELDS_DEV_SHOW_CONNECTIONS_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -999,6 +1013,8 @@ show_device_info (NMDevice *device, NmCli *nmc) - - if (sections_array) - g_array_free (sections_array, TRUE); -+ if (fields_in_section) -+ g_ptr_array_free (fields_in_section, TRUE); - } - - static void -@@ -1073,14 +1089,10 @@ do_devices_status (NmCli *nmc, int argc, char **argv) - - tmpl = nmc_fields_dev_status; - tmpl_len = sizeof (nmc_fields_dev_status); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'device status': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'device status': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_DEV_STATUS_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'device status': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - goto error; -@@ -1552,14 +1564,10 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv) - - tmpl = nmc_fields_dev_wifi_list; - tmpl_len = sizeof (nmc_fields_dev_wifi_list); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'device wifi': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'device wifi': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_DEV_WIFI_LIST_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'device wifi': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - goto error; -@@ -2295,14 +2303,10 @@ do_device_wimax_list (NmCli *nmc, int argc, char **argv) - - tmpl = nmc_fields_dev_wimax_list; - tmpl_len = sizeof (nmc_fields_dev_wimax_list); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'device wimax': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'device wimax': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_DEV_WIMAX_LIST_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'device wimax': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - goto error; -diff --git a/cli/src/network-manager.c b/cli/src/network-manager.c -index 8d59566..20df4dd 100644 ---- a/cli/src/network-manager.c -+++ b/cli/src/network-manager.c -@@ -205,13 +205,10 @@ show_nm_status (NmCli *nmc, const char *pretty_header_name, const char *print_fl - - tmpl = nmc_fields_nm_status; - tmpl_len = sizeof (nmc_fields_nm_status); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: %s (allowed fields: %s)"), error->message, fields_all); -+ g_string_printf (nmc->return_text, _("Error: only these fields are allowed: %s"), fields_all); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return FALSE; -@@ -351,14 +348,10 @@ show_nm_permissions (NmCli *nmc) - - tmpl = nmc_fields_nm_permissions; - tmpl_len = sizeof (nmc_fields_nm_permissions); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'general permissions': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'general permissions': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_NM_PERMISSIONS_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'general permissions': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return FALSE; -@@ -410,14 +403,10 @@ show_general_logging (NmCli *nmc) - - tmpl = nmc_fields_nm_logging; - tmpl_len = sizeof (nmc_fields_nm_logging); -- nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, &error); -+ nmc->print_fields.indices = parse_output_fields (fields_str, tmpl, FALSE, NULL, &error); - - if (error) { -- if (error->code == 0) -- g_string_printf (nmc->return_text, _("Error: 'general logging': %s"), error->message); -- else -- g_string_printf (nmc->return_text, _("Error: 'general logging': %s; allowed fields: %s"), -- error->message, NMC_FIELDS_NM_LOGGING_ALL); -+ g_string_printf (nmc->return_text, _("Error: 'general logging': %s"), error->message); - g_error_free (error); - nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; - return FALSE; -diff --git a/cli/src/nmcli.h b/cli/src/nmcli.h -index c80c4fd..b300c6d 100644 ---- a/cli/src/nmcli.h -+++ b/cli/src/nmcli.h -@@ -74,14 +74,15 @@ typedef enum { - #define NMC_OF_FLAG_MAIN_HEADER_ADD 0x00000004 /* Print main header in addition to values/field names */ - #define NMC_OF_FLAG_MAIN_HEADER_ONLY 0x00000008 /* Print main header only */ - --typedef struct { -- const char *name; /* Field's name */ -- const char *name_l10n; /* Field's name for translation */ -- int width; /* Width in screen columns */ -- void *value; /* Value of current field - char* or char** (NULL-terminated array) */ -- gboolean value_is_array; /* Whether value is char ** instead of char* */ -- gboolean free_value; /* Whether to free the value */ -- guint32 flags; /* Flags - whether and how to print values/field names/headers */ -+typedef struct _NmcOutputField { -+ const char *name; /* Field's name */ -+ const char *name_l10n; /* Field's name for translation */ -+ int width; /* Width in screen columns */ -+ struct _NmcOutputField *group; /* Points to an array with available section field names if this is a section (group) field */ -+ void *value; /* Value of current field - char* or char** (NULL-terminated array) */ -+ gboolean value_is_array; /* Whether value is char** instead of char* */ -+ gboolean free_value; /* Whether to free the value */ -+ guint32 flags; /* Flags - whether and how to print values/field names/headers */ - } NmcOutputField; - - typedef struct { -diff --git a/cli/src/settings.c b/cli/src/settings.c -index cf56cfb..baee672 100644 ---- a/cli/src/settings.c -+++ b/cli/src/settings.c -@@ -5840,7 +5840,7 @@ setting_connection_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_connection; - tmpl_len = sizeof (nmc_fields_setting_connection); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CONNECTION_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CONNECTION_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5877,7 +5877,7 @@ setting_wired_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wired; - tmpl_len = sizeof (nmc_fields_setting_wired); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRED_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRED_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5912,7 +5912,7 @@ setting_802_1X_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_8021X; - tmpl_len = sizeof (nmc_fields_setting_8021X); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_802_1X_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_802_1X_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5968,7 +5968,7 @@ setting_wireless_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wireless; - tmpl_len = sizeof (nmc_fields_setting_wireless); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6005,7 +6005,7 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wireless_security; - tmpl_len = sizeof (nmc_fields_setting_wireless_security); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6046,7 +6046,7 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ip4_config; - tmpl_len = sizeof (nmc_fields_setting_ip4_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP4_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP4_CONFIG_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6082,7 +6082,7 @@ setting_ip6_config_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ip6_config; - tmpl_len = sizeof (nmc_fields_setting_ip6_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP6_CONFIG_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP6_CONFIG_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6117,7 +6117,7 @@ setting_serial_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_serial; - tmpl_len = sizeof (nmc_fields_setting_serial); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_SERIAL_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_SERIAL_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6146,7 +6146,7 @@ setting_ppp_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ppp; - tmpl_len = sizeof (nmc_fields_setting_ppp); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPP_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPP_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6188,7 +6188,7 @@ setting_pppoe_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_pppoe; - tmpl_len = sizeof (nmc_fields_setting_pppoe); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPPOE_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPPOE_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6216,7 +6216,7 @@ setting_gsm_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_gsm; - tmpl_len = sizeof (nmc_fields_setting_gsm); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_GSM_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_GSM_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6251,7 +6251,7 @@ setting_cdma_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_cdma; - tmpl_len = sizeof (nmc_fields_setting_cdma); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CDMA_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CDMA_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6279,7 +6279,7 @@ setting_bluetooth_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bluetooth; - tmpl_len = sizeof (nmc_fields_setting_bluetooth); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BLUETOOTH_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BLUETOOTH_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6305,7 +6305,7 @@ setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_olpc_mesh; - tmpl_len = sizeof (nmc_fields_setting_olpc_mesh); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_OLPC_MESH_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_OLPC_MESH_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6332,7 +6332,7 @@ setting_vpn_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_vpn; - tmpl_len = sizeof (nmc_fields_setting_vpn); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VPN_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VPN_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6360,7 +6360,7 @@ setting_wimax_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wimax; - tmpl_len = sizeof (nmc_fields_setting_wimax); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIMAX_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIMAX_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6386,7 +6386,7 @@ setting_infiniband_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_infiniband; - tmpl_len = sizeof (nmc_fields_setting_infiniband); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_INFINIBAND_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_INFINIBAND_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6415,7 +6415,7 @@ setting_bond_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bond; - tmpl_len = sizeof (nmc_fields_setting_bond); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BOND_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BOND_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6441,7 +6441,7 @@ setting_vlan_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_vlan; - tmpl_len = sizeof (nmc_fields_setting_vlan); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VLAN_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VLAN_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6471,7 +6471,7 @@ setting_adsl_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_adsl; - tmpl_len = sizeof (nmc_fields_setting_adsl); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_ADSL_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_ADSL_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6502,7 +6502,7 @@ setting_bridge_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bridge; - tmpl_len = sizeof (nmc_fields_setting_bridge); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6533,7 +6533,7 @@ setting_bridge_port_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bridge_port; - tmpl_len = sizeof (nmc_fields_setting_bridge_port); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_PORT_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_PORT_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6560,7 +6560,7 @@ setting_team_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_team; - tmpl_len = sizeof (nmc_fields_setting_team); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6586,7 +6586,7 @@ setting_team_port_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_team_port; - tmpl_len = sizeof (nmc_fields_setting_team_port); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_PORT_ALL, tmpl, NULL); -+ nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_PORT_ALL, tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -diff --git a/cli/src/utils.c b/cli/src/utils.c -index de246d6..4ea6253 100644 ---- a/cli/src/utils.c -+++ b/cli/src/utils.c -@@ -608,41 +608,126 @@ nmc_free_output_field_values (NmcOutputField fields_array[]) - } - } - --/* -- * Parse comma separated fields in 'fields_str' according to 'fields_array'. -- * IN: 'field_str': comma-separated fields names -- * 'fields_array': array of allowed fields -- * RETURN: GArray with indices representing fields in 'fields_array'. -- * Caller is responsible to free it. -+/** -+ * parse_output_fields: -+ * @field_str: comma-separated field names to parse -+ * @fields_array: array of allowed fields -+ * @parse_groups: whether the fields can contain group prefix (e.g. general.driver) -+ * @group_fields: (out) (allow-none): array of field names for particular groups -+ * @error: (out) (allow-none): location to store error, or %NULL -+ * -+ * Parses comma separated fields in @fields_str according to @fields_array. -+ * When @parse_groups is %TRUE, fields can be in the form 'group.field'. Then -+ * @group_fields will be filled with the required field for particular group. -+ * @group_fields array corresponds to the returned array. -+ * Examples: -+ * @field_str: "type,name,uuid" | "ip4,general.device" | "ip4.address,ip6" -+ * returned array: 2 0 1 | 7 0 | 7 9 -+ * @group_fields: NULL NULL NULL | NULL "device" | "address" NULL -+ * -+ * Returns: #GArray with indices representing fields in @fields_array. -+ * Caller is responsible for freeing the array. - */ - GArray * --parse_output_fields (const char *fields_str, const NmcOutputField fields_array[], GError **error) -+parse_output_fields (const char *fields_str, -+ const NmcOutputField fields_array[], -+ gboolean parse_groups, -+ GPtrArray **group_fields, -+ GError **error) - { - char **fields, **iter; - GArray *array; -- int i; -+ int i, j; - - g_return_val_if_fail (error == NULL || *error == NULL, NULL); -+ g_return_val_if_fail (group_fields == NULL || *group_fields == NULL, NULL); - - array = g_array_new (FALSE, FALSE, sizeof (int)); -+ if (parse_groups && group_fields) -+ *group_fields = g_ptr_array_new_full (20, (GDestroyNotify) g_free); - - /* Split supplied fields string */ - fields = g_strsplit_set (fields_str, ",", -1); - for (iter = fields; iter && *iter; iter++) { -- for (i = 0; fields_array[i].name; i++) { -- if (strcasecmp (*iter, fields_array[i].name) == 0) { -- g_array_append_val (array, i); -- break; -+ int idx = -1; -+ -+ g_strstrip (*iter); -+ if (parse_groups) { -+ /* e.g. "general.device,general.driver,ip4,ip6" */ -+ gboolean found = FALSE; -+ char *left = *iter; -+ char *right = strchr (*iter, '.'); -+ -+ if (right) -+ *right++ = '\0'; -+ -+ for (i = 0; fields_array[i].name; i++) { -+ if (strcasecmp (left, fields_array[i].name) == 0) { -+ NmcOutputField *valid_names = fields_array[i].group; -+ idx = i; -+ if (!right && !valid_names) { -+ found = TRUE; -+ break; -+ } -+ for (j = 0; valid_names && valid_names[j].name; j++) { -+ if (!right || strcasecmp (right, valid_names[j].name) == 0) { -+ found = TRUE; -+ break; -+ } -+ } -+ } -+ if (found) -+ break; -+ } -+ if (found) { -+ /* Add index to array, and field name (or NULL) to group_fields array */ -+ g_array_append_val (array, idx); -+ if (*group_fields) -+ g_ptr_array_add (*group_fields, g_strdup (right)); -+ } -+ if (right) -+ *(right-1) = '.'; /* Restore the original string */ -+ } else { -+ /* e.g. "general,ip4,ip6" */ -+ for (i = 0; fields_array[i].name; i++) { -+ if (strcasecmp (*iter, fields_array[i].name) == 0) { -+ g_array_append_val (array, i); -+ break; -+ } - } - } -+ -+ /* Field was not found - error case */ - if (fields_array[i].name == NULL) { -+ GString *allowed_fields = g_string_sized_new (256); -+ int k; -+ -+ /* Set GError */ -+ if (idx != -1 && fields_array[idx].group) { -+ NmcOutputField *second_level = fields_array[idx].group; -+ for (k = 0; second_level[k].name; k++) -+ g_string_append_printf (allowed_fields, "%s.%s,", -+ fields_array[idx].name, second_level[k].name); -+ } else { -+ for (k = 0; fields_array[k].name; k++) -+ g_string_append_printf (allowed_fields, "%s,", fields_array[k].name); -+ } -+ g_string_truncate (allowed_fields, allowed_fields->len - 1); -+ - if (!strcasecmp (*iter, "all") || !strcasecmp (*iter, "common")) - g_set_error (error, NMCLI_ERROR, 0, _("field '%s' has to be alone"), *iter); -- - else -- g_set_error (error, NMCLI_ERROR, 1, _("invalid field '%s'"), *iter); -+ g_set_error (error, NMCLI_ERROR, 1, _("invalid field '%s'; allowed fields: %s"), -+ *iter, allowed_fields->str); -+ g_string_free (allowed_fields, TRUE); -+ -+ /* Free arrays on error */ - g_array_free (array, TRUE); - array = NULL; -+ if (group_fields && *group_fields) { -+ g_ptr_array_free (*group_fields, TRUE); -+ *group_fields = NULL; -+ } - goto done; - } - } -diff --git a/cli/src/utils.h b/cli/src/utils.h -index c1c8824..2d3292b 100644 ---- a/cli/src/utils.h -+++ b/cli/src/utils.h -@@ -80,7 +80,11 @@ void set_val_strc (NmcOutputField fields_array[], guint32 index, const char *val - void set_val_arr (NmcOutputField fields_array[], guint32 index, char **value); - void set_val_arrc (NmcOutputField fields_array[], guint32 index, const char **value); - void nmc_free_output_field_values (NmcOutputField fields_array[]); --GArray *parse_output_fields (const char *fields_str, const NmcOutputField fields_array[], GError **error); -+GArray *parse_output_fields (const char *fields_str, -+ const NmcOutputField fields_array[], -+ gboolean parse_groups, -+ GPtrArray **group_fields, -+ GError **error); - gboolean nmc_terse_option_check (NMCPrintOutput print_output, const char *fields, GError **error); - NmcOutputField *nmc_dup_fields_array (NmcOutputField fields[], size_t size, guint32 flags); - void nmc_empty_output_fields (NmCli *nmc); --- -1.7.11.7 - - -From 990f83b7d39b1e228e11d9f5ec24b696da7b5342 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Tue, 10 Dec 2013 15:33:53 +0100 -Subject: [PATCH 2/4] cli: allow '--field group.field' for nmcli con show - active -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Example: -$ nmcli -f general.name,ip4.address c s a myeth -GENERAL.NAME: myeth -IP4.ADDRESS[1]: ip = 10.34.25.228/23, gw = 10.34.25.254 - -Signed-off-by: Jiří Klimeš ---- - cli/src/connections.c | 100 +++++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 79 insertions(+), 21 deletions(-) - -diff --git a/cli/src/connections.c b/cli/src/connections.c -index f837d00..8a5b8f2 100644 ---- a/cli/src/connections.c -+++ b/cli/src/connections.c -@@ -162,14 +162,6 @@ static NmcOutputField nmc_fields_con_show_active[] = { - #define NMC_FIELDS_CON_ACTIVE_ALL "NAME,UUID,DEVICES,STATE,DEFAULT,DEFAULT6,VPN,ZONE,DBUS-PATH,CON-PATH,SPEC-OBJECT,MASTER-PATH" - #define NMC_FIELDS_CON_ACTIVE_COMMON "NAME,UUID,DEVICES,DEFAULT,VPN,MASTER-PATH" - --/* Available fields for 'connection show active ' */ --static NmcOutputField nmc_fields_con_active_details_groups[] = { -- {"GENERAL", N_("GENERAL"), 9}, /* 0 */ -- {"IP", N_("IP"), 5}, /* 1 */ -- {"VPN", N_("VPN"), 5}, /* 2 */ -- {NULL, NULL, 0} --}; --#define NMC_FIELDS_CON_ACTIVE_DETAILS_ALL "GENERAL,IP,VPN" - - /* GENERAL group is the same as nmc_fields_con_show_active */ - #define NMC_FIELDS_CON_ACTIVE_DETAILS_GENERAL_ALL "GROUP,"NMC_FIELDS_CON_ACTIVE_ALL -@@ -189,6 +181,24 @@ static NmcOutputField nmc_fields_con_active_details_vpn[] = { - }; - #define NMC_FIELDS_CON_ACTIVE_DETAILS_VPN_ALL "GROUP,TYPE,USERNAME,GATEWAY,BANNER,VPN-STATE,CFG" - -+/* defined in common.c */ -+extern NmcOutputField nmc_fields_ip4_config[]; -+extern NmcOutputField nmc_fields_ip6_config[]; -+extern NmcOutputField nmc_fields_dhcp4_config[]; -+extern NmcOutputField nmc_fields_dhcp6_config[]; -+ -+/* Available fields for 'connection show active ' */ -+static NmcOutputField nmc_fields_con_active_details_groups[] = { -+ {"GENERAL", N_("GENERAL"), 0, nmc_fields_con_show_active + 1 }, /* 0 */ -+ {"IP4", N_("IP4"), 0, nmc_fields_ip4_config + 1 }, /* 1 */ -+ {"DHCP4", N_("DHCP4"), 0, nmc_fields_dhcp4_config + 1 }, /* 2 */ -+ {"IP6", N_("IP6"), 0, nmc_fields_ip6_config + 1 }, /* 3 */ -+ {"DHCP6", N_("DHCP6"), 0, nmc_fields_dhcp6_config + 1 }, /* 4 */ -+ {"VPN", N_("VPN"), 0, nmc_fields_con_active_details_vpn + 1}, /* 5 */ -+ {NULL, NULL, 0, NULL} -+}; -+#define NMC_FIELDS_CON_ACTIVE_DETAILS_ALL "GENERAL,IP4,DHCP4,IP6,DHCP6,VPN" -+ - - typedef struct { - NmCli *nmc; -@@ -829,6 +839,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - { - GError *error = NULL; - GArray *print_groups; -+ GPtrArray *group_fields = NULL; - int i; - char *fields_str; - char *fields_all = NMC_FIELDS_CON_ACTIVE_DETAILS_ALL; -@@ -844,7 +855,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - else - fields_str = nmc->required_fields; - -- print_groups = parse_output_fields (fields_str, nmc_fields_con_active_details_groups, FALSE, NULL, &error); -+ print_groups = parse_output_fields (fields_str, nmc_fields_con_active_details_groups, TRUE, &group_fields, &error); - if (error) { - g_string_printf (nmc->return_text, _("Error: 'list active': %s"), error->message); - g_error_free (error); -@@ -864,6 +875,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - /* Loop through the groups and print them. */ - for (i = 0; i < print_groups->len; i++) { - int group_idx = g_array_index (print_groups, int, i); -+ char *group_fld = (char *) g_ptr_array_index (group_fields, i); - - if (nmc->print_output != NMC_PRINT_TERSE && !nmc->multiline_output && was_output) - printf ("\n"); /* Empty line */ -@@ -878,7 +890,8 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - /* Add field names */ - tmpl = nmc_fields_con_show_active; - tmpl_len = sizeof (nmc_fields_con_show_active); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_GENERAL_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (group_fld ? group_fld : NMC_FIELDS_CON_ACTIVE_DETAILS_GENERAL_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -890,31 +903,73 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - was_output = TRUE; - } - -- /* IP */ -+ /* 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; - - devices = nm_active_connection_get_devices (acon); - for (j = 0; devices && (j < devices->len); j++) { -- gboolean b1 = FALSE, b2 = FALSE, b3 = FALSE, b4 = FALSE; -+ gboolean b1 = FALSE; - NMDevice *device = g_ptr_array_index (devices, j); - NMIP4Config *cfg4 = nm_device_get_ip4_config (device); -- NMIP6Config *cfg6 = nm_device_get_ip6_config (device); -+ -+ 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; -+ -+ 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; -+ } -+ } -+ -+ /* 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; -+ -+ 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; -+ } -+ } -+ -+ /* 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; -+ -+ 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_ip4_config (cfg4, nmc, "IP4", NULL); -- b2 = print_dhcp4_config (dhcp4, nmc, "DHCP4", NULL); -- b3 = print_ip6_config (cfg6, nmc, "IP6", NULL); -- b4 = print_dhcp6_config (dhcp6, nmc, "DHCP6", NULL); -- was_output = was_output || b1 || b2 || b3 || b4; -+ b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld); -+ was_output = was_output || b1; - } - } - - /* VPN */ - if (NM_IS_VPN_CONNECTION (acon) && -- strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) { -+ strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[5].name) == 0) { - NMConnection *con; - NMSettingConnection *s_con; - NMSettingVPN *s_vpn; -@@ -931,7 +986,8 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - - tmpl = nmc_fields_con_active_details_vpn; - tmpl_len = sizeof (nmc_fields_con_active_details_vpn); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_CON_ACTIVE_DETAILS_VPN_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (group_fld ? group_fld : NMC_FIELDS_CON_ACTIVE_DETAILS_VPN_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -957,7 +1013,7 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - - /* Add values */ - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX); -- set_val_strc (arr, 0, nmc_fields_con_active_details_groups[2].name); -+ set_val_strc (arr, 0, nmc_fields_con_active_details_groups[5].name); - set_val_str (arr, 1, type_str); - set_val_strc (arr, 2, username ? username : get_vpn_data_item (con, VPN_DATA_ITEM_USERNAME)); - set_val_strc (arr, 3, get_vpn_data_item (con, VPN_DATA_ITEM_GATEWAY)); -@@ -972,6 +1028,8 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc) - - if (print_groups) - g_array_free (print_groups, FALSE); -+ if (group_fields) -+ g_ptr_array_free (group_fields, TRUE); - - return TRUE; - } --- -1.7.11.7 - - -From 4ef8696c77725a25cea2bc585f0579b86cfe779a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Tue, 10 Dec 2013 16:23:31 +0100 -Subject: [PATCH 3/4] cli: allow '--field group.field' for nmcli con show conf - -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -That means you can display single property. - -Example: -$ nmcli -f connection.id,802-3-ethernet.mtu s c my-eth-profile -connection.id: my-eth-profile -802-3-ethernet.mtu: auto - -Signed-off-by: Jiří Klimeš ---- - cli/src/connections.c | 91 ++++++++++++++++--------- - cli/src/settings.c | 181 ++++++++++++++++++++++++++++---------------------- - cli/src/settings.h | 4 +- - 3 files changed, 166 insertions(+), 110 deletions(-) - -diff --git a/cli/src/connections.c b/cli/src/connections.c -index 8a5b8f2..f4bc017 100644 ---- a/cli/src/connections.c -+++ b/cli/src/connections.c -@@ -79,35 +79,61 @@ static NmcOutputField nmc_fields_con_show[] = { - #define NMC_FIELDS_CON_SHOW_COMMON "NAME,UUID,TYPE,TIMESTAMP-REAL" - - /* Helper macro to define fields */ --#define SETTING_FIELD(setting, width) { setting, N_(setting), width, NULL, FALSE, FALSE, 0 } -+#define SETTING_FIELD(setting, props) { setting, N_(setting), 0, props, NULL, FALSE, FALSE, 0 } -+ -+/* defined in settings.c */ -+extern NmcOutputField nmc_fields_setting_connection[]; -+extern NmcOutputField nmc_fields_setting_wired[]; -+extern NmcOutputField nmc_fields_setting_8021X[]; -+extern NmcOutputField nmc_fields_setting_wireless[]; -+extern NmcOutputField nmc_fields_setting_wireless_security[]; -+extern NmcOutputField nmc_fields_setting_ip4_config[]; -+extern NmcOutputField nmc_fields_setting_ip6_config[]; -+extern NmcOutputField nmc_fields_setting_serial[]; -+extern NmcOutputField nmc_fields_setting_ppp[]; -+extern NmcOutputField nmc_fields_setting_pppoe[]; -+extern NmcOutputField nmc_fields_setting_adsl[]; -+extern NmcOutputField nmc_fields_setting_gsm[]; -+extern NmcOutputField nmc_fields_setting_cdma[]; -+extern NmcOutputField nmc_fields_setting_bluetooth[]; -+extern NmcOutputField nmc_fields_setting_olpc_mesh[]; -+extern NmcOutputField nmc_fields_setting_vpn[]; -+extern NmcOutputField nmc_fields_setting_wimax[]; -+extern NmcOutputField nmc_fields_setting_infiniband[]; -+extern NmcOutputField nmc_fields_setting_bond[]; -+extern NmcOutputField nmc_fields_setting_vlan[]; -+extern NmcOutputField nmc_fields_setting_bridge[]; -+extern NmcOutputField nmc_fields_setting_bridge_port[]; -+extern NmcOutputField nmc_fields_setting_team[]; -+extern NmcOutputField nmc_fields_setting_team_port[]; - - /* Available settings for 'connection show configured ' */ - static NmcOutputField nmc_fields_settings_names[] = { -- SETTING_FIELD (NM_SETTING_CONNECTION_SETTING_NAME, 0), /* 0 */ -- SETTING_FIELD (NM_SETTING_WIRED_SETTING_NAME, 0), /* 1 */ -- SETTING_FIELD (NM_SETTING_802_1X_SETTING_NAME, 0), /* 2 */ -- SETTING_FIELD (NM_SETTING_WIRELESS_SETTING_NAME, 0), /* 3 */ -- SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, 0), /* 4 */ -- SETTING_FIELD (NM_SETTING_IP4_CONFIG_SETTING_NAME, 0), /* 5 */ -- SETTING_FIELD (NM_SETTING_IP6_CONFIG_SETTING_NAME, 0), /* 6 */ -- SETTING_FIELD (NM_SETTING_SERIAL_SETTING_NAME, 0), /* 7 */ -- SETTING_FIELD (NM_SETTING_PPP_SETTING_NAME, 0), /* 8 */ -- SETTING_FIELD (NM_SETTING_PPPOE_SETTING_NAME, 0), /* 9 */ -- SETTING_FIELD (NM_SETTING_GSM_SETTING_NAME, 0), /* 10 */ -- SETTING_FIELD (NM_SETTING_CDMA_SETTING_NAME, 0), /* 11 */ -- SETTING_FIELD (NM_SETTING_BLUETOOTH_SETTING_NAME, 0), /* 12 */ -- SETTING_FIELD (NM_SETTING_OLPC_MESH_SETTING_NAME, 0), /* 13 */ -- SETTING_FIELD (NM_SETTING_VPN_SETTING_NAME, 0), /* 14 */ -- SETTING_FIELD (NM_SETTING_WIMAX_SETTING_NAME, 0), /* 15 */ -- SETTING_FIELD (NM_SETTING_INFINIBAND_SETTING_NAME, 0), /* 16 */ -- SETTING_FIELD (NM_SETTING_BOND_SETTING_NAME, 0), /* 17 */ -- SETTING_FIELD (NM_SETTING_VLAN_SETTING_NAME, 0), /* 18 */ -- SETTING_FIELD (NM_SETTING_ADSL_SETTING_NAME, 0), /* 19 */ -- SETTING_FIELD (NM_SETTING_BRIDGE_SETTING_NAME, 0), /* 20 */ -- SETTING_FIELD (NM_SETTING_BRIDGE_PORT_SETTING_NAME, 0), /* 21 */ -- SETTING_FIELD (NM_SETTING_TEAM_SETTING_NAME, 0), /* 22 */ -- SETTING_FIELD (NM_SETTING_TEAM_PORT_SETTING_NAME, 0), /* 23 */ -- {NULL, NULL, 0, NULL, FALSE, FALSE, 0} -+ SETTING_FIELD (NM_SETTING_CONNECTION_SETTING_NAME, nmc_fields_setting_connection + 1), /* 0 */ -+ SETTING_FIELD (NM_SETTING_WIRED_SETTING_NAME, nmc_fields_setting_wired + 1), /* 1 */ -+ SETTING_FIELD (NM_SETTING_802_1X_SETTING_NAME, nmc_fields_setting_8021X + 1), /* 2 */ -+ SETTING_FIELD (NM_SETTING_WIRELESS_SETTING_NAME, nmc_fields_setting_wireless + 1), /* 3 */ -+ SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, nmc_fields_setting_wireless_security + 1), /* 4 */ -+ SETTING_FIELD (NM_SETTING_IP4_CONFIG_SETTING_NAME, nmc_fields_setting_ip4_config + 1), /* 5 */ -+ SETTING_FIELD (NM_SETTING_IP6_CONFIG_SETTING_NAME, nmc_fields_setting_ip6_config + 1), /* 6 */ -+ SETTING_FIELD (NM_SETTING_SERIAL_SETTING_NAME, nmc_fields_setting_serial + 1), /* 7 */ -+ SETTING_FIELD (NM_SETTING_PPP_SETTING_NAME, nmc_fields_setting_ppp + 1), /* 8 */ -+ SETTING_FIELD (NM_SETTING_PPPOE_SETTING_NAME, nmc_fields_setting_pppoe + 1), /* 9 */ -+ SETTING_FIELD (NM_SETTING_GSM_SETTING_NAME, nmc_fields_setting_gsm + 1), /* 10 */ -+ SETTING_FIELD (NM_SETTING_CDMA_SETTING_NAME, nmc_fields_setting_cdma + 1), /* 11 */ -+ SETTING_FIELD (NM_SETTING_BLUETOOTH_SETTING_NAME, nmc_fields_setting_bluetooth + 1), /* 12 */ -+ SETTING_FIELD (NM_SETTING_OLPC_MESH_SETTING_NAME, nmc_fields_setting_olpc_mesh + 1), /* 13 */ -+ SETTING_FIELD (NM_SETTING_VPN_SETTING_NAME, nmc_fields_setting_vpn + 1), /* 14 */ -+ SETTING_FIELD (NM_SETTING_WIMAX_SETTING_NAME, nmc_fields_setting_wimax + 1), /* 15 */ -+ SETTING_FIELD (NM_SETTING_INFINIBAND_SETTING_NAME, nmc_fields_setting_infiniband + 1), /* 16 */ -+ SETTING_FIELD (NM_SETTING_BOND_SETTING_NAME, nmc_fields_setting_bond + 1), /* 17 */ -+ SETTING_FIELD (NM_SETTING_VLAN_SETTING_NAME, nmc_fields_setting_vlan + 1), /* 18 */ -+ SETTING_FIELD (NM_SETTING_ADSL_SETTING_NAME, nmc_fields_setting_adsl + 1), /* 19 */ -+ SETTING_FIELD (NM_SETTING_BRIDGE_SETTING_NAME, nmc_fields_setting_bridge + 1), /* 20 */ -+ SETTING_FIELD (NM_SETTING_BRIDGE_PORT_SETTING_NAME, nmc_fields_setting_bridge_port + 1), /* 21 */ -+ SETTING_FIELD (NM_SETTING_TEAM_SETTING_NAME, nmc_fields_setting_team + 1), /* 22 */ -+ SETTING_FIELD (NM_SETTING_TEAM_PORT_SETTING_NAME, nmc_fields_setting_team_port + 1), /* 23 */ -+ {NULL, NULL, 0, NULL, NULL, FALSE, FALSE, 0} - }; - #define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\ - NM_SETTING_WIRED_SETTING_NAME","\ -@@ -348,6 +375,7 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - { - GError *error = NULL; - GArray *print_settings_array; -+ GPtrArray *prop_array = NULL; - int i; - char *fields_str; - char *fields_all = NMC_FIELDS_SETTINGS_NAMES_ALL; -@@ -361,7 +389,7 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - else - fields_str = nmc->required_fields; - -- print_settings_array = parse_output_fields (fields_str, nmc_fields_settings_names, FALSE, NULL, &error); -+ print_settings_array = parse_output_fields (fields_str, nmc_fields_settings_names, TRUE, &prop_array, &error); - if (error) { - g_string_printf (nmc->return_text, _("Error: 'list configured': %s"), error->message); - g_error_free (error); -@@ -382,6 +410,7 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - for (i = 0; i < print_settings_array->len; i++) { - NMSetting *setting; - int section_idx = g_array_index (print_settings_array, int, i); -+ const char *prop_name = (const char *) g_ptr_array_index (prop_array, i); - - if (nmc->print_output != NMC_PRINT_TERSE && !nmc->multiline_output && was_output) - printf ("\n"); /* Empty line */ -@@ -393,14 +422,16 @@ nmc_connection_detail (NMConnection *connection, NmCli *nmc) - - setting = nm_connection_get_setting_by_name (connection, nmc_fields_settings_names[section_idx].name); - if (setting) { -- setting_details (setting, nmc); -+ setting_details (setting, nmc, prop_name); - was_output = TRUE; - continue; - } - } - - if (print_settings_array) - g_array_free (print_settings_array, FALSE); -+ if (prop_array) -+ g_ptr_array_free (prop_array, TRUE); - - return TRUE; - } -@@ -5382,7 +5413,7 @@ editor_show_setting (NMSetting *setting, NmCli *nmc) - /* Remove any previous data */ - nmc_empty_output_fields (nmc); - -- setting_details (setting, nmc); -+ setting_details (setting, nmc, NULL); - } - - typedef enum { -diff --git a/cli/src/settings.c b/cli/src/settings.c -index baee672..c4d0fec 100644 ---- a/cli/src/settings.c -+++ b/cli/src/settings.c -@@ -37,7 +37,7 @@ static char *wep_key_type_to_string (NMWepKeyType type); - #define SETTING_FIELD(setting, width) { setting, N_(setting), width, NULL, FALSE, FALSE, 0 } - - /* Available fields for NM_SETTING_CONNECTION_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_connection[] = { -+NmcOutputField nmc_fields_setting_connection[] = { - SETTING_FIELD ("name", 15), /* 0 */ - SETTING_FIELD (NM_SETTING_CONNECTION_ID, 25), /* 1 */ - SETTING_FIELD (NM_SETTING_CONNECTION_UUID, 38), /* 2 */ -@@ -71,7 +71,7 @@ static NmcOutputField nmc_fields_setting_connection[] = { - #define NMC_FIELDS_SETTING_CONNECTION_COMMON NMC_FIELDS_SETTING_CONNECTION_ALL - - /* Available fields for NM_SETTING_WIRED_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_wired[] = { -+NmcOutputField nmc_fields_setting_wired[] = { - SETTING_FIELD ("name", 17), /* 0 */ - SETTING_FIELD (NM_SETTING_WIRED_PORT, 8), /* 1 */ - SETTING_FIELD (NM_SETTING_WIRED_SPEED, 10), /* 2 */ -@@ -101,7 +101,7 @@ static NmcOutputField nmc_fields_setting_wired[] = { - #define NMC_FIELDS_SETTING_WIRED_COMMON NMC_FIELDS_SETTING_WIRED_ALL - - /* Available fields for NM_SETTING_802_1X_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_8021X[] = { -+NmcOutputField nmc_fields_setting_8021X[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_802_1X_EAP, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_802_1X_IDENTITY, 15), /* 2 */ -@@ -173,7 +173,7 @@ static NmcOutputField nmc_fields_setting_8021X[] = { - #define NMC_FIELDS_SETTING_802_1X_COMMON NMC_FIELDS_SETTING_802_1X_ALL - - /* Available fields for NM_SETTING_WIRELESS_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_wireless[] = { -+NmcOutputField nmc_fields_setting_wireless[] = { - SETTING_FIELD ("name", 17), /* 0 */ - SETTING_FIELD (NM_SETTING_WIRELESS_SSID, 34), /* 1 */ - SETTING_FIELD (NM_SETTING_WIRELESS_MODE, 15), /* 2 */ -@@ -207,7 +207,7 @@ static NmcOutputField nmc_fields_setting_wireless[] = { - #define NMC_FIELDS_SETTING_WIRELESS_COMMON NMC_FIELDS_SETTING_WIRELESS_ALL - - /* Available fields for NM_SETTING_WIRELESS_SECURITY_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_wireless_security[] = { -+NmcOutputField nmc_fields_setting_wireless_security[] = { - SETTING_FIELD ("name", 25), /* 0 */ - SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, 15), /* 2 */ -@@ -249,7 +249,7 @@ static NmcOutputField nmc_fields_setting_wireless_security[] = { - #define NMC_FIELDS_SETTING_WIRELESS_SECURITY_COMMON NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL - - /* Available fields for NM_SETTING_IP4_CONFIG_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_ip4_config[] = { -+NmcOutputField nmc_fields_setting_ip4_config[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_METHOD, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_IP4_CONFIG_DNS, 20), /* 2 */ -@@ -281,7 +281,7 @@ static NmcOutputField nmc_fields_setting_ip4_config[] = { - #define NMC_FIELDS_SETTING_IP4_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL - - /* Available fields for NM_SETTING_IP6_CONFIG_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_ip6_config[] = { -+NmcOutputField nmc_fields_setting_ip6_config[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_METHOD, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_IP6_CONFIG_DNS, 20), /* 2 */ -@@ -311,7 +311,7 @@ static NmcOutputField nmc_fields_setting_ip6_config[] = { - #define NMC_FIELDS_SETTING_IP6_CONFIG_COMMON NMC_FIELDS_SETTING_IP4_CONFIG_ALL - - /* Available fields for NM_SETTING_SERIAL_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_serial[] = { -+NmcOutputField nmc_fields_setting_serial[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_SERIAL_BAUD, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_SERIAL_BITS, 10), /* 2 */ -@@ -329,7 +329,7 @@ static NmcOutputField nmc_fields_setting_serial[] = { - #define NMC_FIELDS_SETTING_SERIAL_COMMON NMC_FIELDS_SETTING_SERIAL_ALL - - /* Available fields for NM_SETTING_PPP_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_ppp[] = { -+NmcOutputField nmc_fields_setting_ppp[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_PPP_NOAUTH, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_PPP_REFUSE_EAP, 10), /* 2 */ -@@ -373,7 +373,7 @@ static NmcOutputField nmc_fields_setting_ppp[] = { - #define NMC_FIELDS_SETTING_PPP_COMMON NMC_FIELDS_SETTING_PPP_ALL - - /* Available fields for NM_SETTING_PPPOE_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_pppoe[] = { -+NmcOutputField nmc_fields_setting_pppoe[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_PPPOE_SERVICE, 12), /* 1 */ - SETTING_FIELD (NM_SETTING_PPPOE_USERNAME, 15), /* 2 */ -@@ -389,7 +389,7 @@ static NmcOutputField nmc_fields_setting_pppoe[] = { - #define NMC_FIELDS_SETTING_PPPOE_COMMON NMC_FIELDS_SETTING_PPPOE_ALL - - /* Available fields for NM_SETTING_ADSL_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_adsl[] = { -+NmcOutputField nmc_fields_setting_adsl[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_ADSL_USERNAME, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_ADSL_PASSWORD, 15), /* 2 */ -@@ -411,7 +411,7 @@ static NmcOutputField nmc_fields_setting_adsl[] = { - #define NMC_FIELDS_SETTING_ADSL_COMMON NMC_FIELDS_SETTING_ADSL_ALL - - /* Available fields for NM_SETTING_GSM_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_gsm[] = { -+NmcOutputField nmc_fields_setting_gsm[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_GSM_NUMBER, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_GSM_USERNAME, 15), /* 2 */ -@@ -441,7 +441,7 @@ static NmcOutputField nmc_fields_setting_gsm[] = { - #define NMC_FIELDS_SETTING_GSM_COMMON NMC_FIELDS_SETTING_GSM_ALL - - /* Available fields for NM_SETTING_CDMA_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_cdma[] = { -+NmcOutputField nmc_fields_setting_cdma[] = { - SETTING_FIELD ("name", 10), /* 0 */ - SETTING_FIELD (NM_SETTING_CDMA_NUMBER, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_CDMA_USERNAME, 15), /* 2 */ -@@ -457,7 +457,7 @@ static NmcOutputField nmc_fields_setting_cdma[] = { - #define NMC_FIELDS_SETTING_CDMA_COMMON NMC_FIELDS_SETTING_CDMA_ALL - - /* Available fields for NM_SETTING_BLUETOOTH_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_bluetooth[] = { -+NmcOutputField nmc_fields_setting_bluetooth[] = { - SETTING_FIELD ("name", 11), /* 0 */ - SETTING_FIELD (NM_SETTING_BLUETOOTH_BDADDR, 19), /* 1 */ - SETTING_FIELD (NM_SETTING_BLUETOOTH_TYPE, 10), /* 2 */ -@@ -469,7 +469,7 @@ static NmcOutputField nmc_fields_setting_bluetooth[] = { - #define NMC_FIELDS_SETTING_BLUETOOTH_COMMON NMC_FIELDS_SETTING_BLUETOOTH_ALL - - /* Available fields for NM_SETTING_OLPC_MESH_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_olpc_mesh[] = { -+NmcOutputField nmc_fields_setting_olpc_mesh[] = { - SETTING_FIELD ("name", 18), /* 0 */ - SETTING_FIELD (NM_SETTING_OLPC_MESH_SSID, 34), /* 1 */ - SETTING_FIELD (NM_SETTING_OLPC_MESH_CHANNEL, 12), /* 2 */ -@@ -483,7 +483,7 @@ static NmcOutputField nmc_fields_setting_olpc_mesh[] = { - #define NMC_FIELDS_SETTING_OLPC_MESH_COMMON NMC_FIELDS_SETTING_OLPC_MESH_ALL - - /* Available fields for NM_SETTING_VPN_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_vpn[] = { -+NmcOutputField nmc_fields_setting_vpn[] = { - SETTING_FIELD ("name", 6), /* 0 */ - SETTING_FIELD (NM_SETTING_VPN_SERVICE_TYPE, 40), /* 1 */ - SETTING_FIELD (NM_SETTING_VPN_USER_NAME, 12), /* 2 */ -@@ -499,7 +499,7 @@ static NmcOutputField nmc_fields_setting_vpn[] = { - #define NMC_FIELDS_SETTING_VPN_COMMON NMC_FIELDS_SETTING_VPN_ALL - - /* Available fields for NM_SETTING_WIMAX_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_wimax[] = { -+NmcOutputField nmc_fields_setting_wimax[] = { - SETTING_FIELD ("name", 6), /* 0 */ - SETTING_FIELD (NM_SETTING_WIMAX_MAC_ADDRESS, 19), /* 1 */ - SETTING_FIELD (NM_SETTING_WIMAX_NETWORK_NAME, 40), /* 2 */ -@@ -511,7 +511,7 @@ static NmcOutputField nmc_fields_setting_wimax[] = { - #define NMC_FIELDS_SETTING_WIMAX_COMMON NMC_FIELDS_SETTING_WIMAX_ALL - - /* Available fields for NM_SETTING_INFINIBAND_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_infiniband[] = { -+NmcOutputField nmc_fields_setting_infiniband[] = { - SETTING_FIELD ("name", 12), /* 0 */ - SETTING_FIELD (NM_SETTING_INFINIBAND_MAC_ADDRESS, 61), /* 1 */ - SETTING_FIELD (NM_SETTING_INFINIBAND_MTU, 6), /* 2 */ -@@ -529,7 +529,7 @@ static NmcOutputField nmc_fields_setting_infiniband[] = { - #define NMC_FIELDS_SETTING_INFINIBAND_COMMON NMC_FIELDS_SETTING_INFINIBAND_ALL \ - - /* Available fields for NM_SETTING_BOND_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_bond[] = { -+NmcOutputField nmc_fields_setting_bond[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_BOND_INTERFACE_NAME, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_BOND_OPTIONS, 30), /* 2 */ -@@ -541,7 +541,7 @@ static NmcOutputField nmc_fields_setting_bond[] = { - #define NMC_FIELDS_SETTING_BOND_COMMON NMC_FIELDS_SETTING_BOND_ALL - - /* Available fields for NM_SETTING_VLAN_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_vlan[] = { -+NmcOutputField nmc_fields_setting_vlan[] = { - SETTING_FIELD ("name", 6), /* 0 */ - SETTING_FIELD (NM_SETTING_VLAN_INTERFACE_NAME, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_VLAN_PARENT, 8), /* 2 */ -@@ -561,7 +561,7 @@ static NmcOutputField nmc_fields_setting_vlan[] = { - #define NMC_FIELDS_SETTING_VLAN_COMMON NMC_FIELDS_SETTING_VLAN_ALL - - /* Available fields for NM_SETTING_BRIDGE_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_bridge[] = { -+NmcOutputField nmc_fields_setting_bridge[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_BRIDGE_INTERFACE_NAME, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_BRIDGE_STP, 5), /* 2 */ -@@ -583,7 +583,7 @@ static NmcOutputField nmc_fields_setting_bridge[] = { - #define NMC_FIELDS_SETTING_BRIDGE_COMMON NMC_FIELDS_SETTING_BRIDGE_ALL - - /* Available fields for NM_SETTING_BRIDGE_PORT_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_bridge_port[] = { -+NmcOutputField nmc_fields_setting_bridge_port[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_BRIDGE_PORT_PRIORITY, 10), /* 1 */ - SETTING_FIELD (NM_SETTING_BRIDGE_PORT_PATH_COST, 12), /* 2 */ -@@ -597,7 +597,7 @@ static NmcOutputField nmc_fields_setting_bridge_port[] = { - #define NMC_FIELDS_SETTING_BRIDGE_PORT_COMMON NMC_FIELDS_SETTING_BRIDGE_PORT_ALL - - /* Available fields for NM_SETTING_TEAM_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_team[] = { -+NmcOutputField nmc_fields_setting_team[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_TEAM_INTERFACE_NAME, 15), /* 1 */ - SETTING_FIELD (NM_SETTING_TEAM_CONFIG, 30), /* 2 */ -@@ -609,7 +609,7 @@ static NmcOutputField nmc_fields_setting_team[] = { - #define NMC_FIELDS_SETTING_TEAM_COMMON NMC_FIELDS_SETTING_TEAM_ALL - - /* Available fields for NM_SETTING_TEAM_PORT_SETTING_NAME */ --static NmcOutputField nmc_fields_setting_team_port[] = { -+NmcOutputField nmc_fields_setting_team_port[] = { - SETTING_FIELD ("name", 8), /* 0 */ - SETTING_FIELD (NM_SETTING_TEAM_PORT_CONFIG, 30), /* 1 */ - {NULL, NULL, 0, NULL, FALSE, FALSE, 0} -@@ -5830,7 +5830,7 @@ nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value) - /*----------------------------------------------------------------------------*/ - - static gboolean --setting_connection_details (NMSetting *setting, NmCli *nmc) -+setting_connection_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingConnection *s_con = NM_SETTING_CONNECTION (setting); - NmcOutputField *tmpl, *arr; -@@ -5840,7 +5840,8 @@ setting_connection_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_connection; - tmpl_len = sizeof (nmc_fields_setting_connection); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CONNECTION_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_CONNECTION_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5867,7 +5868,7 @@ setting_connection_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_wired_details (NMSetting *setting, NmCli *nmc) -+setting_wired_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingWired *s_wired = NM_SETTING_WIRED (setting); - NmcOutputField *tmpl, *arr; -@@ -5877,7 +5878,8 @@ setting_wired_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wired; - tmpl_len = sizeof (nmc_fields_setting_wired); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRED_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_WIRED_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5902,7 +5904,7 @@ setting_wired_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_802_1X_details (NMSetting *setting, NmCli *nmc) -+setting_802_1X_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSetting8021x *s_8021x = NM_SETTING_802_1X (setting); - NmcOutputField *tmpl, *arr; -@@ -5912,7 +5914,8 @@ setting_802_1X_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_8021X; - tmpl_len = sizeof (nmc_fields_setting_8021X); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_802_1X_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_802_1X_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5958,7 +5961,7 @@ setting_802_1X_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_wireless_details (NMSetting *setting, NmCli *nmc) -+setting_wireless_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingWireless *s_wireless = NM_SETTING_WIRELESS (setting); - NmcOutputField *tmpl, *arr; -@@ -5968,7 +5971,8 @@ setting_wireless_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wireless; - tmpl_len = sizeof (nmc_fields_setting_wireless); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_WIRELESS_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -5995,7 +5999,7 @@ setting_wireless_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_wireless_security_details (NMSetting *setting, NmCli *nmc) -+setting_wireless_security_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingWirelessSecurity *s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (setting); - NmcOutputField *tmpl, *arr; -@@ -6005,7 +6009,8 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wireless_security; - tmpl_len = sizeof (nmc_fields_setting_wireless_security); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_WIRELESS_SECURITY_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6036,7 +6041,7 @@ setting_wireless_security_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_ip4_config_details (NMSetting *setting, NmCli *nmc) -+setting_ip4_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingIP4Config *s_ip4 = NM_SETTING_IP4_CONFIG (setting); - NmcOutputField *tmpl, *arr; -@@ -6046,7 +6051,8 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ip4_config; - tmpl_len = sizeof (nmc_fields_setting_ip4_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP4_CONFIG_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_IP4_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6072,7 +6078,7 @@ setting_ip4_config_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_ip6_config_details (NMSetting *setting, NmCli *nmc) -+setting_ip6_config_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingIP6Config *s_ip6 = NM_SETTING_IP6_CONFIG (setting); - NmcOutputField *tmpl, *arr; -@@ -6082,7 +6088,8 @@ setting_ip6_config_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ip6_config; - tmpl_len = sizeof (nmc_fields_setting_ip6_config); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_IP6_CONFIG_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_IP6_CONFIG_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6107,7 +6114,7 @@ setting_ip6_config_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_serial_details (NMSetting *setting, NmCli *nmc) -+setting_serial_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingSerial *s_serial = NM_SETTING_SERIAL (setting); - NmcOutputField *tmpl, *arr; -@@ -6117,7 +6124,8 @@ setting_serial_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_serial; - tmpl_len = sizeof (nmc_fields_setting_serial); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_SERIAL_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_SERIAL_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6136,7 +6144,7 @@ setting_serial_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_ppp_details (NMSetting *setting, NmCli *nmc) -+setting_ppp_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingPPP *s_ppp = NM_SETTING_PPP (setting); - NmcOutputField *tmpl, *arr; -@@ -6146,7 +6154,8 @@ setting_ppp_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_ppp; - tmpl_len = sizeof (nmc_fields_setting_ppp); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPP_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_PPP_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6178,7 +6187,7 @@ setting_ppp_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_pppoe_details (NMSetting *setting, NmCli *nmc) -+setting_pppoe_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingPPPOE *s_pppoe = NM_SETTING_PPPOE (setting); - NmcOutputField *tmpl, *arr; -@@ -6188,7 +6197,8 @@ setting_pppoe_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_pppoe; - tmpl_len = sizeof (nmc_fields_setting_pppoe); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_PPPOE_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_PPPOE_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6206,7 +6216,7 @@ setting_pppoe_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_gsm_details (NMSetting *setting, NmCli *nmc) -+setting_gsm_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingGsm *s_gsm = NM_SETTING_GSM (setting); - NmcOutputField *tmpl, *arr; -@@ -6216,7 +6226,8 @@ setting_gsm_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_gsm; - tmpl_len = sizeof (nmc_fields_setting_gsm); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_GSM_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_GSM_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6241,7 +6252,7 @@ setting_gsm_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_cdma_details (NMSetting *setting, NmCli *nmc) -+setting_cdma_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingCdma *s_cdma = NM_SETTING_CDMA (setting); - NmcOutputField *tmpl, *arr; -@@ -6251,7 +6262,8 @@ setting_cdma_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_cdma; - tmpl_len = sizeof (nmc_fields_setting_cdma); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_CDMA_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_CDMA_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6269,7 +6281,7 @@ setting_cdma_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_bluetooth_details (NMSetting *setting, NmCli *nmc) -+setting_bluetooth_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingBluetooth *s_bluetooth = NM_SETTING_BLUETOOTH (setting); - NmcOutputField *tmpl, *arr; -@@ -6279,7 +6291,8 @@ setting_bluetooth_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bluetooth; - tmpl_len = sizeof (nmc_fields_setting_bluetooth); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BLUETOOTH_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_BLUETOOTH_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6295,7 +6308,7 @@ setting_bluetooth_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc) -+setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingOlpcMesh *s_olpc_mesh = NM_SETTING_OLPC_MESH (setting); - NmcOutputField *tmpl, *arr; -@@ -6305,7 +6318,8 @@ setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_olpc_mesh; - tmpl_len = sizeof (nmc_fields_setting_olpc_mesh); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_OLPC_MESH_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_OLPC_MESH_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6322,7 +6336,7 @@ setting_olpc_mesh_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_vpn_details (NMSetting *setting, NmCli *nmc) -+setting_vpn_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingVPN *s_vpn = NM_SETTING_VPN (setting); - NmcOutputField *tmpl, *arr; -@@ -6332,7 +6346,8 @@ setting_vpn_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_vpn; - tmpl_len = sizeof (nmc_fields_setting_vpn); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VPN_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_VPN_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6350,7 +6365,7 @@ setting_vpn_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_wimax_details (NMSetting *setting, NmCli *nmc) -+setting_wimax_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingWimax *s_wimax = NM_SETTING_WIMAX (setting); - NmcOutputField *tmpl, *arr; -@@ -6360,7 +6375,8 @@ setting_wimax_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_wimax; - tmpl_len = sizeof (nmc_fields_setting_wimax); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_WIMAX_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_WIMAX_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6376,7 +6392,7 @@ setting_wimax_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_infiniband_details (NMSetting *setting, NmCli *nmc) -+setting_infiniband_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingInfiniband *s_infiniband = NM_SETTING_INFINIBAND (setting); - NmcOutputField *tmpl, *arr; -@@ -6386,7 +6402,8 @@ setting_infiniband_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_infiniband; - tmpl_len = sizeof (nmc_fields_setting_infiniband); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_INFINIBAND_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_INFINIBAND_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6405,7 +6422,7 @@ setting_infiniband_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_bond_details (NMSetting *setting, NmCli *nmc) -+setting_bond_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingBond *s_bond = NM_SETTING_BOND (setting); - NmcOutputField *tmpl, *arr; -@@ -6415,7 +6432,8 @@ setting_bond_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bond; - tmpl_len = sizeof (nmc_fields_setting_bond); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BOND_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_BOND_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6431,7 +6449,7 @@ setting_bond_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_vlan_details (NMSetting *setting, NmCli *nmc) -+setting_vlan_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingVlan *s_vlan = NM_SETTING_VLAN (setting); - NmcOutputField *tmpl, *arr; -@@ -6441,7 +6459,8 @@ setting_vlan_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_vlan; - tmpl_len = sizeof (nmc_fields_setting_vlan); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_VLAN_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_VLAN_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6461,7 +6480,7 @@ setting_vlan_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_adsl_details (NMSetting *setting, NmCli *nmc) -+setting_adsl_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingAdsl *s_adsl = NM_SETTING_ADSL (setting); - NmcOutputField *tmpl, *arr; -@@ -6471,7 +6490,8 @@ setting_adsl_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_adsl; - tmpl_len = sizeof (nmc_fields_setting_adsl); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_ADSL_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_ADSL_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6492,7 +6512,7 @@ setting_adsl_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_bridge_details (NMSetting *setting, NmCli *nmc) -+setting_bridge_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingBridge *s_bridge = NM_SETTING_BRIDGE (setting); - NmcOutputField *tmpl, *arr; -@@ -6502,7 +6522,8 @@ setting_bridge_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bridge; - tmpl_len = sizeof (nmc_fields_setting_bridge); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_BRIDGE_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6523,7 +6544,7 @@ setting_bridge_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_bridge_port_details (NMSetting *setting, NmCli *nmc) -+setting_bridge_port_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingBridgePort *s_bridge_port = NM_SETTING_BRIDGE_PORT (setting); - NmcOutputField *tmpl, *arr; -@@ -6533,7 +6554,8 @@ setting_bridge_port_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_bridge_port; - tmpl_len = sizeof (nmc_fields_setting_bridge_port); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_BRIDGE_PORT_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_BRIDGE_PORT_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6550,7 +6572,7 @@ setting_bridge_port_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_team_details (NMSetting *setting, NmCli *nmc) -+setting_team_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingTeam *s_team = NM_SETTING_TEAM (setting); - NmcOutputField *tmpl, *arr; -@@ -6560,7 +6582,8 @@ setting_team_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_team; - tmpl_len = sizeof (nmc_fields_setting_team); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_TEAM_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6576,7 +6599,7 @@ setting_team_details (NMSetting *setting, NmCli *nmc) - } - - static gboolean --setting_team_port_details (NMSetting *setting, NmCli *nmc) -+setting_team_port_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - NMSettingTeamPort *s_team_port = NM_SETTING_TEAM_PORT (setting); - NmcOutputField *tmpl, *arr; -@@ -6586,7 +6609,8 @@ setting_team_port_details (NMSetting *setting, NmCli *nmc) - - tmpl = nmc_fields_setting_team_port; - tmpl_len = sizeof (nmc_fields_setting_team_port); -- nmc->print_fields.indices = parse_output_fields (NMC_FIELDS_SETTING_TEAM_PORT_ALL, tmpl, FALSE, NULL, NULL); -+ nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_TEAM_PORT_ALL, -+ tmpl, FALSE, NULL, NULL); - arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES); - g_ptr_array_add (nmc->output_data, arr); - -@@ -6641,7 +6666,7 @@ setting_dcb_details (NMSetting *setting, NmCli *nmc) - - typedef struct { - const char *sname; -- gboolean (*func) (NMSetting *setting, NmCli *nmc); -+ gboolean (*func) (NMSetting *setting, NmCli *nmc, const char *one_prop); - } SettingDetails; - - static const SettingDetails detail_printers[] = { -@@ -6674,7 +6699,7 @@ static const SettingDetails detail_printers[] = { - }; - - gboolean --setting_details (NMSetting *setting, NmCli *nmc) -+setting_details (NMSetting *setting, NmCli *nmc, const char *one_prop) - { - const SettingDetails *iter = &detail_printers[0]; - -@@ -6682,7 +6707,7 @@ setting_details (NMSetting *setting, NmCli *nmc) - - while (iter->sname) { - if (nm_connection_lookup_setting_type (iter->sname) == G_OBJECT_TYPE (setting)) -- return iter->func (setting, nmc); -+ return iter->func (setting, nmc, one_prop); - iter++; - } - -diff --git a/cli/src/settings.h b/cli/src/settings.h -index d172ac9..e60cabd 100644 ---- a/cli/src/settings.h -+++ b/cli/src/settings.h -@@ -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. - * -- * (C) Copyright 2010 - 2012 Red Hat, Inc. -+ * (C) Copyright 2010 - 2013 Red Hat, Inc. - */ - - #ifndef NMC_SETTINGS_H -@@ -83,6 +83,6 @@ void nmc_property_set_default_value (NMSetting *setting, const char *prop); - gboolean nmc_property_get_gvalue (NMSetting *setting, const char *prop, GValue *value); - gboolean nmc_property_set_gvalue (NMSetting *setting, const char *prop, GValue *value); - --gboolean setting_details (NMSetting *ssetting, NmCli *nmc); -+gboolean setting_details (NMSetting *ssetting, NmCli *nmc, const char *one_prop); - - #endif /* NMC_SETTINGS_H */ --- -1.7.11.7 - - -From abaa17edb9a1d80caaca635734db2b90a294ccd2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -Date: Tue, 17 Dec 2013 14:55:13 +0100 -Subject: [PATCH 4/4] cli: fix compilation without WiMAX -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - - -Signed-off-by: Jiří Klimeš ---- - cli/src/devices.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/cli/src/devices.c b/cli/src/devices.c -index 037d880..f21e063 100644 ---- a/cli/src/devices.c -+++ b/cli/src/devices.c -@@ -150,7 +150,6 @@ static NmcOutputField nmc_fields_dev_show_wifi_prop[] = { - #define NMC_FIELDS_DEV_SHOW_WIFI_PROP_ALL "NAME,WEP,WPA,WPA2,TKIP,CCMP,AP,ADHOC" - #define NMC_FIELDS_DEV_SHOW_WIFI_PROP_COMMON "NAME,WEP,WPA,WPA2,TKIP,CCMP,AP,ADHOC" - --#if WITH_WIMAX - /* Available fields for 'device show' - wimax properties part */ - static NmcOutputField nmc_fields_dev_show_wimax_prop[] = { - {"NAME", N_("NAME"), 18}, /* 0 */ -@@ -163,8 +162,6 @@ static NmcOutputField nmc_fields_dev_show_wimax_prop[] = { - }; - #define NMC_FIELDS_DEV_SHOW_WIMAX_PROP_ALL "NAME,CTR-FREQ,RSSI,CINR,TX-POW,BSID" - #define NMC_FIELDS_DEV_SHOW_WIMAX_PROP_COMMON "NAME,CTR-FREQ,RSSI,CINR,TX-POW,BSID" --#endif -- - - /* Available fields for 'device wifi list' */ - static NmcOutputField nmc_fields_dev_wifi_list[] = { -@@ -192,7 +189,6 @@ static NmcOutputField nmc_fields_dev_wifi_list[] = { - #define NMC_FIELDS_DEV_WIFI_LIST_COMMON "IN-USE,SSID,MODE,CHAN,RATE,SIGNAL,BARS,SECURITY" - #define NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST "NAME,"NMC_FIELDS_DEV_WIFI_LIST_COMMON - --#if WITH_WIMAX - /* Available fields for 'device wimax list' */ - static NmcOutputField nmc_fields_dev_wimax_list[] = { - {"NAME", N_("NAME"), 15}, /* 0 */ -@@ -207,7 +203,6 @@ static NmcOutputField nmc_fields_dev_wimax_list[] = { - #define NMC_FIELDS_DEV_WIMAX_LIST_ALL "NSP,SIGNAL,TYPE,DEVICE,ACTIVE,DBUS-PATH" - #define NMC_FIELDS_DEV_WIMAX_LIST_COMMON "NSP,SIGNAL,TYPE,DEVICE,ACTIVE" - #define NMC_FIELDS_DEV_WIMAX_LIST_FOR_DEV_LIST "NAME,"NMC_FIELDS_DEV_WIMAX_LIST_COMMON --#endif - - /* Available fields for 'device show' - BOND part */ - static NmcOutputField nmc_fields_dev_show_bond_prop[] = { --- -1.7.11.7 - diff --git a/physical-port-id.patch b/physical-port-id.patch deleted file mode 100644 index 3ba149d..0000000 --- a/physical-port-id.patch +++ /dev/null @@ -1,520 +0,0 @@ -From b7300bbe5a9f298ede02225b6b7e73e05aa78bc8 Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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. - - -+ -+ -+ 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. -+ -+ - - - -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 -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š ---- - 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 - diff --git a/platform-ignore-ipv6-ptp.patch b/platform-ignore-ipv6-ptp.patch deleted file mode 100644 index 845c690..0000000 --- a/platform-ignore-ipv6-ptp.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 90782cf023c2fc2c223203a97ca2ea56a0c61c55 Mon Sep 17 00:00:00 2001 -From: Dan Williams -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š ---- - 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 - diff --git a/rem-con-constructed.patch b/rem-con-constructed.patch deleted file mode 100644 index ff5de61..0000000 --- a/rem-con-constructed.patch +++ /dev/null @@ -1,31 +0,0 @@ -From df4c9347fc85ec2aa7ddc67e0ff39bc1d56f669a Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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 - diff --git a/rh1012151-ipv6-disable.patch b/rh1012151-ipv6-disable.patch deleted file mode 100644 index 884c721..0000000 --- a/rh1012151-ipv6-disable.patch +++ /dev/null @@ -1,27 +0,0 @@ -commit 9543e45afe0746ac1c9c10e4f78f43264fd288b4 -Author: Dan Williams -Date: Mon Oct 7 11:40:16 2013 -0500 - - core: allow IPv4 to proceed if IPv6 is globally disabled but set to "auto" (rh #1012151) - - If the user disabled IPv6 support in the kernel with "ipv6.disable=1" on the - kernel boot line, then any attempts to open IPv6 sockets (which libndp does) - will fail. This failed the entire connection, even if IPv6's "may-fail" - property was TRUE. Instead, just fail IPv6 and allow IPv4 to proceed. If - IPv4 fails or is disabled, then other logic will fail the entire connection. - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index d99b3d7..6810afc 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3329,8 +3329,8 @@ act_stage3_ip6_config_start (NMDevice *self, - if ( strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 - || strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) == 0) { - if (!addrconf6_start (self)) { -- *reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE; -- ret = NM_ACT_STAGE_RETURN_FAILURE; -+ /* IPv6 might be disabled; allow IPv4 to proceed */ -+ ret = NM_ACT_STAGE_RETURN_STOP; - } else - ret = NM_ACT_STAGE_RETURN_POSTPONE; - } else if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0) { diff --git a/rh1015598-wifi-detect.patch b/rh1015598-wifi-detect.patch deleted file mode 100644 index 1aa7100..0000000 --- a/rh1015598-wifi-detect.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 473018d8b2628ce946cc35db432ac2bc68f6f912 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Wed, 16 Oct 2013 12:29:13 -0500 -Subject: [PATCH] platform: detect non-mac80211 WiFi devices as WiFi (rh - #1015598) - -Before NMPlatform landed, the old NMManager code looked at either -DEVTYPE=wlan or asked the internal wifi utilities whether the -device was WiFi or not. This got lost when moving to NMPlatform. - -It turns out that only mac80211-based drivers set the DEVTYPE=wlan -flag in sysfs, while older WEXT, out-of-tree, and staging drivers -often do not (though they should). - -To avoid breaking recognition of these crappy drivers that used -to work, re-add the wifi utils checks. ---- - src/platform/nm-linux-platform.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c -index 0bea01b..82286ec 100644 ---- a/src/platform/nm-linux-platform.c -+++ b/src/platform/nm-linux-platform.c -@@ -41,14 +41,15 @@ - #include - #include - #include - #include - - #include "nm-linux-platform.h" - #include "nm-logging.h" -+#include "wifi/wifi-utils.h" - - /* This is only included for the translation of VLAN flags */ - #include "nm-setting-vlan.h" - - #define debug(...) nm_log_dbg (LOGD_PLATFORM, __VA_ARGS__) - #define warning(...) nm_log_warn (LOGD_PLATFORM, __VA_ARGS__) - #define error(...) nm_log_err (LOGD_PLATFORM, __VA_ARGS__) -@@ -473,26 +474,28 @@ type_to_string (NMLinkType type) - } G_STMT_END - - static NMLinkType - link_type_from_udev (NMPlatform *platform, int ifindex, int arptype, const char **out_name) - { - NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); - GUdevDevice *udev_device; -- const char *prop; -+ const char *prop, *name, *sysfs_path; - - udev_device = g_hash_table_lookup (priv->udev_devices, GINT_TO_POINTER (ifindex)); - if (!udev_device) - return_type (NM_LINK_TYPE_UNKNOWN, "unknown"); - - prop = g_udev_device_get_property (udev_device, "ID_NM_OLPC_MESH"); - if (prop) - return_type (NM_LINK_TYPE_OLPC_MESH, "olpc-mesh"); - - prop = g_udev_device_get_property (udev_device, "DEVTYPE"); -- if (g_strcmp0 (prop, "wlan") == 0) -+ name = g_udev_device_get_name (udev_device); -+ sysfs_path = g_udev_device_get_sysfs_path (udev_device); -+ if (g_strcmp0 (prop, "wlan") == 0 || wifi_utils_is_wifi (name, sysfs_path)) - return_type (NM_LINK_TYPE_WIFI, "wifi"); - else if (g_strcmp0 (prop, "wwan") == 0) - return_type (NM_LINK_TYPE_WWAN_ETHERNET, "wwan"); - - if (arptype == ARPHRD_ETHER) - return_type (NM_LINK_TYPE_ETHERNET, "ethernet"); - --- -1.8.3.1 - diff --git a/rh1017884-dispatcher-crash-on-exit.patch b/rh1017884-dispatcher-crash-on-exit.patch deleted file mode 100644 index 436df2f..0000000 --- a/rh1017884-dispatcher-crash-on-exit.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 073cc01f52f8b2b6d5b20c63814dc1ed00699028 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 18 Nov 2013 23:37:58 +0100 -Subject: [PATCH] dispatcher: fix crash while logging from signal handler -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Bug rh#1017884 describes a crash, where dbus_init() failed, which causes -a g_warning(). While writing the warning, a SIGTERM hit, and the -signal_handler() tries to call again g_message(). - -The logging functions of glib are not reentrant and call abort() when -invoked recursivly. The solution, is to use g_unix_signal_add, which -will dispatch the handler on the mainloop asynchronously. - -This bug is not that serious, because the dispatcher was about to -terminate anyway. However, it gets registered as a crash by the system -(ABRT). - -https://bugzilla.redhat.com/show_bug.cgi?id=1017884 - -Signed-off-by: Thomas Haller -Signed-off-by: Jiří Klimeš ---- - callouts/nm-dispatcher-action.c | 30 ++++++++++-------------------- - 1 file changed, 10 insertions(+), 20 deletions(-) - -diff --git a/callouts/nm-dispatcher-action.c b/callouts/nm-dispatcher-action.c -index 397f2ba..f48ff0a 100644 ---- a/callouts/nm-dispatcher-action.c -+++ b/callouts/nm-dispatcher-action.c -@@ -31,6 +31,7 @@ - #include - - #include -+#include - #include - #include - #include -@@ -597,27 +598,15 @@ logging_shutdown (void) - closelog (); - } - --static void --signal_handler (int signo) -+static gboolean -+signal_handler (gpointer user_data) - { -- if (signo == SIGINT || signo == SIGTERM) { -- g_message ("Caught signal %d, shutting down...", signo); -- g_main_loop_quit (loop); -- } --} -+ int signo = GPOINTER_TO_INT (user_data); - --static void --setup_signals (void) --{ -- struct sigaction action; -- sigset_t mask; -- -- sigemptyset (&mask); -- action.sa_handler = signal_handler; -- action.sa_mask = mask; -- action.sa_flags = 0; -- sigaction (SIGTERM, &action, NULL); -- sigaction (SIGINT, &action, NULL); -+ g_message ("Caught signal %d, shutting down...", signo); -+ g_main_loop_quit (loop); -+ -+ return G_SOURCE_REMOVE; - } - - int -@@ -648,7 +637,8 @@ main (int argc, char **argv) - g_option_context_free (opt_ctx); - - g_type_init (); -- setup_signals (); -+ g_unix_signal_add (SIGTERM, signal_handler, GINT_TO_POINTER (SIGTERM)); -+ g_unix_signal_add (SIGINT, signal_handler, GINT_TO_POINTER (SIGINT)); - - if (!debug) - logging_setup (); --- -1.7.11.7 - diff --git a/rh1018317-openvpn-ptp.patch b/rh1018317-openvpn-ptp.patch deleted file mode 100644 index 09c9a6b..0000000 --- a/rh1018317-openvpn-ptp.patch +++ /dev/null @@ -1,857 +0,0 @@ -From fec50bd5fad633e57bfd6f9ee480e6192504ca5f Mon Sep 17 00:00:00 2001 -From: Dan Winship -Date: Mon, 2 Dec 2013 10:20:26 -0500 -Subject: [PATCH] platform/core: add back support for PtP/peer addresses (rh - #1018317) - -In the migration to NMPlatform, support for ptp/peer addresses was -accidentally dropped. This broke OpenVPN configurations using 'p2p' -topology, which send a different peer address than the local address -for tunX, plus the server may also push routes that use the peer -address as the next hop. NetworkManager was unable to add these -routes, because the kernel had no idea how to talk to the peer, -because the peer's address was not assigned to any interface or -reachable over any routes. - -Partly based on a patch from Dan Williams. ---- - src/nm-ip4-config.c | 44 +--------------------------- - src/nm-ip4-config.h | 4 --- - src/nm-ip6-config.c | 49 ------------------------------- - src/nm-ip6-config.h | 4 --- - src/platform/nm-fake-platform.c | 10 +++++-- - src/platform/nm-linux-platform.c | 58 ++++++++++++++++++++++++++++++++----- - src/platform/nm-platform.c | 26 +++++++++++++---- - src/platform/nm-platform.h | 14 ++++++--- - src/platform/tests/platform.c | 4 +-- - src/platform/tests/test-address.c | 12 ++++---- - src/platform/tests/test-cleanup.c | 4 +-- - src/ppp-manager/nm-ppp-manager.c | 2 +- - src/tests/test-dhcp-options.c | 5 ++-- - src/tests/test-ip4-config.c | 12 ++++---- - src/tests/test-ip6-config.c | 13 ++++----- - src/vpn-manager/nm-vpn-connection.c | 10 +++---- - 16 files changed, 118 insertions(+), 153 deletions(-) - -diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c -index 7aff888..640a1e1 100644 ---- a/src/nm-ip4-config.c -+++ b/src/nm-ip4-config.c -@@ -47,7 +47,6 @@ typedef struct { - GPtrArray *domains; - GPtrArray *searches; - guint32 mss; -- guint32 ptp_address; - GArray *nis; - char *nis_domain; - GArray *wins; -@@ -454,10 +453,6 @@ nm_ip4_config_merge (NMIP4Config *dst, const NMIP4Config *src) - for (i = 0; i < nm_ip4_config_get_num_addresses (src); i++) - nm_ip4_config_add_address (dst, nm_ip4_config_get_address (src, i)); - -- /* ptp address; only replace if src doesn't have one */ -- if (!nm_ip4_config_get_ptp_address (dst)) -- nm_ip4_config_set_ptp_address (dst, nm_ip4_config_get_ptp_address (src)); -- - /* nameservers */ - for (i = 0; i < nm_ip4_config_get_num_nameservers (src); i++) - nm_ip4_config_add_nameserver (dst, nm_ip4_config_get_nameserver (src, i)); -@@ -527,10 +522,6 @@ nm_ip4_config_subtract (NMIP4Config *dst, const NMIP4Config *src) - } - } - -- /* ptp address */ -- if (nm_ip4_config_get_ptp_address (src) == nm_ip4_config_get_ptp_address (dst)) -- nm_ip4_config_set_ptp_address (dst, 0); -- - /* nameservers */ - for (i = 0; i < nm_ip4_config_get_num_nameservers (src); i++) { - guint32 src_ns = nm_ip4_config_get_nameserver (src, i); -@@ -788,12 +779,6 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev - has_minor_changes = TRUE; - } - -- /* ptp address */ -- if (src_priv->ptp_address != dst_priv->ptp_address) { -- dst_priv->ptp_address = src_priv->ptp_address; -- has_relevant_changes = TRUE; -- } -- - /* nis */ - num = nm_ip4_config_get_num_nis_servers (src); - are_equal = num == nm_ip4_config_get_num_nis_servers (dst); -@@ -873,11 +858,6 @@ nm_ip4_config_dump (const NMIP4Config *config, const char *detail) - } - } - -- /* ptp address */ -- tmp = nm_ip4_config_get_ptp_address (config); -- if (inet_ntop (AF_INET, (void *) &tmp, buf, sizeof (buf))) -- g_message (" ptp: %s", buf); -- - /* default gateway */ - tmp = nm_ip4_config_get_gateway (config); - if (inet_ntop (AF_INET, (void *) &tmp, buf, sizeof (buf))) -@@ -1314,24 +1294,6 @@ nm_ip4_config_get_mss (const NMIP4Config *config) - /******************************************************************/ - - void --nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr) --{ -- NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -- -- priv->ptp_address = ptp_addr; --} -- --guint32 --nm_ip4_config_get_ptp_address (const NMIP4Config *config) --{ -- NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -- -- return priv->ptp_address; --} -- --/******************************************************************/ -- --void - nm_ip4_config_reset_nis_servers (NMIP4Config *config) - { - NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config); -@@ -1480,7 +1442,7 @@ hash_u32 (GChecksum *sum, guint32 n) - void - nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only) - { -- guint32 i, n; -+ guint32 i; - const char *s; - - g_return_if_fail (config); -@@ -1504,10 +1466,6 @@ nm_ip4_config_hash (const NMIP4Config *config, GChecksum *sum, gboolean dns_only - hash_u32 (sum, route->metric); - } - -- n = nm_ip4_config_get_ptp_address (config); -- if (n) -- hash_u32 (sum, n); -- - for (i = 0; i < nm_ip4_config_get_num_nis_servers (config); i++) - hash_u32 (sum, nm_ip4_config_get_nis_server (config, i)); - -diff --git a/src/nm-ip4-config.h b/src/nm-ip4-config.h -index 5b76fb4..d57cd52 100644 ---- a/src/nm-ip4-config.h -+++ b/src/nm-ip4-config.h -@@ -117,10 +117,6 @@ const char * nm_ip4_config_get_search (const NMIP4Config *config, guint i); - void nm_ip4_config_set_mss (NMIP4Config *config, guint32 mss); - guint32 nm_ip4_config_get_mss (const NMIP4Config *config); - --/* PTP */ --void nm_ip4_config_set_ptp_address (NMIP4Config *config, guint32 ptp_addr); --guint32 nm_ip4_config_get_ptp_address (const NMIP4Config *config); -- - /* NIS */ - void nm_ip4_config_reset_nis_servers (NMIP4Config *config); - void nm_ip4_config_add_nis_server (NMIP4Config *config, guint32 nis); -diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c -index 65cbd0b..8eb79f2 100644 ---- a/src/nm-ip6-config.c -+++ b/src/nm-ip6-config.c -@@ -47,7 +47,6 @@ typedef struct { - GPtrArray *domains; - GPtrArray *searches; - guint32 mss; -- struct in6_addr ptp_address; - } NMIP6ConfigPrivate; - - -@@ -457,10 +456,6 @@ nm_ip6_config_merge (NMIP6Config *dst, const NMIP6Config *src) - for (i = 0; i < nm_ip6_config_get_num_addresses (src); i++) - nm_ip6_config_add_address (dst, nm_ip6_config_get_address (src, i)); - -- /* ptp address; only replace if src doesn't have one */ -- if (!nm_ip6_config_get_ptp_address (dst)) -- nm_ip6_config_set_ptp_address (dst, nm_ip6_config_get_ptp_address (src)); -- - /* nameservers */ - for (i = 0; i < nm_ip6_config_get_num_nameservers (src); i++) - nm_ip6_config_add_nameserver (dst, nm_ip6_config_get_nameserver (src, i)); -@@ -535,12 +530,6 @@ nm_ip6_config_subtract (NMIP6Config *dst, const NMIP6Config *src) - } - } - -- /* ptp address */ -- src_tmp = nm_ip6_config_get_ptp_address (src); -- dst_tmp = nm_ip6_config_get_ptp_address (dst); -- if (src_tmp && dst_tmp && IN6_ARE_ADDR_EQUAL (src_tmp, dst_tmp)) -- nm_ip6_config_set_ptp_address (dst, NULL); -- - /* nameservers */ - for (i = 0; i < nm_ip6_config_get_num_nameservers (src); i++) { - const struct in6_addr *src_ns = nm_ip6_config_get_nameserver (src, i); -@@ -769,12 +758,6 @@ nm_ip6_config_replace (NMIP6Config *dst, const NMIP6Config *src, gboolean *relev - has_minor_changes = TRUE; - } - -- /* ptp address */ -- if (!IN6_ARE_ADDR_EQUAL (&src_priv->ptp_address, &dst_priv->ptp_address)) { -- nm_ip6_config_set_ptp_address (dst, &src_priv->ptp_address); -- has_relevant_changes = TRUE; -- } -- - /* config_equal does not compare *all* the fields, therefore, we might have has_minor_changes - * regardless of config_equal. But config_equal must correspond to has_relevant_changes. */ - g_assert (config_equal == !has_relevant_changes); -@@ -1219,28 +1197,6 @@ nm_ip6_config_get_mss (const NMIP6Config *config) - - /******************************************************************/ - --void --nm_ip6_config_set_ptp_address (NMIP6Config *config, const struct in6_addr *ptp_address) --{ -- NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); -- -- if (ptp_address) -- priv->ptp_address = *ptp_address; -- else -- memset (&priv->ptp_address, 0, sizeof (priv->ptp_address)); -- --} -- --const struct in6_addr * --nm_ip6_config_get_ptp_address (const NMIP6Config *config) --{ -- NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config); -- -- return IN6_IS_ADDR_UNSPECIFIED (&priv->ptp_address) ? NULL : &priv->ptp_address; --} -- --/******************************************************************/ -- - static inline void - hash_u32 (GChecksum *sum, guint32 n) - { -@@ -1260,7 +1216,6 @@ void - nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only) - { - guint32 i; -- const struct in6_addr *in6a; - const char *s; - - g_return_if_fail (config); -@@ -1284,10 +1239,6 @@ nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only - hash_in6addr (sum, &route->gateway); - hash_u32 (sum, route->metric); - } -- -- in6a = nm_ip6_config_get_ptp_address (config); -- if (in6a) -- hash_in6addr (sum, in6a); - } - - for (i = 0; i < nm_ip6_config_get_num_nameservers (config); i++) -diff --git a/src/nm-ip6-config.h b/src/nm-ip6-config.h -index aecdab2..eb93d07 100644 ---- a/src/nm-ip6-config.h -+++ b/src/nm-ip6-config.h -@@ -116,10 +116,6 @@ const char * nm_ip6_config_get_search (const NMIP6Config *config, guint i); - void nm_ip6_config_set_mss (NMIP6Config *config, guint32 mss); - guint32 nm_ip6_config_get_mss (const NMIP6Config *config); - --/* PTP */ --void nm_ip6_config_set_ptp_address (NMIP6Config *config, const struct in6_addr *ptp_addr); --const struct in6_addr *nm_ip6_config_get_ptp_address (const NMIP6Config *config); -- - void nm_ip6_config_hash (const NMIP6Config *config, GChecksum *sum, gboolean dns_only); - gboolean nm_ip6_config_equal (const NMIP6Config *a, const NMIP6Config *b); - -diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c -index df5d5b8..dcbf932 100644 ---- a/src/platform/nm-fake-platform.c -+++ b/src/platform/nm-fake-platform.c -@@ -739,7 +739,9 @@ get_time (void) - } - - static gboolean --ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred) -+ip4_address_add (NMPlatform *platform, int ifindex, -+ in_addr_t addr, in_addr_t peer_addr, -+ int plen, guint32 lifetime, guint32 preferred) - { - NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform); - NMPlatformIP4Address address; -@@ -748,6 +750,7 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu - memset (&address, 0, sizeof (address)); - address.ifindex = ifindex; - address.address = addr; -+ address.peer_address = peer_addr; - address.plen = plen; - address.timestamp = get_time (); - address.lifetime = lifetime; -@@ -775,7 +778,9 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu - } - - static gboolean --ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags) -+ip6_address_add (NMPlatform *platform, int ifindex, -+ struct in6_addr addr, struct in6_addr peer_addr, -+ int plen, guint32 lifetime, guint32 preferred, guint flags) - { - NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform); - NMPlatformIP6Address address; -@@ -784,6 +789,7 @@ ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int pl - memset (&address, 0, sizeof (address)); - address.ifindex = ifindex; - address.address = addr; -+ address.peer_address = peer_addr; - address.plen = plen; - address.timestamp = get_time (); - address.lifetime = lifetime; -diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c -index d13abbe..50b027a 100644 ---- a/src/platform/nm-linux-platform.c -+++ b/src/platform/nm-linux-platform.c -@@ -764,6 +764,7 @@ static void - init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr) - { - struct nl_addr *nladdr = rtnl_addr_get_local (rtnladdr); -+ struct nl_addr *nlpeer = rtnl_addr_get_peer (rtnladdr); - - g_assert (nladdr); - -@@ -776,12 +777,17 @@ init_ip4_address (NMPlatformIP4Address *address, struct rtnl_addr *rtnladdr) - address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr); - g_assert (nl_addr_get_len (nladdr) == sizeof (address->address)); - memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address)); -+ if (nlpeer) { -+ g_assert (nl_addr_get_len (nlpeer) == sizeof (address->peer_address)); -+ memcpy (&address->peer_address, nl_addr_get_binary_addr (nlpeer), sizeof (address->peer_address)); -+ } - } - - static void - init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr) - { - struct nl_addr *nladdr = rtnl_addr_get_local (rtnladdr); -+ struct nl_addr *nlpeer = rtnl_addr_get_peer (rtnladdr); - - memset (address, 0, sizeof (*address)); - -@@ -793,6 +799,10 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr) - address->flags = rtnl_addr_get_flags (rtnladdr); - g_assert (nl_addr_get_len (nladdr) == sizeof (address->address)); - memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address)); -+ if (nlpeer) { -+ g_assert (nl_addr_get_len (nlpeer) == sizeof (address->peer_address)); -+ memcpy (&address->peer_address, nl_addr_get_binary_addr (nlpeer), sizeof (address->peer_address)); -+ } - } - - static gboolean -@@ -2208,7 +2218,14 @@ ip6_address_get_all (NMPlatform *platform, int ifindex) - } - - static struct nl_object * --build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred, guint flags) -+build_rtnl_addr (int family, -+ int ifindex, -+ gconstpointer addr, -+ gconstpointer peer_addr, -+ int plen, -+ guint32 lifetime, -+ guint32 preferred, -+ guint flags) - { - struct rtnl_addr *rtnladdr = rtnl_addr_alloc (); - int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr); -@@ -2220,6 +2237,14 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 - rtnl_addr_set_ifindex (rtnladdr, ifindex); - nle = rtnl_addr_set_local (rtnladdr, nladdr); - g_assert (!nle); -+ -+ if (peer_addr) { -+ auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen); -+ -+ nle = rtnl_addr_set_peer (rtnladdr, nlpeer); -+ g_assert (!nle); -+ } -+ - rtnl_addr_set_prefixlen (rtnladdr, plen); - if (lifetime) { - rtnl_addr_set_valid_lifetime (rtnladdr, lifetime); -@@ -2232,33 +2257,50 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 - } - - static gboolean --ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred) -+ip4_address_add (NMPlatform *platform, -+ int ifindex, -+ in_addr_t addr, -+ in_addr_t peer_addr, -+ int plen, -+ guint32 lifetime, -+ guint32 preferred) - { -- return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred, 0)); -+ return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, -+ peer_addr ? &peer_addr : NULL, -+ plen, lifetime, preferred, 0)); - } - - static gboolean --ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags) -+ip6_address_add (NMPlatform *platform, -+ int ifindex, -+ struct in6_addr addr, -+ struct in6_addr peer_addr, -+ int plen, -+ guint32 lifetime, -+ guint32 preferred, -+ guint flags) - { -- return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred, flags)); -+ return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, -+ memcmp (&peer_addr, &in6addr_any, sizeof (struct in6_addr)) == 0 ? NULL : &peer_addr, -+ plen, lifetime, preferred, flags)); - } - - static gboolean - ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen) - { -- return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0, 0)); -+ return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, NULL, plen, 0, 0, 0)); - } - - static gboolean - ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen) - { -- return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0, 0)); -+ return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, NULL, plen, 0, 0, 0)); - } - - static gboolean - ip_address_exists (NMPlatform *platform, int family, int ifindex, gconstpointer addr, int plen) - { -- auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, plen, 0, 0, 0); -+ auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, NULL, plen, 0, 0, 0); - auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object); - - return !!cached_object; -diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c -index 3f7f054..4e9c8fc 100644 ---- a/src/platform/nm-platform.c -+++ b/src/platform/nm-platform.c -@@ -1165,7 +1165,12 @@ nm_platform_ip6_address_get_all (int ifindex) - } - - gboolean --nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 lifetime, guint32 preferred) -+nm_platform_ip4_address_add (int ifindex, -+ in_addr_t address, -+ in_addr_t peer_address, -+ int plen, -+ guint32 lifetime, -+ guint32 preferred) - { - reset_error (); - -@@ -1175,11 +1180,17 @@ nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 l - g_return_val_if_fail (klass->ip4_address_add, FALSE); - - debug ("address: adding or updating IPv4 address"); -- return klass->ip4_address_add (platform, ifindex, address, plen, lifetime, preferred); -+ return klass->ip4_address_add (platform, ifindex, address, peer_address, plen, lifetime, preferred); - } - - gboolean --nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred, guint flags) -+nm_platform_ip6_address_add (int ifindex, -+ struct in6_addr address, -+ struct in6_addr peer_address, -+ int plen, -+ guint32 lifetime, -+ guint32 preferred, -+ guint flags) - { - reset_error (); - -@@ -1189,7 +1200,7 @@ nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, gui - g_return_val_if_fail (klass->ip6_address_add, FALSE); - - debug ("address: adding or updating IPv6 address"); -- return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred, flags); -+ return klass->ip6_address_add (platform, ifindex, address, peer_address, plen, lifetime, preferred, flags); - } - - gboolean -@@ -1350,7 +1361,7 @@ nm_platform_ip4_address_sync (int ifindex, const GArray *known_addresses) - } else - lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT; - -- if (!nm_platform_ip4_address_add (ifindex, known_address->address, known_address->plen, lifetime, preferred)) -+ if (!nm_platform_ip4_address_add (ifindex, known_address->address, known_address->peer_address, known_address->plen, lifetime, preferred)) - return FALSE; - } - -@@ -1407,7 +1418,8 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses) - } else - lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT; - -- if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen, -+ if (!nm_platform_ip6_address_add (ifindex, known_address->address, -+ known_address->peer_address, known_address->plen, - lifetime, preferred, known_address->flags)) - return FALSE; - } -@@ -1843,6 +1855,7 @@ nm_platform_ip4_address_cmp (const NMPlatformIP4Address *a, const NMPlatformIP4A - { - _CMP_POINTER (a, b); - _CMP_FIELD_MEMCMP (a, b, address); -+ _CMP_FIELD_MEMCMP (a, b, peer_address); - _CMP_FIELD (a, b, ifindex); - _CMP_FIELD (a, b, plen); - _CMP_FIELD (a, b, timestamp); -@@ -1857,6 +1870,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A - _CMP_POINTER (a, b); - _CMP_FIELD (a, b, ifindex); - _CMP_FIELD_MEMCMP (a, b, address); -+ _CMP_FIELD_MEMCMP (a, b, peer_address); - _CMP_FIELD (a, b, plen); - _CMP_FIELD (a, b, timestamp); - _CMP_FIELD (a, b, lifetime); -diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h -index ff338fc..b742c39 100644 ---- a/src/platform/nm-platform.h -+++ b/src/platform/nm-platform.h -@@ -122,6 +122,7 @@ typedef struct { - typedef struct { - int ifindex; - in_addr_t address; -+ in_addr_t peer_address; /* PTP peer address */ - int plen; - guint32 timestamp; - guint32 lifetime; -@@ -131,6 +132,7 @@ typedef struct { - typedef struct { - int ifindex; - struct in6_addr address; -+ struct in6_addr peer_address; - int plen; - guint32 timestamp; - guint32 lifetime; -@@ -280,9 +282,11 @@ typedef struct { - - GArray * (*ip4_address_get_all) (NMPlatform *, int ifindex); - GArray * (*ip6_address_get_all) (NMPlatform *, int ifindex); -- gboolean (*ip4_address_add) (NMPlatform *, int ifindex, in_addr_t address, int plen, -- guint32 lifetime, guint32 preferred_lft); -- gboolean (*ip6_address_add) (NMPlatform *, int ifindex, struct in6_addr address, int plen, -+ gboolean (*ip4_address_add) (NMPlatform *, int ifindex, -+ in_addr_t address, in_addr_t peer_address, int plen, -+ guint32 lifetime, guint32 preferred_lft); -+ gboolean (*ip6_address_add) (NMPlatform *, int ifindex, -+ struct in6_addr address, struct in6_addr peer_address, int plen, - guint32 lifetime, guint32 preferred_lft, guint flags); - gboolean (*ip4_address_delete) (NMPlatform *, int ifindex, in_addr_t address, int plen); - gboolean (*ip6_address_delete) (NMPlatform *, int ifindex, struct in6_addr address, int plen); -@@ -402,9 +406,11 @@ gboolean nm_platform_gre_get_properties (int ifindex, NMPlatformGreProperties *p - - GArray *nm_platform_ip4_address_get_all (int ifindex); - GArray *nm_platform_ip6_address_get_all (int ifindex); --gboolean nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, -- guint32 lifetime, guint32 preferred_lft); --gboolean nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, -+gboolean nm_platform_ip4_address_add (int ifindex, -+ in_addr_t address, in_addr_t peer_address, int plen, -+ guint32 lifetime, guint32 preferred_lft); -+gboolean nm_platform_ip6_address_add (int ifindex, -+ struct in6_addr address, struct in6_addr peer_address, int plen, - guint32 lifetime, guint32 preferred_lft, guint flags); - gboolean nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen); - gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen); -diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c -index c0b2c02..7ca2cb5 100644 ---- a/src/platform/tests/platform.c -+++ b/src/platform/tests/platform.c -@@ -523,7 +523,7 @@ do_ip4_address_add (char **argv) - guint32 lifetime = strtol (*argv++, NULL, 10); - guint32 preferred = strtol (*argv++, NULL, 10); - -- gboolean value = nm_platform_ip4_address_add (ifindex, address, plen, lifetime, preferred); -+ gboolean value = nm_platform_ip4_address_add (ifindex, address, 0, plen, lifetime, preferred); - return value; - } else - return FALSE; -@@ -541,7 +541,7 @@ do_ip6_address_add (char **argv) - guint32 preferred = strtol (*argv++, NULL, 10); - guint flags = (*argv) ? rtnl_addr_str2flags (*argv++) : 0; - -- gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred, flags); -+ gboolean value = nm_platform_ip6_address_add (ifindex, address, in6addr_any, plen, lifetime, preferred, flags); - return value; - } else - return FALSE; -diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c -index 52952c3..0f0ccc8 100644 ---- a/src/platform/tests/test-address.c -+++ b/src/platform/tests/test-address.c -@@ -60,14 +60,14 @@ test_ip4_address (void) - /* Add address */ - g_assert (!nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN)); - no_error (); -- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred)); - no_error (); - g_assert (nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN)); - no_error (); - accept_signal (address_added); - - /* Add address again (aka update) */ -- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred)); - no_error (); - accept_signal (address_changed); - -@@ -116,14 +116,14 @@ test_ip6_address (void) - /* Add address */ - g_assert (!nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - no_error (); -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - no_error (); - accept_signal (address_added); - - /* Add address again (aka update) */ -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - accept_signal (address_changed); - -@@ -183,7 +183,7 @@ test_ip4_address_external (void) - /* Add/delete conflict */ - run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d", - IP4_ADDRESS, IP4_PLEN, DEVICE_NAME, lifetime, preferred); -- g_assert (nm_platform_ip4_address_add (ifindex, addr, IP4_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip4_address_add (ifindex, addr, 0, IP4_PLEN, lifetime, preferred)); - no_error (); - g_assert (nm_platform_ip4_address_exists (ifindex, addr, IP4_PLEN)); - accept_signal (address_added); -@@ -222,7 +222,7 @@ test_ip6_address_external (void) - /* Add/delete conflict */ - run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d", - IP6_ADDRESS, IP6_PLEN, DEVICE_NAME, lifetime, preferred); -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, in6addr_any, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - accept_signal (address_added); -diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c -index f102870..d94b359 100644 ---- a/src/platform/tests/test-cleanup.c -+++ b/src/platform/tests/test-cleanup.c -@@ -41,8 +41,8 @@ test_cleanup_internal () - g_assert (ifindex > 0); - - /* Add routes and addresses */ -- g_assert (nm_platform_ip4_address_add (ifindex, addr4, plen4, lifetime, preferred)); -- g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred, flags)); -+ g_assert (nm_platform_ip4_address_add (ifindex, addr4, 0, plen4, lifetime, preferred)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr6, in6addr_any, plen6, lifetime, preferred, flags)); - g_assert (nm_platform_ip4_route_add (ifindex, gateway4, 32, INADDR_ANY, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, network4, plen4, gateway4, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway4, metric, mss)); -diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c -index ffb1e74..b2f2326 100644 ---- a/src/ppp-manager/nm-ppp-manager.c -+++ b/src/ppp-manager/nm-ppp-manager.c -@@ -538,7 +538,7 @@ impl_ppp_manager_set_ip4_config (NMPPPManager *manager, - val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_GATEWAY); - if (val) { - nm_ip4_config_set_gateway (config, g_value_get_uint (val)); -- nm_ip4_config_set_ptp_address (config, g_value_get_uint (val)); -+ address.peer_address = g_value_get_uint (val); - } - - val = (GValue *) g_hash_table_lookup (config_hash, NM_PPP_IP4_CONFIG_ADDRESS); -diff --git a/src/tests/test-dhcp-options.c b/src/tests/test-dhcp-options.c -index effe658..6ef599e 100644 ---- a/src/tests/test-dhcp-options.c -+++ b/src/tests/test-dhcp-options.c -@@ -129,6 +129,8 @@ test_generic_options (const char *client) - "dhcp-generic", "couldn't convert expected IP address"); - ASSERT (address->address == tmp, - "dhcp-generic", "unexpected IP address"); -+ ASSERT (address->peer_address == 0, -+ "dhcp-generic", "unexpected PTP address"); - - ASSERT (address->plen == 24, - "dhcp-generic", "unexpected IP address prefix length"); -@@ -139,9 +141,6 @@ test_generic_options (const char *client) - ASSERT (nm_ip4_config_get_gateway (ip4_config) == tmp, - "dhcp-generic", "unexpected IP gateway"); - -- ASSERT (nm_ip4_config_get_ptp_address (ip4_config) == 0, -- "dhcp-generic", "unexpected PTP address"); -- - ASSERT (nm_ip4_config_get_num_wins (ip4_config) == 0, - "dhcp-generic", "unexpected number of WINS servers"); - -diff --git a/src/tests/test-ip4-config.c b/src/tests/test-ip4-config.c -index 331897c..fde4a40 100644 ---- a/src/tests/test-ip4-config.c -+++ b/src/tests/test-ip4-config.c -@@ -25,10 +25,12 @@ - #include "nm-ip4-config.h" - - static void --addr_init (NMPlatformIP4Address *a, const char *addr, guint plen) -+addr_init (NMPlatformIP4Address *a, const char *addr, const char *peer, guint plen) - { - memset (a, 0, sizeof (*a)); - g_assert (inet_pton (AF_INET, addr, (void *) &a->address) == 1); -+ if (peer) -+ g_assert (inet_pton (AF_INET, peer, (void *) &a->peer_address) == 1); - a->plen = plen; - } - -@@ -68,7 +70,7 @@ build_test_config (void) - /* Build up the config to subtract */ - config = nm_ip4_config_new (); - -- addr_init (&addr, "192.168.1.10", 24); -+ addr_init (&addr, "192.168.1.10", "1.2.3.4", 24); - nm_ip4_config_add_address (config, &addr); - - route_new (&route, "10.0.0.0", 8, "192.168.1.1"); -@@ -86,8 +88,6 @@ build_test_config (void) - nm_ip4_config_add_search (config, "blahblah.com"); - nm_ip4_config_add_search (config, "beatbox.com"); - -- nm_ip4_config_set_ptp_address (config, addr_to_num ("1.2.3.4")); -- - nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.9")); - nm_ip4_config_add_nis_server (config, addr_to_num ("1.2.3.10")); - -@@ -121,7 +121,7 @@ test_subtract (void) - - /* add a couple more things to the test config */ - dst = build_test_config (); -- addr_init (&addr, expected_addr, expected_addr_plen); -+ addr_init (&addr, expected_addr, NULL, expected_addr_plen); - nm_ip4_config_add_address (dst, &addr); - - route_new (&route, expected_route_dest, expected_route_plen, expected_route_next_hop); -@@ -142,9 +142,9 @@ test_subtract (void) - test_addr = nm_ip4_config_get_address (dst, 0); - g_assert (test_addr != NULL); - g_assert_cmpuint (test_addr->address, ==, addr_to_num (expected_addr)); -+ g_assert_cmpuint (test_addr->peer_address, ==, 0); - g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen); - -- g_assert_cmpuint (nm_ip4_config_get_ptp_address (dst), ==, 0); - g_assert_cmpuint (nm_ip4_config_get_gateway (dst), ==, 0); - - g_assert_cmpuint (nm_ip4_config_get_num_routes (dst), ==, 1); -diff --git a/src/tests/test-ip6-config.c b/src/tests/test-ip6-config.c -index 10ce3bf..b8b9c7b 100644 ---- a/src/tests/test-ip6-config.c -+++ b/src/tests/test-ip6-config.c -@@ -25,10 +25,12 @@ - #include "nm-ip6-config.h" - - static void --addr_init (NMPlatformIP6Address *a, const char *addr, guint plen) -+addr_init (NMPlatformIP6Address *a, const char *addr, const char *peer, guint plen) - { - memset (a, 0, sizeof (*a)); - g_assert (inet_pton (AF_INET6, addr, (void *) &a->address) == 1); -+ if (peer) -+ g_assert (inet_pton (AF_INET6, peer, (void *) &a->peer_address) == 1); - a->plen = plen; - } - -@@ -61,7 +63,7 @@ build_test_config (void) - /* Build up the config to subtract */ - config = nm_ip6_config_new (); - -- addr_init (&addr, "abcd:1234:4321::cdde", 64); -+ addr_init (&addr, "abcd:1234:4321::cdde", "1:2:3:4::5", 64); - nm_ip6_config_add_address (config, &addr); - - route_new (&route, "abcd:1234:4321::", 24, "abcd:1234:4321:cdde::2"); -@@ -82,9 +84,6 @@ build_test_config (void) - nm_ip6_config_add_search (config, "blahblah.com"); - nm_ip6_config_add_search (config, "beatbox.com"); - -- addr_to_num ("1:2:3:4::5", &tmp); -- nm_ip6_config_set_ptp_address (config, &tmp); -- - return config; - } - -@@ -111,7 +110,7 @@ test_subtract (void) - - /* add a couple more things to the test config */ - dst = build_test_config (); -- addr_init (&addr, expected_addr, expected_addr_plen); -+ addr_init (&addr, expected_addr, NULL, expected_addr_plen); - nm_ip6_config_add_address (dst, &addr); - - route_new (&route, expected_route_dest, expected_route_plen, expected_route_next_hop); -@@ -133,9 +132,9 @@ test_subtract (void) - g_assert (test_addr != NULL); - addr_to_num (expected_addr, &tmp); - g_assert (memcmp (&test_addr->address, &tmp, sizeof (tmp)) == 0); -+ g_assert (memcmp (&test_addr->peer_address, &in6addr_any, sizeof (tmp)) == 0); - g_assert_cmpuint (test_addr->plen, ==, expected_addr_plen); - -- g_assert (nm_ip6_config_get_ptp_address (dst) == NULL); - g_assert (nm_ip6_config_get_gateway (dst) == NULL); - - g_assert_cmpuint (nm_ip6_config_get_num_routes (dst), ==, 1); -diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c -index a3b09f2..2d53449 100644 ---- a/src/vpn-manager/nm-vpn-connection.c -+++ b/src/vpn-manager/nm-vpn-connection.c -@@ -569,8 +569,7 @@ print_vpn_config (NMVPNConnection *connection) - nm_log_info (LOGD_VPN, " Internal Gateway: %s", ip_address_to_string (priv->ip4_internal_gw)); - nm_log_info (LOGD_VPN, " Internal Address: %s", ip_address_to_string (address4->address)); - nm_log_info (LOGD_VPN, " Internal Prefix: %d", address4->plen); -- nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", -- ip_address_to_string (nm_ip4_config_get_ptp_address (priv->ip4_config))); -+ nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", ip_address_to_string (address4->peer_address)); - nm_log_info (LOGD_VPN, " Maximum Segment Size (MSS): %d", nm_ip4_config_get_mss (priv->ip4_config)); - - num = nm_ip4_config_get_num_routes (priv->ip4_config); -@@ -610,8 +609,7 @@ print_vpn_config (NMVPNConnection *connection) - nm_log_info (LOGD_VPN, " Internal Gateway: %s", ip6_address_to_string (priv->ip6_internal_gw)); - nm_log_info (LOGD_VPN, " Internal Address: %s", ip6_address_to_string (&address6->address)); - nm_log_info (LOGD_VPN, " Internal Prefix: %d", address6->plen); -- nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", -- ip6_address_to_string (nm_ip6_config_get_ptp_address (priv->ip6_config))); -+ nm_log_info (LOGD_VPN, " Internal Point-to-Point Address: %s", ip6_address_to_string (&address6->peer_address)); - nm_log_info (LOGD_VPN, " Maximum Segment Size (MSS): %d", nm_ip6_config_get_mss (priv->ip6_config)); - - num = nm_ip6_config_get_num_routes (priv->ip6_config); -@@ -876,7 +874,7 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy, - - val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_PTP); - if (val) -- nm_ip4_config_set_ptp_address (config, g_value_get_uint (val)); -+ address.peer_address = g_value_get_uint (val); - - val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP4_CONFIG_PREFIX); - if (val) -@@ -1024,7 +1022,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy, - GByteArray *ba = g_value_get_boxed (val); - - if (ba->len == sizeof (struct in6_addr)) -- nm_ip6_config_set_ptp_address (config, (struct in6_addr *)ba->data); -+ address.peer_address = *(struct in6_addr *) ba->data; - } - - val = (GValue *) g_hash_table_lookup (config_hash, NM_VPN_PLUGIN_IP6_CONFIG_PREFIX); --- -1.8.4.2 - diff --git a/rh1018317-prereq.patch b/rh1018317-prereq.patch deleted file mode 100644 index e5f8f4a..0000000 --- a/rh1018317-prereq.patch +++ /dev/null @@ -1,321 +0,0 @@ -From ac94d83f04d87971c8bea4e164d7a5e260720e5c Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Tue, 15 Oct 2013 20:44:59 +0200 -Subject: [PATCH] core: add ifa_flags to NMPlatformIP6Address structure - -Add a field 'flags' to NMPlatformIP6Address that holds the -IFA_F_* flags as reported over netlink. - -Signed-off-by: Thomas Haller ---- - src/platform/nm-fake-platform.c | 3 ++- - src/platform/nm-linux-platform.c | 17 ++++++++++------- - src/platform/nm-platform.c | 20 +++++++++++++++----- - src/platform/nm-platform.h | 6 ++++-- - src/platform/tests/platform.c | 6 ++++-- - src/platform/tests/test-address.c | 8 +++++--- - src/platform/tests/test-cleanup.c | 3 ++- - 7 files changed, 42 insertions(+), 21 deletions(-) - -diff --git a/src/platform/nm-fake-platform.c b/src/platform/nm-fake-platform.c -index 491e23e..df5d5b8 100644 ---- a/src/platform/nm-fake-platform.c -+++ b/src/platform/nm-fake-platform.c -@@ -775,7 +775,7 @@ ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, gu - } - - static gboolean --ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred) -+ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags) - { - NMFakePlatformPrivate *priv = NM_FAKE_PLATFORM_GET_PRIVATE (platform); - NMPlatformIP6Address address; -@@ -788,6 +788,7 @@ ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int pl - address.timestamp = get_time (); - address.lifetime = lifetime; - address.preferred = preferred; -+ address.flags = flags; - - for (i = 0; i < priv->ip6_addresses->len; i++) { - NMPlatformIP6Address *item = &g_array_index (priv->ip6_addresses, NMPlatformIP6Address, i); -diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c -index 0f67180..e3d6357 100644 ---- a/src/platform/nm-linux-platform.c -+++ b/src/platform/nm-linux-platform.c -@@ -790,6 +790,7 @@ init_ip6_address (NMPlatformIP6Address *address, struct rtnl_addr *rtnladdr) - address->timestamp = rtnl_addr_get_create_time (rtnladdr); - address->lifetime = rtnl_addr_get_valid_lifetime (rtnladdr); - address->preferred = rtnl_addr_get_preferred_lifetime (rtnladdr); -+ address->flags = rtnl_addr_get_flags (rtnladdr); - g_assert (nl_addr_get_len (nladdr) == sizeof (address->address)); - memcpy (&address->address, nl_addr_get_binary_addr (nladdr), sizeof (address->address)); - } -@@ -2198,7 +2199,7 @@ ip6_address_get_all (NMPlatform *platform, int ifindex) - } - - static struct nl_object * --build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred) -+build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 lifetime, guint32 preferred, guint flags) - { - struct rtnl_addr *rtnladdr = rtnl_addr_alloc (); - int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr); -@@ -2215,6 +2216,8 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 - rtnl_addr_set_valid_lifetime (rtnladdr, lifetime); - rtnl_addr_set_preferred_lifetime (rtnladdr, preferred); - } -+ if (flags) -+ rtnl_addr_set_flags (rtnladdr, flags); - - return (struct nl_object *) rtnladdr; - } -@@ -2222,31 +2225,31 @@ build_rtnl_addr (int family, int ifindex, gconstpointer addr, int plen, guint32 - static gboolean - ip4_address_add (NMPlatform *platform, int ifindex, in_addr_t addr, int plen, guint32 lifetime, guint32 preferred) - { -- return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred)); -+ return add_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, lifetime, preferred, 0)); - } - - static gboolean --ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred) -+ip6_address_add (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen, guint32 lifetime, guint32 preferred, guint flags) - { -- return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred)); -+ return add_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, lifetime, preferred, flags)); - } - - static gboolean - ip4_address_delete (NMPlatform *platform, int ifindex, in_addr_t addr, int plen) - { -- return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0)); -+ return delete_object (platform, build_rtnl_addr (AF_INET, ifindex, &addr, plen, 0, 0, 0)); - } - - static gboolean - ip6_address_delete (NMPlatform *platform, int ifindex, struct in6_addr addr, int plen) - { -- return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0)); -+ return delete_object (platform, build_rtnl_addr (AF_INET6, ifindex, &addr, plen, 0, 0, 0)); - } - - static gboolean - ip_address_exists (NMPlatform *platform, int family, int ifindex, gconstpointer addr, int plen) - { -- auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, plen, 0, 0); -+ auto_nl_object struct nl_object *object = build_rtnl_addr (family, ifindex, addr, plen, 0, 0, 0); - auto_nl_object struct nl_object *cached_object = nl_cache_search (choose_cache (platform, object), object); - - return !!cached_object; -diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c -index 5a5e464..3f645ed 100644 ---- a/src/platform/nm-platform.c -+++ b/src/platform/nm-platform.c -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #include "nm-platform.h" - #include "nm-logging.h" -@@ -1100,7 +1101,7 @@ nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, guint32 l - } - - gboolean --nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred) -+nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, guint32 lifetime, guint32 preferred, guint flags) - { - reset_error (); - -@@ -1111,7 +1112,7 @@ nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, gui - g_return_val_if_fail (klass->ip6_address_add, FALSE); - - debug ("address: adding or updating IPv6 address"); -- return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred); -+ return klass->ip6_address_add (platform, ifindex, address, plen, lifetime, preferred, flags); - } - - gboolean -@@ -1329,7 +1330,8 @@ nm_platform_ip6_address_sync (int ifindex, const GArray *known_addresses) - } else - lifetime = preferred = NM_PLATFORM_LIFETIME_PERMANENT; - -- if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen, lifetime, preferred)) -+ if (!nm_platform_ip6_address_add (ifindex, known_address->address, known_address->plen, -+ lifetime, preferred, known_address->flags)) - return FALSE; - } - -@@ -1637,8 +1639,10 @@ const char * - nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address) - { - static char buffer[256]; -+ char s_flags[256]; - char s_address[INET6_ADDRSTRLEN]; - const char *s_dev; -+ char *str_flags; - - g_return_val_if_fail (address, "(unknown)"); - -@@ -1648,7 +1652,12 @@ nm_platform_ip6_address_to_string (const NMPlatformIP6Address *address) - s_dev = address->ifindex > 0 ? nm_platform_link_get_name (address->ifindex) : NULL; - -- g_snprintf (buffer, sizeof (buffer), "%s/%d lft %u pref %u time %u dev %s", -+ rtnl_addr_flags2str(address->flags, s_flags, sizeof(s_flags)); -+ 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", - s_address, address->plen, (guint)address->lifetime, (guint)address->preferred, -- (guint)address->timestamp, s_dev ? s_dev : "-"); -+ (guint)address->timestamp, s_dev ? s_dev : "-", -+ str_flags ? str_flags : ""); -+ g_free (str_flags); - return buffer; - } -@@ -1775,6 +1784,7 @@ nm_platform_ip6_address_cmp (const NMPlatformIP6Address *a, const NMPlatformIP6A - _CMP_FIELD (a, b, timestamp); - _CMP_FIELD (a, b, lifetime); - _CMP_FIELD (a, b, preferred); -+ _CMP_FIELD (a, b, flags); - return 0; - } - -diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h -index eae5465..7de0280 100644 ---- a/src/platform/nm-platform.h -+++ b/src/platform/nm-platform.h -@@ -24,6 +24,7 @@ - #include - #include - #include -+#include - - #define NM_TYPE_PLATFORM (nm_platform_get_type ()) - #define NM_PLATFORM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_PLATFORM, NMPlatform)) -@@ -134,6 +135,7 @@ typedef struct { - guint32 timestamp; - guint32 lifetime; - guint32 preferred; -+ guint flags; /* ifa_flags from , field type "unsigned int" is as used in rtnl_addr_get_flags. */ - } NMPlatformIP6Address; - - typedef struct { -@@ -281,7 +283,7 @@ typedef struct { - gboolean (*ip4_address_add) (NMPlatform *, int ifindex, in_addr_t address, int plen, - guint32 lifetime, guint32 preferred_lft); - gboolean (*ip6_address_add) (NMPlatform *, int ifindex, struct in6_addr address, int plen, -- guint32 lifetime, guint32 preferred_lft); -+ guint32 lifetime, guint32 preferred_lft, guint flags); - gboolean (*ip4_address_delete) (NMPlatform *, int ifindex, in_addr_t address, int plen); - gboolean (*ip6_address_delete) (NMPlatform *, int ifindex, struct in6_addr address, int plen); - gboolean (*ip4_address_exists) (NMPlatform *, int ifindex, in_addr_t address, int plen); -@@ -402,7 +404,7 @@ GArray *nm_platform_ip6_address_get_all (int ifindex); - gboolean nm_platform_ip4_address_add (int ifindex, in_addr_t address, int plen, - guint32 lifetime, guint32 preferred_lft); - gboolean nm_platform_ip6_address_add (int ifindex, struct in6_addr address, int plen, -- guint32 lifetime, guint32 preferred_lft); -+ guint32 lifetime, guint32 preferred_lft, guint flags); - gboolean nm_platform_ip4_address_delete (int ifindex, in_addr_t address, int plen); - gboolean nm_platform_ip6_address_delete (int ifindex, struct in6_addr address, int plen); - gboolean nm_platform_ip4_address_exists (int ifindex, in_addr_t address, int plen); -diff --git a/src/platform/tests/platform.c b/src/platform/tests/platform.c -index cd274cd..c0b2c02 100644 ---- a/src/platform/tests/platform.c -+++ b/src/platform/tests/platform.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #include "nm-platform.h" - #include "nm-linux-platform.h" -@@ -538,8 +539,9 @@ do_ip6_address_add (char **argv) - if (ifindex && parse_ip6_address (*argv++, &address, &plen)) { - guint32 lifetime = strtol (*argv++, NULL, 10); - guint32 preferred = strtol (*argv++, NULL, 10); -+ guint flags = (*argv) ? rtnl_addr_str2flags (*argv++) : 0; - -- gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred); -+ gboolean value = nm_platform_ip6_address_add (ifindex, address, plen, lifetime, preferred, flags); - return value; - } else - return FALSE; -@@ -765,7 +767,7 @@ static const command_t commands[] = { - { "ip4-address-get-all", "print all IPv4 addresses", do_ip4_address_get_all, 1, "" }, - { "ip6-address-get-all", "print all IPv6 addresses", do_ip6_address_get_all, 1, "" }, - { "ip4-address-add", "add IPv4 address", do_ip4_address_add, 4, "
/ <>" }, -- { "ip6-address-add", "add IPv6 address", do_ip6_address_add, 4, "
/ <>" }, -+ { "ip6-address-add", "add IPv6 address", do_ip6_address_add, 4, "
/ [] <>" }, - { "ip4-address-delete", "delete IPv4 address", do_ip4_address_delete, 2, - "
/" }, - { "ip6-address-delete", "delete IPv6 address", do_ip6_address_delete, 2, -diff --git a/src/platform/tests/test-address.c b/src/platform/tests/test-address.c -index ff11384..52952c3 100644 ---- a/src/platform/tests/test-address.c -+++ b/src/platform/tests/test-address.c -@@ -109,20 +109,21 @@ test_ip6_address (void) - struct in6_addr addr; - guint32 lifetime = 2000; - guint32 preferred = 1000; -+ guint flags = 0; - - inet_pton (AF_INET6, IP6_ADDRESS, &addr); - - /* Add address */ - g_assert (!nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - no_error (); -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - no_error (); - accept_signal (address_added); - - /* Add address again (aka update) */ -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - accept_signal (address_changed); - -@@ -205,6 +206,7 @@ test_ip6_address_external (void) - struct in6_addr addr; - guint32 lifetime = 2000; - guint32 preferred = 1000; -+ guint flags = 0; - - inet_pton (AF_INET6, IP6_ADDRESS, &addr); - -@@ -220,7 +222,7 @@ test_ip6_address_external (void) - /* Add/delete conflict */ - run_command ("ip address add %s/%d dev %s valid_lft %d preferred_lft %d", - IP6_ADDRESS, IP6_PLEN, DEVICE_NAME, lifetime, preferred); -- g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr, IP6_PLEN, lifetime, preferred, flags)); - no_error (); - g_assert (nm_platform_ip6_address_exists (ifindex, addr, IP6_PLEN)); - accept_signal (address_added); -diff --git a/src/platform/tests/test-cleanup.c b/src/platform/tests/test-cleanup.c -index cbfebe7..f102870 100644 ---- a/src/platform/tests/test-cleanup.c -+++ b/src/platform/tests/test-cleanup.c -@@ -23,6 +23,7 @@ test_cleanup_internal () - int preferred = NM_PLATFORM_LIFETIME_PERMANENT; - int metric = 20; - int mss = 1000; -+ guint flags = 0; - - inet_pton (AF_INET, "192.0.2.1", &addr4); - inet_pton (AF_INET, "192.0.3.0", &network4); -@@ -41,7 +42,7 @@ test_cleanup_internal () - - /* Add routes and addresses */ - g_assert (nm_platform_ip4_address_add (ifindex, addr4, plen4, lifetime, preferred)); -- g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred)); -+ g_assert (nm_platform_ip6_address_add (ifindex, addr6, plen6, lifetime, preferred, flags)); - g_assert (nm_platform_ip4_route_add (ifindex, gateway4, 32, INADDR_ANY, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, network4, plen4, gateway4, metric, mss)); - g_assert (nm_platform_ip4_route_add (ifindex, 0, 0, gateway4, metric, mss)); --- -1.8.4.2 - diff --git a/rh1018317-vpn-logging.patch b/rh1018317-vpn-logging.patch deleted file mode 100644 index 685bdd3..0000000 --- a/rh1018317-vpn-logging.patch +++ /dev/null @@ -1,51 +0,0 @@ -From ec1cabde2872337a98b1f5fb8e1e9b8219548010 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 30 Oct 2013 22:39:32 +0100 -Subject: [PATCH] core: fix error in print_vpn_config to print the route - correctly - -ip_address_to_string returns a static buffer, need to make a copy -in this case. - -Signed-off-by: Thomas Haller ---- - src/vpn-manager/nm-vpn-connection.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c -index a3074aa..7d3582a 100644 ---- a/src/vpn-manager/nm-vpn-connection.c -+++ b/src/vpn-manager/nm-vpn-connection.c -@@ -576,11 +576,13 @@ print_vpn_config (NMVPNConnection *connection) - num = nm_ip4_config_get_num_routes (priv->ip4_config); - for (i = 0; i < num; i++) { - const NMPlatformIP4Route *route = nm_ip4_config_get_route (priv->ip4_config, i); -+ char *s = g_strdup (ip_address_to_string (route->gateway)); - - nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s", - ip_address_to_string (route->network), - route->plen, -- ip_address_to_string (route->gateway)); -+ s); -+ g_free (s); - } - - nm_log_info (LOGD_VPN, " Forbid Default Route: %s", -@@ -615,11 +617,13 @@ print_vpn_config (NMVPNConnection *connection) - num = nm_ip6_config_get_num_routes (priv->ip6_config); - for (i = 0; i < num; i++) { - const NMPlatformIP6Route *route = nm_ip6_config_get_route (priv->ip6_config, i); -+ char *s = g_strdup (ip6_address_to_string (&route->gateway)); - - nm_log_info (LOGD_VPN, " Static Route: %s/%d Next Hop: %s", - ip6_address_to_string (&route->network), - route->plen, -- ip6_address_to_string (&route->gateway)); -+ s); -+ g_free (s); - } - - nm_log_info (LOGD_VPN, " Forbid Default Route: %s", --- -1.8.4.2 - diff --git a/rh1019021-fix-crash-ip6-routing.patch b/rh1019021-fix-crash-ip6-routing.patch deleted file mode 100644 index f001a69..0000000 --- a/rh1019021-fix-crash-ip6-routing.patch +++ /dev/null @@ -1,62 +0,0 @@ -commit 19b040236ec59fe8f9730d9da6d9262921d28936 -Author: Thomas Haller -Date: Wed Oct 30 20:18:58 2013 +0100 - - core: fix segfault in nm-policy when setting default route for vpn - - nm_vpn_connection_get_ip6_internal_gateway might return NULL. In this - case, we add a device route (to gateway '::') over the vpn. - - Before, in such a case, NM crashed with SEGFAULT. - - https://bugzilla.redhat.com/show_bug.cgi?id=1019021 - - Signed-off-by: Thomas Haller - -diff --git a/src/nm-policy.c b/src/nm-policy.c -index 6d15e01..49c005c 100644 ---- a/src/nm-policy.c -+++ b/src/nm-policy.c -@@ -860,12 +860,15 @@ update_ip6_routing (NMPolicy *policy, gboolean force_update) - int parent_ifindex = nm_device_get_ip_ifindex (parent); - NMIP6Config *parent_ip6 = nm_device_get_ip6_config (parent); - guint32 parent_mss = parent_ip6 ? nm_ip6_config_get_mss (parent_ip6) : 0; -- struct in6_addr int_gw = *nm_vpn_connection_get_ip6_internal_gateway (vpn); -+ const struct in6_addr *int_gw = nm_vpn_connection_get_ip6_internal_gateway (vpn); - int mss = nm_ip6_config_get_mss (ip6_config); - -- if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, int_gw, 0, mss)) { -+ if (!int_gw) -+ int_gw = &in6addr_any; -+ -+ 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)) { -+ if (!nm_platform_ip6_route_add (ip_ifindex, in6addr_any, 0, *int_gw, 0, mss)) { - nm_log_err (LOGD_IP6 | LOGD_VPN, "Failed to set default route."); - } - } -commit 886ca75ac33de252158a63074cc7cf9d0215c962 -Author: Thomas Haller -Date: Fri Nov 1 10:57:18 2013 +0100 - - core: fix crash when reading routes from VPN Ip6Config (bgo #706332) - - https://bugzilla.gnome.org/show_bug.cgi?id=706332 - - Reported-by: Nicolas Iooss - Signed-off-by: Thomas Haller - -diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c -index 6962e30..263f253 100644 ---- a/src/vpn-manager/nm-vpn-connection.c -+++ b/src/vpn-manager/nm-vpn-connection.c -@@ -1084,7 +1084,7 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy, - * the VPN server, we want to use the NM created route instead of - * whatever the server provides. - */ -- if (IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128) -+ if (priv->ip6_external_gw && IN6_ARE_ADDR_EQUAL (&route.network, priv->ip6_external_gw) && route.plen == 128) - continue; - - /* Otherwise accept the VPN-provided route */ diff --git a/rh1021112-fix-crash-never-default.patch b/rh1021112-fix-crash-never-default.patch deleted file mode 100644 index 58b7d29..0000000 --- a/rh1021112-fix-crash-never-default.patch +++ /dev/null @@ -1,19 +0,0 @@ -commit 0a557ac01d28340e43247eef52007a8b18bb24d8 -Author: Dan Winship -Date: Thu Oct 24 15:15:02 2013 -0400 - - core: fix crash when activating a never-default IPv4 connection - -diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c -index 81c003e..ed1728d 100644 ---- a/src/nm-ip4-config.c -+++ b/src/nm-ip4-config.c -@@ -583,7 +583,7 @@ nm_ip4_config_replace (NMIP4Config *dst, const NMIP4Config *src, gboolean *relev - /* never_default */ - if (src_priv->never_default != dst_priv->never_default) { - dst_priv->never_default = src_priv->never_default; -- has_relevant_changes = TRUE; -+ has_minor_changes = TRUE; - } - - /* default gateway */ diff --git a/rh1023571-fix-crash-ifcfg-rh-reload.patch b/rh1023571-fix-crash-ifcfg-rh-reload.patch deleted file mode 100644 index 60929fd..0000000 --- a/rh1023571-fix-crash-ifcfg-rh-reload.patch +++ /dev/null @@ -1,55 +0,0 @@ -commit 912152cf85d29db45f706522c8e3ce13eaf13197 -Author: Jiří Klimeš -Date: Tue Oct 29 15:02:30 2013 +0100 - - ifcfg-rh: fix crash when doing managed->unmanaged transition - - Testcase: - * add 'NM_CONTROLLED=no' to /etc/sysconfig/network-scripts/ifcfg-ABC - * sudo nmcli con reload - * ... NM asserts ... - - We need to ref() 'existing' connection before nm_settings_connection_signal_remove(), - because the function unref()s ithe connection via connection_removed_cb(). - - Backtrace: - ... - #4 0x00007fbcf0ea0cba in g_assertion_message_expr (domain=domain@entry=0x0, - file=file@entry=0x7fbcf4e5805d "nm-dbus-manager.c", line=line@entry=848, - func=func@entry=0x7fbcf4e585e0 <__FUNCTION__.15088> "nm_dbus_manager_unregister_object", expr=expr@entry=0x7fbcf4e5820b "G_IS_OBJECT (object)") - at gtestutils.c:2293 - #5 0x00007fbcf4de69d9 in nm_dbus_manager_unregister_object ( - self=0x7fbcf6fdc9c0, object=0x7fbcf70235c0) at nm-dbus-manager.c:848 - #6 0x00007fbcf4dd6a23 in nm_settings_connection_signal_remove ( - self=) at settings/nm-settings-connection.c:1541 - #7 0x00007fbce6fee884 in connection_new_or_changed ( - self=self@entry=0x7fbcf7006f80, - path=path@entry=0x7fbcf70c3f80 "/etc/sysconfig/network-scripts/ifcfg-ABC", - existing=existing@entry=0x7fbcf70235c0, - out_old_path=out_old_path@entry=0x7fff2b7b8988) at plugin.c:327 - #8 0x00007fbce6feeca2 in read_connections (plugin=0x7fbcf7006f80) - at plugin.c:453 - #9 0x00007fbcf4dd8e98 in impl_settings_reload_connections ( - self=0x7fbcf6fd98c0, context=0x7fbcf70bcb30) at settings/nm-settings.c:1262 - ... - -diff --git a/src/settings/plugins/ifcfg-rh/plugin.c b/src/settings/plugins/ifcfg-rh/plugin.c -index dbfc496..5cd24b0 100644 ---- a/src/settings/plugins/ifcfg-rh/plugin.c -+++ b/src/settings/plugins/ifcfg-rh/plugin.c -@@ -320,6 +320,7 @@ connection_new_or_changed (SCPluginIfcfg *self, - - if (new_unmanaged) { - if (!old_unmanaged) { -+ g_object_ref (existing); - /* Unexport the connection by telling the settings service it's - * been removed, and notify the settings service by signalling that - * unmanaged specs have changed. -@@ -331,6 +332,7 @@ connection_new_or_changed (SCPluginIfcfg *self, - - g_object_set (existing, NM_IFCFG_CONNECTION_UNMANAGED, new_unmanaged, NULL); - g_signal_emit_by_name (self, NM_SYSTEM_CONFIG_INTERFACE_UNMANAGED_SPECS_CHANGED); -+ g_object_unref (existing); - } - } else { - if (old_unmanaged) { /* now managed */ diff --git a/rh1025007-fix-crash-ifcfg-rh.patch b/rh1025007-fix-crash-ifcfg-rh.patch deleted file mode 100644 index bc60c77..0000000 --- a/rh1025007-fix-crash-ifcfg-rh.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit 25428882839ff17c531887bfc58f6669c9708fc8 -Author: Thomas Haller -Date: Thu Oct 31 12:42:01 2013 +0100 - - ifcfg-rh: fix crash when reading connection (assert in connection_new_or_changed) - - rh #1025007 reports a crash on g_assert_no_error() in - connection_new_or_changed() of src/settings/plugins/ifcfg-rh/plugin.c. - From the back trace I am not 100% sure, what the problem was, but I - think that nm_settings_connection_replace_settings failed because of - nm_connection_update_secrets. Apparently such a situation can - happen and it should simply be accepted as valid. - - What might have happened, is that the connection used to have - secrets (maybe it had 802.1x configured?) and then it got changed, - so update_secrets() fails because the connection no longer has a - setting to which the secrets would apply. - - https://bugzilla.redhat.com/show_bug.cgi?id=1025007 - - Signed-off-by: Thomas Haller - -diff --git a/src/settings/nm-settings-connection.c b/src/settings/nm-settings-connection.c -index 59b29ad..7dce397 100644 ---- a/src/settings/nm-settings-connection.c -+++ b/src/settings/nm-settings-connection.c -@@ -462,7 +462,7 @@ nm_settings_connection_replace_settings (NMSettingsConnection *self, - if (priv->agent_secrets) { - hash = nm_connection_to_hash (priv->agent_secrets, NM_SETTING_HASH_FLAG_ONLY_SECRETS); - if (hash) { -- success = nm_connection_update_secrets (NM_CONNECTION (self), NULL, hash, error); -+ nm_connection_update_secrets (NM_CONNECTION (self), NULL, hash, NULL); - g_hash_table_destroy (hash); - } - } diff --git a/rh1025371-wifi-potential-crash.patch b/rh1025371-wifi-potential-crash.patch deleted file mode 100644 index d1597c7..0000000 --- a/rh1025371-wifi-potential-crash.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 788eed99de51cd35adeb6585379b5e920c79b3f3 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Fri, 1 Nov 2013 10:32:27 +0100 -Subject: [PATCH] core: workaround crash when connecting to wifi (rh #1025371) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -rh #1025371 reports a crash in handle_ip_config_timeout() because -nm_device_wifi_get_activation_ap() did not return any access point. - -The handling of the AP in nm-device-wifi.c should be reworked and soon -will be fixed. For now, play it safe, and try to cope with any cases -where nm_device_wifi_get_activation_ap() might return NULL. - -Later, this patch should be reverted and handling of the AP properly -cleaned up. - -https://bugzilla.redhat.com/show_bug.cgi?id=1025371 - -Signed-off-by: Thomas Haller -Signed-off-by: Jiří Klimeš ---- - src/devices/nm-device-wifi.c | 16 +++++++++------- - 1 file changed, 9 insertions(+), 7 deletions(-) - -diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c -index 855c1e7..6c19d62 100644 ---- a/src/devices/nm-device-wifi.c -+++ b/src/devices/nm-device-wifi.c -@@ -2313,7 +2313,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface, - */ - if (devstate == NM_DEVICE_STATE_CONFIG) { - NMAccessPoint *ap = nm_device_wifi_get_activation_ap (self); -- const GByteArray *ssid = nm_ap_get_ssid (ap); -+ const GByteArray *ssid = ap ? nm_ap_get_ssid (ap) : NULL; - - nm_log_info (LOGD_DEVICE | LOGD_WIFI, - "Activation (%s/wireless) Stage 2 of 5 (Device Configure) " -@@ -2593,9 +2593,8 @@ supplicant_connection_timeout_cb (gpointer user_data) - - g_assert (priv->mode == NM_802_11_MODE_INFRA); - ap = nm_device_wifi_get_activation_ap (self); -- g_assert (ap); - -- if (priv->ssid_found && is_encrypted (ap, connection)) { -+ if (priv->ssid_found && ap && is_encrypted (ap, connection)) { - guint64 timestamp = 0; - gboolean new_secrets = TRUE; - -@@ -2944,7 +2943,11 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason) - g_assert (req); - - ap = nm_device_wifi_get_activation_ap (self); -- g_assert (ap); -+ if (!ap) { -+ nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "act_stage2_config failed due to unexpected missing activation_ap. Abort"); -+ *reason = NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT; -+ goto out; -+ } - - connection = nm_act_request_get_connection (req); - g_assert (connection); -@@ -3102,7 +3105,6 @@ handle_ip_config_timeout (NMDeviceWifi *self, - } - - ap = nm_device_wifi_get_activation_ap (self); -- g_assert (ap); - - /* If IP configuration times out and it's a static WEP connection, that - * usually means the WEP key is wrong. WEP's Open System auth mode has -@@ -3111,7 +3113,7 @@ handle_ip_config_timeout (NMDeviceWifi *self, - * types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the - * connection would have failed before IP configuration. - */ -- if (is_static_wep (ap, connection) && (may_fail == FALSE)) { -+ if (ap && is_static_wep (ap, connection) && (may_fail == FALSE)) { - /* Activation failed, we must have bad encryption key */ - nm_log_warn (LOGD_DEVICE | LOGD_WIFI, - "Activation (%s/wireless): could not get IP configuration for " -@@ -3203,7 +3205,7 @@ activation_success_handler (NMDevice *dev) - /* If the AP isn't fake, it was found in the scan list and all its - * details are known. - */ -- if (!nm_ap_get_fake (ap)) -+ if (!ap || !nm_ap_get_fake (ap)) - goto done; - - /* If the activate AP was fake, it probably won't have a BSSID at all. --- -1.7.11.7 - diff --git a/rh1029053-fix-crash-device-no-MAC.patch b/rh1029053-fix-crash-device-no-MAC.patch deleted file mode 100644 index fdac258..0000000 --- a/rh1029053-fix-crash-device-no-MAC.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 696f655d7c7b605d0344aeb6ba4ff643cd46a5b4 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Mon, 11 Nov 2013 15:43:13 -0600 -Subject: [PATCH] ethernet: don't crash if device doesn't have a MAC address - (rh #1029053) -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Like IBM s390 CTC devices, which aren't really ethernet but for -historical reasons we treat them as such. - -Signed-off-by: Jiří Klimeš - -Updated to apply for Fedora 20 snapshot. - ---- - src/devices/nm-device-ethernet.c | 14 +++++++++++--- - 1 file changed, 11 insertions(+), 3 deletions(-) - -diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c -index 7b1c248..c0b7861 100644 ---- a/src/devices/nm-device-ethernet.c -+++ b/src/devices/nm-device-ethernet.c -@@ -310,6 +310,7 @@ update_permanent_hw_address (NMDevice *dev) - struct ifreq req; - struct ethtool_perm_addr *epaddr = NULL; - int fd, ret; -+ const guint8 *mac; - - fd = socket (PF_INET, SOCK_DGRAM, 0); - if (fd < 0) { -@@ -332,7 +333,11 @@ update_permanent_hw_address (NMDevice *dev) - nm_log_dbg (LOGD_HW | LOGD_ETHER, "(%s): unable to read permanent MAC address (error %d)", - nm_device_get_iface (dev), errno); - /* Fall back to current address */ -- memcpy (epaddr->data, nm_device_get_hw_address (dev, NULL), ETH_ALEN); -+ mac = nm_device_get_hw_address (dev, NULL); -+ if (mac) -+ memcpy (epaddr->data, mac, ETH_ALEN); -+ else -+ memset (epaddr->data, 0, ETH_ALEN); - } - - if (memcmp (&priv->perm_hw_addr, epaddr->data, ETH_ALEN)) { -@@ -350,11 +355,14 @@ update_initial_hw_address (NMDevice *dev) - NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev); - NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self); - char *mac_str; -+ const guint8 *mac; - - /* This sets initial MAC address from current MAC address. It should only - * be called from NMDevice constructor() to really get the initial address. - */ -- memcpy (priv->initial_hw_addr, nm_device_get_hw_address (dev, NULL), ETH_ALEN); -+ mac = nm_device_get_hw_address (dev, NULL); -+ if (mac) -+ memcpy (priv->initial_hw_addr, mac, ETH_ALEN); - - mac_str = nm_utils_hwaddr_ntoa (priv->initial_hw_addr, ARPHRD_ETHER); - nm_log_dbg (LOGD_DEVICE | LOGD_ETHER, "(%s): read initial MAC address %s", -@@ -1219,7 +1219,7 @@ update_connection (NMDevice *device, NMConnection *connection) - { - NMSettingWired *s_wired = nm_connection_get_setting_wired (connection); - guint maclen; -- gconstpointer mac = nm_device_get_hw_address (device, &maclen); -+ const guint8 *mac = nm_device_get_hw_address (device, &maclen); - - if (!s_wired) { - s_wired = (NMSettingWired *) nm_setting_wired_new (); --- -1.7.11.7 - diff --git a/rh1029213-debug-netlink-add-errors.patch b/rh1029213-debug-netlink-add-errors.patch deleted file mode 100644 index 3609960..0000000 --- a/rh1029213-debug-netlink-add-errors.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 2086cab1273b26630840e3a0c092e8b1617e803b Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Wed, 13 Nov 2013 20:06:39 -0600 -Subject: [PATCH] platform: dump objects that fail to be added (rh #1029213) - -Attempt to figure out why the objects fail. ---- - src/platform/nm-linux-platform.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c -index a35b0cc..d13abbe 100644 ---- a/src/platform/nm-linux-platform.c -+++ b/src/platform/nm-linux-platform.c -@@ -1100,27 +1100,32 @@ refresh_object (NMPlatform *platform, struct nl_object *object, gboolean removed - /* Decreases the reference count if @obj for convenience */ - static gboolean - add_object (NMPlatform *platform, struct nl_object *obj) - { - auto_nl_object struct nl_object *object = obj; - NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (platform); - int nle; -+ struct nl_dump_params dp = { -+ .dp_type = NL_DUMP_DETAILS, -+ .dp_fd = stderr, -+ }; - - nle = add_kernel_object (priv->nlh, object); - - /* NLE_EXIST is considered equivalent to success to avoid race conditions. You - * never know when something sends an identical object just before - * NetworkManager. - */ - switch (nle) { - case -NLE_SUCCESS: - case -NLE_EXIST: - break; - default: - error ("Netlink error: %s", nl_geterror (nle)); -+ nl_object_dump (object, &dp); - return FALSE; - } - - return refresh_object (platform, object, FALSE, NM_PLATFORM_REASON_INTERNAL); - } - - /* Decreases the reference count if @obj for convenience */ --- -1.8.3.1 - diff --git a/rh1029213-ignore-RA-default-routes.patch b/rh1029213-ignore-RA-default-routes.patch deleted file mode 100644 index e5b06d4..0000000 --- a/rh1029213-ignore-RA-default-routes.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 8586353b09460ec0a619058421743dd7d424a75d Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Wed, 20 Nov 2013 13:40:07 -0600 -Subject: [PATCH] core: ignore RA-provided default routes (rh #1029213) - -The router has no idea what the local configuration or user preferences are, -so sending routes with a prefix length of 0 is at best misinformed and at -worst breaks things. The kernel also ignores plen=0 routes in its in-kernel -RA processing code in net/ipv6/ndisc.c. - -https://bugzilla.redhat.com/show_bug.cgi?id=1029213 ---- - src/devices/nm-device.c | 16 +++++++++++----- - 1 file changed, 11 insertions(+), 5 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index f03ecbb..d92a94b 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3283,20 +3283,26 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device - /* Rebuild route list from router discovery cache. */ - nm_ip6_config_reset_routes (priv->ac_ip6_config); - - for (i = 0; i < rdisc->routes->len; i++) { - NMRDiscRoute *discovered_route = &g_array_index (rdisc->routes, NMRDiscRoute, i); - NMPlatformIP6Route route; - -- memset (&route, 0, sizeof (route)); -- route.network = discovered_route->network; -- route.plen = discovered_route->plen; -- route.gateway = discovered_route->gateway; -+ /* Only accept non-default routes. The router has no idea what the -+ * local configuration or user preferences are, so sending routes -+ * with a prefix length of 0 is quite rude and thus ignored. -+ */ -+ if (discovered_route->plen > 0) { -+ memset (&route, 0, sizeof (route)); -+ route.network = discovered_route->network; -+ route.plen = discovered_route->plen; -+ route.gateway = discovered_route->gateway; - -- nm_ip6_config_add_route (priv->ac_ip6_config, &route); -+ nm_ip6_config_add_route (priv->ac_ip6_config, &route); -+ } - } - } - - if (changed & NM_RDISC_CONFIG_DNS_SERVERS) { - /* Rebuild DNS server list from router discovery cache. */ - nm_ip6_config_reset_nameservers (priv->ac_ip6_config); - --- -1.8.3.1 - -From 6e73f01b6e69f44f8d9da4872fb796b9d80acac1 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Tue, 3 Dec 2013 14:12:55 -0600 -Subject: [PATCH] platform: fix possible out-of-bounds access with RA route - masking - -If the prefix length was 128, that could cause an access beyond the -end of the array. Found by Thomas Haller. ---- - src/rdisc/nm-lndp-rdisc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c -index abcc3c2..3299b32 100644 ---- a/src/rdisc/nm-lndp-rdisc.c -+++ b/src/rdisc/nm-lndp-rdisc.c -@@ -411,17 +411,21 @@ set_address_masked (struct in6_addr *dst, struct in6_addr *src, guint8 plen) - guint nbytes = plen / 8; - guint nbits = plen % 8; - - g_return_if_fail (plen <= 128); - g_assert (src); - g_assert (dst); - -- memset (dst, 0, sizeof (*dst)); -- memcpy (dst, src, nbytes); -- dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits))); -+ if (plen >= 128) -+ *dst = *src; -+ else { -+ memset (dst, 0, sizeof (*dst)); -+ memcpy (dst, src, nbytes); -+ dst->s6_addr[nbytes] = (src->s6_addr[nbytes] & (0xFF << (8 - nbits))); -+ } - } - - static int - receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) - { - NMRDisc *rdisc = (NMRDisc *) user_data; - NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc); --- -1.8.3.1 - diff --git a/rh1030068-vpn-tunnel-interface.patch b/rh1030068-vpn-tunnel-interface.patch deleted file mode 100644 index ffb0e00..0000000 --- a/rh1030068-vpn-tunnel-interface.patch +++ /dev/null @@ -1,293 +0,0 @@ -From d7c369712b9e6298d62303899e372ab7d27a92d9 Mon Sep 17 00:00:00 2001 -From: Dan Williams -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š ---- - 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 - diff --git a/rh1030403-editor-crash-remote-connection.patch b/rh1030403-editor-crash-remote-connection.patch deleted file mode 100644 index 5fcc7f7..0000000 --- a/rh1030403-editor-crash-remote-connection.patch +++ /dev/null @@ -1,45 +0,0 @@ -From fbcabeb7f72b710a790ca8617f7406a1ba7cf5be Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 18 Nov 2013 22:20:05 +0100 -Subject: [PATCH] libnm-glib: fix crash by taking additional ref in - nm-remote-connection/result_cb -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -result_cb invokes a function pointer provided by the user. Nothing prevents -the user from destroying the NMRemoteConnection in the callback, which leads -to a crash. Take an additional ref of NMRemoteConnection to keep it -alive. - -This probably caused a crash for nm-applet: -https://bugzilla.redhat.com/show_bug.cgi?id=1030403 - -Signed-off-by: Thomas Haller -Signed-off-by: Jiří Klimeš ---- - 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 a03a44b..73a2cc8 100644 ---- a/libnm-glib/nm-remote-connection.c -+++ b/libnm-glib/nm-remote-connection.c -@@ -137,12 +137,14 @@ result_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data) - RemoteCall *call = user_data; - NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc) call->callback; - GError *error = NULL; -+ NMRemoteConnection *self = g_object_ref (call->self); - - dbus_g_proxy_end_call (proxy, proxy_call, &error, G_TYPE_INVALID); - if (func) - (*func) (call->self, error, call->user_data); - g_clear_error (&error); - remote_call_complete (call->self, call); -+ g_object_unref (self); - } - - /** --- -1.7.11.7 - diff --git a/rh1031170-bridge-port-crash.patch b/rh1031170-bridge-port-crash.patch deleted file mode 100644 index 01f980d..0000000 --- a/rh1031170-bridge-port-crash.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 8a046bedbbf8218737d7471f949a541b35579539 Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Fri, 11 Oct 2013 18:25:20 +0200 -Subject: [PATCH] core: fix crash for bridge-slave with missing - NMSettingBridgePort setting - -Signed-off-by: Thomas Haller ---- - src/devices/nm-device-bridge.c | 29 ++++++++++++++++++----------- - 1 file changed, 18 insertions(+), 11 deletions(-) - -diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c -index 69e976c..2018e93 100644 ---- a/src/devices/nm-device-bridge.c -+++ b/src/devices/nm-device-bridge.c -@@ -203,7 +203,7 @@ static const Option slave_options[] = { - }; - - static void --commit_option (NMDevice *device, GObject *setting, const Option *option, gboolean slave) -+commit_option (NMDevice *device, NMSetting *setting, const Option *option, gboolean slave) - { - int ifindex = nm_device_get_ifindex (device); - GParamSpec *pspec; -@@ -211,12 +211,14 @@ commit_option (NMDevice *device, GObject *setting, const Option *option, gboolea - guint32 uval = 0; - gs_free char *value = NULL; - -+ g_assert (setting); -+ - pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (setting), option->name); - g_assert (pspec); - - /* Get the property's value */ - g_value_init (&val, G_PARAM_SPEC_VALUE_TYPE (pspec)); -- g_object_get_property (setting, option->name, &val); -+ g_object_get_property ((GObject *) setting, option->name, &val); - if (G_VALUE_HOLDS_BOOLEAN (&val)) - uval = g_value_get_boolean (&val) ? 1 : 0; - else if (G_VALUE_HOLDS_UINT (&val)) { -@@ -251,25 +253,30 @@ commit_option (NMDevice *device, GObject *setting, const Option *option, gboolea - } - - static void --commit_master_options (NMDevice *device, GObject *setting) -+commit_master_options (NMDevice *device, NMSettingBridge *setting) - { - const Option *option; -- -- g_assert (setting); -+ NMSetting *s = NM_SETTING (setting); - - for (option = master_options; option->name; option++) -- commit_option (device, setting, option, FALSE); -+ commit_option (device, s, option, FALSE); - } - - static void --commit_slave_options (NMDevice *device, GObject *setting) -+commit_slave_options (NMDevice *device, NMSettingBridgePort *setting) - { - const Option *option; -+ NMSetting *s, *s_clear = NULL; - -- g_assert (setting); -+ if (setting) -+ s = NM_SETTING (setting); -+ else -+ s = s_clear = nm_setting_bridge_port_new (); - - for (option = slave_options; option->name; option++) -- commit_option (device, setting, option, TRUE); -+ commit_option (device, s, option, TRUE); -+ -+ g_clear_object (&s_clear); - } - - static NMActStageReturn -@@ -284,7 +291,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason) - if (ret != NM_ACT_STAGE_RETURN_SUCCESS) - return ret; - -- commit_master_options (device, (GObject *) nm_connection_get_setting_bridge (connection)); -+ commit_master_options (device, nm_connection_get_setting_bridge (connection)); - - return NM_ACT_STAGE_RETURN_SUCCESS; - } -@@ -295,7 +302,7 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection) - if (!nm_platform_link_enslave (nm_device_get_ip_ifindex (device), nm_device_get_ip_ifindex (slave))) - return FALSE; - -- commit_slave_options (slave, (GObject *) nm_connection_get_setting_bridge_port (connection)); -+ commit_slave_options (slave, nm_connection_get_setting_bridge_port (connection)); - - nm_log_info (LOGD_BRIDGE, "(%s): attached bridge port %s", - nm_device_get_ip_iface (device), --- -1.8.4.2 - diff --git a/rh1031574-primary-connection.patch b/rh1031574-primary-connection.patch deleted file mode 100644 index f137be4..0000000 --- a/rh1031574-primary-connection.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 00b29b6c61c0b7bff874a1a440f59c782ea7f83d Mon Sep 17 00:00:00 2001 -From: Dan Winship -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 - diff --git a/rh1032819-set-broadcast-address.patch b/rh1032819-set-broadcast-address.patch deleted file mode 100644 index dd3c0fb..0000000 --- a/rh1032819-set-broadcast-address.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 7eb12a5b21f87d7592ec2c5235d1ed90c4fac132 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Tue, 3 Dec 2013 11:42:28 -0600 -Subject: [PATCH] platform: set IPv4 broadcast address too (rh #1032819) - -When moving over the platform, setting of the IPv4 broadcast address -got lost. Bring it back. - -https://bugzilla.redhat.com/show_bug.cgi?id=1032819 ---- - src/platform/nm-linux-platform.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - -diff --git a/src/platform/nm-linux-platform.c b/src/platform/nm-linux-platform.c -index 8f0e077..3f57925 100644 ---- a/src/platform/nm-linux-platform.c -+++ b/src/platform/nm-linux-platform.c -@@ -2213,14 +2213,33 @@ ip6_address_get_all (NMPlatform *platform, int ifindex) - nl_object_unmark (object); - } - } - - return addresses; - } - -+static void -+addr4_to_broadcast (struct in_addr *dst, const struct in_addr *src, guint8 plen) -+{ -+ guint nbytes = plen / 8; -+ guint nbits = plen % 8; -+ -+ g_return_if_fail (plen <= 32); -+ g_assert (src); -+ g_assert (dst); -+ -+ if (plen >= 32) -+ *dst = *src; -+ else { -+ dst->s_addr = 0xFFFFFFFF; -+ memcpy (dst, src, nbytes); -+ ((guint8 *) dst)[nbytes] = (((const guint8 *) src)[nbytes] | (0xFF >> nbits)); -+ } -+} -+ - static struct nl_object * - build_rtnl_addr (int family, - int ifindex, - gconstpointer addr, - gconstpointer peer_addr, - int plen, - guint32 lifetime, -@@ -2230,18 +2249,31 @@ build_rtnl_addr (int family, - struct rtnl_addr *rtnladdr = rtnl_addr_alloc (); - int addrlen = family == AF_INET ? sizeof (in_addr_t) : sizeof (struct in6_addr); - auto_nl_addr struct nl_addr *nladdr = nl_addr_build (family, addr, addrlen); - int nle; - - g_assert (rtnladdr && nladdr); - -+ /* IP address */ - rtnl_addr_set_ifindex (rtnladdr, ifindex); - nle = rtnl_addr_set_local (rtnladdr, nladdr); - g_assert (!nle); - -+ /* IPv4 Broadcast address */ -+ if (family == AF_INET) { -+ struct in_addr bcast; -+ auto_nl_addr struct nl_addr *bcaddr = NULL; -+ -+ addr4_to_broadcast (&bcast, addr, plen); -+ bcaddr = nl_addr_build (family, &bcast, addrlen); -+ g_assert (bcaddr); -+ rtnl_addr_set_broadcast (rtnladdr, bcaddr); -+ } -+ -+ /* Peer/point-to-point address */ - if (peer_addr) { - auto_nl_addr struct nl_addr *nlpeer = nl_addr_build (family, peer_addr, addrlen); - - nle = rtnl_addr_set_peer (rtnladdr, nlpeer); - g_assert (!nle); - } - --- -1.8.3.1 - diff --git a/rh1034921-startup-link-wait.patch b/rh1034921-startup-link-wait.patch deleted file mode 100644 index d851b1f..0000000 --- a/rh1034921-startup-link-wait.patch +++ /dev/null @@ -1,833 +0,0 @@ -From 07281f21a71fa333288821ad863accfeedfff567 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Mon, 9 Dec 2013 12:55:04 -0600 -Subject: [PATCH] core: delay startup complete until carrier is found or - timeout (rh #1034921) (rh #1030583) - ---- - src/devices/nm-device.c | 177 ++++++++++++++++++++++++++++++++++----------- - src/nm-active-connection.c | 8 ++ - 2 files changed, 142 insertions(+), 43 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index 578ccb0..96a5d44 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -184,15 +184,15 @@ typedef struct { - gboolean initialized; - gboolean in_state_changed; - - NMDeviceState state; - NMDeviceStateReason state_reason; - QueuedState queued_state; - guint queued_ip_config_id; -- guint pending_actions; -+ GArray *pending_actions; - - char * udi; - char * path; - char * iface; /* may change, could be renamed by user */ - int ifindex; - gboolean is_software; - char * ip_iface; -@@ -224,14 +224,15 @@ typedef struct { - gpointer act_source6_func; - - /* Link stuff */ - guint link_connected_id; - guint link_disconnected_id; - guint carrier_defer_id; - gboolean carrier; -+ guint carrier_wait_id; - gboolean ignore_carrier; - - /* Generic DHCP stuff */ - NMDHCPManager * dhcp_manager; - guint32 dhcp_timeout; - GByteArray * dhcp_anycast_address; - -@@ -390,14 +391,15 @@ nm_device_init (NMDevice *self) - priv->capabilities = NM_DEVICE_CAP_NM_SUPPORTED; - priv->state = NM_DEVICE_STATE_UNMANAGED; - priv->state_reason = NM_DEVICE_STATE_REASON_NONE; - priv->dhcp_timeout = 0; - priv->rfkill_type = RFKILL_TYPE_UNKNOWN; - priv->autoconnect = DEFAULT_AUTOCONNECT; - priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); -+ priv->pending_actions = g_array_sized_new (FALSE, TRUE, sizeof (GQuark), 5); - } - - static void - update_accept_ra_save (NMDevice *self) - { - NMDevicePrivate *priv; - const char *ip_iface; -@@ -1154,14 +1156,20 @@ nm_device_set_carrier (NMDevice *device, gboolean carrier) - if (priv->carrier) { - nm_log_info (LOGD_DEVICE, "(%s): link connected", iface); - if (priv->carrier_defer_id) { - g_source_remove (priv->carrier_defer_id); - priv->carrier_defer_id = 0; - } - klass->carrier_changed (device, TRUE); -+ -+ if (priv->carrier_wait_id) { -+ g_source_remove (priv->carrier_wait_id); -+ priv->carrier_wait_id = 0; -+ nm_device_remove_pending_action (device, "carrier wait"); -+ } - } else if (state <= NM_DEVICE_STATE_DISCONNECTED) { - nm_log_info (LOGD_DEVICE, "(%s): link disconnected", iface); - klass->carrier_changed (device, FALSE); - } else { - nm_log_info (LOGD_DEVICE, "(%s): link disconnected (deferring action for %d seconds)", - iface, LINK_DISCONNECT_DELAY); - priv->carrier_defer_id = g_timeout_add_seconds (LINK_DISCONNECT_DELAY, -@@ -5110,17 +5118,28 @@ nm_device_start_ip_check (NMDevice *self) - /* If no ping was started, just advance to SECONDARIES */ - if (!priv->gw_ping.pid) - nm_device_queue_state (self, NM_DEVICE_STATE_SECONDARIES, NM_DEVICE_STATE_REASON_NONE); - } - - /****************************************************************/ - -+static gboolean -+carrier_wait_timeout (gpointer user_data) -+{ -+ NMDevice *self = NM_DEVICE (user_data); -+ -+ NM_DEVICE_GET_PRIVATE (self)->carrier_wait_id = 0; -+ nm_device_remove_pending_action (self, "carrier wait"); -+ return G_SOURCE_REMOVE; -+} -+ - gboolean - nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware) - { -+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - gboolean success; - guint32 tries = 0; - - g_return_val_if_fail (NM_IS_DEVICE (self), FALSE); - - if (nm_device_is_up (self)) - goto out; -@@ -5138,14 +5157,28 @@ nm_device_bring_up (NMDevice *self, gboolean block, gboolean *no_firmware) - g_usleep (200); - - if (!nm_device_is_up (self)) { - nm_log_warn (LOGD_HW, "(%s): device not up after timeout!", nm_device_get_iface (self)); - return FALSE; - } - -+ /* Devices that support carrier detect must be IFF_UP to report carrier -+ * changes; so after setting the device IFF_UP we must suppress startup -+ * complete (via a pending action) until either the carrier turns on, or -+ * a timeout is reached. -+ */ -+ if (device_has_capability (self, NM_DEVICE_CAP_CARRIER_DETECT)) { -+ if (priv->carrier_wait_id) { -+ g_source_remove (priv->carrier_wait_id); -+ nm_device_remove_pending_action (self, "carrier wait"); -+ } -+ priv->carrier_wait_id = g_timeout_add_seconds (5, carrier_wait_timeout, self); -+ nm_device_add_pending_action (self, "carrier wait"); -+ } -+ - out: - /* Can only get HW address of some devices when they are up */ - nm_device_update_hw_address (self); - - _update_ip4_address (self); - return TRUE; - } -@@ -5301,14 +5334,19 @@ dispose (GObject *object) - } - - if (priv->cp_updated_id) { - g_signal_handler_disconnect (priv->con_provider, priv->cp_updated_id); - priv->cp_updated_id = 0; - } - -+ if (priv->carrier_wait_id) { -+ g_source_remove (priv->carrier_wait_id); -+ priv->carrier_wait_id = 0; -+ } -+ - g_hash_table_unref (priv->available_connections); - priv->available_connections = NULL; - - activation_source_clear (self, TRUE, AF_INET); - activation_source_clear (self, TRUE, AF_INET6); - - clear_act_request (self); -@@ -5331,14 +5369,17 @@ finalize (GObject *object) - - if (priv->dhcp_manager) - g_object_unref (priv->dhcp_manager); - - if (priv->fw_manager) - g_object_unref (priv->fw_manager); - -+ g_array_free (priv->pending_actions, TRUE); -+ priv->pending_actions = NULL; -+ - g_free (priv->udi); - g_free (priv->path); - g_free (priv->iface); - g_free (priv->ip_iface); - g_free (priv->driver); - g_free (priv->driver_version); - g_free (priv->firmware_version); -@@ -5931,46 +5972,54 @@ nm_device_set_firmware_missing (NMDevice *self, gboolean new_missing) - - gboolean - nm_device_get_firmware_missing (NMDevice *self) - { - return NM_DEVICE_GET_PRIVATE (self)->firmware_missing; - } - -+#define QUEUED_PREFIX "queued state change to " -+ - static const char * --state_to_string (NMDeviceState state) -+queued_state_to_string (NMDeviceState state) - { - switch (state) { - case NM_DEVICE_STATE_UNMANAGED: -- return "unmanaged"; -+ return QUEUED_PREFIX "unmanaged"; - case NM_DEVICE_STATE_UNAVAILABLE: -- return "unavailable"; -+ return QUEUED_PREFIX "unavailable"; - case NM_DEVICE_STATE_DISCONNECTED: -- return "disconnected"; -+ return QUEUED_PREFIX "disconnected"; - case NM_DEVICE_STATE_PREPARE: -- return "prepare"; -+ return QUEUED_PREFIX "prepare"; - case NM_DEVICE_STATE_CONFIG: -- return "config"; -+ return QUEUED_PREFIX "config"; - case NM_DEVICE_STATE_NEED_AUTH: -- return "need-auth"; -+ return QUEUED_PREFIX "need-auth"; - case NM_DEVICE_STATE_IP_CONFIG: -- return "ip-config"; -+ return QUEUED_PREFIX "ip-config"; - case NM_DEVICE_STATE_IP_CHECK: -- return "ip-check"; -+ return QUEUED_PREFIX "ip-check"; - case NM_DEVICE_STATE_SECONDARIES: -- return "secondaries"; -+ return QUEUED_PREFIX "secondaries"; - case NM_DEVICE_STATE_ACTIVATED: -- return "activated"; -+ return QUEUED_PREFIX "activated"; - case NM_DEVICE_STATE_DEACTIVATING: -- return "deactivating"; -+ return QUEUED_PREFIX "deactivating"; - case NM_DEVICE_STATE_FAILED: -- return "failed"; -+ return QUEUED_PREFIX "failed"; - default: - break; - } -- return "unknown"; -+ return QUEUED_PREFIX "unknown"; -+} -+ -+static const char * -+state_to_string (NMDeviceState state) -+{ -+ return queued_state_to_string (state) + strlen (QUEUED_PREFIX); - } - - static const char * - reason_to_string (NMDeviceStateReason reason) - { - switch (reason) { - case NM_DEVICE_STATE_REASON_NONE: -@@ -6083,21 +6132,14 @@ reason_to_string (NMDeviceStateReason reason) - return "secondary-connection-failed"; - default: - break; - } - return "unknown"; - } - --static inline gboolean --state_implies_pending_action (NMDeviceState state) --{ -- return ( state >= NM_DEVICE_STATE_PREPARE -- && state < NM_DEVICE_STATE_ACTIVATED); --} -- - void - nm_device_state_changed (NMDevice *device, - NMDeviceState state, - NMDeviceStateReason reason) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - NMDeviceState old_state; -@@ -6131,18 +6173,14 @@ nm_device_state_changed (NMDevice *device, - return; - } - - old_state = priv->state; - priv->state = state; - priv->state_reason = reason; - -- if ( state_implies_pending_action (state) -- && !state_implies_pending_action (old_state)) -- nm_device_add_pending_action (device, "activation"); -- - nm_log_info (LOGD_DEVICE, "(%s): device state change: %s -> %s (reason '%s') [%d %d %d]", - nm_device_get_iface (device), - state_to_string (old_state), - state_to_string (state), - reason_to_string (reason), - old_state, - state, -@@ -6300,18 +6338,14 @@ 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); - - /* Dispose of the cached activation request */ - if (req) - g_object_unref (req); - -- if ( state_implies_pending_action (old_state) -- && !state_implies_pending_action (state)) -- nm_device_remove_pending_action (device, "activation"); -- - priv->in_state_changed = FALSE; - } - - static gboolean - queued_set_state (gpointer user_data) - { - NMDevice *self = NM_DEVICE (user_data); -@@ -6330,15 +6364,15 @@ queued_set_state (gpointer user_data) - */ - priv->queued_state.id = 0; - new_state = priv->queued_state.state; - new_reason = priv->queued_state.reason; - nm_device_queued_state_clear (self); - - nm_device_state_changed (self, new_state, new_reason); -- nm_device_remove_pending_action (self, "queued state change"); -+ nm_device_remove_pending_action (self, queued_state_to_string (new_state)); - } else { - g_warn_if_fail (priv->queued_state.state == NM_DEVICE_STATE_UNKNOWN); - g_warn_if_fail (priv->queued_state.reason == NM_DEVICE_STATE_REASON_NONE); - } - return FALSE; - } - -@@ -6349,29 +6383,37 @@ nm_device_queue_state (NMDevice *self, - { - NMDevicePrivate *priv; - - g_return_if_fail (NM_IS_DEVICE (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"); -+ - /* 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_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 change"); -+ 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), - priv->queued_state.id); - } - - NMDeviceState -@@ -6391,15 +6433,15 @@ nm_device_queued_state_clear (NMDevice *self) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - - if (priv->queued_state.id) { - nm_log_dbg (LOGD_DEVICE, "(%s): clearing queued state transition (id %d)", - nm_device_get_iface (self), priv->queued_state.id); - g_source_remove (priv->queued_state.id); -- nm_device_remove_pending_action (self, "queued state change"); -+ nm_device_remove_pending_action (self, queued_state_to_string (priv->queued_state.state)); - } - memset (&priv->queued_state, 0, sizeof (priv->queued_state)); - } - - NMDeviceState - nm_device_get_state (NMDevice *device) - { -@@ -7102,40 +7144,89 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, - } - nm_device_bring_up (device, TRUE, NULL); - g_free (mac_str); - - return success; - } - -+/** -+ * nm_device_add_pending_action(): -+ * @device: the #NMDevice to add the pending action to -+ * @action: a static string that identifies the action -+ * -+ * Adds a pending action to the device. -+ */ - void - nm_device_add_pending_action (NMDevice *device, const char *action) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); -+ GQuark qaction; -+ guint i; - -- priv->pending_actions++; -- nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): %s", -- nm_device_get_iface (device), priv->pending_actions, action); -+ qaction = g_quark_from_static_string (action); - -- if (priv->pending_actions == 1) -+ /* Shouldn't ever add the same pending action twice */ -+ for (i = 0; i < priv->pending_actions->len; i++) { -+ if (qaction == g_array_index (priv->pending_actions, GQuark, i)) { -+ nm_log_warn (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already added", -+ nm_device_get_iface (device), -+ priv->pending_actions->len, -+ action); -+ g_warn_if_reached (); -+ return; -+ } -+ } -+ -+ g_array_prepend_val (priv->pending_actions, qaction); -+ nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s'", -+ nm_device_get_iface (device), -+ priv->pending_actions->len, -+ action); -+ -+ if (priv->pending_actions->len == 1) - g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); - } - -+/** -+ * nm_device_remove_pending_action(): -+ * @device: the #NMDevice to remove the pending action from -+ * @action: a static string that identifies the action -+ * -+ * Removes a pending action previously added by nm_device_add_pending_action(). -+ */ - void - nm_device_remove_pending_action (NMDevice *device, const char *action) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); -+ GQuark qaction; -+ guint i; - -- priv->pending_actions--; -- nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): %s", -- nm_device_get_iface (device), priv->pending_actions, action); -+ qaction = g_quark_from_static_string (action); - -- if (priv->pending_actions == 0) -- g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); -+ /* Shouldn't ever add the same pending action twice */ -+ for (i = 0; i < priv->pending_actions->len; i++) { -+ if (qaction == g_array_index (priv->pending_actions, GQuark, i)) { -+ g_array_remove_index_fast (priv->pending_actions, i); -+ nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s'", -+ nm_device_get_iface (device), -+ priv->pending_actions->len, -+ action); -+ -+ if (priv->pending_actions->len == 0) -+ g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); -+ return; -+ } -+ } -+ -+ nm_log_warn (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' never added", -+ nm_device_get_iface (device), -+ priv->pending_actions->len, -+ action); - } - - gboolean - nm_device_has_pending_action (NMDevice *device) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - -- return priv->pending_actions > 0; -+ return priv->pending_actions->len > 0; - } -diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c -index 6a825bc..34f438c 100644 ---- a/src/nm-active-connection.c -+++ b/src/nm-active-connection.c -@@ -135,14 +135,20 @@ nm_active_connection_set_state (NMActiveConnection *self, - - if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED - || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (priv->connection), - (guint64) time (NULL), TRUE); - } - -+ if (priv->device) { -+ if ( old_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATED -+ && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED) -+ nm_device_remove_pending_action (priv->device, "activation"); -+ } -+ - if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { - /* Device is no longer relevant when deactivated */ - g_clear_object (&priv->device); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); - } - } - -@@ -262,8 +268,10 @@ set_property (GObject *object, guint pro - case PROP_INT_DEVICE: - g_warn_if_fail (priv->device == NULL); - priv->device = g_value_dup_object (value); -- if (priv->device) -+ if (priv->device) { - g_warn_if_fail (priv->device != priv->master); -+ nm_device_add_pending_action (priv->device, "activation"); -+ } - break; - case PROP_INT_USER_REQUESTED: - priv->user_requested = g_value_get_boolean (value); --- -1.8.3.1 - -From 813ea5995bb5a35c115c46f30eefe18db2886afb Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 16 Dec 2013 16:52:36 +0100 -Subject: [PATCH 1/2] core: allow dynamic strings for pending action names - -Use a GSList of the string values, instead of an array of GQuarks. -Using GQuarks does not allow to add arbitrary strings, because they -would leak the internalized strings. The next patch will begin -using unique, non-const action strings. - -Given the rather small number of expected pending states, a singly -linked list seems appropriate. - -Signed-off-by: Thomas Haller - -(some fixes and simplifications by dcbw based on patch reviews) ---- - src/devices/nm-device.c | 49 +++++++++++++++++++++++++------------------------ - 1 file changed, 25 insertions(+), 24 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index c1c7c69..e4644bf 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -184,15 +184,15 @@ typedef struct { - gboolean initialized; - gboolean in_state_changed; - - NMDeviceState state; - NMDeviceStateReason state_reason; - QueuedState queued_state; - guint queued_ip_config_id; -- GArray *pending_actions; -+ GSList *pending_actions; - - char * udi; - char * path; - char * iface; /* may change, could be renamed by user */ - int ifindex; - gboolean is_software; - char * ip_iface; -@@ -391,15 +391,14 @@ nm_device_init (NMDevice *self) - priv->capabilities = NM_DEVICE_CAP_NM_SUPPORTED; - priv->state = NM_DEVICE_STATE_UNMANAGED; - priv->state_reason = NM_DEVICE_STATE_REASON_NONE; - priv->dhcp_timeout = 0; - priv->rfkill_type = RFKILL_TYPE_UNKNOWN; - priv->autoconnect = DEFAULT_AUTOCONNECT; - priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL); -- priv->pending_actions = g_array_sized_new (FALSE, TRUE, sizeof (GQuark), 5); - } - - static void - update_accept_ra_save (NMDevice *self) - { - NMDevicePrivate *priv; - const char *ip_iface; -@@ -5368,16 +5367,15 @@ finalize (GObject *object) - - if (priv->dhcp_manager) - g_object_unref (priv->dhcp_manager); - - if (priv->fw_manager) - g_object_unref (priv->fw_manager); - -- g_array_free (priv->pending_actions, TRUE); -- priv->pending_actions = NULL; -+ g_slist_free_full (priv->pending_actions, g_free); - - g_free (priv->udi); - g_free (priv->path); - g_free (priv->iface); - g_free (priv->ip_iface); - g_free (priv->driver); - g_free (priv->driver_version); -@@ -7153,78 +7152,80 @@ nm_device_set_hw_addr (NMDevice *device, const guint8 *addr, - * - * Adds a pending action to the device. - */ - void - nm_device_add_pending_action (NMDevice *device, const char *action) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); -- GQuark qaction; -- guint i; -+ GSList *iter; -+ guint count; - -- qaction = g_quark_from_static_string (action); -+ g_return_if_fail (action); - - /* Shouldn't ever add the same pending action twice */ -- for (i = 0; i < priv->pending_actions->len; i++) { -- if (qaction == g_array_index (priv->pending_actions, GQuark, i)) { -+ for (iter = priv->pending_actions; iter; iter = iter->next) { -+ if (!strcmp (action, iter->data)) { - nm_log_warn (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s' already added", - nm_device_get_iface (device), -- priv->pending_actions->len, -+ g_slist_length (priv->pending_actions), - action); -- g_warn_if_reached (); -- return; -+ g_return_val_if_reached (FALSE); - } - } - -- g_array_prepend_val (priv->pending_actions, qaction); -+ priv->pending_actions = g_slist_append (priv->pending_actions, g_strdup (action)); -+ count = g_slist_length (priv->pending_actions); -+ - nm_log_dbg (LOGD_DEVICE, "(%s): add_pending_action (%d): '%s'", - nm_device_get_iface (device), -- priv->pending_actions->len, -+ count, - action); - -- if (priv->pending_actions->len == 1) -+ if (count == 1) - g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); - } - - /** - * nm_device_remove_pending_action(): - * @device: the #NMDevice to remove the pending action from - * @action: a static string that identifies the action - * - * Removes a pending action previously added by nm_device_add_pending_action(). - */ - void - nm_device_remove_pending_action (NMDevice *device, const char *action) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); -- GQuark qaction; -- guint i; -+ GSList *iter; - -- qaction = g_quark_from_static_string (action); -+ g_return_if_fail (action); - - /* Shouldn't ever add the same pending action twice */ -- for (i = 0; i < priv->pending_actions->len; i++) { -- if (qaction == g_array_index (priv->pending_actions, GQuark, i)) { -- g_array_remove_index_fast (priv->pending_actions, i); -+ for (iter = priv->pending_actions; iter; iter = iter->next) { -+ if (!strcmp (action, iter->data)) { -+ g_free (iter->data); -+ priv->pending_actions = g_slist_delete_link (priv->pending_actions, iter); - nm_log_dbg (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s'", - nm_device_get_iface (device), -- priv->pending_actions->len, -+ g_slist_length (priv->pending_actions), - action); - -- if (priv->pending_actions->len == 0) -+ if (priv->pending_actions == NULL) - g_object_notify (G_OBJECT (device), NM_DEVICE_HAS_PENDING_ACTION); - return; - } - } - - nm_log_warn (LOGD_DEVICE, "(%s): remove_pending_action (%d): '%s' never added", - nm_device_get_iface (device), -- priv->pending_actions->len, -+ g_slist_length (priv->pending_actions), - action); -+ g_return_if_reached (); - } - - gboolean - nm_device_has_pending_action (NMDevice *device) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (device); - -- return priv->pending_actions->len > 0; -+ return !!priv->pending_actions; - } --- -1.8.3.1 - -From b6ef165cfefba44a496cc336e1f91bb93b28f3ff Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Mon, 16 Dec 2013 15:02:38 +0100 -Subject: [PATCH 2/2] core: fix NMActiveConnection to properly add/remove - pending action "activation" - -When a new activation request is received, NetworkManager creates a new -NMActiveConnection to track that request. The device may already be activated, -in which case NetworkManager stops the old activation and starts the new one, -but both exist in parallel for a short period of time. If the old -NMActiveConnection is activating and already has a pending 'activation' -action, when the new NMActiveConnection adds its own 'activating' action, -they will clash. This is fixed by making each NMActiveConnection's activation -pending action uniquely named. - -This fixes a g_warning with the following back trace: - - #0 0x000000328224edfd in g_logv () from /lib64/libglib-2.0.so.0 - #1 0x000000328224efe2 in g_log () from /lib64/libglib-2.0.so.0 - #2 0x000000328224f2e6 in g_warn_message () from /lib64/libglib-2.0.so.0 - #3 0x0000000000440aee in nm_device_add_pending_action (device=0x14002e0, action=0x50704a "activation") at devices/nm-device.c:7172 - #4 0x000000000047525c in nm_active_connection_set_device (self=0x141b3c0, device=0x14002e0) at nm-active-connection.c:364 - #5 0x0000000000475ec1 in set_property (object=0x141b3c0, prop_id=11, value=0x7fff7ff36c20, pspec=0x1405f70) at nm-active-connection.c:647 - #6 0x0000003282615d3e in g_object_newv () from /lib64/libgobject-2.0.so.0 - #7 0x00000032826162e6 in g_object_new_valist () from /lib64/libgobject-2.0.so.0 - #8 0x0000003282616654 in g_object_new () from /lib64/libgobject-2.0.so.0 - #9 0x0000000000474193 in nm_act_request_new (connection=0x13bb0e0, specific_object=0x0, subject=0x1447740, device=0x14002e0) at nm-activation-request.c:376 - #10 0x000000000048e477 in _new_active_connection (self=0x13e8060, connection=0x13bb0e0, specific_object=0x0, device=0x14002e0, subject=0x1447740, error=0x7fff7ff36f90) at nm-manager.c:2947 - #11 0x000000000048ed77 in impl_manager_activate_connection (self=0x13e8060, connection_path=0x134d590 "/org/freedesktop/NetworkManager/Settings/9", device_path=0x134d550 "/org/freedesktop/NetworkManager/Devices/1", - specific_object_path=0x0, context=0x143a9b0) at nm-manager.c:3206 - #12 0x00000000004876c8 in dbus_glib_marshal_nm_manager_VOID__BOXED_BOXED_BOXED_POINTER (closure=0x7fff7ff37220, return_value=0x0, n_param_values=5, param_values=0x1448830, invocation_hint=0x0, - marshal_data=0x48e9dd ) at nm-manager-glue.h:189 - #13 0x0000003284a0d6a9 in object_registration_message () from /lib64/libdbus-glib-1.so.2 - #14 0x000000348ea1ce66 in _dbus_object_tree_dispatch_and_unlock () from /lib64/libdbus-1.so.3 - #15 0x000000348ea0fa31 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3 - #16 0x0000003284a0acc5 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2 - #17 0x0000003282247df6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 - #18 0x0000003282248148 in g_main_context_iterate.isra.22 () from /lib64/libglib-2.0.so.0 - #19 0x000000328224854a in g_main_loop_run () from /lib64/libglib-2.0.so.0 - #20 0x000000000042c6c0 in main (argc=1, argv=0x7fff7ff379b8) at main.c:629 - -Signed-off-by: Thomas Haller ---- - src/nm-active-connection.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/src/nm-active-connection.c b/src/nm-active-connection.c -index cb42417..a8a422c 100644 ---- a/src/nm-active-connection.c -+++ b/src/nm-active-connection.c -@@ -42,14 +42,16 @@ G_DEFINE_ABSTRACT_TYPE (NMActiveConnection, nm_active_connection, G_TYPE_OBJECT) - NMDevice *device; - - gboolean is_default; - gboolean is_default6; - NMActiveConnectionState state; - gboolean vpn; - -+ char *pending_activation_id; -+ - gboolean user_requested; - gulong user_uid; - NMDevice *master; - } NMActiveConnectionPrivate; - - enum { - PROP_0, -@@ -138,16 +140,20 @@ nm_active_connection_set_state (NMActiveConnection *self, - || old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) { - nm_settings_connection_update_timestamp (NM_SETTINGS_CONNECTION (priv->connection), - (guint64) time (NULL), TRUE); - } - - if (priv->device) { - if ( old_state < NM_ACTIVE_CONNECTION_STATE_ACTIVATED -- && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED) -- nm_device_remove_pending_action (priv->device, "activation"); -+ && new_state >= NM_ACTIVE_CONNECTION_STATE_ACTIVATED && -+ priv->pending_activation_id) -+ { -+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id); -+ g_clear_pointer (&priv->pending_activation_id, g_free); -+ } - } - - if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) { - /* Device is no longer relevant when deactivated */ - g_clear_object (&priv->device); - g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEVICES); - } -@@ -357,15 +363,16 @@ set_property (GObject *object, guint prop_id, - priv->connection = g_value_dup_object (value); - break; - case PROP_INT_DEVICE: - g_warn_if_fail (priv->device == NULL); - priv->device = g_value_dup_object (value); - if (priv->device) { - g_warn_if_fail (priv->device != priv->master); -- nm_device_add_pending_action (priv->device, "activation"); -+ priv->pending_activation_id = g_strdup_printf ("activation::%p", (void *)object); -+ nm_device_add_pending_action (priv->device, priv->pending_activation_id); - } - break; - case PROP_INT_USER_REQUESTED: - priv->user_requested = g_value_get_boolean (value); - break; - case PROP_INT_USER_UID: - priv->user_uid = g_value_get_ulong (value); -@@ -732,14 +739,18 @@ static void - - g_free (priv->path); - priv->path = NULL; - g_free (priv->specific_object); - priv->specific_object = NULL; - - g_clear_object (&priv->connection); -+ if (priv->pending_activation_id) { -+ nm_device_remove_pending_action (priv->device, priv->pending_activation_id); -+ g_clear_pointer (&priv->pending_activation_id, g_free); -+ } - g_clear_object (&priv->device); - g_clear_object (&priv->master); - - G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object); - } - - static void --- -1.8.3.1 - diff --git a/rh1036132-VPN-active-con-info.patch b/rh1036132-VPN-active-con-info.patch deleted file mode 100644 index a438ff0..0000000 --- a/rh1036132-VPN-active-con-info.patch +++ /dev/null @@ -1,943 +0,0 @@ -From fe2fb7137c2fec59222db890d516a81a16cc0a60 Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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 @@ - - - -- The path of the connection. -+ -+ The path of the connection. -+ - - - -@@ -27,22 +29,37 @@ - - - -- Array of object paths representing devices which are part of this active connection. -+ -+ Array of object paths representing devices which are part of this active -+ connection. -+ - - -- The state of this active connection. -+ -+ The state of this active connection. -+ - - -- Whether this active connection is the default IPv4 connection, i.e. whether it currently owns the default IPv4 route. -+ -+ Whether this active connection is the default IPv4 connection, i.e. -+ whether it currently owns the default IPv4 route. -+ - - -- Whether this active connection is the default IPv6 connection, i.e. whether it currently owns the default IPv6 route. -+ -+ Whether this active connection is the default IPv6 connection, i.e. -+ whether it currently owns the default IPv6 route. -+ - - -- Whether this active connection is also a VPN connection. -+ -+ Whether this active connection is also a VPN connection. -+ - - -- The path to the master device if the connection is a slave. -+ -+ The path to the master device if the connection is a slave. -+ - - - --- -1.7.11.7 - - -From f642e88afd2bf585036ca8af54c81976cd2f259b Mon Sep 17 00:00:00 2001 -From: Dan Winship -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š ---- - 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. - - -+ -+ -+ 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. -+ -+ -+ -+ -+ 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. -+ -+ - - - Whether this active connection is the default IPv6 connection, i.e. - whether it currently owns the default IPv6 route. - - -+ -+ -+ 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. -+ -+ -+ -+ -+ 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. -+ -+ - - - 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 -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š ---- - 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 - #include -+#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 -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š ---- - 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 - diff --git a/rh1044757-ipv6-solicit-infinity.patch b/rh1044757-ipv6-solicit-infinity.patch deleted file mode 100644 index 818a714..0000000 --- a/rh1044757-ipv6-solicit-infinity.patch +++ /dev/null @@ -1,431 +0,0 @@ -From 8d3618a07baccc8abd9cfe7cf5b000b5d8c3340b Mon Sep 17 00:00:00 2001 -From: Thomas Haller -Date: Wed, 23 Oct 2013 18:37:02 +0200 -Subject: [PATCH] rdisc: emit config_change signal for update of address - lifetime - -Signed-off-by: Thomas Haller ---- - src/rdisc/nm-lndp-rdisc.c | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c -index 3299b32..f94d82a 100644 ---- a/src/rdisc/nm-lndp-rdisc.c -+++ b/src/rdisc/nm-lndp-rdisc.c -@@ -101,16 +101,19 @@ add_address (NMRDisc *rdisc, const NMRDiscAddress *new) - { - int i; - - for (i = 0; i < rdisc->addresses->len; i++) { - NMRDiscAddress *item = &g_array_index (rdisc->addresses, NMRDiscAddress, i); - - if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address)) { -- memcpy (item, new, sizeof (*new)); -- return FALSE; -+ gboolean changed = item->timestamp + item->lifetime != new->timestamp + new->lifetime || -+ item->timestamp + item->preferred != new->timestamp + new->preferred; -+ -+ *item = *new; -+ return changed; - } - } - - g_array_insert_val (rdisc->addresses, i, *new); - return TRUE; - } - --- -1.8.3.1 - -From 4f3f789fa5dad459a2aecabd77ef4a595dec5013 Mon Sep 17 00:00:00 2001 -From: Dan Williams -Date: Thu, 19 Dec 2013 10:58:46 -0600 -Subject: [PATCH] rdisc: ensure RDNSS and DNSSL lifetimes are updated (rh - #1044757) (bgo #720760) - -The DNS server and domain timestamps and lifetimes weren't updated -when a new RA was received. When half the lifetime for either of -them had passed, clean_dns_servers() and clean_domains() request a -Router Solicitation to ensure the DNS information does not expire. - -This obviously results in a new Router Advertisement, but since the -timestamps don't get updated, clean_dns_servers() and clean_domains() -simply request another solicitation because 'now' is still greater -than half the old lifetime. This casues another solicit request, -which causes another RA, which... etc. - -https://bugzilla.redhat.com/show_bug.cgi?id=1044757 -https://bugzilla.gnome.org/show_bug.cgi?id=720760 ---- - src/devices/nm-device.c | 9 +++-- - src/rdisc/nm-lndp-rdisc.c | 97 +++++++++++++++++++++++++++++------------------ - 2 files changed, 67 insertions(+), 39 deletions(-) - -diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c -index 74d443d..6f2383b 100644 ---- a/src/devices/nm-device.c -+++ b/src/devices/nm-device.c -@@ -3315,14 +3315,17 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device - NMRDiscDNSServer *discovered_server = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i); - - nm_ip6_config_add_nameserver (priv->ac_ip6_config, &discovered_server->address); - } - } - - if (changed & NM_RDISC_CONFIG_DNS_DOMAINS) { -+ /* Rebuild domain list from router discovery cache. */ -+ nm_ip6_config_reset_domains (priv->ac_ip6_config); -+ - for (i = 0; i < rdisc->dns_domains->len; i++) { - NMRDiscDNSDomain *discovered_domain = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); - - nm_ip6_config_add_domain (priv->ac_ip6_config, discovered_domain->domain); - } - } - -@@ -3357,28 +3360,29 @@ rdisc_config_changed (NMRDisc *rdisc, NMRDiscConfigMap changed, NMDevice *device - - static gboolean - addrconf6_start (NMDevice *self) - { - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - NMConnection *connection; -+ const char *ip_iface = nm_device_get_ip_iface (self); - - connection = nm_device_get_connection (self); - g_assert (connection); - - g_warn_if_fail (priv->ac_ip6_config == NULL); - if (priv->ac_ip6_config) { - g_object_unref (priv->ac_ip6_config); - priv->ac_ip6_config = NULL; - } - -- priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), nm_device_get_ip_iface (self)); -+ priv->rdisc = nm_lndp_rdisc_new (nm_device_get_ip_ifindex (self), ip_iface); - nm_platform_sysctl_set (priv->ip6_accept_ra_path, "0"); - - if (!priv->rdisc) { -- nm_log_err (LOGD_IP6, "Failed to start router discovery."); -+ nm_log_err (LOGD_IP6, "(%s): failed to start router discovery.", ip_iface); - return FALSE; - } - - priv->rdisc_config_changed_sigid = g_signal_connect ( - priv->rdisc, NM_RDISC_CONFIG_CHANGED, G_CALLBACK (rdisc_config_changed), self); - - /* FIXME: what if interface has no lladdr, like PPP? */ -diff --git a/src/rdisc/nm-lndp-rdisc.c b/src/rdisc/nm-lndp-rdisc.c -index f94d82a..2e22fd9 100644 ---- a/src/rdisc/nm-lndp-rdisc.c -+++ b/src/rdisc/nm-lndp-rdisc.c -@@ -140,44 +140,68 @@ add_route (NMRDisc *rdisc, const NMRDiscRoute *new) - } - - g_array_insert_val (rdisc->routes, i, *new); - return TRUE; - } - - static gboolean --add_server (NMRDisc *rdisc, const NMRDiscDNSServer *new) -+add_dns_server (NMRDisc *rdisc, const NMRDiscDNSServer *new) - { - int i; - - for (i = 0; i < rdisc->dns_servers->len; i++) { - NMRDiscDNSServer *item = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i); - -- if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address)) -- return FALSE; -+ if (IN6_ARE_ADDR_EQUAL (&item->address, &new->address)) { -+ gboolean changed = item->timestamp != new->timestamp || -+ item->lifetime != new->lifetime; -+ if (changed) { -+ item->timestamp = new->timestamp; -+ item->lifetime = new->lifetime; -+ } -+ return changed; -+ } - } - -+ /* DNS server should no longer be used */ -+ if (new->lifetime == 0) -+ return FALSE; -+ - g_array_insert_val (rdisc->dns_servers, i, *new); -- - return TRUE; - } - -+/* Always copies new->domain */ - static gboolean - add_domain (NMRDisc *rdisc, const NMRDiscDNSDomain *new) - { -+ NMRDiscDNSDomain *item; - int i; - - for (i = 0; i < rdisc->dns_domains->len; i++) { -- NMRDiscDNSDomain *item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); -+ item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); - -- if (!g_strcmp0 (item->domain, new->domain)) -- return FALSE; -+ if (!g_strcmp0 (item->domain, new->domain)) { -+ gboolean changed = item->timestamp != new->timestamp || -+ item->lifetime != new->lifetime; -+ if (changed) { -+ item->timestamp = new->timestamp; -+ item->lifetime = new->lifetime; -+ } -+ return changed; -+ } - } - -+ /* Domain should no longer be used */ -+ if (new->lifetime == 0) -+ return FALSE; -+ - g_array_insert_val (rdisc->dns_domains, i, *new); -- -+ item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); -+ item->domain = g_strdup (new->domain); - return TRUE; - } - - #define RETRY 10 - - static gboolean - send_rs (NMRDisc *rdisc) -@@ -186,15 +210,15 @@ send_rs (NMRDisc *rdisc) - struct ndp_msg *msg; - int error; - - error = ndp_msg_new (&msg, NDP_MSG_RS); - g_assert (!error); - ndp_msg_ifindex_set (msg, rdisc->ifindex); - -- debug ("(%s): sending router solicitation: %d", rdisc->ifname, rdisc->ifindex); -+ debug ("(%s): sending router solicitation", rdisc->ifname); - - error = ndp_msg_send (priv->ndp, msg); - if (error) - error ("(%s): cannot send router solicitation: %d.", rdisc->ifname, error); - - ndp_msg_destroy (msg); - -@@ -218,139 +242,140 @@ solicit (NMRDisc *rdisc) - static void - clean_gateways (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) - { - int i; - - for (i = 0; i < rdisc->gateways->len; i++) { - NMRDiscGateway *item = &g_array_index (rdisc->gateways, NMRDiscGateway, i); -- guint32 expiry = item->timestamp + item->lifetime; -+ guint64 expiry = item->timestamp + item->lifetime; - -- if (item->lifetime == UINT_MAX) -+ if (item->lifetime == G_MAXUINT32) - continue; - - if (now >= expiry) { - g_array_remove_index (rdisc->gateways, i--); - *changed |= NM_RDISC_CONFIG_GATEWAYS; - } else if (*nextevent > expiry) -- *nextevent = expiry; -+ *nextevent = (guint32) expiry; - } - } - - static void - clean_addresses (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) - { - int i; - - for (i = 0; i < rdisc->addresses->len; i++) { - NMRDiscAddress *item = &g_array_index (rdisc->addresses, NMRDiscAddress, i); -- guint32 expiry = item->timestamp + item->lifetime; -+ guint64 expiry = item->timestamp + item->lifetime; - -- if (item->lifetime == UINT_MAX) -+ if (item->lifetime == G_MAXUINT32) - continue; - - if (now >= expiry) { - g_array_remove_index (rdisc->addresses, i--); - *changed |= NM_RDISC_CONFIG_ADDRESSES; - } else if (*nextevent > expiry) -- *nextevent = expiry; -+ *nextevent = (guint32) expiry; - } - } - - static void - clean_routes (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) - { - int i; - - for (i = 0; i < rdisc->routes->len; i++) { - NMRDiscRoute *item = &g_array_index (rdisc->routes, NMRDiscRoute, i); -- guint32 expiry = item->timestamp + item->lifetime; -+ guint64 expiry = item->timestamp + item->lifetime; - -- if (item->lifetime == UINT_MAX) -+ if (item->lifetime == G_MAXUINT32) - continue; - - if (now >= expiry) { - g_array_remove_index (rdisc->routes, i--); - *changed |= NM_RDISC_CONFIG_ROUTES; - } else if (*nextevent > expiry) -- *nextevent = expiry; -+ *nextevent = (guint32) expiry; - } - } - - static void --clean_servers (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) -+clean_dns_servers (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) - { - int i; - - for (i = 0; i < rdisc->dns_servers->len; i++) { - NMRDiscDNSServer *item = &g_array_index (rdisc->dns_servers, NMRDiscDNSServer, i); -- guint32 expiry = item->timestamp + item->lifetime; -- guint32 refresh = item->timestamp + item->lifetime / 2; -+ guint64 expiry = item->timestamp + item->lifetime; -+ guint64 refresh = item->timestamp + item->lifetime / 2; - -- if (item->lifetime == UINT_MAX) -+ if (item->lifetime == G_MAXUINT32) - continue; - - if (now >= expiry) { - g_array_remove_index (rdisc->dns_servers, i--); -- *changed |= NM_RDISC_CONFIG_ROUTES; -+ *changed |= NM_RDISC_CONFIG_DNS_SERVERS; - } else if (now >= refresh) - solicit (rdisc); - else if (*nextevent > refresh) -- *nextevent = refresh; -+ *nextevent = (guint32) refresh; - } - } - - static void - clean_domains (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap *changed, guint32 *nextevent) - { - int i; - - for (i = 0; i < rdisc->dns_domains->len; i++) { - NMRDiscDNSDomain *item = &g_array_index (rdisc->dns_domains, NMRDiscDNSDomain, i); -- guint32 expiry = item->timestamp + item->lifetime; -- guint32 refresh = item->timestamp + item->lifetime / 2; -+ guint64 expiry = item->timestamp + item->lifetime; -+ guint64 refresh = item->timestamp + item->lifetime / 2; - -- if (item->lifetime == UINT_MAX) -+ if (item->lifetime == G_MAXUINT32) - continue; - - if (now >= expiry) { -+ g_free (item->domain); - g_array_remove_index (rdisc->dns_domains, i--); -- *changed |= NM_RDISC_CONFIG_ROUTES; -+ *changed |= NM_RDISC_CONFIG_DNS_DOMAINS; - } else if (now >= refresh) - solicit (rdisc); - else if (*nextevent >=refresh) -- *nextevent = refresh; -+ *nextevent = (guint32) refresh; - } - } - - static gboolean timeout_cb (gpointer user_data); - - static void - check_timestamps (NMRDisc *rdisc, guint32 now, NMRDiscConfigMap changed) - { - NMLNDPRDiscPrivate *priv = NM_LNDP_RDISC_GET_PRIVATE (rdisc); -- /* Use a magic date in distant enough future as there's no guint32 max macro. */ -- guint32 never = G_MAXINT32; -+ /* Use a magic date in the distant future (~68 years) */ -+ guint32 never = G_MAXINT32; - guint32 nextevent = never; - - if (priv->timeout_id) { - g_source_remove (priv->timeout_id); - priv->timeout_id = 0; - } - - clean_gateways (rdisc, now, &changed, &nextevent); - clean_addresses (rdisc, now, &changed, &nextevent); - clean_routes (rdisc, now, &changed, &nextevent); -- clean_servers (rdisc, now, &changed, &nextevent); -+ clean_dns_servers (rdisc, now, &changed, &nextevent); - clean_domains (rdisc, now, &changed, &nextevent); - - if (changed) - g_signal_emit_by_name (rdisc, NM_RDISC_CONFIG_CHANGED, changed); - - if (nextevent != never) { -- debug ("Scheduling next now/lifetime check: %d seconds", (int) nextevent); -+ debug ("(%s): scheduling next now/lifetime check: %u seconds", rdisc->ifname, nextevent); - priv->timeout_id = g_timeout_add_seconds (nextevent, timeout_cb, rdisc); - } - } - - static guint32 - get_time (void) - { -@@ -450,15 +475,15 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) - * - * The biggest difference from good old DHCP is that all configuration - * items have their own lifetimes and they are merged from various - * sources. Router discovery is *not* contract-based, so there is *no* - * single time when the configuration is finished and updates can - * come at any time. - */ -- debug ("Recieved router advertisement: %d at %d", rdisc->ifindex, (int) now); -+ debug ("(%s): received router advertisement at %u", rdisc->ifname, now); - - if (priv->send_rs_id) { - g_source_remove (priv->send_rs_id); - priv->send_rs_id = 0; - } - - /* DHCP level: -@@ -559,27 +584,27 @@ receive_ra (struct ndp *ndp, struct ndp_msg *msg, gpointer user_data) - /* Pad the lifetime somewhat to give a bit of slack in cases - * where one RA gets lost or something (which can happen on unreliable - * links like WiFi where certain types of frames are not retransmitted). - * Note that 0 has special meaning and is therefore not adjusted. - */ - if (dns_server.lifetime && dns_server.lifetime < 7200) - dns_server.lifetime = 7200; -- if (add_server (rdisc, &dns_server)) -+ if (add_dns_server (rdisc, &dns_server)) - changed |= NM_RDISC_CONFIG_DNS_SERVERS; - } - } - ndp_msg_opt_for_each_offset(offset, msg, NDP_MSG_OPT_DNSSL) { - char *domain; - int domain_index; - - ndp_msg_opt_dnssl_for_each_domain (domain, domain_index, msg, offset) { - NMRDiscDNSDomain dns_domain; - - memset (&dns_domain, 0, sizeof (dns_domain)); -- dns_domain.domain = g_strdup (domain); -+ dns_domain.domain = domain; - dns_domain.timestamp = now; - dns_domain.lifetime = ndp_msg_opt_rdnss_lifetime (msg, offset); - /* Pad the lifetime somewhat to give a bit of slack in cases - * where one RA gets lost or something (which can happen on unreliable - * links like WiFi where certain types of frames are not retransmitted). - * Note that 0 has special meaning and is therefore not adjusted. - */ --- -1.8.3.1 - diff --git a/rh1048046-dhcp-no-ipv6.patch b/rh1048046-dhcp-no-ipv6.patch deleted file mode 100644 index dff0a3d..0000000 --- a/rh1048046-dhcp-no-ipv6.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a9f1d121783a7f3c65c9f47d3419b5a8a255fe47 Mon Sep 17 00:00:00 2001 -From: Dan Williams -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š ---- - 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 - diff --git a/rh1048711-bluez-crash.patch b/rh1048711-bluez-crash.patch deleted file mode 100644 index f8b7457..0000000 --- a/rh1048711-bluez-crash.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c.bluez-crash NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c ---- NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c.bluez-crash 2013-10-03 15:00:51.000000000 -0400 -+++ NetworkManager-0.9.9.0/src/bluez-manager/nm-bluez-device.c 2014-01-06 12:09:14.449583005 -0500 -@@ -686,7 +686,7 @@ static void - on_adapter_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self) - { - NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); -- GError *error; -+ GError *error = NULL; - GVariant *v; - - priv->adapter = g_dbus_proxy_new_for_bus_finish (res, &error); -@@ -923,7 +923,7 @@ static void - on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self) - { - NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self); -- GError *error; -+ GError *error = NULL; - - priv->proxy5 = g_dbus_proxy_new_for_bus_finish (res, &error); - diff --git a/rh1057738-dbus-clean-exit.patch b/rh1057738-dbus-clean-exit.patch deleted file mode 100644 index 94bd64c..0000000 --- a/rh1057738-dbus-clean-exit.patch +++ /dev/null @@ -1,203 +0,0 @@ -From e62b212be3b51b0dc31fd12ea70d78358164063e Mon Sep 17 00:00:00 2001 -From: Dan Williams -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š ---- - 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 - diff --git a/rh983325-add-route-for-dhcp-server.patch b/rh983325-add-route-for-dhcp-server.patch deleted file mode 100644 index bbbee4e..0000000 --- a/rh983325-add-route-for-dhcp-server.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 31fe84e467732463eabc8f70c2a419008e7a227c Mon Sep 17 00:00:00 2001 -From: Scott Shambarger -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 -Signed-off-by: Jiří Klimeš ---- - 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 - diff --git a/sources b/sources index b82a9f6..dd7b0f4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7251704430cb206f2c29bfebc45bd0fb NetworkManager-0.9.9.0.git20131003.tar.bz2 +58cea93d4b444cadc540091f6fe490db NetworkManager-0.9.9.0.git20140131.tar.bz2 diff --git a/vpn-connection-states.patch b/vpn-connection-states.patch deleted file mode 100644 index db70751..0000000 --- a/vpn-connection-states.patch +++ /dev/null @@ -1,178 +0,0 @@ -From c72d2eb02fa05b29dbff372a3ab02a11f3a0557b Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= -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š ---- - 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?= -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š ---- - 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 -