dispatcher: explicitly set missing interface argument for device actions
authorThomas Haller <thaller@redhat.com>
Wed, 19 Aug 2015 20:47:18 +0000 (22:47 +0200)
committerThomas Haller <thaller@redhat.com>
Wed, 19 Aug 2015 21:36:36 +0000 (23:36 +0200)
The first argument for dispatcher actions is the interface name, except
for the "hostname" action, where no interface is available.

For "hostname" actions continue to pass "none", as there is no interface
available. But for device actions, it may happen that the interface name
is missing too. In this case, don't pass "none" but instead an empty
name.

callouts/nm-dispatcher-utils.c
callouts/nm-dispatcher.c

index 52eddfd..bbd0e49 100644 (file)
@@ -349,7 +349,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
        g_return_val_if_fail (*out_iface == NULL, NULL);
 
        /* Hostname changes don't require a device nor contain a connection */
-       if (!strcmp (action, "hostname"))
+       if (!strcmp (action, NMD_ACTION_HOSTNAME))
                goto done;
 
        /* Connection properties */
index 32b60e8..3cb50b5 100644 (file)
@@ -372,7 +372,9 @@ dispatch_one_script (Request *request)
        ScriptInfo *script = g_ptr_array_index (request->scripts, request->idx);
 
        argv[0] = script->script;
-       argv[1] = request->iface ? request->iface : "none";
+       argv[1] = request->iface
+                 ? request->iface
+                 : (!strcmp (request->action, NMD_ACTION_HOSTNAME) ? "none" : "");
        argv[2] = request->action;
        argv[3] = NULL;