[PATCH 4/5] Fixes for Dispatcher to create env variables for Proxies.



Dispatcher fixed for releasing variables like PROXIES, PROXY_PAC_URL,
PROXY_PAC_SCRIPT and similarly with VPN_ prefix for VPN into environment.
---
 callouts/nm-dispatcher-utils.c        | 52 ++++++++++++++++++++++++
 callouts/nm-dispatcher-utils.h        |  2 +
 callouts/nm-dispatcher.c              |  6 +++
 callouts/tests/dispatcher-external    |  8 ++++
 callouts/tests/dispatcher-up          |  8 ++++
 callouts/tests/dispatcher-vpn-down    |  8 ++++
 callouts/tests/dispatcher-vpn-up      |  8 ++++
 callouts/tests/test-dispatcher-envp.c | 60 +++++++++++++++++++++++++++
 src/nm-dispatcher.c                   | 76 ++++++++++++++++++++++++++++++-----
 src/nm-dispatcher.h                   |  2 +
 10 files changed, 220 insertions(+), 10 deletions(-)

diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index 015bb07..b88e778 100644
--- a/callouts/nm-dispatcher-utils.c
+++ b/callouts/nm-dispatcher-utils.c
@@ -101,6 +101,54 @@ add_domains (GSList *items,
 }
 
 static GSList *
+construct_proxy_items (GSList *items, GVariant *proxy_config, const char *prefix)
+{
+       GVariant *val;
+
+       if (proxy_config == NULL)
+               return items;
+
+       if (prefix == NULL)
+               prefix = "";
+
+       /* Proxies */
+       val = g_variant_lookup_value (proxy_config, "proxies", G_VARIANT_TYPE_STRING_ARRAY);
+       if (val) {
+               items = _list_append_val_strv (items, g_variant_dup_strv (val, NULL),
+                                              "%sPROXIES=", prefix);
+               g_variant_unref (val);
+       }
+
+       /* PAC Url */
+       val = g_variant_lookup_value (proxy_config, "pac-url", G_VARIANT_TYPE_STRING);
+       if (val) {
+               char *str;
+
+               str = g_strdup_printf ("%sPROXY_PAC_URL=%s",
+                                      prefix,
+                                      g_variant_get_string (val, NULL));
+
+               items = g_slist_prepend (items, str);
+               g_variant_unref (val);
+       }
+
+       /* PAC Script */
+       val = g_variant_lookup_value (proxy_config, "pac-script", G_VARIANT_TYPE_STRING);
+       if (val) {
+               char *str;
+
+               str = g_strdup_printf ("%sPROXY_PAC_SCRIPT=%s",
+                                      prefix,
+                                      g_variant_get_string (val, NULL));
+
+               items = g_slist_prepend (items, str);
+               g_variant_unref (val);
+       }
+
+       return items;
+}
+
+static GSList *
 construct_ip4_items (GSList *items, GVariant *ip4_config, const char *prefix)
 {
        GPtrArray *addresses, *routes;
@@ -323,11 +371,13 @@ nm_dispatcher_utils_construct_envp (const char *action,
                                     GVariant *connection_dict,
                                     GVariant *connection_props,
                                     GVariant *device_props,
+                                    GVariant *device_proxy_props,
                                     GVariant *device_ip4_props,
                                     GVariant *device_ip6_props,
                                     GVariant *device_dhcp4_props,
                                     GVariant *device_dhcp6_props,
                                     const char *vpn_ip_iface,
+                                    GVariant *vpn_proxy_props,
                                     GVariant *vpn_ip4_props,
                                     GVariant *vpn_ip6_props,
                                     char **out_iface,
@@ -440,6 +490,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
 
        /* Device it's aren't valid if the device isn't activated */
        if (iface && (dev_state == NM_DEVICE_STATE_ACTIVATED)) {
+               items = construct_proxy_items (items, device_proxy_props, NULL);
                items = construct_ip4_items (items, device_ip4_props, NULL);
                items = construct_ip6_items (items, device_ip6_props, NULL);
                items = construct_device_dhcp4_items (items, device_dhcp4_props);
@@ -448,6 +499,7 @@ nm_dispatcher_utils_construct_envp (const char *action,
 
        if (vpn_ip_iface) {
                items = g_slist_prepend (items, g_strdup_printf ("VPN_IP_IFACE=%s", vpn_ip_iface));
+               items = construct_proxy_items (items, vpn_proxy_props, "VPN_");
                items = construct_ip4_items (items, vpn_ip4_props, "VPN_");
                items = construct_ip6_items (items, vpn_ip6_props, "VPN_");
        }
diff --git a/callouts/nm-dispatcher-utils.h b/callouts/nm-dispatcher-utils.h
index 40a0d41..024e9f1 100644
--- a/callouts/nm-dispatcher-utils.h
+++ b/callouts/nm-dispatcher-utils.h
@@ -28,11 +28,13 @@ nm_dispatcher_utils_construct_envp (const char *action,
                                     GVariant *connection_dict,
                                     GVariant *connection_props,
                                     GVariant *device_props,
+                                    GVariant *device_proxy_props,
                                     GVariant *device_ip4_props,
                                     GVariant *device_ip6_props,
                                     GVariant *device_dhcp4_props,
                                     GVariant *device_dhcp6_props,
                                     const char *vpn_ip_iface,
+                                    GVariant *vpn_proxy_props,
                                     GVariant *vpn_ip4_props,
                                     GVariant *vpn_ip6_props,
                                     char **out_iface,
diff --git a/callouts/nm-dispatcher.c b/callouts/nm-dispatcher.c
index 7ddffb0..eb9cdf9 100644
--- a/callouts/nm-dispatcher.c
+++ b/callouts/nm-dispatcher.c
@@ -76,11 +76,13 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
                GVariant *connection_dict,
                GVariant *connection_props,
                GVariant *device_props,
+               GVariant *device_proxy_props,
                GVariant *device_ip4_props,
                GVariant *device_ip6_props,
                GVariant *device_dhcp4_props,
                GVariant *device_dhcp6_props,
                const char *vpn_ip_iface,
+               GVariant *vpn_proxy_props,
                GVariant *vpn_ip4_props,
                GVariant *vpn_ip6_props,
                gboolean request_debug,
@@ -664,11 +666,13 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
                GVariant *connection_dict,
                GVariant *connection_props,
                GVariant *device_props,
+               GVariant *device_proxy_props,
                GVariant *device_ip4_props,
                GVariant *device_ip6_props,
                GVariant *device_dhcp4_props,
                GVariant *device_dhcp6_props,
                const char *vpn_ip_iface,
+               GVariant *vpn_proxy_props,
                GVariant *vpn_ip4_props,
                GVariant *vpn_ip6_props,
                gboolean request_debug,
@@ -695,11 +699,13 @@ handle_action (NMDBusDispatcher *dbus_dispatcher,
                                                            connection_dict,
                                                            connection_props,
                                                            device_props,
+                                                           device_proxy_props,
                                                            device_ip4_props,
                                                            device_ip6_props,
                                                            device_dhcp4_props,
                                                            device_dhcp6_props,
                                                            vpn_ip_iface,
+                                                           vpn_proxy_props,
                                                            vpn_ip4_props,
                                                            vpn_ip6_props,
                                                            &request->iface,
diff --git a/callouts/tests/dispatcher-external b/callouts/tests/dispatcher-external
index 5430bec..9de005d 100644
--- a/callouts/tests/dispatcher-external
+++ b/callouts/tests/dispatcher-external
@@ -12,6 +12,11 @@ type=13
 interface=virbr0
 path=/org/freedesktop/NetworkManager/Devices/0
 
+[proxy]
+proxies=http://test.proxy.com https://sec.proxy.com
+pac-url=http://networkmanager.com/proxy.pac
+pac-script=FindProxyForURL{DIRECT}
+
 [ip4]
 addresses=192.168.122.1/24 0.0.0.0
 domains=
@@ -26,6 +31,9 @@ CONNECTION_ID=virbr0
 CONNECTION_EXTERNAL=1
 DEVICE_IFACE=virbr0
 DEVICE_IP_IFACE=virbr0
+PROXIES=http://test.proxy.com https://sec.proxy.com
+PROXY_PAC_URL=http://networkmanager.com/proxy.pac
+PROXY_PAC_SCRIPT=FindProxyForURL{DIRECT}
 IP4_NUM_ADDRESSES=1
 IP4_ADDRESS_0=192.168.122.1/24 0.0.0.0
 IP4_GATEWAY=0.0.0.0
diff --git a/callouts/tests/dispatcher-up b/callouts/tests/dispatcher-up
index 463409e..022340e 100644
--- a/callouts/tests/dispatcher-up
+++ b/callouts/tests/dispatcher-up
@@ -25,6 +25,11 @@ broadcast_address=192.168.1.255
 subnet_mask=255.255.255.0
 expiry=1304300446
 
+[proxy]
+proxies=http://test.proxy.com https://sec.proxy.com
+pac-url=http://networkmanager.com/proxy.pac
+pac-script=FindProxyForURL{DIRECT}
+
 [ip4]
 addresses=192.168.1.119/24 192.168.1.1
 nameservers=68.87.77.134 68.87.72.134 192.168.1.1
@@ -38,6 +43,9 @@ CONNECTION_ID=Random Connection
 CONNECTION_FILENAME=/callouts/tests/dispatcher-up
 DEVICE_IFACE=wlan0
 DEVICE_IP_IFACE=wlan0
+PROXIES=http://test.proxy.com https://sec.proxy.com
+PROXY_PAC_URL=http://networkmanager.com/proxy.pac
+PROXY_PAC_SCRIPT=FindProxyForURL{DIRECT}
 IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1
 IP4_NUM_ADDRESSES=1
 IP4_NAMESERVERS=68.87.77.134 68.87.72.134 192.168.1.1
diff --git a/callouts/tests/dispatcher-vpn-down b/callouts/tests/dispatcher-vpn-down
index 18267f8..d7e09d9 100644
--- a/callouts/tests/dispatcher-vpn-down
+++ b/callouts/tests/dispatcher-vpn-down
@@ -25,6 +25,11 @@ broadcast_address=192.168.1.255
 subnet_mask=255.255.255.0
 expiry=1304349405
 
+[proxy]
+proxies=http://test.proxy.com https://sec.proxy.com
+pac-url=http://networkmanager.com/proxy.pac
+pac-script=FindProxyForURL{DIRECT}
+
 [ip4]
 addresses=192.168.1.119/24 192.168.1.1
 nameservers=68.87.77.134 68.87.72.134 192.168.1.1
@@ -38,6 +43,9 @@ CONNECTION_ID=Random Connection
 CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-down
 DEVICE_IFACE=wlan0
 DEVICE_IP_IFACE=tun0
+PROXIES=http://test.proxy.com https://sec.proxy.com
+PROXY_PAC_URL=http://networkmanager.com/proxy.pac
+PROXY_PAC_SCRIPT=FindProxyForURL{DIRECT}
 IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1
 IP4_NUM_ADDRESSES=1
 IP4_NAMESERVERS=68.87.77.134 68.87.72.134 192.168.1.1
diff --git a/callouts/tests/dispatcher-vpn-up b/callouts/tests/dispatcher-vpn-up
index 181ecb5..895fbc5 100644
--- a/callouts/tests/dispatcher-vpn-up
+++ b/callouts/tests/dispatcher-vpn-up
@@ -25,6 +25,11 @@ broadcast_address=192.168.1.255
 subnet_mask=255.255.255.0
 expiry=1304349405
 
+[proxy]
+proxies=http://test.proxy.com https://sec.proxy.com
+pac-url=http://networkmanager.com/proxy.pac
+pac-script=FindProxyForURL{DIRECT}
+
 [ip4]
 addresses=192.168.1.119/24 192.168.1.1
 nameservers=68.87.77.134 68.87.72.134 192.168.1.1
@@ -38,6 +43,9 @@ CONNECTION_ID=Random Connection
 CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-up
 DEVICE_IFACE=wlan0
 DEVICE_IP_IFACE=tun0
+PROXIES=http://test.proxy.com https://sec.proxy.com
+PROXY_PAC_URL=http://networkmanager.com/proxy.pac
+PROXY_PAC_SCRIPT=FindProxyForURL{DIRECT}
 IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1
 IP4_NUM_ADDRESSES=1
 IP4_NAMESERVERS=68.87.77.134 68.87.72.134 192.168.1.1
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c
index 83e84d7..cfdd986 100644
--- a/callouts/tests/test-dispatcher-envp.c
+++ b/callouts/tests/test-dispatcher-envp.c
@@ -192,6 +192,47 @@ add_uint_array (GKeyFile *kf,
 }
 
 static gboolean
+parse_proxy (GKeyFile *kf, GVariant **out_props, const char *section, GError **error)
+{
+       GVariantBuilder props;
+       char *tmp;
+       char **split, **iter;
+
+       g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}"));
+
+       tmp = g_key_file_get_string (kf, section, "proxies", error);
+       if (tmp == NULL)
+               return FALSE;
+       split = g_strsplit_set (tmp, " ", -1);
+       g_free (tmp);
+
+       if (split && g_strv_length (split) > 0) {
+               for (iter = split; iter && *iter; iter++)
+                       g_strstrip (*iter);
+               g_variant_builder_add (&props, "{sv}", "proxies", g_variant_new_strv ((gpointer) split, -1));
+       }
+       g_strfreev (split);
+
+       tmp = g_key_file_get_string (kf, section, "pac-url", error);
+       if (tmp == NULL)
+               return FALSE;
+       g_variant_builder_add (&props, "{sv}",
+                              "pac-url",
+                              g_variant_new_string (tmp));
+       g_free (tmp);
+
+       tmp = g_key_file_get_string (kf, section, "pac-script", error);
+       if (tmp == NULL)
+               return FALSE;
+       g_variant_builder_add (&props, "{sv}",
+                              "pac-script",
+                              g_variant_new_string (tmp));
+       g_free (tmp);
+       *out_props = g_variant_builder_end (&props);
+       return TRUE;
+}
+
+static gboolean
 parse_ip4 (GKeyFile *kf, GVariant **out_props, const char *section, GError **error)
 {
        GVariantBuilder props;
@@ -355,11 +396,13 @@ get_dispatcher_file (const char *file,
                      GVariant **out_con_dict,
                      GVariant **out_con_props,
                      GVariant **out_device_props,
+                     GVariant **out_device_proxy_props,
                      GVariant **out_device_ip4_props,
                      GVariant **out_device_ip6_props,
                      GVariant **out_device_dhcp4_props,
                      GVariant **out_device_dhcp6_props,
                      char **out_vpn_ip_iface,
+                     GVariant **out_vpn_proxy_props,
                      GVariant **out_vpn_ip4_props,
                      GVariant **out_vpn_ip6_props,
                      char **out_expected_iface,
@@ -375,11 +418,13 @@ get_dispatcher_file (const char *file,
        g_assert (out_con_dict && !*out_con_dict);
        g_assert (out_con_props && !*out_con_props);
        g_assert (out_device_props && !*out_device_props);
+       g_assert (out_device_proxy_props && !*out_device_proxy_props);
        g_assert (out_device_ip4_props && !*out_device_ip4_props);
        g_assert (out_device_ip6_props && !*out_device_ip6_props);
        g_assert (out_device_dhcp4_props && !*out_device_dhcp4_props);
        g_assert (out_device_dhcp6_props && !*out_device_dhcp6_props);
        g_assert (out_vpn_ip_iface && !*out_vpn_ip_iface);
+       g_assert (out_vpn_proxy_props && !*out_vpn_proxy_props);
        g_assert (out_vpn_ip4_props && !*out_vpn_ip4_props);
        g_assert (out_vpn_ip6_props && !*out_vpn_ip6_props);
        g_assert (out_expected_iface && !*out_expected_iface);
@@ -403,6 +448,11 @@ get_dispatcher_file (const char *file,
        if (!parse_device (kf, out_device_props, error))
                goto out;
 
+       if (g_key_file_has_group (kf, "proxy")) {
+               if (!parse_proxy (kf, out_device_proxy_props, "proxy", error))
+                       goto out;
+       }
+
        if (g_key_file_has_group (kf, "ip4")) {
                if (!parse_ip4 (kf, out_device_ip4_props, "ip4", error))
                        goto out;
@@ -447,11 +497,13 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
        GVariant *con_dict = NULL;
        GVariant *con_props = NULL;
        GVariant *device_props = NULL;
+       GVariant *device_proxy_props = NULL;
        GVariant *device_ip4_props = NULL;
        GVariant *device_ip6_props = NULL;
        GVariant *device_dhcp4_props = NULL;
        GVariant *device_dhcp6_props = NULL;
        char *vpn_ip_iface = NULL;
+       GVariant *vpn_proxy_props = NULL;
        GVariant *vpn_ip4_props = NULL;
        GVariant *vpn_ip6_props = NULL;
        char *expected_iface = NULL;
@@ -470,11 +522,13 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
                                       &con_dict,
                                       &con_props,
                                       &device_props,
+                                      &device_proxy_props,
                                       &device_ip4_props,
                                       &device_ip6_props,
                                       &device_dhcp4_props,
                                       &device_dhcp6_props,
                                       &vpn_ip_iface,
+                                      &vpn_proxy_props,
                                       &vpn_ip4_props,
                                       &vpn_ip6_props,
                                       &expected_iface,
@@ -490,11 +544,13 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
                                                   con_dict,
                                                   con_props,
                                                   device_props,
+                                                  device_proxy_props,
                                                   device_ip4_props,
                                                   device_ip6_props,
                                                   device_dhcp4_props,
                                                   device_dhcp6_props,
                                                   override_vpn_ip_iface ? override_vpn_ip_iface : 
vpn_ip_iface,
+                                                  vpn_proxy_props,
                                                   vpn_ip4_props,
                                                   vpn_ip6_props,
                                                   &out_iface,
@@ -554,6 +610,8 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
        g_variant_unref (con_dict);
        g_variant_unref (con_props);
        g_variant_unref (device_props);
+       if (device_proxy_props)
+               g_variant_unref (device_proxy_props);
        if (device_ip4_props)
                g_variant_unref (device_ip4_props);
        if (device_ip6_props)
@@ -562,6 +620,8 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
                g_variant_unref (device_dhcp4_props);
        if (device_dhcp6_props)
                g_variant_unref (device_dhcp6_props);
+       if (vpn_proxy_props)
+               g_variant_unref (vpn_proxy_props);
        if (vpn_ip4_props)
                g_variant_unref (vpn_ip4_props);
        if (vpn_ip6_props)
diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c
index 4959ed5..9cd2921 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -31,6 +31,7 @@
 #include "nm-device.h"
 #include "nm-dhcp4-config.h"
 #include "nm-dhcp6-config.h"
+#include "nm-proxy-config.h"
 #include "nm-ip4-config.h"
 #include "nm-ip6-config.h"
 #include "nm-settings-connection.h"
@@ -89,6 +90,35 @@ _get_monitor_by_action (DispatcherAction action)
 }
 
 static void
+dump_proxy_to_props (NMProxyConfig *proxy, GVariantBuilder *builder)
+{
+       GVariantBuilder int_builder;
+       guint n, i;
+
+       if (nm_proxy_config_get_method (proxy) == NM_PROXY_CONFIG_METHOD_NONE)
+               return;
+
+       /* Proxies */
+       g_variant_builder_init (&int_builder, G_VARIANT_TYPE ("as"));
+       n = nm_proxy_config_get_num_proxies (proxy);
+       for (i = 0; i < n; i++)
+               g_variant_builder_add (&int_builder, "s", nm_proxy_config_get_proxy (proxy, i));
+       g_variant_builder_add (builder, "{sv}",
+                              "proxies",
+                              g_variant_builder_end (&int_builder));
+
+       /* PAC Url */
+       g_variant_builder_add (builder, "{sv}",
+                              "pac-url",
+                              g_variant_new_string (nm_proxy_config_get_pac_url (proxy)));
+
+       /* PAC Script */
+       g_variant_builder_add (builder, "{sv}",
+                              "pac-script",
+                              g_variant_new_string (nm_proxy_config_get_pac_script (proxy)));
+}
+
+static void
 dump_ip4_to_props (NMIP4Config *ip4, GVariantBuilder *builder)
 {
        GVariantBuilder int_builder;
@@ -229,11 +259,13 @@ dump_ip6_to_props (NMIP6Config *ip6, GVariantBuilder *builder)
 static void
 fill_device_props (NMDevice *device,
                    GVariantBuilder *dev_builder,
+                   GVariantBuilder *proxy_builder,
                    GVariantBuilder *ip4_builder,
                    GVariantBuilder *ip6_builder,
                    GVariant **dhcp4_props,
                    GVariant **dhcp6_props)
 {
+       NMProxyConfig *proxy_config;
        NMIP4Config *ip4_config;
        NMIP6Config *ip6_config;
        NMDhcp4Config *dhcp4_config;
@@ -252,6 +284,10 @@ fill_device_props (NMDevice *device,
                g_variant_builder_add (dev_builder, "{sv}", NMD_DEVICE_PROPS_PATH,
                                       g_variant_new_object_path (nm_exported_object_get_path 
(NM_EXPORTED_OBJECT (device))));
 
+       proxy_config = nm_device_get_proxy_config (device);
+       if (proxy_config)
+               dump_proxy_to_props (proxy_config, proxy_builder);
+
        ip4_config = nm_device_get_ip4_config (device);
        if (ip4_config)
                dump_ip4_to_props (ip4_config, ip4_builder);
@@ -270,11 +306,15 @@ fill_device_props (NMDevice *device,
 }
 
 static void
-fill_vpn_props (NMIP4Config *ip4_config,
+fill_vpn_props (NMProxyConfig *proxy_config,
+                NMIP4Config *ip4_config,
                 NMIP6Config *ip6_config,
+                GVariantBuilder *proxy_builder,
                 GVariantBuilder *ip4_builder,
                 GVariantBuilder *ip6_builder)
 {
+       if (proxy_config)
+               dump_proxy_to_props (proxy_config, proxy_builder);
        if (ip4_config)
                dump_ip4_to_props (ip4_config, ip4_builder);
        if (ip6_config)
@@ -450,6 +490,7 @@ _dispatcher_call (DispatcherAction action,
                   NMConnection *applied_connection,
                   NMDevice *device,
                   const char *vpn_iface,
+                  NMProxyConfig *vpn_proxy_config,
                   NMIP4Config *vpn_ip4_config,
                   NMIP6Config *vpn_ip6_config,
                   DispatcherFunc callback,
@@ -459,10 +500,12 @@ _dispatcher_call (DispatcherAction action,
        GVariant *connection_dict;
        GVariantBuilder connection_props;
        GVariantBuilder device_props;
+       GVariantBuilder device_proxy_props;
        GVariantBuilder device_ip4_props;
        GVariantBuilder device_ip6_props;
        GVariant *device_dhcp4_props = NULL;
        GVariant *device_dhcp6_props = NULL;
+       GVariantBuilder vpn_proxy_props;
        GVariantBuilder vpn_ip4_props;
        GVariantBuilder vpn_ip6_props;
        DispatchInfo *info = NULL;
@@ -546,8 +589,10 @@ _dispatcher_call (DispatcherAction action,
        }
 
        g_variant_builder_init (&device_props, G_VARIANT_TYPE_VARDICT);
+       g_variant_builder_init (&device_proxy_props, G_VARIANT_TYPE_VARDICT);
        g_variant_builder_init (&device_ip4_props, G_VARIANT_TYPE_VARDICT);
        g_variant_builder_init (&device_ip6_props, G_VARIANT_TYPE_VARDICT);
+       g_variant_builder_init (&vpn_proxy_props, G_VARIANT_TYPE_VARDICT);
        g_variant_builder_init (&vpn_ip4_props, G_VARIANT_TYPE_VARDICT);
        g_variant_builder_init (&vpn_ip6_props, G_VARIANT_TYPE_VARDICT);
 
@@ -555,13 +600,16 @@ _dispatcher_call (DispatcherAction action,
        if (action != DISPATCHER_ACTION_HOSTNAME) {
                fill_device_props (device,
                                   &device_props,
+                                  &device_proxy_props,
                                   &device_ip4_props,
                                   &device_ip6_props,
                                   &device_dhcp4_props,
                                   &device_dhcp6_props);
                if (vpn_ip4_config || vpn_ip6_config) {
-                       fill_vpn_props (vpn_ip4_config,
+                       fill_vpn_props (vpn_proxy_config,
+                                       vpn_ip4_config,
                                        vpn_ip6_config,
+                                       &vpn_proxy_props,
                                        &vpn_ip4_props,
                                        &vpn_ip6_props);
                }
@@ -578,16 +626,18 @@ _dispatcher_call (DispatcherAction action,
                GVariantIter *results;
 
                ret = _nm_dbus_proxy_call_sync (dispatcher_proxy, "Action",
-                                               g_variant_new ("(s a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv} 
a{sv}sa{sv}a{sv}b)",
+                                               g_variant_new ("(s a{sa{sv}}a{sv}a{sv}a{sv}a{sv}a{sv}@a{sv} 
a{sv}sa{sv}a{sv}a{sv}b)",
                                                               action_to_string (action),
                                                               connection_dict,
                                                               &connection_props,
                                                               &device_props,
+                                                              &device_proxy_props,
                                                               &device_ip4_props,
                                                               &device_ip6_props,
                                                               device_dhcp4_props,
                                                               device_dhcp6_props,
                                                               vpn_iface ? vpn_iface : "",
+                                                              &vpn_proxy_props,
                                                               &vpn_ip4_props,
                                                               &vpn_ip6_props,
                                                               nm_logging_enabled (LOGL_DEBUG, 
LOGD_DISPATCH)),
@@ -613,16 +663,18 @@ _dispatcher_call (DispatcherAction action,
                info->callback = callback;
                info->user_data = user_data;
                g_dbus_proxy_call (dispatcher_proxy, "Action",
-                                  g_variant_new ("(s a{sa{sv}}a{sv}a{sv}a{sv}a{sv}@a{sv} a{sv}sa{sv}a{sv}b)",
+                                  g_variant_new ("(s a{sa{sv}}a{sv}a{sv}a{sv}a{sv}a{sv}@a{sv} 
a{sv}sa{sv}a{sv}a{sv}b)",
                                                  action_to_string (action),
                                                  connection_dict,
                                                  &connection_props,
                                                  &device_props,
+                                                 &device_proxy_props,
                                                  &device_ip4_props,
                                                  &device_ip6_props,
                                                  device_dhcp4_props,
                                                  device_dhcp6_props,
                                                  vpn_iface ? vpn_iface : "",
+                                                 &vpn_proxy_props,
                                                  &vpn_ip4_props,
                                                  &vpn_ip6_props,
                                                  nm_logging_enabled (LOGL_DEBUG, LOGD_DISPATCH)),
@@ -671,8 +723,8 @@ nm_dispatcher_call (DispatcherAction action,
                     gpointer user_data,
                     guint *out_call_id)
 {
-       return _dispatcher_call (action, FALSE, settings_connection, applied_connection, device, NULL, NULL,
-                                NULL, callback, user_data, out_call_id);
+       return _dispatcher_call (action, FALSE, settings_connection, applied_connection, device, NULL,
+                                NULL, NULL, NULL, callback, user_data, out_call_id);
 }
 
 /**
@@ -693,8 +745,8 @@ nm_dispatcher_call_sync (DispatcherAction action,
                          NMConnection *applied_connection,
                          NMDevice *device)
 {
-       return _dispatcher_call (action, TRUE, settings_connection, applied_connection, device, NULL, NULL,
-                                NULL, NULL, NULL, NULL);
+       return _dispatcher_call (action, TRUE, settings_connection, applied_connection, device, NULL,
+                                NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
 /**
@@ -704,6 +756,7 @@ nm_dispatcher_call_sync (DispatcherAction action,
  * @applied_connection: the currently applied connection
  * @parent_device: the parent #NMDevice of the VPN connection
  * @vpn_iface: the IP interface of the VPN tunnel, if any
+ * @vpn_proxy_config: the #NMProxyConfig of the VPN connection
  * @vpn_ip4_config: the #NMIP4Config of the VPN connection
  * @vpn_ip6_config: the #NMIP6Config of the VPN connection
  * @callback: a caller-supplied callback to execute when done
@@ -722,6 +775,7 @@ nm_dispatcher_call_vpn (DispatcherAction action,
                         NMConnection *applied_connection,
                         NMDevice *parent_device,
                         const char *vpn_iface,
+                        NMProxyConfig *vpn_proxy_config,
                         NMIP4Config *vpn_ip4_config,
                         NMIP6Config *vpn_ip6_config,
                         DispatcherFunc callback,
@@ -729,7 +783,7 @@ nm_dispatcher_call_vpn (DispatcherAction action,
                         guint *out_call_id)
 {
        return _dispatcher_call (action, FALSE, settings_connection, applied_connection, parent_device, 
vpn_iface,
-                                vpn_ip4_config, vpn_ip6_config, callback, user_data, out_call_id);
+                                vpn_proxy_config, vpn_ip4_config, vpn_ip6_config, callback, user_data, 
out_call_id);
 }
 
 /**
@@ -739,6 +793,7 @@ nm_dispatcher_call_vpn (DispatcherAction action,
  * @applied_connection: the currently applied connection
  * @parent_device: the parent #NMDevice of the VPN connection
  * @vpn_iface: the IP interface of the VPN tunnel, if any
+ * @vpn_proxy_config: the #NMProxyConfig of the VPN connection
  * @vpn_ip4_config: the #NMIP4Config of the VPN connection
  * @vpn_ip6_config: the #NMIP6Config of the VPN connection
  *
@@ -753,11 +808,12 @@ nm_dispatcher_call_vpn_sync (DispatcherAction action,
                              NMConnection *applied_connection,
                              NMDevice *parent_device,
                              const char *vpn_iface,
+                             NMProxyConfig *vpn_proxy_config,
                              NMIP4Config *vpn_ip4_config,
                              NMIP6Config *vpn_ip6_config)
 {
        return _dispatcher_call (action, TRUE, settings_connection, applied_connection, parent_device, 
vpn_iface,
-                                vpn_ip4_config, vpn_ip6_config, NULL, NULL, NULL);
+                                vpn_proxy_config, vpn_ip4_config, vpn_ip6_config, NULL, NULL, NULL);
 }
 
 void
diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h
index 42dcdc4..49da239 100644
--- a/src/nm-dispatcher.h
+++ b/src/nm-dispatcher.h
@@ -61,6 +61,7 @@ gboolean nm_dispatcher_call_vpn (DispatcherAction action,
                                  NMConnection *applied_connection,
                                  NMDevice *parent_device,
                                  const char *vpn_iface,
+                                 NMProxyConfig *vpn_proxy_config,
                                  NMIP4Config *vpn_ip4_config,
                                  NMIP6Config *vpn_ip6_config,
                                  DispatcherFunc callback,
@@ -72,6 +73,7 @@ gboolean nm_dispatcher_call_vpn_sync (DispatcherAction action,
                                       NMConnection *applied_connection,
                                       NMDevice *parent_device,
                                       const char *vpn_iface,
+                                      NMProxyConfig *vpn_proxy_config,
                                       NMIP4Config *vpn_ip4_config,
                                       NMIP6Config *vpn_ip6_config);
 
-- 
2.5.5



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]