diff --git a/callouts/nm-dispatcher-api.h b/callouts/nm-dispatcher-api.h
index 9b2c3b32c..71410939c 100644
--- a/callouts/nm-dispatcher-api.h
+++ b/callouts/nm-dispatcher-api.h
@@ -32,6 +32,7 @@
#define NMD_CONNECTION_PROPS_PATH "path"
#define NMD_CONNECTION_PROPS_FILENAME "filename"
+#define NMD_CONNECTION_PROPS_EXTERNAL "external"
#define NMD_DEVICE_PROPS_INTERFACE "interface"
#define NMD_DEVICE_PROPS_IP_INTERFACE "ip-interface"
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index dd761f75c..82ae353ad 100644
--- a/callouts/nm-dispatcher-utils.c
+++ b/callouts/nm-dispatcher-utils.c
@@ -335,6 +335,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
const char *iface = NULL, *ip_iface = NULL;
const char *uuid = NULL, *id = NULL, *path = NULL;
const char *filename = NULL;
+ gboolean external;
NMDeviceState dev_state = NM_DEVICE_STATE_UNKNOWN;
GVariant *value;
char **envp = NULL, *path_item;
@@ -357,6 +358,9 @@ nm_dispatcher_utils_construct_envp (const char *action,
}
items = g_slist_prepend (items, g_strdup_printf ("CONNECTION_DBUS_PATH=%s", path));
+ if (g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_EXTERNAL, "b", &external) && external)
+ items = g_slist_prepend (items, g_strdup ("CONNECTION_EXTERNAL=1"));
+
if (g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_FILENAME, "&s", &filename))
items = g_slist_prepend (items, g_strdup_printf ("CONNECTION_FILENAME=%s", filename));
diff --git a/callouts/tests/Makefile.am b/callouts/tests/Makefile.am
index 49b2f9458..3d16d74e2 100644
--- a/callouts/tests/Makefile.am
+++ b/callouts/tests/Makefile.am
@@ -34,6 +34,7 @@ endif
EXTRA_DIST= \
dispatcher-down \
+ dispatcher-external \
dispatcher-up \
dispatcher-vpn-down \
dispatcher-vpn-up
diff --git a/callouts/tests/dispatcher-external b/callouts/tests/dispatcher-external
new file mode 100644
index 000000000..5430bec28
--- /dev/null
+++ b/callouts/tests/dispatcher-external
@@ -0,0 +1,33 @@
+[main]
+action=up
+expected-iface=virbr0
+uuid=92bbc2fb-7304-46be-8ebb-6093dbe19a6a
+id=virbr0
+external=1
+
+[device]
+state=100
+ip-interface=virbr0
+type=13
+interface=virbr0
+path=/org/freedesktop/NetworkManager/Devices/0
+
+[ip4]
+addresses=192.168.122.1/24 0.0.0.0
+domains=
+gateway=0.0.0.0
+
+[env]
+PATH=
+CONNECTION_UUID=92bbc2fb-7304-46be-8ebb-6093dbe19a6a
+CONNECTION_DBUS_PATH=/org/freedesktop/NetworkManager/Connections/5
+CONNECTION_FILENAME=/callouts/tests/dispatcher-external
+CONNECTION_ID=virbr0
+CONNECTION_EXTERNAL=1
+DEVICE_IFACE=virbr0
+DEVICE_IP_IFACE=virbr0
+IP4_NUM_ADDRESSES=1
+IP4_ADDRESS_0=192.168.122.1/24 0.0.0.0
+IP4_GATEWAY=0.0.0.0
+IP4_NUM_ROUTES=0
+
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c
index 3c0a47050..527dc35c4 100644
--- a/callouts/tests/test-dispatcher-envp.c
+++ b/callouts/tests/test-dispatcher-envp.c
@@ -83,11 +83,19 @@ parse_main (GKeyFile *kf,
g_variant_builder_add (&props, "{sv}",
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");
g_variant_builder_add (&props, "{sv}",
"filename",
g_variant_new_string (filename));
+
+ if (g_key_file_get_boolean (kf, "main", "external", NULL)) {
+ g_variant_builder_add (&props, "{sv}",
+ "external",
+ g_variant_new_boolean (TRUE));
+ }
+
*out_con_props = g_variant_builder_end (&props);
return TRUE;
@@ -560,6 +568,12 @@ test_vpn_down (void)
test_generic ("dispatcher-vpn-down", NULL);
}
+static void
+test_external (void)
+{
+ test_generic ("dispatcher-external", NULL);
+}
+
static void
test_up_empty_vpn_iface (void)
{
@@ -584,6 +598,7 @@ main (int argc, char **argv)
g_test_add_func ("/dispatcher/down", test_down);
g_test_add_func ("/dispatcher/vpn_up", test_vpn_up);
g_test_add_func ("/dispatcher/vpn_down", test_vpn_down);
+ g_test_add_func ("/dispatcher/external", test_external);
g_test_add_func ("/dispatcher/up_empty_vpn_iface", test_up_empty_vpn_iface);
diff --git a/man/NetworkManager.xml b/man/NetworkManager.xml
index 6b2d886ad..aa54fe152 100644
--- a/man/NetworkManager.xml
+++ b/man/NetworkManager.xml
@@ -178,6 +178,13 @@
The backing file name of the connection profile (if any).
+
+ CONNECTION_EXTERNAL
+
+ If "1", this indicates that the connection describes a
+ network configuration created outside of NetworkManager.
+
+
DEVICE_IFACE
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 4e2002660..4e0a05ed7 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -491,6 +491,11 @@ _dispatcher_call (DispatcherAction action,
NMD_CONNECTION_PROPS_FILENAME,
filename);
}
+ if (nm_settings_connection_get_nm_generated_assumed (NM_SETTINGS_CONNECTION (connection))) {
+ value_hash_add_bool (connection_props,
+ NMD_CONNECTION_PROPS_EXTERNAL,
+ TRUE);
+ }
} else {
connection_hash = value_hash_create ();
connection_props = value_hash_create ();