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.
This commit is contained in:
@@ -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.
|
||||
*/
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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");
|
||||
|
@@ -166,6 +166,12 @@
|
||||
The name (ID) of the connection profile.
|
||||
</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>
|
||||
|
Reference in New Issue
Block a user