core: Expose IP and DHCP config information for VPN connections (rh #1036132)

This commit is contained in:
Dan Winship 2013-12-19 11:50:39 -05:00
commit 5e3c55eb28
10 changed files with 406 additions and 55 deletions

View file

@ -941,66 +941,38 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
/* IP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[1].name) == 0) {
const GPtrArray *devices;
int j;
gboolean b1 = FALSE;
NMIP4Config *cfg4 = nm_active_connection_get_ip4_config (acon);
devices = nm_active_connection_get_devices (acon);
for (j = 0; devices && (j < devices->len); j++) {
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
was_output = was_output || b1;
}
b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
was_output = was_output || b1;
}
/* DHCP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) {
const GPtrArray *devices;
int j;
gboolean b1 = FALSE;
NMDHCP4Config *dhcp4 = nm_active_connection_get_dhcp4_config (acon);
devices = nm_active_connection_get_devices (acon);
for (j = 0; devices && (j < devices->len); j++) {
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device);
b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
was_output = was_output || b1;
}
b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
was_output = was_output || b1;
}
/* IP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[3].name) == 0) {
const GPtrArray *devices;
int j;
gboolean b1 = FALSE;
NMIP6Config *cfg6 = nm_active_connection_get_ip6_config (acon);
devices = nm_active_connection_get_devices (acon);
for (j = 0; devices && (j < devices->len); j++) {
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
was_output = was_output || b1;
}
b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
was_output = was_output || b1;
}
/* DHCP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[4].name) == 0) {
const GPtrArray *devices;
int j;
gboolean b1 = FALSE;
NMDHCP6Config *dhcp6 = nm_active_connection_get_dhcp6_config (acon);
devices = nm_active_connection_get_devices (acon);
for (j = 0; devices && (j < devices->len); j++) {
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device);
b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
was_output = was_output || b1;
}
b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
was_output = was_output || b1;
}
/* VPN */

View file

@ -45,12 +45,42 @@
whether it currently owns the default IPv4 route.
</tp:docstring>
</property>
<property name="Ip4Config" type="o" access="read">
<tp:docstring>
Object path of the Ip4Config object describing the configuration of the
connection. Only valid when the connection is in the
NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
</tp:docstring>
</property>
<property name="Dhcp4Config" type="o" access="read">
<tp:docstring>
Object path of the Dhcp4Config object describing the DHCP options
returned by the DHCP server (assuming the connection used DHCP). Only
valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
state.
</tp:docstring>
</property>
<property name="Default6" type="b" access="read">
<tp:docstring>
Whether this active connection is the default IPv6 connection, i.e.
whether it currently owns the default IPv6 route.
</tp:docstring>
</property>
<property name="Ip6Config" type="o" access="read">
<tp:docstring>
Object path of the Ip6Config object describing the configuration of the
connection. Only valid when the connection is in the
NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
</tp:docstring>
</property>
<property name="Dhcp6Config" type="o" access="read">
<tp:docstring>
Object path of the Dhcp6Config object describing the DHCP options
returned by the DHCP server (assuming the connection used DHCP). Only
valid when the connection is in the NM_ACTIVE_CONNECTION_STATE_ACTIVATED
state.
</tp:docstring>
</property>
<property name="Vpn" type="b" access="read">
<tp:docstring>
Whether this active connection is also a VPN connection.

View file

@ -23,6 +23,10 @@ global:
nm_active_connection_get_default6;
nm_active_connection_get_default;
nm_active_connection_get_devices;
nm_active_connection_get_dhcp4_config;
nm_active_connection_get_dhcp6_config;
nm_active_connection_get_ip4_config;
nm_active_connection_get_ip6_config;
nm_active_connection_get_master;
nm_active_connection_get_specific_object;
nm_active_connection_get_state;

View file

@ -58,7 +58,11 @@ typedef struct {
GPtrArray *devices;
NMActiveConnectionState state;
gboolean is_default;
NMIP4Config *ip4_config;
NMDHCP4Config *dhcp4_config;
gboolean is_default6;
NMIP6Config *ip6_config;
NMDHCP6Config *dhcp6_config;
char *master;
} NMActiveConnectionPrivate;
@ -70,21 +74,16 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
PROP_IP4_CONFIG,
PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
PROP_IP6_CONFIG,
PROP_DHCP6_CONFIG,
PROP_MASTER,
LAST_PROP
};
#define DBUS_PROP_CONNECTION "Connection"
#define DBUS_PROP_UUID "Uuid"
#define DBUS_PROP_SPECIFIC_OBJECT "SpecificObject"
#define DBUS_PROP_DEVICES "Devices"
#define DBUS_PROP_STATE "State"
#define DBUS_PROP_DEFAULT "Default"
#define DBUS_PROP_DEFAULT6 "Default6"
#define DBUS_PROP_MASTER "Master"
/**
* nm_active_connection_new:
* @connection: the #DBusGConnection
@ -307,6 +306,49 @@ nm_active_connection_get_default (NMActiveConnection *connection)
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_default;
}
/**
* nm_active_connection_get_ip4_config:
* @connection: an #NMActiveConnection
*
* Gets the current #NMIP4Config associated with the #NMActiveConnection.
*
* Returns: (transfer none): the #NMIP4Config, or %NULL if the
* connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
* state.
*
* Since: 0.9.10
**/
NMIP4Config *
nm_active_connection_get_ip4_config (NMActiveConnection *connection)
{
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
_nm_object_ensure_inited (NM_OBJECT (connection));
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip4_config;
}
/**
* nm_active_connection_get_dhcp4_config:
* @connection: an #NMActiveConnection
*
* Gets the current #NMDHCP4Config (if any) associated with the
* #NMActiveConnection.
*
* Returns: (transfer none): the #NMDHCP4Config, or %NULL if the
* connection does not use DHCP, or is not in the
* %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
*
* Since: 0.9.10
**/
NMDHCP4Config *
nm_active_connection_get_dhcp4_config (NMActiveConnection *connection)
{
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
_nm_object_ensure_inited (NM_OBJECT (connection));
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp4_config;
}
/**
* nm_active_connection_get_default6:
* @connection: a #NMActiveConnection
@ -325,6 +367,49 @@ nm_active_connection_get_default6 (NMActiveConnection *connection)
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_default6;
}
/**
* nm_active_connection_get_ip6_config:
* @connection: an #NMActiveConnection
*
* Gets the current #NMIP6Config associated with the #NMActiveConnection.
*
* Returns: (transfer none): the #NMIP6Config, or %NULL if the
* connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
* state.
*
* Since: 0.9.10
**/
NMIP6Config *
nm_active_connection_get_ip6_config (NMActiveConnection *connection)
{
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
_nm_object_ensure_inited (NM_OBJECT (connection));
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip6_config;
}
/**
* nm_active_connection_get_dhcp6_config:
* @connection: an #NMActiveConnection
*
* Gets the current #NMDHCP6Config (if any) associated with the
* #NMActiveConnection.
*
* Returns: (transfer none): the #NMDHCP6Config, or %NULL if the
* connection does not use DHCPv6, or is not in the
* %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
*
* Since: 0.9.10
**/
NMDHCP6Config *
nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
{
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
_nm_object_ensure_inited (NM_OBJECT (connection));
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
}
/**
* nm_active_connection_get_master:
* @connection: a #NMActiveConnection
@ -359,6 +444,11 @@ dispose (GObject *object)
priv->devices = NULL;
}
g_clear_object (&priv->ip4_config);
g_clear_object (&priv->dhcp4_config);
g_clear_object (&priv->ip6_config);
g_clear_object (&priv->dhcp6_config);
g_clear_object (&priv->proxy);
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
@ -406,9 +496,21 @@ get_property (GObject *object,
case PROP_DEFAULT:
g_value_set_boolean (value, nm_active_connection_get_default (self));
break;
case PROP_IP4_CONFIG:
g_value_set_object (value, nm_active_connection_get_ip4_config (self));
break;
case PROP_DHCP4_CONFIG:
g_value_set_object (value, nm_active_connection_get_dhcp4_config (self));
break;
case PROP_DEFAULT6:
g_value_set_boolean (value, nm_active_connection_get_default6 (self));
break;
case PROP_IP6_CONFIG:
g_value_set_object (value, nm_active_connection_get_ip6_config (self));
break;
case PROP_DHCP6_CONFIG:
g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
break;
case PROP_MASTER:
g_value_set_string (value, nm_active_connection_get_master (self));
break;
@ -429,7 +531,11 @@ register_properties (NMActiveConnection *connection)
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
{ NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
{ NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
/* not tracked after construction time */
@ -550,6 +656,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
FALSE,
G_PARAM_READABLE));
/**
* NMActiveConnection:ip4-config:
*
* The #NMIP4Config of the connection.
*
* Since: 0.9.10
**/
g_object_class_install_property
(object_class, PROP_IP4_CONFIG,
g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG,
"IP4 Config",
"IP4 Config",
NM_TYPE_IP4_CONFIG,
G_PARAM_READABLE));
/**
* NMActiveConnection:dhcp4-config:
*
* The #NMDHCP4Config of the connection.
*
* Since: 0.9.10
**/
g_object_class_install_property
(object_class, PROP_DHCP4_CONFIG,
g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
"DHCP4 Config",
"DHCP4 Config",
NM_TYPE_DHCP4_CONFIG,
G_PARAM_READABLE));
/**
* NMActiveConnection:default6:
*
@ -563,6 +699,36 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
FALSE,
G_PARAM_READABLE));
/**
* NMActiveConnection:ip6-config:
*
* The #NMIP6Config of the connection.
*
* Since: 0.9.10
**/
g_object_class_install_property
(object_class, PROP_IP6_CONFIG,
g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG,
"IP6 Config",
"IP6 Config",
NM_TYPE_IP6_CONFIG,
G_PARAM_READABLE));
/**
* NMActiveConnection:dhcp6-config:
*
* The #NMDHCP6Config of the connection.
*
* Since: 0.9.10
**/
g_object_class_install_property
(object_class, PROP_DHCP6_CONFIG,
g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
"DHCP6 Config",
"DHCP6 Config",
NM_TYPE_DHCP6_CONFIG,
G_PARAM_READABLE));
/**
* NMActiveConnection:master:
*

View file

@ -29,6 +29,10 @@
#include "nm-object.h"
#include <nm-connection.h>
#include <NetworkManager.h>
#include "nm-ip4-config.h"
#include "nm-dhcp4-config.h"
#include "nm-ip6-config.h"
#include "nm-dhcp6-config.h"
G_BEGIN_DECLS
@ -45,7 +49,11 @@ G_BEGIN_DECLS
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_MASTER "master"
typedef struct {
@ -73,9 +81,13 @@ const char * nm_active_connection_get_uuid (NMActiveConnection *c
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
gboolean nm_active_connection_get_default (NMActiveConnection *connection);
gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
const char * nm_active_connection_get_master (NMActiveConnection *connection);
gboolean nm_active_connection_get_default (NMActiveConnection *connection);
NMIP4Config * nm_active_connection_get_ip4_config (NMActiveConnection *connection);
NMDHCP4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
G_END_DECLS

View file

@ -1253,6 +1253,10 @@ nm_device_get_firmware_missing (NMDevice *device)
*
* Gets the current #NMIP4Config associated with the #NMDevice.
*
* Note that as of NetworkManager 0.9.10, you can alternatively use
* nm_active_connection_get_ip4_config(), which also works with VPN
* connections.
*
* Returns: (transfer none): the #NMIP4Config or %NULL if the device is not activated.
**/
NMIP4Config *
@ -1270,6 +1274,10 @@ nm_device_get_ip4_config (NMDevice *device)
*
* Gets the current #NMDHCP4Config associated with the #NMDevice.
*
* Note that as of NetworkManager 0.9.10, you can alternatively use
* nm_active_connection_get_dhcp4_config(), which also works with VPN
* connections.
*
* Returns: (transfer none): the #NMDHCP4Config or %NULL if the device is not activated or not
* using DHCP.
**/
@ -1288,6 +1296,10 @@ nm_device_get_dhcp4_config (NMDevice *device)
*
* Gets the current #NMIP6Config associated with the #NMDevice.
*
* Note that as of NetworkManager 0.9.10, you can alternatively use
* nm_active_connection_get_ip6_config(), which also works with VPN
* connections.
*
* Returns: (transfer none): the #NMIP6Config or %NULL if the device is not activated.
**/
NMIP6Config *
@ -1305,6 +1317,10 @@ nm_device_get_ip6_config (NMDevice *device)
*
* Gets the current #NMDHCP6Config associated with the #NMDevice.
*
* Note that as of NetworkManager 0.9.10, you can alternatively use
* nm_active_connection_get_dhcp6_config(), which also works with VPN
* connections.
*
* Returns: (transfer none): the #NMDHCP6Config or %NULL if the device is not activated or not
* using DHCP.
**/

View file

@ -56,6 +56,16 @@ typedef struct {
GSList *share_rules;
} NMActRequestPrivate;
enum {
PROP_0,
PROP_IP4_CONFIG,
PROP_DHCP4_CONFIG,
PROP_IP6_CONFIG,
PROP_DHCP6_CONFIG,
LAST_PROP
};
/*******************************************************************/
NMConnection *
@ -281,6 +291,14 @@ nm_act_request_add_share_rule (NMActRequest *req,
/********************************************************************/
static void
device_notify (GObject *object,
GParamSpec *pspec,
gpointer self)
{
g_object_notify (self, pspec->name);
}
static void
device_state_changed (NMActiveConnection *active,
NMDevice *device,
@ -301,6 +319,15 @@ device_state_changed (NMActiveConnection *active,
break;
case NM_DEVICE_STATE_ACTIVATED:
ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
g_signal_connect (device, "notify::" NM_DEVICE_IP4_CONFIG,
G_CALLBACK (device_notify), active);
g_signal_connect (device, "notify::" NM_DEVICE_DHCP4_CONFIG,
G_CALLBACK (device_notify), active);
g_signal_connect (device, "notify::" NM_DEVICE_IP6_CONFIG,
G_CALLBACK (device_notify), active);
g_signal_connect (device, "notify::" NM_DEVICE_DHCP6_CONFIG,
G_CALLBACK (device_notify), active);
break;
case NM_DEVICE_STATE_DEACTIVATING:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATING;
@ -310,6 +337,8 @@ device_state_changed (NMActiveConnection *active,
case NM_DEVICE_STATE_UNMANAGED:
case NM_DEVICE_STATE_UNAVAILABLE:
ac_state = NM_ACTIVE_CONNECTION_STATE_DEACTIVATED;
g_signal_handlers_disconnect_by_func (device, G_CALLBACK (device_notify), active);
break;
default:
break;
@ -413,6 +442,37 @@ dispose (GObject *object)
G_OBJECT_CLASS (nm_act_request_parent_class)->dispose (object);
}
static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMDevice *device;
device = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
if (!device) {
g_value_set_boxed (value, "/");
return;
}
switch (prop_id) {
case PROP_IP4_CONFIG:
g_object_get_property (G_OBJECT (device), NM_DEVICE_IP4_CONFIG, value);
break;
case PROP_DHCP4_CONFIG:
g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP4_CONFIG, value);
break;
case PROP_IP6_CONFIG:
g_object_get_property (G_OBJECT (device), NM_DEVICE_IP6_CONFIG, value);
break;
case PROP_DHCP6_CONFIG:
g_object_get_property (G_OBJECT (device), NM_DEVICE_DHCP6_CONFIG, value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
nm_act_request_class_init (NMActRequestClass *req_class)
{
@ -423,7 +483,18 @@ nm_act_request_class_init (NMActRequestClass *req_class)
/* virtual methods */
object_class->dispose = dispose;
object_class->get_property = get_property;
active_class->master_failed = master_failed;
active_class->device_state_changed = device_state_changed;
/* properties */
g_object_class_override_property (object_class, PROP_IP4_CONFIG,
NM_ACTIVE_CONNECTION_IP4_CONFIG);
g_object_class_override_property (object_class, PROP_DHCP4_CONFIG,
NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
g_object_class_override_property (object_class, PROP_IP6_CONFIG,
NM_ACTIVE_CONNECTION_IP6_CONFIG);
g_object_class_override_property (object_class, PROP_DHCP6_CONFIG,
NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
}

View file

@ -74,7 +74,11 @@ enum {
PROP_DEVICES,
PROP_STATE,
PROP_DEFAULT,
PROP_IP4_CONFIG,
PROP_DHCP4_CONFIG,
PROP_DEFAULT6,
PROP_IP6_CONFIG,
PROP_DHCP6_CONFIG,
PROP_VPN,
PROP_MASTER,
@ -152,6 +156,14 @@ nm_active_connection_set_state (NMActiveConnection *self,
}
}
if ( new_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|| old_state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP4_CONFIG);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP4_CONFIG);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_IP6_CONFIG);
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DHCP6_CONFIG);
}
if (priv->state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
/* Device is no longer relevant when deactivated. So remove it and
* emit property change notification so clients re-read the value,
@ -712,9 +724,22 @@ get_property (GObject *object, guint prop_id,
case PROP_DEFAULT:
g_value_set_boolean (value, priv->is_default);
break;
case PROP_IP4_CONFIG:
/* The IP and DHCP config properties may be overridden by a subclass */
g_value_set_boxed (value, "/");
break;
case PROP_DHCP4_CONFIG:
g_value_set_boxed (value, "/");
break;
case PROP_DEFAULT6:
g_value_set_boolean (value, priv->is_default6);
break;
case PROP_IP6_CONFIG:
g_value_set_boxed (value, "/");
break;
case PROP_DHCP6_CONFIG:
g_value_set_boxed (value, "/");
break;
case PROP_VPN:
g_value_set_boolean (value, priv->vpn);
break;
@ -838,6 +863,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_IP4_CONFIG,
g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP4_CONFIG,
"IP4 Config",
"IP4 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_DHCP4_CONFIG,
g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP4_CONFIG,
"DHCP4 Config",
"DHCP4 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_DEFAULT6,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6,
"Default6",
@ -845,6 +884,20 @@ nm_active_connection_class_init (NMActiveConnectionClass *ac_class)
FALSE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_IP6_CONFIG,
g_param_spec_boxed (NM_ACTIVE_CONNECTION_IP6_CONFIG,
"IP6 Config",
"IP6 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_DHCP6_CONFIG,
g_param_spec_boxed (NM_ACTIVE_CONNECTION_DHCP6_CONFIG,
"DHCP6 Config",
"DHCP6 Config",
DBUS_TYPE_G_OBJECT_PATH,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_VPN,
g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN,
"VPN",

View file

@ -40,7 +40,11 @@
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
#define NM_ACTIVE_CONNECTION_STATE "state"
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
#define NM_ACTIVE_CONNECTION_VPN "vpn"
#define NM_ACTIVE_CONNECTION_MASTER "master"

View file

@ -105,6 +105,8 @@ enum {
PROP_0,
PROP_VPN_STATE,
PROP_BANNER,
PROP_IP4_CONFIG,
PROP_IP6_CONFIG,
PROP_MASTER = 2000,
LAST_PROP
@ -1011,6 +1013,8 @@ nm_vpn_connection_ip4_config_get (DBusGProxy *proxy,
nm_ip4_config_merge_setting (config, nm_connection_get_setting_ip4_config (priv->connection));
priv->ip4_config = config;
nm_ip4_config_export (config);
g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP4_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@ -1152,6 +1156,8 @@ nm_vpn_connection_ip6_config_get (DBusGProxy *proxy,
nm_ip6_config_merge_setting (config, nm_connection_get_setting_ip6_config (priv->connection));
priv->ip6_config = config;
nm_ip6_config_export (config);
g_object_notify (G_OBJECT (connection), NM_ACTIVE_CONNECTION_IP6_CONFIG);
nm_vpn_connection_config_maybe_complete (connection, TRUE);
}
@ -1787,6 +1793,18 @@ get_property (GObject *object, guint prop_id,
case PROP_BANNER:
g_value_set_string (value, priv->banner ? priv->banner : "");
break;
case PROP_IP4_CONFIG:
if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip4_config)
g_value_set_boxed (value, nm_ip4_config_get_dbus_path (priv->ip4_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_IP6_CONFIG:
if (priv->vpn_state == NM_VPN_CONNECTION_STATE_ACTIVATED && priv->ip6_config)
g_value_set_boxed (value, nm_ip6_config_get_dbus_path (priv->ip6_config));
else
g_value_set_boxed (value, "/");
break;
case PROP_MASTER:
parent_dev = nm_active_connection_get_device (NM_ACTIVE_CONNECTION (object));
g_value_set_boxed (value, parent_dev ? nm_device_get_path (parent_dev) : "/");
@ -1832,6 +1850,11 @@ nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
NULL,
G_PARAM_READABLE));
g_object_class_override_property (object_class, PROP_IP4_CONFIG,
NM_ACTIVE_CONNECTION_IP4_CONFIG);
g_object_class_override_property (object_class, PROP_IP6_CONFIG,
NM_ACTIVE_CONNECTION_IP6_CONFIG);
/* signals */
signals[VPN_STATE_CHANGED] =
g_signal_new ("vpn-state-changed",