diff options
author | Dan Winship <danw@redhat.com> | 2014-12-18 09:06:56 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-19 11:17:37 -0500 |
commit | 995da9a5a68c5b3f3da458100df23b855e2bbc2a (patch) | |
tree | 799062b9819f38886e474c9ced21db69dda4c5c4 | |
parent | 9cfd9d376fd5fd2fef097293e6f851044068c6d1 (diff) | |
download | NetworkManager-995da9a5a68c5b3f3da458100df23b855e2bbc2a.tar.gz |
dispatcher: expose connection D-Bus path
src/nm-dispatcher.c was passing the connection's D-Bus path to the
dispatcher, which was then ignoring it. Meanwhile,
test-dispatcher-envp was passing a fake D-Bus path with the wrong name
(which didn't actually matter since
nm_dispatcher_utils_construct_envp() ignored it anyway).
Fix it so that the path gets exposed as CONNECTION_DBUS_PATH, and
adjust the tests for that.
-rw-r--r-- | callouts/nm-dispatcher-utils.c | 11 | ||||
-rw-r--r-- | callouts/tests/dispatcher-down | 1 | ||||
-rw-r--r-- | callouts/tests/dispatcher-up | 1 | ||||
-rw-r--r-- | callouts/tests/dispatcher-vpn-down | 1 | ||||
-rw-r--r-- | callouts/tests/dispatcher-vpn-up | 1 | ||||
-rw-r--r-- | callouts/tests/test-dispatcher-envp.c | 2 | ||||
-rw-r--r-- | man/NetworkManager.xml | 6 |
7 files changed, 20 insertions, 3 deletions
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index e84b5669cd..dd761f75cc 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -333,7 +333,7 @@ nm_dispatcher_utils_construct_envp (const char *action, char **out_iface) { const char *iface = NULL, *ip_iface = NULL; - const char *uuid = NULL, *id = NULL, *path; + const char *uuid = NULL, *id = NULL, *path = NULL; const char *filename = NULL; NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN; GVariant *value; @@ -350,10 +350,17 @@ nm_dispatcher_utils_construct_envp (const char *action, if (!strcmp (action, "hostname")) goto done; - /* config filename */ + /* Connection properties */ + if (!g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_PATH, "&o", &path)) { + g_warning ("Missing or invalid required value " NMD_CONNECTION_PROPS_PATH "!"); + return NULL; + } + items = g_slist_prepend (items, g_strdup_printf ("CONNECTION_DBUS_PATH=%s", path)); + if (g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_FILENAME, "&s", &filename)) items = g_slist_prepend (items, g_strdup_printf ("CONNECTION_FILENAME=%s", filename)); + /* Canonicalize the VPN interface name; "" is used when passing it through * D-Bus so make sure that's fixed up here. */ diff --git a/callouts/tests/dispatcher-down b/callouts/tests/dispatcher-down index da97d3f62d..f766595c1e 100644 --- a/callouts/tests/dispatcher-down +++ b/callouts/tests/dispatcher-down @@ -14,6 +14,7 @@ path=/org/freedesktop/NetworkManager/Devices/0 [env] PATH= CONNECTION_UUID=3fd2a33a-d81b-423f-ae99-e6baba742311 +CONNECTION_DBUS_PATH=/org/freedesktop/NetworkManager/Connections/5 CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-down DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-up b/callouts/tests/dispatcher-up index 78cfadadb5..463409e27c 100644 --- a/callouts/tests/dispatcher-up +++ b/callouts/tests/dispatcher-up @@ -33,6 +33,7 @@ domains=hsd1.mn.comcast.net. [env] PATH= CONNECTION_UUID=3fd2a33a-d81b-423f-ae99-e6baba742311 +CONNECTION_DBUS_PATH=/org/freedesktop/NetworkManager/Connections/5 CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-up DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-vpn-down b/callouts/tests/dispatcher-vpn-down index eb4dc2ca9d..18267f841d 100644 --- a/callouts/tests/dispatcher-vpn-down +++ b/callouts/tests/dispatcher-vpn-down @@ -33,6 +33,7 @@ domains=hsd1.mn.comcast.net. [env] PATH= CONNECTION_UUID=355653c0-34d3-4777-ad25-f9a498b7ef8e +CONNECTION_DBUS_PATH=/org/freedesktop/NetworkManager/Connections/5 CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-down DEVICE_IFACE=wlan0 diff --git a/callouts/tests/dispatcher-vpn-up b/callouts/tests/dispatcher-vpn-up index 8ae78a31ce..181ecb53a6 100644 --- a/callouts/tests/dispatcher-vpn-up +++ b/callouts/tests/dispatcher-vpn-up @@ -33,6 +33,7 @@ domains=hsd1.mn.comcast.net. [env] PATH= CONNECTION_UUID=355653c0-34d3-4777-ad25-f9a498b7ef8e +CONNECTION_DBUS_PATH=/org/freedesktop/NetworkManager/Connections/5 CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-up DEVICE_IFACE=wlan0 diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index abccf6155f..3c0a47050d 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -81,7 +81,7 @@ parse_main (GKeyFile *kf, g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&props, "{sv}", - "connection-path", + NMD_CONNECTION_PROPS_PATH, g_variant_new_object_path ("/org/freedesktop/NetworkManager/Connections/5")); /* Strip out the non-fixed portion of the filename */ filename = strstr (filename, "/callouts"); diff --git a/man/NetworkManager.xml b/man/NetworkManager.xml index 26f84e5e21..6b2d886ad9 100644 --- a/man/NetworkManager.xml +++ b/man/NetworkManager.xml @@ -167,6 +167,12 @@ </para></listitem> </varlistentry> <varlistentry> + <term><varname>CONNECTION_DBUS_PATH</varname></term> + <listitem><para> + The NetworkManager D-Bus path of the connection. + </para></listitem> + </varlistentry> + <varlistentry> <term><varname>CONNECTION_FILENAME</varname></term> <listitem><para> The backing file name of the connection profile (if any). |