fix dispatcher events on DHCP change (rh #1113122) and escape in nmcli bash-completion
- core: fix missing dispatcher events on DHCP change (rh #1113122) - cli: improve escaping special characters and space for bash completion (bgo #709426)
This commit is contained in:
parent
55b365ece1
commit
58b629c589
75
0067-rh1113122-missing-dispatcher-event-on-dhcp-change.patch
Normal file
75
0067-rh1113122-missing-dispatcher-event-on-dhcp-change.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
From 0103063caa63d4fa72ca6e78399569416465030d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Dan Williams <dcbw@redhat.com>
|
||||||
|
Date: Tue, 29 Apr 2014 16:42:57 -0500
|
||||||
|
Subject: [PATCH 1/1] core: emit dhcp4/dhcp6-change dispatcher events if other
|
||||||
|
IP completes first (rh #1091296) (bgo #729284)
|
||||||
|
|
||||||
|
If IPv6 completes first it would emit the "up" dispatcher event with IPv6
|
||||||
|
details and move the device to ACTIVATED state. But if DHCPv4 was still
|
||||||
|
running, no dispatcher event would be emitted with the DHCPv4 information
|
||||||
|
until the first lease renew. Thus dispatcher scripts would not receive
|
||||||
|
DHCPv4 information for quite some time.
|
||||||
|
|
||||||
|
Ensure that if the other IP version completes first, that when the slower
|
||||||
|
method's DHCP completes, that it emits the appropriate dhcp4-change
|
||||||
|
or dhcp6-change event so that dispatcher scripts get the information
|
||||||
|
as soon as it's available.
|
||||||
|
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=729284
|
||||||
|
(cherry picked from commit 11f9855223966c4fd927fe83e2cd9a623a74acad)
|
||||||
|
|
||||||
|
Conflicts:
|
||||||
|
src/devices/nm-device.c
|
||||||
|
---
|
||||||
|
src/devices/nm-device.c | 28 ++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 28 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
||||||
|
index 1e8704c..5fc6cb7 100644
|
||||||
|
--- a/src/devices/nm-device.c
|
||||||
|
+++ b/src/devices/nm-device.c
|
||||||
|
@@ -4219,6 +4219,20 @@ nm_device_activate_ip4_config_commit (gpointer user_data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* If IPv4 wasn't the first to complete, and DHCP was used, then ensure
|
||||||
|
+ * dispatcher scripts get the DHCP lease information.
|
||||||
|
+ */
|
||||||
|
+ if ( priv->dhcp4_client
|
||||||
|
+ && nm_device_activate_ip4_state_in_conf (self)
|
||||||
|
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
|
||||||
|
+ /* Notify dispatcher scripts of new DHCP4 config */
|
||||||
|
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP4_CHANGE,
|
||||||
|
+ nm_device_get_connection (self),
|
||||||
|
+ self,
|
||||||
|
+ NULL,
|
||||||
|
+ NULL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||||
|
priv->ip4_state = IP_DONE;
|
||||||
|
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
|
||||||
|
@@ -4297,6 +4311,20 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
|
||||||
|
NM_DEVICE_GET_CLASS (self)->ip6_config_pre_commit (self);
|
||||||
|
|
||||||
|
if (ip6_config_merge_and_apply (self, TRUE, &reason)) {
|
||||||
|
+ /* If IPv6 wasn't the first IP to complete, and DHCP was used,
|
||||||
|
+ * then ensure dispatcher scripts get the DHCP lease information.
|
||||||
|
+ */
|
||||||
|
+ if ( priv->dhcp6_client
|
||||||
|
+ && nm_device_activate_ip6_state_in_conf (self)
|
||||||
|
+ && (nm_device_get_state (self) > NM_DEVICE_STATE_IP_CONFIG)) {
|
||||||
|
+ /* Notify dispatcher scripts of new DHCP6 config */
|
||||||
|
+ nm_dispatcher_call (DISPATCHER_ACTION_DHCP6_CHANGE,
|
||||||
|
+ nm_device_get_connection (self),
|
||||||
|
+ self,
|
||||||
|
+ NULL,
|
||||||
|
+ NULL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Enter the IP_CHECK state if this is the first method to complete */
|
||||||
|
priv->ip6_state = IP_DONE;
|
||||||
|
if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
61
0068-cli-bash-completion-escaping.patch
Normal file
61
0068-cli-bash-completion-escaping.patch
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
From 92a4443a0f9645a6147ded3d3d799eb264c4af38 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
|
||||||
|
Date: Mon, 14 Apr 2014 13:00:35 +0200
|
||||||
|
Subject: [PATCH 1/1] cli/bash-completion: escape spaces in profile names (rh
|
||||||
|
#1041901) (bgo #709426)
|
||||||
|
|
||||||
|
We need to escape spaces and quotes in connection names, so that a connection
|
||||||
|
name containing spaces (quotes) is regarded as a single argument by bash.
|
||||||
|
See e.g. http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
|
||||||
|
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=1041901
|
||||||
|
https://bugzilla.gnome.org/show_bug.cgi?id=709426
|
||||||
|
(cherry picked from commit b911d663d8a9df739a9311efe99c21af362c5738)
|
||||||
|
---
|
||||||
|
cli/completion/nmcli | 30 ++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 30 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/cli/completion/nmcli b/cli/completion/nmcli
|
||||||
|
index 9ed1c03..e5a1555 100644
|
||||||
|
--- a/cli/completion/nmcli
|
||||||
|
+++ b/cli/completion/nmcli
|
||||||
|
@@ -11,6 +11,36 @@ _nmcli_list_nl()
|
||||||
|
{
|
||||||
|
local IFS=$'\n'
|
||||||
|
COMPREPLY=( $( compgen -W '$1' -- $cur ) )
|
||||||
|
+
|
||||||
|
+ # Now escape special characters (spaces, single and double quotes),
|
||||||
|
+ # so that the argument is really regarded a single argument by bash.
|
||||||
|
+ # See http://stackoverflow.com/questions/1146098/properly-handling-spaces-and-quotes-in-bash-completion
|
||||||
|
+ local escaped_single_quote="'\''"
|
||||||
|
+ local i=0
|
||||||
|
+ local entry
|
||||||
|
+ for entry in ${COMPREPLY[*]}
|
||||||
|
+ do
|
||||||
|
+ if [[ "${cur:0:1}" == "'" ]]; then
|
||||||
|
+ # started with single quote, escaping only other single quotes
|
||||||
|
+ # [']bla'bla"bla\bla bla --> [']bla'\''bla"bla\bla bla
|
||||||
|
+ COMPREPLY[$i]="${entry//\'/${escaped_single_quote}}"
|
||||||
|
+ elif [[ "${cur:0:1}" == '"' ]]; then
|
||||||
|
+ # started with double quote, escaping all double quotes and all backslashes
|
||||||
|
+ # ["]bla'bla"bla\bla bla --> ["]bla'bla\"bla\\bla bla
|
||||||
|
+ entry="${entry//\\/\\\\}"
|
||||||
|
+ entry="${entry//\"/\\\"}"
|
||||||
|
+ COMPREPLY[$i]="$entry"
|
||||||
|
+ else
|
||||||
|
+ # no quotes in front, escaping _everything_
|
||||||
|
+ # [ ]bla'bla"bla\bla bla --> [ ]bla\'bla\"bla\\bla\ bla
|
||||||
|
+ entry="${entry//\\/\\\\}"
|
||||||
|
+ entry="${entry//\'/\'}"
|
||||||
|
+ entry="${entry//\"/\\\"}"
|
||||||
|
+ entry="${entry// /\\ }"
|
||||||
|
+ COMPREPLY[$i]="$entry"
|
||||||
|
+ fi
|
||||||
|
+ (( i++ ))
|
||||||
|
+ done
|
||||||
|
}
|
||||||
|
|
||||||
|
_nmcli_con_id()
|
||||||
|
--
|
||||||
|
1.9.3
|
||||||
|
|
@ -42,7 +42,7 @@ Name: NetworkManager
|
|||||||
Summary: Network connection manager and user applications
|
Summary: Network connection manager and user applications
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Version: 0.9.9.0
|
Version: 0.9.9.0
|
||||||
Release: 39%{snapshot}%{?dist}
|
Release: 40%{snapshot}%{?dist}
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.gnome.org/projects/NetworkManager/
|
URL: http://www.gnome.org/projects/NetworkManager/
|
||||||
@ -117,6 +117,8 @@ Patch63: 0063-rh1095378-endless-loop.patch
|
|||||||
Patch64: 0064-rh1059494-fix-bluetooth-NM-crash.patch
|
Patch64: 0064-rh1059494-fix-bluetooth-NM-crash.patch
|
||||||
Patch65: 0065-rh1094064-agent-crash-fix.patch
|
Patch65: 0065-rh1094064-agent-crash-fix.patch
|
||||||
Patch66: 0066-rh1082041-addr-preferred-time-fix.patch
|
Patch66: 0066-rh1082041-addr-preferred-time-fix.patch
|
||||||
|
Patch67: 0067-rh1113122-missing-dispatcher-event-on-dhcp-change.patch
|
||||||
|
Patch68: 0068-cli-bash-completion-escaping.patch
|
||||||
|
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||||
|
|
||||||
@ -348,6 +350,8 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
|
|||||||
%patch64 -p1 -b .0064-rh1059494-fix-bluetooth-NM-crash.orig
|
%patch64 -p1 -b .0064-rh1059494-fix-bluetooth-NM-crash.orig
|
||||||
%patch65 -p1 -b .0065-rh1094064-agent-crash-fix.orig
|
%patch65 -p1 -b .0065-rh1094064-agent-crash-fix.orig
|
||||||
%patch66 -p1 -b .0066-rh1082041-addr-preferred-time-fix.orig
|
%patch66 -p1 -b .0066-rh1082041-addr-preferred-time-fix.orig
|
||||||
|
%patch67 -p1 -b .0067-rh1113122-missing-dispatcher-event-on-dhcp-change.orig
|
||||||
|
%patch68 -p1 -b .0068-cli-bash-completion-escaping.orig
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
@ -574,6 +578,10 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Jun 25 2014 Thomas Haller <thaller@redhat.com> - 0.9.9.0-40.git20131003
|
||||||
|
- core: fix missing dispatcher events on DHCP change (rh #1113122)
|
||||||
|
- cli: improve escaping special characters and space for bash completion (bgo #709426)
|
||||||
|
|
||||||
* Thu Jun 12 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-39.git20131003
|
* Thu Jun 12 2014 Jiří Klimeš <jklimes@redhat.com> - 0.9.9.0-39.git20131003
|
||||||
- core: fix Wi-Fi activation endless loop on missing secrets (rh #1095378)
|
- core: fix Wi-Fi activation endless loop on missing secrets (rh #1095378)
|
||||||
- bluetooth: fix NM crash on bluetooth turn-off while connected to a phone (rh #1059494)
|
- bluetooth: fix NM crash on bluetooth turn-off while connected to a phone (rh #1059494)
|
||||||
|
Loading…
Reference in New Issue
Block a user