summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2008-10-26 17:41:37 +0000
committerDan Williams <dcbw@redhat.com>2008-10-26 17:41:37 +0000
commit7d723b54a4bb5dd9b93a3e2fc2f73cb22858bec9 (patch)
tree802be23727fdc526ea5929737d794e26c684c399 /src
parent76c366b54664d6fefe757bbd2a6c96949411ad48 (diff)
downloadNetworkManager-7d723b54a4bb5dd9b93a3e2fc2f73cb22858bec9.tar.gz
2008-10-26 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com> * libnm-util/libnm-util.ver libnm-util/nm-setting-connection.c libnm-util/nm-setting-connection.h - Make properties private and add accessor functions * src/NetworkManagerPolicy.c src/nm-cdma-device.c src/nm-device-ethernet.c src/nm-device-interface.c src/nm-device-wifi.c src/nm-gsm-device.c src/nm-manager.c src/ppp-manager/nm-ppp-manager.c src/vpn-manager/nm-vpn-connection.c system-settings/plugins/ifcfg-fedora/nm-ifcfg-connection.c system-settings/plugins/ifcfg-fedora/plugin.c system-settings/plugins/ifcfg-fedora/reader.c system-settings/plugins/ifcfg-suse/parser.c system-settings/plugins/ifupdown/parser.c system-settings/plugins/keyfile/nm-keyfile-connection.c system-settings/plugins/keyfile/plugin.c system-settings/plugins/keyfile/writer.c system-settings/src/main.c - Use those accessors git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4220 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
Diffstat (limited to 'src')
-rw-r--r--src/NetworkManagerPolicy.c12
-rw-r--r--src/nm-cdma-device.c4
-rw-r--r--src/nm-device-ethernet.c28
-rw-r--r--src/nm-device-interface.c3
-rw-r--r--src/nm-device-wifi.c14
-rw-r--r--src/nm-gsm-device.c4
-rw-r--r--src/nm-manager.c10
-rw-r--r--src/ppp-manager/nm-ppp-manager.c7
-rw-r--r--src/vpn-manager/nm-vpn-connection.c2
9 files changed, 48 insertions, 36 deletions
diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c
index 107a8412a2..21b24cd393 100644
--- a/src/NetworkManagerPolicy.c
+++ b/src/NetworkManagerPolicy.c
@@ -177,7 +177,7 @@ get_connection_id (NMConnection *connection)
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
g_return_val_if_fail (s_con != NULL, NULL);
- return s_con->id;
+ return nm_setting_connection_get_id (s_con);
}
static NMDevice *
@@ -485,6 +485,7 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
NMVPNConnection *vpn = NULL;
NMConnection *connection = NULL;
NMSettingConnection *s_con = NULL;
+ const char *connection_id;
best = get_best_device (policy->manager, &best_req);
if (!best)
@@ -593,8 +594,9 @@ update_routing_and_dns (NMPolicy *policy, gboolean force_update)
if (connection)
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
- if (s_con && s_con->id)
- nm_info ("Policy set '%s' (%s) as default for routing and DNS.", s_con->id, ip_iface);
+ connection_id = s_con ? nm_setting_connection_get_id (s_con) : NULL;
+ if (connection_id)
+ nm_info ("Policy set '%s' (%s) as default for routing and DNS.", connection_id, ip_iface);
else
nm_info ("Policy set (%s) as default for routing and DNS.", ip_iface);
@@ -666,7 +668,7 @@ auto_activate_device (gpointer user_data)
g_assert (s_con);
nm_warning ("Connection '%s' auto-activation failed: (%d) %s",
- s_con->id, error->code, error->message);
+ nm_setting_connection_get_id (s_con), error->code, error->message);
g_error_free (error);
}
}
@@ -945,7 +947,7 @@ connection_removed (NMManager *manager,
if (!nm_manager_deactivate_connection (manager, path, NM_DEVICE_STATE_REASON_CONNECTION_REMOVED, &error)) {
nm_warning ("Connection '%s' disappeared, but error deactivating it: (%d) %s",
- s_con->id, error->code, error->message);
+ nm_setting_connection_get_id (s_con), error->code, error->message);
g_error_free (error);
}
g_free (path);
diff --git a/src/nm-cdma-device.c b/src/nm-cdma-device.c
index 9b49d6e75f..628a9b7e15 100644
--- a/src/nm-cdma-device.c
+++ b/src/nm-cdma-device.c
@@ -237,10 +237,10 @@ real_get_best_auto_connection (NMDevice *dev,
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
g_assert (s_con);
- if (!s_con->autoconnect)
+ if (!nm_setting_connection_get_autoconnect (s_con))
continue;
- if (strcmp (s_con->type, NM_SETTING_CDMA_SETTING_NAME))
+ if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_CDMA_SETTING_NAME))
continue;
return connection;
diff --git a/src/nm-device-ethernet.c b/src/nm-device-ethernet.c
index df69ba73a6..6fd3987bcf 100644
--- a/src/nm-device-ethernet.c
+++ b/src/nm-device-ethernet.c
@@ -551,17 +551,19 @@ real_get_best_auto_connection (NMDevice *dev,
NMConnection *connection = NM_CONNECTION (iter->data);
NMSettingConnection *s_con;
NMSettingWired *s_wired;
+ const char *connection_type;
gboolean is_pppoe = FALSE;
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
g_assert (s_con);
- if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME))
+ connection_type = nm_setting_connection_get_connection_type (s_con);
+ if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
is_pppoe = TRUE;
- if (!is_pppoe && strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME))
+ if (!is_pppoe && strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME))
continue;
- if (!s_con->autoconnect)
+ if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
@@ -1181,14 +1183,14 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
NMActRequest *req = nm_device_get_act_request (NM_DEVICE (self));
nm_info ("Activation (%s/wired): connection '%s' has security, but secrets are required.",
- iface, s_connection->id);
+ iface, nm_setting_connection_get_id (s_connection));
ret = handle_auth_or_fail (self, req, FALSE);
if (ret != NM_ACT_STAGE_RETURN_POSTPONE)
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
} else {
nm_info ("Activation (%s/wired): connection '%s' requires no security. No secrets needed.",
- iface, s_connection->id);
+ iface, nm_setting_connection_get_id (s_connection));
if (supplicant_interface_init (self))
ret = NM_ACT_STAGE_RETURN_POSTPONE;
@@ -1284,6 +1286,7 @@ static NMActStageReturn
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
{
NMSettingConnection *s_connection;
+ const char *connection_type;
NMActStageReturn ret;
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
@@ -1291,7 +1294,8 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
s_connection = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
g_assert (s_connection);
- if (!strcmp (s_connection->type, NM_SETTING_WIRED_SETTING_NAME)) {
+ connection_type = nm_setting_connection_get_connection_type (s_connection);
+ if (!strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME)) {
NMSetting8021x *security;
security = (NMSetting8021x *) device_get_setting (device, NM_TYPE_SETTING_802_1X);
@@ -1299,10 +1303,10 @@ real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
ret = nm_8021x_stage2_config (NM_DEVICE_ETHERNET (device), reason);
else
ret = NM_ACT_STAGE_RETURN_SUCCESS;
- } else if (!strcmp (s_connection->type, NM_SETTING_PPPOE_SETTING_NAME))
+ } else if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
ret = pppoe_stage2_config (NM_DEVICE_ETHERNET (device), reason);
else {
- nm_warning ("Invalid connection type '%s' for ethernet device", s_connection->type);
+ nm_warning ("Invalid connection type '%s' for ethernet device", connection_type);
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
ret = NM_ACT_STAGE_RETURN_FAILURE;
}
@@ -1382,20 +1386,22 @@ real_check_connection_compatible (NMDevice *device,
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
NMSettingConnection *s_con;
NMSettingWired *s_wired;
+ const char *connection_type;
gboolean is_pppoe = FALSE;
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
- if ( strcmp (s_con->type, NM_SETTING_WIRED_SETTING_NAME)
- && strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME)) {
+ connection_type = nm_setting_connection_get_connection_type (s_con);
+ if ( strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME)
+ && strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME)) {
g_set_error (error,
NM_ETHERNET_ERROR, NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED,
"The connection was not a wired or PPPoE connection.");
return FALSE;
}
- if (!strcmp (s_con->type, NM_SETTING_PPPOE_SETTING_NAME))
+ if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
is_pppoe = TRUE;
s_wired = (NMSettingWired *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRED);
diff --git a/src/nm-device-interface.c b/src/nm-device-interface.c
index 88bb14a9f2..2cd41dea71 100644
--- a/src/nm-device-interface.c
+++ b/src/nm-device-interface.c
@@ -223,7 +223,8 @@ nm_device_interface_activate (NMDeviceInterface *device,
g_assert (s_con);
iface = nm_device_interface_get_iface (device);
- nm_info ("Activation (%s) starting connection '%s'", iface, s_con->id);
+ nm_info ("Activation (%s) starting connection '%s'", iface,
+ nm_setting_connection_get_id (s_con));
g_free (iface);
success = NM_DEVICE_INTERFACE_GET_INTERFACE (device)->activate (device, req, error);
diff --git a/src/nm-device-wifi.c b/src/nm-device-wifi.c
index 7cabe0fe73..6ab6144e16 100644
--- a/src/nm-device-wifi.c
+++ b/src/nm-device-wifi.c
@@ -990,7 +990,7 @@ real_check_connection_compatible (NMDevice *device,
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
- if (strcmp (s_con->type, NM_SETTING_WIRELESS_SETTING_NAME)) {
+ if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME)) {
g_set_error (error,
NM_WIFI_ERROR, NM_WIFI_ERROR_CONNECTION_NOT_WIRELESS,
"The connection was not a WiFi connection.");
@@ -1060,9 +1060,9 @@ real_get_best_auto_connection (NMDevice *dev,
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
if (s_con == NULL)
continue;
- if (strcmp (s_con->type, NM_SETTING_WIRELESS_SETTING_NAME))
+ if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_WIRELESS_SETTING_NAME))
continue;
- if (!s_con->autoconnect)
+ if (!nm_setting_connection_get_autoconnect (s_con))
continue;
s_wireless = (NMSettingWireless *) nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS);
@@ -2869,7 +2869,7 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
if (setting_name) {
nm_info ("Activation (%s/wireless): access point '%s' has security,"
" but secrets are required.",
- iface, s_connection->id);
+ iface, nm_setting_connection_get_id (s_connection));
ret = handle_auth_or_fail (self, req, FALSE);
if (ret == NM_ACT_STAGE_RETURN_FAILURE)
@@ -2881,11 +2881,11 @@ real_act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
if (s_wireless->security) {
nm_info ("Activation (%s/wireless): connection '%s' has security"
", and secrets exist. No new secrets needed.",
- iface, s_connection->id);
+ iface, nm_setting_connection_get_id (s_connection));
} else {
nm_info ("Activation (%s/wireless): connection '%s' requires no "
"security. No secrets needed.",
- iface, s_connection->id);
+ iface, nm_setting_connection_get_id (s_connection));
}
config = build_supplicant_config (self, connection, ap);
@@ -2997,7 +2997,7 @@ real_act_stage4_ip_config_timeout (NMDevice *dev,
/* Activation failed, we must have bad encryption key */
nm_info ("Activation (%s/wireless): could not get IP configuration for "
"connection '%s'.",
- nm_device_get_iface (dev), s_con->id);
+ nm_device_get_iface (dev), nm_setting_connection_get_id (s_con));
ret = handle_auth_or_fail (self, req, TRUE);
if (ret == NM_ACT_STAGE_RETURN_POSTPONE) {
diff --git a/src/nm-gsm-device.c b/src/nm-gsm-device.c
index 670e2e64e9..1a9cb0f0c0 100644
--- a/src/nm-gsm-device.c
+++ b/src/nm-gsm-device.c
@@ -684,10 +684,10 @@ real_get_best_auto_connection (NMDevice *dev,
s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
g_assert (s_con);
- if (!s_con->autoconnect)
+ if (!nm_setting_connection_get_autoconnect (s_con))
continue;
- if (strcmp (s_con->type, NM_SETTING_GSM_SETTING_NAME))
+ if (strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_GSM_SETTING_NAME))
continue;
return connection;
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 74345b0d53..4ae935a0c0 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -1846,7 +1846,7 @@ nm_manager_activate_connection (NMManager *manager,
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
- if (!strcmp (s_con->type, NM_SETTING_VPN_SETTING_NAME)) {
+ if (!strcmp (nm_setting_connection_get_connection_type (s_con), NM_SETTING_VPN_SETTING_NAME)) {
NMActRequest *req;
NMVPNManager *vpn_manager;
@@ -2163,15 +2163,15 @@ connection_sort (gconstpointer pa, gconstpointer pb)
con_b = (NMSettingConnection *) nm_connection_get_setting (b, NM_TYPE_SETTING_CONNECTION);
g_assert (con_b);
- if (con_a->autoconnect != con_b->autoconnect) {
- if (con_a->autoconnect)
+ if (nm_setting_connection_get_autoconnect (con_a) != nm_setting_connection_get_autoconnect (con_b)) {
+ if (nm_setting_connection_get_autoconnect (con_a))
return -1;
return 1;
}
- if (con_a->timestamp > con_b->timestamp)
+ if (nm_setting_connection_get_timestamp (con_a) > nm_setting_connection_get_timestamp (con_b))
return -1;
- else if (con_a->timestamp == con_b->timestamp)
+ else if (nm_setting_connection_get_timestamp (con_a) == nm_setting_connection_get_timestamp (con_b))
return 0;
return 1;
}
diff --git a/src/ppp-manager/nm-ppp-manager.c b/src/ppp-manager/nm-ppp-manager.c
index 8644347391..1277b6f6ac 100644
--- a/src/ppp-manager/nm-ppp-manager.c
+++ b/src/ppp-manager/nm-ppp-manager.c
@@ -347,6 +347,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
NMPPPManagerPrivate *priv = NM_PPP_MANAGER_GET_PRIVATE (manager);
NMConnection *connection;
NMSettingConnection *s_con;
+ const char *connection_type;
const char *setting_name;
guint32 tries;
GPtrArray *hints = NULL;
@@ -356,14 +357,16 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
g_assert (s_con);
- g_assert (s_con->type);
+
+ connection_type = nm_setting_connection_get_connection_type (s_con);
+ g_assert (connection_type);
nm_connection_clear_secrets (connection);
setting_name = nm_connection_need_secrets (connection, &hints);
if (!setting_name) {
NMSetting *setting;
- setting = nm_connection_get_setting_by_name (connection, s_con->type);
+ setting = nm_connection_get_setting_by_name (connection, connection_type);
if (setting) {
const char *username = NULL;
const char *password = NULL;
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index 77075a5870..5803631a2b 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -631,7 +631,7 @@ nm_vpn_connection_get_name (NMVPNConnection *connection)
priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
setting = (NMSettingConnection *) nm_connection_get_setting (priv->connection, NM_TYPE_SETTING_CONNECTION);
- return setting->id;
+ return nm_setting_connection_get_id (setting);
}
NMConnection *