NetworkManager r4329 - in trunk: . callouts
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4329 - in trunk: . callouts
- Date: Mon, 24 Nov 2008 02:07:21 +0000 (UTC)
Author: dcbw
Date: Mon Nov 24 02:07:20 2008
New Revision: 4329
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4329&view=rev
Log:
2008-11-23 Dan Williams <dcbw redhat com>
* callouts/nm-dispatcher-action.c
- (construct_envp, nm_dispatcher_action): pass connection UUID to
scripts in the environment
Modified:
trunk/ChangeLog
trunk/callouts/nm-dispatcher-action.c
Modified: trunk/callouts/nm-dispatcher-action.c
==============================================================================
--- trunk/callouts/nm-dispatcher-action.c (original)
+++ trunk/callouts/nm-dispatcher-action.c Mon Nov 24 02:07:20 2008
@@ -38,6 +38,7 @@
#include <NetworkManager.h>
#include <libnm-util/nm-connection.h>
#include <libnm-util/nm-setting-ip4-config.h>
+#include <libnm-util/nm-setting-connection.h>
#include <libnm-glib/nm-dhcp4-config.h>
#include <libnm-glib/nm-device.h>
@@ -235,7 +236,7 @@
}
static char **
-construct_envp (NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config)
+construct_envp (const char *uuid, NMIP4Config *ip4_config, NMDHCP4Config *dhcp4_config)
{
guint32 env_size = 0;
char **envp;
@@ -261,7 +262,8 @@
+ 1 /* domains */
+ 1 /* hostname */
+ g_slist_length (routes)
- + 1 /* routes length */;
+ + 1 /* routes length */
+ + 1 /* connection UUID */;
if (dhcp4_config) {
options = nm_dhcp4_config_get_options (dhcp4_config);
@@ -270,6 +272,9 @@
envp = g_new0 (char *, env_size + 1);
+ if (uuid)
+ envp[envp_idx++] = g_strdup_printf ("CONNECTION_UUID=%s", uuid);
+
/* IP4 config stuff */
for (iter = addresses, num = 0; iter; iter = g_slist_next (iter)) {
NMIP4Address *addr = (NMIP4Address *) iter->data;
@@ -377,6 +382,7 @@
const char *iface,
const char *parent_iface,
NMDeviceType type,
+ const char *uuid,
NMIP4Config *ip4_config,
NMDHCP4Config *dhcp4_config)
{
@@ -422,7 +428,7 @@
}
g_dir_close (dir);
- envp = construct_envp (ip4_config, dhcp4_config);
+ envp = construct_envp (uuid, ip4_config, dhcp4_config);
for (iter = scripts; iter; iter = g_slist_next (iter)) {
gchar *argv[4];
@@ -467,8 +473,8 @@
{
Dispatcher *d = g_object_get_data (G_OBJECT (h), "dispatcher");
NMConnection *connection;
- char *iface = NULL;
- char *parent_iface = NULL;
+ char *iface = NULL, *parent_iface = NULL;
+ const char *uuid = NULL;
NMDeviceType type = NM_DEVICE_TYPE_UNKNOWN;
NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN;
NMDevice *device = NULL;
@@ -483,7 +489,13 @@
d->quit_timeout = g_timeout_add (10000, quit_timeout_cb, NULL);
connection = nm_connection_new_from_hash (connection_hash, error);
- if (!connection) {
+ if (connection) {
+ NMSettingConnection *s_con;
+
+ s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+ if (s_con)
+ uuid = nm_setting_connection_get_uuid (s_con);
+ } else {
g_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d",
__func__,
g_type_name (nm_connection_lookup_setting_type_by_quark ((*error)->domain)),
@@ -547,7 +559,7 @@
}
dispatch:
- dispatch_scripts (action, iface, parent_iface, type, ip4_config, dhcp4_config);
+ dispatch_scripts (action, iface, parent_iface, type, uuid, ip4_config, dhcp4_config);
if (device)
g_object_unref (device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]