[PATCH v3 5/7] callouts: Fixes in Dispatcher to release Proxy env variables



Dispatcher Fixed to release env variables for proxy stuff. For VPNs
proxy variables have prefix "VPN_" as usual.
---
 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                   | 78 ++++++++++++++++++++++++++++++-----
 src/nm-dispatcher.h                   |  2 +
 10 files changed, 222 insertions(+), 10 deletions(-)

diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c
index 78ef8dd..3fdf800 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,12 +371,14 @@ 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 *connectivity_state,
                                     const char *vpn_ip_iface,
+                                    GVariant *vpn_proxy_props,
                                     GVariant *vpn_ip4_props,
                                     GVariant *vpn_ip6_props,
                                     char **out_iface,
@@ -443,6 +493,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);
@@ -451,6 +502,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 034898e..3c0afe6 100644
--- a/callouts/nm-dispatcher-utils.h
+++ b/callouts/nm-dispatcher-utils.h
@@ -28,12 +28,14 @@ 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 *connectivity_state,
                                     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 94bd132..6bb5221 100644
--- a/callouts/nm-dispatcher.c
+++ b/callouts/nm-dispatcher.c
@@ -76,12 +76,14 @@ 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 *connectivity_state,
                const char *vpn_ip_iface,
+               GVariant *vpn_proxy_props,
                GVariant *vpn_ip4_props,
                GVariant *vpn_ip6_props,
                gboolean request_debug,
@@ -665,12 +667,14 @@ 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 *connectivity_state,
                const char *vpn_ip_iface,
+               GVariant *vpn_proxy_props,
                GVariant *vpn_ip4_props,
                GVariant *vpn_ip6_props,
                gboolean request_debug,
@@ -697,12 +701,14 @@ 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,
                                                            connectivity_state,
                                                            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..2ff0c63 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=path/to/script
+
 [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=path/to/script
 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..d3f9c29 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=path/to/script
+
 [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=path/to/script
 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..5f5823b 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=path/to/script
+
 [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=path/to/script
 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..fc2518c 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=path/to/script
+
 [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=path/to/script
 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 55ccbd6..9b42613 100644
--- a/callouts/tests/test-dispatcher-envp.c
+++ b/callouts/tests/test-dispatcher-envp.c
@@ -194,6 +194,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;
@@ -357,12 +398,14 @@ 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_connectivity_state,
                      char **out_vpn_ip_iface,
+                     GVariant **out_vpn_proxy_props,
                      GVariant **out_vpn_ip4_props,
                      GVariant **out_vpn_ip6_props,
                      char **out_expected_iface,
@@ -378,12 +421,14 @@ 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_connectivity_state && !*out_connectivity_state);
        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);
@@ -408,6 +453,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;
@@ -452,12 +502,14 @@ 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 *connectivity_change = 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;
@@ -476,12 +528,14 @@ 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,
                                       &connectivity_change,
                                       &vpn_ip_iface,
+                                      &vpn_proxy_props,
                                       &vpn_ip4_props,
                                       &vpn_ip6_props,
                                       &expected_iface,
@@ -497,12 +551,14 @@ 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,
                                                   connectivity_change,
                                                   override_vpn_ip_iface ? override_vpn_ip_iface : 
vpn_ip_iface,
+                                                  vpn_proxy_props,
                                                   vpn_ip4_props,
                                                   vpn_ip6_props,
                                                   &out_iface,
@@ -562,6 +618,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)
@@ -570,6 +628,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 df9be2e..890e57d 100644
--- a/src/nm-dispatcher.c
+++ b/src/nm-dispatcher.c
@@ -32,6 +32,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-manager.h"
@@ -91,6 +92,37 @@ _get_monitor_by_action (DispatcherAction action)
 }
 
 static void
+dump_proxy_to_props (NMProxyConfig *proxy, GVariantBuilder *builder)
+{
+       char **proxies = NULL;
+       const char *pac_url = NULL, *pac_script = NULL;
+
+       if (nm_proxy_config_get_method (proxy) == NM_PROXY_CONFIG_METHOD_NONE)
+               return;
+
+       /* Proxies */
+       proxies = nm_proxy_config_get_proxies (proxy);
+       if (proxies && g_strv_length (proxies) > 0)
+               g_variant_builder_add (builder, "{sv}",
+                                      "proxies",
+                                      g_variant_new_strv ((const char *const *) proxies, -1));
+
+       /* PAC Url */
+       pac_url = nm_proxy_config_get_pac_url (proxy);
+       if (pac_url)
+               g_variant_builder_add (builder, "{sv}",
+                                      "pac-url",
+                                      g_variant_new_string (pac_url));
+
+       /* PAC Script */
+       pac_script = nm_proxy_config_get_pac_script (proxy);
+       if (pac_script)
+               g_variant_builder_add (builder, "{sv}",
+                                      "pac-script",
+                                      g_variant_new_string (pac_script));
+}
+
+static void
 dump_ip4_to_props (NMIP4Config *ip4, GVariantBuilder *builder)
 {
        GVariantBuilder int_builder;
@@ -231,11 +263,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;
@@ -254,6 +288,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);
@@ -272,11 +310,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)
@@ -454,6 +496,7 @@ _dispatcher_call (DispatcherAction action,
                   NMDevice *device,
                   NMConnectivityState connectivity_state,
                   const char *vpn_iface,
+                  NMProxyConfig *vpn_proxy_config,
                   NMIP4Config *vpn_ip4_config,
                   NMIP6Config *vpn_ip6_config,
                   DispatcherFunc callback,
@@ -463,10 +506,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;
@@ -551,8 +596,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);
 
@@ -561,13 +608,16 @@ _dispatcher_call (DispatcherAction action,
            && action != DISPATCHER_ACTION_CONNECTIVITY_CHANGE) {
                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);
                }
@@ -584,17 +634,19 @@ _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}ssa{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}ssa{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,
                                                               nm_connectivity_state_to_string 
(connectivity_state),
                                                               vpn_iface ? vpn_iface : "",
+                                                              &vpn_proxy_props,
                                                               &vpn_ip4_props,
                                                               &vpn_ip6_props,
                                                               nm_logging_enabled (LOGL_DEBUG, 
LOGD_DISPATCH)),
@@ -620,17 +672,19 @@ _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}ssa{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}ssa{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,
                                                  nm_connectivity_state_to_string (connectivity_state),
                                                  vpn_iface ? vpn_iface : "",
+                                                 &vpn_proxy_props,
                                                  &vpn_ip4_props,
                                                  &vpn_ip6_props,
                                                  nm_logging_enabled (LOGL_DEBUG, LOGD_DISPATCH)),
@@ -680,7 +734,7 @@ nm_dispatcher_call (DispatcherAction action,
                     guint *out_call_id)
 {
        return _dispatcher_call (action, FALSE, settings_connection, applied_connection, device,
-                                NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL,
+                                NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, NULL,
                                 callback, user_data, out_call_id);
 }
 
@@ -703,7 +757,7 @@ nm_dispatcher_call_sync (DispatcherAction action,
                          NMDevice *device)
 {
        return _dispatcher_call (action, TRUE, settings_connection, applied_connection, device,
-                                NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, NULL, NULL, NULL);
+                                NM_CONNECTIVITY_UNKNOWN, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
 /**
@@ -713,6 +767,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
@@ -731,6 +786,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,
@@ -738,8 +794,8 @@ nm_dispatcher_call_vpn (DispatcherAction action,
                         guint *out_call_id)
 {
        return _dispatcher_call (action, FALSE, settings_connection, applied_connection,
-                                parent_device, NM_CONNECTIVITY_UNKNOWN, vpn_iface, vpn_ip4_config,
-                                vpn_ip6_config, callback, user_data, out_call_id);
+                                parent_device, NM_CONNECTIVITY_UNKNOWN, vpn_iface, vpn_proxy_config,
+                                vpn_ip4_config, vpn_ip6_config, callback, user_data, out_call_id);
 }
 
 /**
@@ -749,6 +805,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
  *
@@ -763,11 +820,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, NM_CONNECTIVITY_UNKNOWN, vpn_iface,
+                                parent_device, NM_CONNECTIVITY_UNKNOWN, vpn_iface, vpn_proxy_config,
                                 vpn_ip4_config, vpn_ip6_config, NULL, NULL, NULL);
 }
 
@@ -785,7 +843,7 @@ nm_dispatcher_call_connectivity (DispatcherAction action,
                                  NMConnectivityState connectivity_state)
 {
        return _dispatcher_call (action, FALSE, NULL, NULL, NULL, connectivity_state,
-                                NULL, NULL, NULL, NULL, NULL, NULL);
+                                NULL, NULL, NULL, NULL, NULL, NULL, NULL);
 }
 
 void
diff --git a/src/nm-dispatcher.h b/src/nm-dispatcher.h
index 47cb648..919a92d 100644
--- a/src/nm-dispatcher.h
+++ b/src/nm-dispatcher.h
@@ -62,6 +62,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,
@@ -73,6 +74,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]