Commit 86d4573b authored by Atul Anand's avatar Atul Anand Committed by Thomas Haller

src: Fixes to add Proxy Feature

src: Fixes in nm-device.c and nm-vpn-connection.c to update PacRunner
at the right place and moment. When a device goes up PacRunner is
configured with the Device IPxConfigs and Proxy Config. When it goes
down the same configuration is removed from PacRunner.

ifcfg-rh: Fixed to read and write proxy settings to the ifcfg network
scripts.
parent fd0b9ab5
......@@ -45,8 +45,10 @@
#include "nm-lndp-rdisc.h"
#include "nm-dhcp-manager.h"
#include "nm-act-request.h"
#include "nm-proxy-config.h"
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
#include "nm-pacrunner-manager.h"
#include "nm-dnsmasq-manager.h"
#include "nm-dhcp4-config.h"
#include "nm-dhcp6-config.h"
......@@ -294,6 +296,10 @@ typedef struct _NMDevicePrivate {
guint32 dhcp_timeout;
char * dhcp_anycast_address;
/* Proxy Configuration */
NMProxyConfig * proxy_config;
NMPacRunnerManager * pacrunner_manager;
/* IP4 configuration info */
NMIP4Config * ip4_config; /* Combined config from VPN, settings, and device */
union {
......@@ -416,6 +422,8 @@ typedef struct _NMDevicePrivate {
} NMDevicePrivate;
static void nm_device_set_proxy_config (NMDevice *self, GHashTable *options);
static gboolean nm_device_set_ip4_config (NMDevice *self,
NMIP4Config *config,
guint32 default_route_metric,
......@@ -5072,6 +5080,8 @@ dhcp4_state_changed (NMDhcpClient *client,
break;
}
nm_device_set_proxy_config (self, options);
nm_dhcp4_config_set_options (priv->dhcp4.config, options);
_notify (self, PROP_DHCP4_CONFIG);
priv->dhcp4.num_tries_left = DHCP_NUM_TRIES_MAX;
......@@ -6982,6 +6992,9 @@ activate_stage3_ip_config_start (NMDevice *self)
&& !nm_device_activate_stage3_ip6_start (self))
return;
/* Proxy */
nm_device_set_proxy_config (self, NULL);
check_ip_state (self, TRUE);
}
......@@ -8517,8 +8530,50 @@ nm_device_is_activating (NMDevice *self)
return priv->act_handle4.id ? TRUE : FALSE;
}
/* IP Configuration stuff */
NMProxyConfig *
nm_device_get_proxy_config (NMDevice *self)
{
g_return_val_if_fail (NM_IS_DEVICE (self), NULL);
return NM_DEVICE_GET_PRIVATE (self)->proxy_config;
}
static void
nm_device_set_proxy_config (NMDevice *self, GHashTable *options)
{
NMDevicePrivate *priv;
NMConnection *connection;
NMSettingProxy *s_proxy = NULL;
char *pac = NULL;
g_return_if_fail (NM_IS_DEVICE (self));
priv = NM_DEVICE_GET_PRIVATE (self);
g_clear_object (&priv->proxy_config);
priv->proxy_config = nm_proxy_config_new ();
if (options) {
pac = g_hash_table_lookup (options, "wpad");
if (pac) {
nm_proxy_config_set_method (priv->proxy_config, NM_PROXY_CONFIG_METHOD_AUTO);
nm_proxy_config_set_pac_url (priv->proxy_config, pac);
_LOGD (LOGD_PROXY, "PAC url: %s",pac);
} else {
nm_proxy_config_set_method (priv->proxy_config, NM_PROXY_CONFIG_METHOD_NONE);
_LOGI (LOGD_PROXY, "PAC url not obtained from DHCP server");
}
}
connection = nm_device_get_applied_connection (self);
if (connection)
s_proxy = nm_connection_get_setting_proxy (connection);
if (s_proxy)
nm_proxy_config_merge_setting (priv->proxy_config, s_proxy);
}
/* IP Configuration stuff */
NMDhcp4Config *
nm_device_get_dhcp4_config (NMDevice *self)
{
......@@ -10735,6 +10790,7 @@ _cleanup_generic_post (NMDevice *self, CleanupType cleanup_type)
*/
nm_device_set_ip4_config (self, NULL, 0, TRUE, TRUE, NULL);
nm_device_set_ip6_config (self, NULL, TRUE, TRUE, NULL);
g_clear_object (&priv->proxy_config);
g_clear_object (&priv->con_ip4_config);
g_clear_object (&priv->dev_ip4_config);
g_clear_object (&priv->ext_ip4_config);
......@@ -11325,6 +11381,9 @@ _set_state_full (NMDevice *self,
deactivate_dispatcher_complete (0, self);
}
}
/* Remove config from PacRunner */
nm_pacrunner_manager_remove (priv->pacrunner_manager, nm_device_get_ip_iface (self));
break;
case NM_DEVICE_STATE_DISCONNECTED:
if ( priv->queued_act_request
......@@ -11348,6 +11407,14 @@ _set_state_full (NMDevice *self,
nm_act_request_get_settings_connection (req),
nm_act_request_get_applied_connection (req),
self, NULL, NULL, NULL);
/* Load PacRunner with Device's config */
if (!nm_pacrunner_manager_send (priv->pacrunner_manager,
nm_device_get_ip_iface (self),
priv->proxy_config,
priv->ip4_config,
priv->ip6_config))
_LOGI (LOGD_PROXY, "Couldn't update pacrunner for %s", nm_device_get_ip_iface (self));
break;
case NM_DEVICE_STATE_FAILED:
/* Usually upon failure the activation chain is interrupted in
......@@ -12164,6 +12231,8 @@ nm_device_init (NMDevice *self)
priv->available_connections = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
priv->ip6_saved_properties = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free);
priv->pacrunner_manager = g_object_ref (nm_pacrunner_manager_get ());
priv->default_route.v4_is_assumed = TRUE;
priv->default_route.v6_is_assumed = TRUE;
......@@ -12275,6 +12344,8 @@ dispose (GObject *object)
dispatcher_cleanup (self);
g_clear_object (&priv->pacrunner_manager);
_cleanup_generic_pre (self, CLEANUP_TYPE_KEEP);
g_warn_if_fail (priv->slaves == NULL);
......
......@@ -366,9 +366,10 @@ const char * nm_device_get_permanent_hw_address (NMDevice *dev,
gboolean fallback_fake);
const char * nm_device_get_initial_hw_address (NMDevice *dev);
NMProxyConfig * nm_device_get_proxy_config (NMDevice *dev);
NMDhcp4Config * nm_device_get_dhcp4_config (NMDevice *dev);
NMDhcp6Config * nm_device_get_dhcp6_config (NMDevice *dev);
NMIP4Config * nm_device_get_ip4_config (NMDevice *dev);
void nm_device_replace_vpn4_config (NMDevice *dev,
NMIP4Config *old,
......
This diff is collapsed.
......@@ -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);
......
......@@ -57,6 +57,7 @@
#include "nm-setting-adsl.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-proxy.h"
#include "nm-setting-bond.h"
#include "nm-utils.h"
#include "nm-core-internal.h"
......
......@@ -48,6 +48,7 @@
#include "nm-setting-bridge.h"
#include "nm-setting-bridge-port.h"
#include "nm-setting-dcb.h"
#include "nm-setting-proxy.h"
#include "nm-setting-generic.h"
#include "nm-core-internal.h"
#include "nm-utils.h"
......@@ -899,6 +900,176 @@ error:
return success;
}
static NMSetting *
make_proxy_setting (shvarFile *ifcfg, GError **error)
{
NMSettingProxy *s_proxy = NULL;
char *value = NULL;
NMSettingProxyMethod method;
value = svGetValue (ifcfg, "PROXY_METHOD", FALSE);
if (!value)
return NULL;
if (!g_ascii_strcasecmp (value, "auto"))
method = NM_SETTING_PROXY_METHOD_AUTO;
else if (!g_ascii_strcasecmp (value, "manual"))
method = NM_SETTING_PROXY_METHOD_MANUAL;
else
method = NM_SETTING_PROXY_METHOD_NONE;
g_free (value);
s_proxy = (NMSettingProxy *) nm_setting_proxy_new ();
switch (method) {
case NM_SETTING_PROXY_METHOD_AUTO:
g_object_set (s_proxy,
NM_SETTING_PROXY_METHOD, NM_SETTING_PROXY_METHOD_AUTO,
NULL);
value = svGetValue (ifcfg, "PAC_URL", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_PAC_URL, value, NULL);
g_free (value);
}
value = svGetValue (ifcfg, "PAC_SCRIPT", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_PAC_SCRIPT, value, NULL);
g_free (value);
}
break;
case NM_SETTING_PROXY_METHOD_MANUAL:
g_object_set (s_proxy,
NM_SETTING_PROXY_METHOD, NM_SETTING_PROXY_METHOD_MANUAL,
NULL);
value = svGetValue (ifcfg, "NO_PROXY_FOR", FALSE);
if (value) {
char **excludes = NULL;
excludes = g_strsplit (value, " ", 0);
if (excludes)
g_object_set (s_proxy,
NM_SETTING_PROXY_NO_PROXY_FOR, excludes,
NULL);
g_free (value);
}
value = svGetValue (ifcfg, "HTTP_PROXY", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_PROXY, value, NULL);
g_free (value);
}
value = svGetValue (ifcfg, "HTTP_PORT", FALSE);
if (value) {
int port;
port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1);
if (port > 0)
g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_PORT, (guint) port, NULL);
else
PARSE_WARNING ("invalid PORT '%s'", value);
g_free (value);
}
value = svGetValue (ifcfg, "HTTP_DEFAULT", FALSE);
if (value) {
if (!g_ascii_strcasecmp (value, "yes")) {
g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_DEFAULT, TRUE, NULL);
g_free (value);
break;
}
}
value = svGetValue (ifcfg, "SSL_PROXY", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PROXY, value, NULL);
g_free (value);
}
value = svGetValue (ifcfg, "SSL_PORT", FALSE);
if (value) {
int port;
port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1);
if (port > 0)
g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PORT, (guint) port, NULL);
else
PARSE_WARNING ("invalid PORT '%s'", value);
g_free (value);
}
value = svGetValue (ifcfg, "FTP_PROXY", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PROXY, value, NULL);
g_free (value);
}
value = svGetValue (ifcfg, "FTP_PORT", FALSE);
if (value) {
int port;
port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1);
if (port > 0)
g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PORT, (guint) port, NULL);
else
PARSE_WARNING ("invalid PORT '%s'", value);
g_free (value);
}
value = svGetValue (ifcfg, "SOCKS_PROXY", FALSE);
if (value) {
value = g_strstrip (value);
g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_PROXY, value, NULL);
g_free (value);
}
value = svGetValue (ifcfg, "SOCKS_PORT", FALSE);
if (value) {
int port;
port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1);
if (port > 0)
g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_PORT, (guint) port, NULL);
else
PARSE_WARNING ("invalid PORT '%s'", value);
g_free (value);
}
value = svGetValue (ifcfg, "SOCKS_VERSION_5", FALSE);
if (value) {
if (!g_ascii_strcasecmp (value, "yes")) {
g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_VERSION_5, TRUE, NULL);
g_free (value);
break;
}
}
break;
case NM_SETTING_PROXY_METHOD_NONE:
g_object_set (s_proxy,
NM_SETTING_PROXY_METHOD, NM_SETTING_PROXY_METHOD_NONE,
NULL);
}
value = svGetValue (ifcfg, "BROWSER_ONLY", FALSE);
if (value) {
if (!g_ascii_strcasecmp (value, "yes")) {
g_object_set (s_proxy, NM_SETTING_PROXY_BROWSER_ONLY, TRUE, NULL);
g_free (value);
}
}
return NM_SETTING (s_proxy);
}
static NMSetting *
make_ip4_setting (shvarFile *ifcfg,
......@@ -4962,7 +5133,7 @@ connection_from_file_full (const char *filename,
shvarFile *parsed;
gs_free char *type = NULL;
char *devtype, *bootproto;
NMSetting *s_ip4, *s_ip6, *s_port, *s_dcb = NULL;
NMSetting *s_ip4, *s_ip6, *s_proxy, *s_port, *s_dcb = NULL;
const char *ifcfg_name = NULL;
g_return_val_if_fail (filename != NULL, NULL);
......@@ -5179,6 +5350,10 @@ connection_from_file_full (const char *filename,
*/
check_dns_search_domains (parsed, s_ip4, s_ip6);
s_proxy = make_proxy_setting (parsed, error);
if (s_proxy)
nm_connection_add_setting (connection, s_proxy);
/* Bridge port? */
s_port = make_bridge_port_setting (parsed);
if (s_port)
......
......@@ -36,6 +36,7 @@
#include "nm-setting-wired.h"
#include "nm-setting-wireless.h"
#include "nm-setting-8021x.h"
#include "nm-setting-proxy.h"
#include "nm-setting-ip4-config.h"
#include "nm-setting-ip6-config.h"
#include "nm-setting-pppoe.h"
......@@ -1997,6 +1998,138 @@ error:
return success;
}
static gboolean
write_proxy_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
NMSettingProxy *s_proxy;
NMSettingProxyMethod method;
char *tmp;
const char *pac_url, *pac_script;
const char *http_proxy, *ssl_proxy, *ftp_proxy, *socks_proxy;
guint32 http_port, ssl_port, ftp_port, socks_port;
gboolean http_default, socks_version_5, browser_only;
const char *const*excludes;
s_proxy = nm_connection_get_setting_proxy (connection);
if (!s_proxy)
return TRUE;
svSetValue (ifcfg, "HTTP_PROXY", NULL, FALSE);
svSetValue (ifcfg, "HTTP_PORT", NULL, FALSE);
svSetValue (ifcfg, "HTTP_DEFAULT", NULL, FALSE);
svSetValue (ifcfg, "SSL_PROXY", NULL, FALSE);
svSetValue (ifcfg, "SSL_PORT", NULL, FALSE);
svSetValue (ifcfg, "FTP_PROXY", NULL, FALSE);
svSetValue (ifcfg, "FTP_PORT", NULL, FALSE);
svSetValue (ifcfg, "SOCKS_PROXY", NULL, FALSE);
svSetValue (ifcfg, "SOCKS_PORT", NULL, FALSE);
svSetValue (ifcfg, "SOCKS_VERSION_5", NULL, FALSE);
svSetValue (ifcfg, "NO_PROXY_FOR", NULL, FALSE);
svSetValue (ifcfg, "BROWSER_ONLY", NULL, FALSE);
svSetValue (ifcfg, "PAC_URL", NULL, FALSE);
svSetValue (ifcfg, "PAC_SCRIPT", NULL, FALSE);
method = nm_setting_proxy_get_method (s_proxy);
switch (method) {
case NM_SETTING_PROXY_METHOD_AUTO:
svSetValue (ifcfg, "PROXY_METHOD", "auto", FALSE);
pac_url = nm_setting_proxy_get_pac_url (s_proxy);
if (pac_url)
svSetValue (ifcfg, "PAC_URL", pac_url, FALSE);
pac_script = nm_setting_proxy_get_pac_script (s_proxy);
if (pac_script)
svSetValue (ifcfg, "PAC_SCRIPT", pac_script, FALSE);
break;
case NM_SETTING_PROXY_METHOD_MANUAL:
svSetValue (ifcfg, "PROXY_METHOD", "manual", FALSE);
excludes = nm_setting_proxy_get_no_proxy_for (s_proxy);
if (excludes && excludes[0]) {
gs_free char *str = NULL;
str = g_strjoinv (" ", (char **) excludes);
svSetValue (ifcfg, "NO_PROXY_FOR", str, FALSE);
}
http_proxy = nm_setting_proxy_get_http_proxy (s_proxy);
if (http_proxy)
svSetValue (ifcfg, "HTTP_PROXY", http_proxy, FALSE);
svSetValue (ifcfg, "HTTP_PORT", NULL, FALSE);
http_port = nm_setting_proxy_get_http_port (s_proxy);
if (http_port) {
tmp = g_strdup_printf ("%u", http_port);
svSetValue (ifcfg, "HTTP_PORT", tmp, FALSE);
g_free (tmp);
}
http_default = nm_setting_proxy_get_http_default (s_proxy);
if (http_default) {
svSetValue (ifcfg, "HTTP_DEFAULT", "yes", FALSE);
break;
} else
svSetValue (ifcfg, "HTTP_DEFAULT", "no", FALSE);
ssl_proxy = nm_setting_proxy_get_ssl_proxy (s_proxy);
if (ssl_proxy)
svSetValue (ifcfg, "SSL_PROXY", ssl_proxy, FALSE);
svSetValue (ifcfg, "SSL_PORT", NULL, FALSE);
ssl_port = nm_setting_proxy_get_ssl_port (s_proxy);
if (ssl_port) {
tmp = g_strdup_printf ("%u", ssl_port);
svSetValue (ifcfg, "SSL_PORT", tmp, FALSE);
g_free (tmp);
}
ftp_proxy = nm_setting_proxy_get_ftp_proxy (s_proxy);
if (ftp_proxy)
svSetValue (ifcfg, "FTP_PROXY", ftp_proxy, FALSE);
svSetValue (ifcfg, "FTP_PORT", NULL, FALSE);
ftp_port = nm_setting_proxy_get_ftp_port (s_proxy);
if (ftp_port) {
tmp = g_strdup_printf ("%u", ftp_port);
svSetValue (ifcfg, "FTP_PORT", tmp, FALSE);
g_free (tmp);
}
socks_proxy = nm_setting_proxy_get_socks_proxy (s_proxy);
if (socks_proxy)
svSetValue (ifcfg, "SOCKS_PROXY", socks_proxy, FALSE);
svSetValue (ifcfg, "SOCKS_PORT", NULL, FALSE);
socks_port = nm_setting_proxy_get_socks_port (s_proxy);
if (socks_port) {
tmp = g_strdup_printf ("%u", socks_port);
svSetValue (ifcfg, "SOCKS_PORT", tmp, FALSE);
g_free (tmp);
}
socks_version_5 = nm_setting_proxy_get_socks_version_5 (s_proxy);
if (socks_version_5)
svSetValue (ifcfg, "SOCKS_VERSION_5", "yes", FALSE);
else
svSetValue (ifcfg, "SOCKS_VERSION_5", "no", FALSE);
break;
case NM_SETTING_PROXY_METHOD_NONE:
svSetValue (ifcfg, "PROXY_METHOD", "none", FALSE);
/* Write nothing more */
}
browser_only = nm_setting_proxy_get_browser_only (s_proxy);
if (browser_only)
svSetValue (ifcfg, "BROWSER_ONLY", "yes", FALSE);
else
svSetValue (ifcfg, "BROWSER_ONLY", "no", FALSE);
return TRUE;
}
static gboolean
write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
{
......@@ -2887,6 +3020,9 @@ write_connection (NMConnection *connection,
if (!write_dcb_setting (connection, ifcfg, error))
goto out;
if (!write_proxy_setting (connection, ifcfg, error))
goto out;
svSetValue (ifcfg, "DHCP_HOSTNAME", NULL, FALSE);
svSetValue (ifcfg, "DHCP_FQDN", NULL, FALSE);
......
......@@ -32,6 +32,7 @@
#include <unistd.h>
#include <syslog.h>
#include "nm-proxy-config.h"
#include "nm-ip4-config.h"
#include "nm-ip6-config.h"
#include "nm-platform.h"
......@@ -41,6 +42,7 @@
#include "nm-dispatcher.h"
#include "nm-agent-manager.h"
#include "nm-core-internal.h"
#include "nm-pacrunner-manager.h"
#include "nm-default-route-manager.h"
#include "nm-route-manager.h"
#include "nm-firewall-manager.h"
......@@ -124,6 +126,7 @@ typedef struct {
GCancellable *cancellable;
GVariant *connect_hash;
guint connect_timeout;
NMProxyConfig *proxy_config;
gboolean has_ip4;
NMIP4Config *ip4_config;
guint32 ip4_internal_gw;
......@@ -537,6 +540,7 @@ _set_vpn_state (NMVpnConnection *self,
_get_applied_connection (self),
parent_dev,
priv->ip_iface,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config,
dispatcher_pre_up_done,
......@@ -556,11 +560,20 @@ _set_vpn_state (NMVpnConnection *self,
_get_applied_connection (self),
parent_dev,
priv->ip_iface,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config,
NULL,
NULL,
NULL);
/* Load PacRunner with VPN's config */
if (!nm_pacrunner_manager_send (nm_pacrunner_manager_get (),
priv->ip_iface,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config))
_LOGI ("Couldn't update pacrunner for %s", priv->ip_iface);
break;
case STATE_DEACTIVATING:
if (quitting) {
......@@ -569,6 +582,7 @@ _set_vpn_state (NMVpnConnection *self,
_get_applied_connection (self),
parent_dev,
priv->ip_iface,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config);
} else {
......@@ -577,6 +591,7 @@ _set_vpn_state (NMVpnConnection *self,
_get_applied_connection (self),
parent_dev,
priv->ip_iface,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config,
dispatcher_pre_down_done,
......@@ -586,6 +601,9 @@ _set_vpn_state (NMVpnConnection *self,
dispatcher_pre_down_done (0, self);
}
}
/* Remove config from PacRunner */
nm_pacrunner_manager_remove (nm_pacrunner_manager_get(), priv->ip_iface);
break;
case STATE_FAILED:
case STATE_DISCONNECTED:
......@@ -599,6 +617,7 @@ _set_vpn_state (NMVpnConnection *self,
parent_dev,
priv->ip_iface,
NULL,
NULL,
NULL);
} else {
nm_dispatcher_call_vpn (DISPATCHER_ACTION_VPN_DOWN,
......@@ -610,6 +629,7 @@ _set_vpn_state (NMVpnConnection *self,
NULL,
NULL,
NULL,
NULL,
NULL);
}
}
......@@ -1277,6 +1297,20 @@ process_generic_config (NMVpnConnection *self, GVariant *dict)
_notify (self, PROP_BANNER);
}
/* Proxy Config */
g_clear_object (&priv->proxy_config);
priv->proxy_config = nm_proxy_config_new ();
if (g_variant_lookup (dict, NM_VPN_PLUGIN_CONFIG_PROXY_PAC, "&s", &str)) {
nm_proxy_config_set_method (priv->proxy_config, NM_PROXY_CONFIG_METHOD_AUTO);
nm_proxy_config_set_pac_url (priv->proxy_config, str);
} else
nm_proxy_config_set_method (priv->proxy_config, NM_PROXY_CONFIG_METHOD_NONE);
/* User overrides if any from the NMConnection's Proxy settings */
nm_proxy_config_merge_setting (priv->proxy_config,
nm_connection_get_setting_proxy (_get_applied_connection (self)));
/* External world-visible address of the VPN server */
priv->ip4_external_gw = 0;
g_clear_pointer (&priv->ip6_external_gw, g_free);
......@@ -2199,6 +2233,14 @@ nm_vpn_connection_get_banner (NMVpnConnection *self)
return NM_VPN_CONNECTION_GET_PRIVATE (self)->banner;
}
NMProxyConfig *
nm_vpn_connection_get_proxy_config (NMVpnConnection *self)
{
g_return_val_if_fail (NM_IS_VPN_CONNECTION (self), NULL);
return NM_VPN_CONNECTION_GET_PRIVATE (self)->proxy_config;
}
NMIP4Config *
nm_vpn_connection_get_ip4_config (NMVpnConnection *self)
{
......@@ -2597,6 +2639,7 @@ dispose (GObject *object)
g_cancellable_cancel (priv->cancellable);
g_clear_object (&priv->cancellable);
}
g_clear_object (&priv->proxy_config);
nm_exported_object_clear_and_unexport (&priv->ip4_config);
nm_exported_object_clear_and_unexport (&priv->ip6_config);
g_clear_object (&priv->proxy);
......
......@@ -68,6 +68,8 @@ void nm_vpn_connection_disconnect (NMVpnConnection *self,
NMVpnConnectionStateReason reason,
gboolean quitting);
NMProxyConfig * nm_vpn_connection_get_proxy_config (NMVpnConnection *self);
NMIP4Config * nm_vpn_connection_get_ip4_config (NMVpnConnection *self);
NMIP6Config * nm_vpn_connection_get_ip6_config (NMVpnConnection *self);
const char * nm_vpn_connection_get_ip_iface (NMVpnConnection *self, gboolean fallback_device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment