From 9a133787536452cc8e471efe6bc0c94e5ad43383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= Date: Wed, 19 Nov 2014 13:03:38 +0100 Subject: [PATCH] dispatcher: introduce new env variables for gateway address (bgo #740363) IP4_GATEWAY VPN_IP4_GATEWAY IP6_GATEWAY VPN_IP6_GATEWAY We still put gateway into IP[46]_ADDRESS_N for backward compatibility. https://bugzilla.gnome.org/show_bug.cgi?id=740363 --- callouts/nm-dispatcher-utils.c | 8 ++++++++ man/NetworkManager.xml | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index ab7fda660..5b1419db1 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -123,6 +123,10 @@ construct_ip4_items (GSList *items, GVariant *ip4_config, const char *prefix) } if (addresses->len) items = g_slist_prepend (items, g_strdup_printf ("%sIP4_NUM_ADDRESSES=%d", prefix, addresses->len)); + + /* Write gateway to a separate variable, too. */ + items = g_slist_prepend (items, g_strdup_printf ("%sIP4_GATEWAY=%s", prefix, gateway)); + g_ptr_array_unref (addresses); g_free (gateway); g_variant_unref (val); @@ -257,6 +261,10 @@ construct_ip6_items (GSList *items, GVariant *ip6_config, const char *prefix) } if (addresses->len) items = g_slist_prepend (items, g_strdup_printf ("%sIP6_NUM_ADDRESSES=%d", prefix, addresses->len)); + + /* Write gateway to a separate variable, too. */ + items = g_slist_prepend (items, g_strdup_printf ("%sIP6_GATEWAY=%s", prefix, gateway)); + g_ptr_array_unref (addresses); g_free (gateway); g_variant_unref (val); diff --git a/man/NetworkManager.xml b/man/NetworkManager.xml index 229c390cd..78b52e3b5 100644 --- a/man/NetworkManager.xml +++ b/man/NetworkManager.xml @@ -182,7 +182,8 @@ IP4_ADDRESS_N The IPv4 address in the format "address/prefix gateway", where N is a number - from 0 to (# IPv4 address \- 1). + from 0 to (# IPv4 address \- 1). gateway item in this variable is deprecated, + use IP4_GATEWAY instead. @@ -191,6 +192,12 @@ The variable contains the number of IPv4 addresses the script may expect. + + IP4_GATEWAY + + The gateway IPv4 address in traditional numbers-and-dots notation. + + IP4_ROUTE_N