2008-03-02 Dan Williams <dcbw@redhat.com>
* src/nm-device.c src/nm-device.h src/nm-device-802-11-wireless.c src/nm-device-802-3-ethernet.c src/NetworkManagerPolicy.c - s/link_active/carrier - nm_device_set_active_link() -> nm_device_set_carrier() - nm_device_has_active_link() -> nm_device_get_carrier() git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3371 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
11
ChangeLog
11
ChangeLog
@@ -1,3 +1,14 @@
|
|||||||
|
2008-03-02 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
* src/nm-device.c
|
||||||
|
src/nm-device.h
|
||||||
|
src/nm-device-802-11-wireless.c
|
||||||
|
src/nm-device-802-3-ethernet.c
|
||||||
|
src/NetworkManagerPolicy.c
|
||||||
|
- s/link_active/carrier
|
||||||
|
- nm_device_set_active_link() -> nm_device_set_carrier()
|
||||||
|
- nm_device_has_active_link() -> nm_device_get_carrier()
|
||||||
|
|
||||||
2008-03-02 Dan Williams <dcbw@redhat.com>
|
2008-03-02 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* system-settings/plugins/ifcfg-fedora/parser.c
|
* system-settings/plugins/ifcfg-fedora/parser.c
|
||||||
|
@@ -117,12 +117,12 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
|
|||||||
for (elt = nm_manager_get_devices (policy->manager); elt; elt = elt->next) {
|
for (elt = nm_manager_get_devices (policy->manager); elt; elt = elt->next) {
|
||||||
NMConnection *tmp_con = NULL;
|
NMConnection *tmp_con = NULL;
|
||||||
char *tmp_obj = NULL;
|
char *tmp_obj = NULL;
|
||||||
gboolean link_active;
|
gboolean carrier;
|
||||||
guint prio = 0;
|
guint prio = 0;
|
||||||
NMDevice * dev = (NMDevice *)(elt->data);
|
NMDevice * dev = (NMDevice *)(elt->data);
|
||||||
guint32 caps;
|
guint32 caps;
|
||||||
|
|
||||||
link_active = nm_device_has_active_link (dev);
|
carrier = nm_device_get_carrier (dev);
|
||||||
caps = nm_device_get_capabilities (dev);
|
caps = nm_device_get_capabilities (dev);
|
||||||
|
|
||||||
tmp_con = nm_device_get_best_connection (dev, connections, &tmp_obj);
|
tmp_con = nm_device_get_best_connection (dev, connections, &tmp_obj);
|
||||||
@@ -140,10 +140,10 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (NM_IS_DEVICE_802_3_ETHERNET (dev)) {
|
if (NM_IS_DEVICE_802_3_ETHERNET (dev)) {
|
||||||
if (link_active)
|
if (carrier)
|
||||||
prio += 1;
|
prio += 1;
|
||||||
|
|
||||||
if (nm_device_get_act_request (dev) && link_active)
|
if (nm_device_get_act_request (dev) && carrier)
|
||||||
prio += 1;
|
prio += 1;
|
||||||
|
|
||||||
if (prio > best_wired_prio) {
|
if (prio > best_wired_prio) {
|
||||||
@@ -157,10 +157,10 @@ nm_policy_auto_get_best_device (NMPolicy *policy,
|
|||||||
/* Bump by 1 so that _something_ gets chosen every time */
|
/* Bump by 1 so that _something_ gets chosen every time */
|
||||||
prio += 1;
|
prio += 1;
|
||||||
|
|
||||||
if (link_active)
|
if (carrier)
|
||||||
prio += 1;
|
prio += 1;
|
||||||
|
|
||||||
if (nm_device_get_act_request (dev) && link_active)
|
if (nm_device_get_act_request (dev) && carrier)
|
||||||
prio += 3;
|
prio += 3;
|
||||||
|
|
||||||
if (prio > best_wireless_prio) {
|
if (prio > best_wireless_prio) {
|
||||||
@@ -314,7 +314,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||||||
do_switch = TRUE;
|
do_switch = TRUE;
|
||||||
} else if (old_dev && new_dev) {
|
} else if (old_dev && new_dev) {
|
||||||
gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
|
gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
|
||||||
gboolean old_has_link = nm_device_has_active_link (old_dev);
|
gboolean old_carrier = nm_device_get_carrier (old_dev);
|
||||||
|
|
||||||
/* If an old device is active or being activated (and has an active link),
|
/* If an old device is active or being activated (and has an active link),
|
||||||
* and its connection is a system connection, and the best connection is
|
* and its connection is a system connection, and the best connection is
|
||||||
@@ -323,7 +323,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||||||
if ( old_connection
|
if ( old_connection
|
||||||
&& (nm_connection_get_scope (old_connection) == NM_CONNECTION_SCOPE_SYSTEM)
|
&& (nm_connection_get_scope (old_connection) == NM_CONNECTION_SCOPE_SYSTEM)
|
||||||
&& (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_USER)
|
&& (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_USER)
|
||||||
&& nm_device_has_active_link (old_dev))
|
&& old_carrier)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if ( (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM)
|
if ( (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM)
|
||||||
@@ -343,7 +343,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||||||
* a new device. Note that new_dev will never be wireless since automatic device picking
|
* a new device. Note that new_dev will never be wireless since automatic device picking
|
||||||
* above will prefer a wired device to a wireless device.
|
* above will prefer a wired device to a wireless device.
|
||||||
*/
|
*/
|
||||||
if ((!old_user_requested || !old_has_link) && (new_dev != old_dev)) {
|
if ((!old_user_requested || !old_carrier) && (new_dev != old_dev)) {
|
||||||
nm_info ("SWITCH: found better connection '%s (%s)' than "
|
nm_info ("SWITCH: found better connection '%s (%s)' than "
|
||||||
" current connection '%s (%s)'.",
|
" current connection '%s (%s)'.",
|
||||||
connection ? get_connection_id (connection) : "(none)",
|
connection ? get_connection_id (connection) : "(none)",
|
||||||
@@ -365,7 +365,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||||||
if (old_dev == new_dev && nm_device_is_activating (new_dev))
|
if (old_dev == new_dev && nm_device_is_activating (new_dev))
|
||||||
same_activating = TRUE;
|
same_activating = TRUE;
|
||||||
|
|
||||||
if (!same_activating && !old_has_link && (old_mode != IW_MODE_ADHOC)) {
|
if (!same_activating && !old_carrier && (old_mode != IW_MODE_ADHOC)) {
|
||||||
NMSettingConnection * new_sc = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
NMSettingConnection * new_sc = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
|
||||||
NMSettingConnection * old_sc = (NMSettingConnection *) nm_connection_get_setting (old_connection, NM_TYPE_SETTING_CONNECTION);
|
NMSettingConnection * old_sc = (NMSettingConnection *) nm_connection_get_setting (old_connection, NM_TYPE_SETTING_CONNECTION);
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ nm_policy_device_change_check (gpointer user_data)
|
|||||||
new_sc->id,
|
new_sc->id,
|
||||||
nm_device_get_iface (old_dev),
|
nm_device_get_iface (old_dev),
|
||||||
old_sc->id,
|
old_sc->id,
|
||||||
old_has_link);
|
old_carrier);
|
||||||
do_switch = TRUE;
|
do_switch = TRUE;
|
||||||
}
|
}
|
||||||
} else if (NM_IS_DEVICE_802_3_ETHERNET (new_dev)) {
|
} else if (NM_IS_DEVICE_802_3_ETHERNET (new_dev)) {
|
||||||
|
@@ -545,7 +545,7 @@ real_update_link (NMDevice *dev)
|
|||||||
new_link = TRUE;
|
new_link = TRUE;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
nm_device_set_active_link (NM_DEVICE (self), new_link);
|
nm_device_set_carrier (NM_DEVICE (self), new_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMAccessPoint *
|
static NMAccessPoint *
|
||||||
@@ -1877,7 +1877,7 @@ link_timeout_cb (gpointer user_data)
|
|||||||
ap = nm_device_802_11_wireless_get_activation_ap (self);
|
ap = nm_device_802_11_wireless_get_activation_ap (self);
|
||||||
if (req == NULL || ap == NULL) {
|
if (req == NULL || ap == NULL) {
|
||||||
nm_warning ("couldn't get activation request or activation AP.");
|
nm_warning ("couldn't get activation request or activation AP.");
|
||||||
nm_device_set_active_link (dev, FALSE);
|
nm_device_set_carrier (dev, FALSE);
|
||||||
if (nm_device_is_activating (dev)) {
|
if (nm_device_is_activating (dev)) {
|
||||||
cleanup_association_attempt (self, TRUE);
|
cleanup_association_attempt (self, TRUE);
|
||||||
nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);
|
nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);
|
||||||
@@ -1928,7 +1928,7 @@ link_timeout_cb (gpointer user_data)
|
|||||||
|
|
||||||
time_out:
|
time_out:
|
||||||
nm_info ("%s: link timed out.", nm_device_get_iface (dev));
|
nm_info ("%s: link timed out.", nm_device_get_iface (dev));
|
||||||
nm_device_set_active_link (dev, FALSE);
|
nm_device_set_carrier (dev, FALSE);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1996,7 +1996,7 @@ supplicant_iface_state_cb_handler (gpointer user_data)
|
|||||||
cancel_pending_scan (self);
|
cancel_pending_scan (self);
|
||||||
cleanup_association_attempt (self, FALSE);
|
cleanup_association_attempt (self, FALSE);
|
||||||
cleanup_supplicant_interface (self);
|
cleanup_supplicant_interface (self);
|
||||||
nm_device_set_active_link (NM_DEVICE (self), FALSE);
|
nm_device_set_carrier (NM_DEVICE (self), FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slice_free (struct state_cb_data, cb_data);
|
g_slice_free (struct state_cb_data, cb_data);
|
||||||
@@ -2045,7 +2045,7 @@ supplicant_iface_connection_state_cb_handler (gpointer user_data)
|
|||||||
if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED) {
|
if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED) {
|
||||||
remove_supplicant_interface_connection_error_handler (self);
|
remove_supplicant_interface_connection_error_handler (self);
|
||||||
remove_supplicant_timeouts (self);
|
remove_supplicant_timeouts (self);
|
||||||
nm_device_set_active_link (dev, TRUE);
|
nm_device_set_carrier (dev, TRUE);
|
||||||
|
|
||||||
/* If this is the initial association during device activation,
|
/* If this is the initial association during device activation,
|
||||||
* schedule the next activation stage.
|
* schedule the next activation stage.
|
||||||
@@ -2066,7 +2066,7 @@ supplicant_iface_connection_state_cb_handler (gpointer user_data)
|
|||||||
if (!self->priv->link_timeout_id)
|
if (!self->priv->link_timeout_id)
|
||||||
self->priv->link_timeout_id = g_timeout_add (15000, link_timeout_cb, self);
|
self->priv->link_timeout_id = g_timeout_add (15000, link_timeout_cb, self);
|
||||||
} else {
|
} else {
|
||||||
nm_device_set_active_link (dev, FALSE);
|
nm_device_set_carrier (dev, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2164,7 +2164,7 @@ supplicant_mgr_state_cb_handler (gpointer user_data)
|
|||||||
cleanup_association_attempt (self, FALSE);
|
cleanup_association_attempt (self, FALSE);
|
||||||
cleanup_supplicant_interface (self);
|
cleanup_supplicant_interface (self);
|
||||||
|
|
||||||
nm_device_set_active_link (NM_DEVICE (self), FALSE);
|
nm_device_set_carrier (NM_DEVICE (self), FALSE);
|
||||||
|
|
||||||
if (nm_device_is_activating (dev)) {
|
if (nm_device_is_activating (dev)) {
|
||||||
nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);
|
nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);
|
||||||
|
@@ -94,7 +94,7 @@ nm_device_802_3_ethernet_carrier_on (NMNetlinkMonitor *monitor,
|
|||||||
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
|
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nm_device_set_active_link (dev, TRUE);
|
nm_device_set_carrier (dev, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ nm_device_802_3_ethernet_carrier_off (NMNetlinkMonitor *monitor,
|
|||||||
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
|
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nm_device_set_active_link (dev, FALSE);
|
nm_device_set_carrier (dev, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ constructor (GType type,
|
|||||||
} else {
|
} else {
|
||||||
priv->link_connected_id = 0;
|
priv->link_connected_id = 0;
|
||||||
priv->link_disconnected_id = 0;
|
priv->link_disconnected_id = 0;
|
||||||
nm_device_set_active_link (dev, TRUE);
|
nm_device_set_carrier (dev, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return object;
|
return object;
|
||||||
@@ -177,7 +177,7 @@ static void
|
|||||||
real_update_link (NMDevice *dev)
|
real_update_link (NMDevice *dev)
|
||||||
{
|
{
|
||||||
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev);
|
NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev);
|
||||||
gboolean have_link = FALSE;
|
gboolean carrier = FALSE;
|
||||||
guint32 caps;
|
guint32 caps;
|
||||||
gchar * contents;
|
gchar * contents;
|
||||||
gsize length;
|
gsize length;
|
||||||
@@ -187,17 +187,17 @@ real_update_link (NMDevice *dev)
|
|||||||
*/
|
*/
|
||||||
caps = nm_device_get_capabilities (dev);
|
caps = nm_device_get_capabilities (dev);
|
||||||
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) {
|
if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) {
|
||||||
have_link = TRUE;
|
carrier = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_file_get_contents (priv->carrier_file_path, &contents, &length, NULL)) {
|
if (g_file_get_contents (priv->carrier_file_path, &contents, &length, NULL)) {
|
||||||
have_link = atoi (contents) > 0 ? TRUE : FALSE;
|
carrier = atoi (contents) > 0 ? TRUE : FALSE;
|
||||||
g_free (contents);
|
g_free (contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
nm_device_set_active_link (dev, have_link);
|
nm_device_set_carrier (dev, carrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ real_can_interrupt_activation (NMDevice *dev)
|
|||||||
* if the link becomes inactive.
|
* if the link becomes inactive.
|
||||||
*/
|
*/
|
||||||
if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_CARRIER_DETECT) {
|
if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_CARRIER_DETECT) {
|
||||||
if (nm_device_has_active_link (dev) == FALSE) {
|
if (nm_device_get_carrier (dev) == FALSE) {
|
||||||
interrupt = TRUE;
|
interrupt = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ struct _NMDevicePrivate
|
|||||||
guint32 capabilities;
|
guint32 capabilities;
|
||||||
char * driver;
|
char * driver;
|
||||||
|
|
||||||
gboolean link_active;
|
gboolean carrier;
|
||||||
guint32 ip4_address;
|
guint32 ip4_address;
|
||||||
struct in6_addr ip6_address;
|
struct in6_addr ip6_address;
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ nm_device_init (NMDevice * self)
|
|||||||
self->priv->capabilities = NM_DEVICE_CAP_NONE;
|
self->priv->capabilities = NM_DEVICE_CAP_NONE;
|
||||||
self->priv->driver = NULL;
|
self->priv->driver = NULL;
|
||||||
|
|
||||||
self->priv->link_active = FALSE;
|
self->priv->carrier = FALSE;
|
||||||
self->priv->ip4_address = 0;
|
self->priv->ip4_address = 0;
|
||||||
memset (&self->priv->ip6_address, 0, sizeof (struct in6_addr));
|
memset (&self->priv->ip6_address, 0, sizeof (struct in6_addr));
|
||||||
|
|
||||||
@@ -347,28 +347,28 @@ nm_device_get_act_request (NMDevice *self)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get/set functions for link_active
|
* Get/set functions for carrier
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
nm_device_has_active_link (NMDevice *self)
|
nm_device_get_carrier (NMDevice *self)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (self != NULL, FALSE);
|
g_return_val_if_fail (self != NULL, FALSE);
|
||||||
|
|
||||||
return self->priv->link_active;
|
return self->priv->carrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nm_device_set_active_link (NMDevice *self,
|
nm_device_set_carrier (NMDevice *self,
|
||||||
const gboolean link_active)
|
const gboolean carrier)
|
||||||
{
|
{
|
||||||
NMDevicePrivate *priv;
|
NMDevicePrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_DEVICE (self));
|
g_return_if_fail (NM_IS_DEVICE (self));
|
||||||
|
|
||||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||||
if (priv->link_active != link_active) {
|
if (priv->carrier != carrier) {
|
||||||
priv->link_active = link_active;
|
priv->carrier = carrier;
|
||||||
g_signal_emit_by_name (self, "carrier-changed", link_active);
|
g_signal_emit_by_name (self, "carrier-changed", carrier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1667,7 +1667,7 @@ get_property (GObject *object, guint prop_id,
|
|||||||
g_value_set_uint (value, priv->type);
|
g_value_set_uint (value, priv->type);
|
||||||
break;
|
break;
|
||||||
case NM_DEVICE_INTERFACE_PROP_CARRIER:
|
case NM_DEVICE_INTERFACE_PROP_CARRIER:
|
||||||
g_value_set_boolean (value, priv->link_active);
|
g_value_set_boolean (value, priv->carrier);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@@ -128,7 +128,9 @@ NMDeviceType nm_device_get_device_type (NMDevice *dev);
|
|||||||
guint32 nm_device_get_capabilities (NMDevice *dev);
|
guint32 nm_device_get_capabilities (NMDevice *dev);
|
||||||
guint32 nm_device_get_type_capabilities (NMDevice *dev);
|
guint32 nm_device_get_type_capabilities (NMDevice *dev);
|
||||||
|
|
||||||
gboolean nm_device_has_active_link (NMDevice *dev);
|
gboolean nm_device_get_carrier (NMDevice *dev);
|
||||||
|
void nm_device_set_carrier (NMDevice *dev, const gboolean carrier);
|
||||||
|
|
||||||
guint32 nm_device_get_ip4_address (NMDevice *dev);
|
guint32 nm_device_get_ip4_address (NMDevice *dev);
|
||||||
void nm_device_update_ip4_address (NMDevice *dev);
|
void nm_device_update_ip4_address (NMDevice *dev);
|
||||||
struct in6_addr * nm_device_get_ip6_address (NMDevice *dev);
|
struct in6_addr * nm_device_get_ip6_address (NMDevice *dev);
|
||||||
|
Reference in New Issue
Block a user