mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-21 18:24:49 +00:00
Revert :carrier-detect properties and associated code
Ignoring carrier is generally something you want at the machine level (eg, for a server), not at the connection level.
This commit is contained in:
parent
1ca4745394
commit
5fec30d98e
|
@ -78,7 +78,6 @@ static NmcOutputField nmc_fields_setting_wired[] = {
|
|||
SETTING_FIELD (NM_SETTING_WIRED_S390_SUBCHANNELS, 20), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_WIRED_S390_NETTYPE, 15), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_WIRED_S390_OPTIONS, 20), /* 11 */
|
||||
SETTING_FIELD (NM_SETTING_WIRED_CARRIER_DETECT, 13), /* 12 */
|
||||
{NULL, NULL, 0, NULL, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_WIRED_ALL "name"","\
|
||||
|
@ -92,8 +91,7 @@ static NmcOutputField nmc_fields_setting_wired[] = {
|
|||
NM_SETTING_WIRED_MTU","\
|
||||
NM_SETTING_WIRED_S390_SUBCHANNELS","\
|
||||
NM_SETTING_WIRED_S390_NETTYPE","\
|
||||
NM_SETTING_WIRED_S390_OPTIONS","\
|
||||
NM_SETTING_WIRED_CARRIER_DETECT
|
||||
NM_SETTING_WIRED_S390_OPTIONS
|
||||
#define NMC_FIELDS_SETTING_WIRED_COMMON NMC_FIELDS_SETTING_WIRED_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_802_1X_SETTING_NAME */
|
||||
|
@ -514,14 +512,12 @@ static NmcOutputField nmc_fields_setting_infiniband[] = {
|
|||
SETTING_FIELD (NM_SETTING_INFINIBAND_MAC_ADDRESS, 61), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_INFINIBAND_MTU, 6), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_INFINIBAND_TRANSPORT_MODE, 12), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_INFINIBAND_CARRIER_DETECT, 13), /* 4 */
|
||||
{NULL, NULL, 0, NULL, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_INFINIBAND_ALL "name"","\
|
||||
NM_SETTING_INFINIBAND_MAC_ADDRESS","\
|
||||
NM_SETTING_INFINIBAND_MTU","\
|
||||
NM_SETTING_INFINIBAND_TRANSPORT_MODE","\
|
||||
NM_SETTING_INFINIBAND_CARRIER_DETECT
|
||||
NM_SETTING_INFINIBAND_TRANSPORT_MODE
|
||||
#define NMC_FIELDS_SETTING_INFINIBAND_COMMON NMC_FIELDS_SETTING_INFINIBAND_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_BOND_SETTING_NAME */
|
||||
|
@ -545,7 +541,6 @@ static NmcOutputField nmc_fields_setting_vlan[] = {
|
|||
SETTING_FIELD (NM_SETTING_VLAN_FLAGS, 45), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_VLAN_INGRESS_PRIORITY_MAP, 22), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_VLAN_EGRESS_PRIORITY_MAP, 22), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_VLAN_CARRIER_DETECT, 13), /* 7 */
|
||||
{NULL, NULL, 0, NULL, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_VLAN_ALL "name"","\
|
||||
|
@ -554,8 +549,7 @@ static NmcOutputField nmc_fields_setting_vlan[] = {
|
|||
NM_SETTING_VLAN_ID","\
|
||||
NM_SETTING_VLAN_FLAGS","\
|
||||
NM_SETTING_VLAN_INGRESS_PRIORITY_MAP","\
|
||||
NM_SETTING_VLAN_EGRESS_PRIORITY_MAP","\
|
||||
NM_SETTING_VLAN_CARRIER_DETECT
|
||||
NM_SETTING_VLAN_EGRESS_PRIORITY_MAP
|
||||
#define NMC_FIELDS_SETTING_VLAN_COMMON NMC_FIELDS_SETTING_VLAN_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_BRIDGE_SETTING_NAME */
|
||||
|
@ -1058,7 +1052,6 @@ DEFINE_GETTER (nmc_property_gsm_get_home_only, NM_SETTING_GSM_HOME_ONLY)
|
|||
/* --- NM_SETTING_INFINIBAND_SETTING_NAME property get functions --- */
|
||||
DEFINE_HWADDR_GETTER (nmc_property_ib_get_mac_address, NM_SETTING_INFINIBAND_MAC_ADDRESS)
|
||||
DEFINE_GETTER (nmc_property_ib_get_transport_mode, NM_SETTING_INFINIBAND_TRANSPORT_MODE)
|
||||
DEFINE_GETTER (nmc_property_ib_get_carrier_detect, NM_SETTING_INFINIBAND_CARRIER_DETECT)
|
||||
|
||||
static char *
|
||||
nmc_property_ib_get_mtu (NMSetting *setting)
|
||||
|
@ -1161,7 +1154,6 @@ DEFINE_GETTER (nmc_property_serial_get_send_delay, NM_SETTING_SERIAL_SEND_DELAY)
|
|||
DEFINE_GETTER (nmc_property_vlan_get_interface_name, NM_SETTING_VLAN_INTERFACE_NAME)
|
||||
DEFINE_GETTER (nmc_property_vlan_get_parent, NM_SETTING_VLAN_PARENT)
|
||||
DEFINE_GETTER (nmc_property_vlan_get_id, NM_SETTING_VLAN_ID)
|
||||
DEFINE_GETTER (nmc_property_vlan_get_carrier_detect, NM_SETTING_VLAN_CARRIER_DETECT)
|
||||
|
||||
|
||||
static char *
|
||||
|
@ -1228,7 +1220,6 @@ DEFINE_GETTER (nmc_property_wired_get_mac_address_blacklist, NM_SETTING_WIRED_MA
|
|||
DEFINE_GETTER (nmc_property_wired_get_s390_subchannels, NM_SETTING_WIRED_S390_SUBCHANNELS)
|
||||
DEFINE_GETTER (nmc_property_wired_get_s390_nettype, NM_SETTING_WIRED_S390_NETTYPE)
|
||||
DEFINE_GETTER (nmc_property_wired_get_s390_options, NM_SETTING_WIRED_S390_OPTIONS)
|
||||
DEFINE_GETTER (nmc_property_wired_get_carrier_detect, NM_SETTING_WIRED_CARRIER_DETECT)
|
||||
|
||||
static char *
|
||||
nmc_property_wired_get_mtu (NMSetting *setting)
|
||||
|
@ -1479,7 +1470,6 @@ setting_wired_details (NMSettingWired *s_wired, NmCli *nmc)
|
|||
set_val_str (nmc->allowed_fields, 9, nmc_property_wired_get_s390_subchannels (setting));
|
||||
set_val_str (nmc->allowed_fields, 10, nmc_property_wired_get_s390_nettype (setting));
|
||||
set_val_str (nmc->allowed_fields, 11, nmc_property_wired_get_s390_options (setting));
|
||||
set_val_str (nmc->allowed_fields, 12, nmc_property_wired_get_carrier_detect (setting));
|
||||
|
||||
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
|
||||
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
|
||||
|
@ -1982,7 +1972,6 @@ setting_infiniband_details (NMSettingInfiniband *s_infiniband, NmCli *nmc)
|
|||
set_val_str (nmc->allowed_fields, 1, nmc_property_ib_get_mac_address (setting));
|
||||
set_val_str (nmc->allowed_fields, 2, nmc_property_ib_get_mtu (setting));
|
||||
set_val_str (nmc->allowed_fields, 3, nmc_property_ib_get_transport_mode (setting));
|
||||
set_val_str (nmc->allowed_fields, 4, nmc_property_ib_get_carrier_detect (setting));
|
||||
|
||||
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
|
||||
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
|
||||
|
@ -2039,7 +2028,6 @@ setting_vlan_details (NMSettingVlan *s_vlan, NmCli *nmc)
|
|||
set_val_str (nmc->allowed_fields, 4, nmc_property_vlan_get_flags (setting));
|
||||
set_val_str (nmc->allowed_fields, 5, nmc_property_vlan_get_ingress_priority_map (setting));
|
||||
set_val_str (nmc->allowed_fields, 6, nmc_property_vlan_get_egress_priority_map (setting));
|
||||
set_val_str (nmc->allowed_fields, 7, nmc_property_vlan_get_carrier_detect (setting));
|
||||
|
||||
nmc->print_fields.flags = multiline_flag | mode_flag | escape_flag | NMC_PF_FLAG_SECTION_PREFIX;
|
||||
print_fields (nmc->print_fields, nmc->allowed_fields); /* Print values */
|
||||
|
|
|
@ -11,7 +11,6 @@ global:
|
|||
nm_connection_error_get_type;
|
||||
nm_connection_error_quark;
|
||||
nm_connection_for_each_setting_value;
|
||||
nm_connection_get_carrier_detect;
|
||||
nm_connection_get_id;
|
||||
nm_connection_get_path;
|
||||
nm_connection_get_setting;
|
||||
|
@ -288,7 +287,6 @@ global:
|
|||
nm_setting_hash_flags_get_type;
|
||||
nm_setting_infiniband_error_get_type;
|
||||
nm_setting_infiniband_error_quark;
|
||||
nm_setting_infiniband_get_carrier_detect;
|
||||
nm_setting_infiniband_get_mac_address;
|
||||
nm_setting_infiniband_get_mtu;
|
||||
nm_setting_infiniband_get_transport_mode;
|
||||
|
@ -417,7 +415,6 @@ global:
|
|||
nm_setting_vlan_clear_priorities;
|
||||
nm_setting_vlan_error_get_type;
|
||||
nm_setting_vlan_error_quark;
|
||||
nm_setting_vlan_get_carrier_detect;
|
||||
nm_setting_vlan_get_flags;
|
||||
nm_setting_vlan_get_id;
|
||||
nm_setting_vlan_get_interface_name;
|
||||
|
@ -453,7 +450,6 @@ global:
|
|||
nm_setting_wired_error_get_type;
|
||||
nm_setting_wired_error_quark;
|
||||
nm_setting_wired_get_auto_negotiate;
|
||||
nm_setting_wired_get_carrier_detect;
|
||||
nm_setting_wired_get_cloned_mac_address;
|
||||
nm_setting_wired_get_duplex;
|
||||
nm_setting_wired_get_mac_address;
|
||||
|
|
|
@ -1220,42 +1220,6 @@ nm_connection_get_id (NMConnection *connection)
|
|||
return nm_setting_connection_get_id (s_con);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* nm_connection_get_carrier_detect:
|
||||
* @connection: the #NMConnection
|
||||
*
|
||||
* A shortcut to return the "carrier-detect" property from the
|
||||
* connection's device-specific #NMSetting.
|
||||
*
|
||||
* Returns: the connection's "carrier-detect" property, or
|
||||
* %NULL if the connection is for a device that does not
|
||||
* support carrier detection.
|
||||
**/
|
||||
const char *
|
||||
nm_connection_get_carrier_detect (NMConnection *connection)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
NMSetting *s_type;
|
||||
const char *type, *ret;
|
||||
char *carrier_detect;
|
||||
|
||||
s_con = nm_connection_get_setting_connection (connection);
|
||||
g_return_val_if_fail (s_con != NULL, NULL);
|
||||
|
||||
type = nm_setting_connection_get_connection_type (s_con);
|
||||
s_type = nm_connection_get_setting_by_name (connection, type);
|
||||
g_return_val_if_fail (s_type != NULL, NULL);
|
||||
|
||||
if (!g_object_class_find_property (G_OBJECT_GET_CLASS (s_type), "carrier-detect"))
|
||||
return NULL;
|
||||
|
||||
g_object_get (G_OBJECT (s_type), "carrier-detect", &carrier_detect, NULL);
|
||||
ret = g_intern_string (carrier_detect);
|
||||
g_free (carrier_detect);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/**
|
||||
|
|
|
@ -183,11 +183,9 @@ GType nm_connection_lookup_setting_type (const char *name);
|
|||
GType nm_connection_lookup_setting_type_by_quark (GQuark error_quark);
|
||||
|
||||
/* Helpers */
|
||||
const char * nm_connection_get_uuid (NMConnection *connection);
|
||||
const char * nm_connection_get_uuid (NMConnection *connection);
|
||||
|
||||
const char * nm_connection_get_id (NMConnection *connection);
|
||||
|
||||
const char * nm_connection_get_carrier_detect (NMConnection *connection);
|
||||
const char * nm_connection_get_id (NMConnection *connection);
|
||||
|
||||
NMSetting8021x * nm_connection_get_setting_802_1x (NMConnection *connection);
|
||||
NMSettingBluetooth * nm_connection_get_setting_bluetooth (NMConnection *connection);
|
||||
|
|
|
@ -67,7 +67,6 @@ typedef struct {
|
|||
GByteArray *mac_address;
|
||||
char *transport_mode;
|
||||
guint32 mtu;
|
||||
char *carrier_detect;
|
||||
} NMSettingInfinibandPrivate;
|
||||
|
||||
enum {
|
||||
|
@ -75,7 +74,6 @@ enum {
|
|||
PROP_MAC_ADDRESS,
|
||||
PROP_MTU,
|
||||
PROP_TRANSPORT_MODE,
|
||||
PROP_CARRIER_DETECT,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
@ -138,21 +136,6 @@ nm_setting_infiniband_get_transport_mode (NMSettingInfiniband *setting)
|
|||
return NM_SETTING_INFINIBAND_GET_PRIVATE (setting)->transport_mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_infiniband_get_carrier_detect:
|
||||
* @setting: the #NMSettingInfiniband
|
||||
*
|
||||
* Returns: the connection's carrier-detection behavior;
|
||||
* See #NMSettingInfiniband:carrier-detect.
|
||||
**/
|
||||
const char *
|
||||
nm_setting_infiniband_get_carrier_detect (NMSettingInfiniband *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_INFINIBAND (setting), NULL);
|
||||
|
||||
return NM_SETTING_INFINIBAND_GET_PRIVATE (setting)->carrier_detect;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||
|
@ -183,16 +166,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->carrier_detect && !_nm_utils_carrier_detect_mode_valid (priv->carrier_detect)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_INFINIBAND_ERROR,
|
||||
NM_SETTING_INFINIBAND_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not a valid value for the property"),
|
||||
priv->carrier_detect);
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_INFINIBAND_CARRIER_DETECT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -207,7 +180,6 @@ finalize (GObject *object)
|
|||
{
|
||||
NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->carrier_detect);
|
||||
g_free (priv->transport_mode);
|
||||
if (priv->mac_address)
|
||||
g_byte_array_free (priv->mac_address, TRUE);
|
||||
|
@ -234,10 +206,6 @@ set_property (GObject *object, guint prop_id,
|
|||
g_free (priv->transport_mode);
|
||||
priv->transport_mode = g_value_dup_string (value);
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_free (priv->carrier_detect);
|
||||
priv->carrier_detect = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -260,9 +228,6 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_TRANSPORT_MODE:
|
||||
g_value_set_string (value, nm_setting_infiniband_get_transport_mode (setting));
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_value_set_string (value, nm_setting_infiniband_get_carrier_detect (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -331,29 +296,5 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class)
|
|||
"The IPoIB transport mode. Either 'datagram' or 'connected'.",
|
||||
NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
/**
|
||||
* NMSettingInfiniband:carrier-detect:
|
||||
*
|
||||
* Controls whether device carrier affects this connection. Possible values
|
||||
* are 'no', meaning the connection completely ignores carrier; 'yes',
|
||||
* meaning the connection can only be activated if carrier is present,
|
||||
* and will be deactivated automatically if carrier is lost; and
|
||||
* 'on-activate', meaning the connection can only be activated if carrier
|
||||
* is present, but will not be deactivated if carrier is lost.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CARRIER_DETECT,
|
||||
g_param_spec_string (NM_SETTING_INFINIBAND_CARRIER_DETECT,
|
||||
"Carrier-detect",
|
||||
"Controls whether device carrier affects this connection. "
|
||||
"Possible values are 'no', meaning the connection completely "
|
||||
"ignores carrier; 'yes', meaning the connection can only be "
|
||||
"activated if carrier is present, and will be deactivated "
|
||||
"automatically if carrier is lost; and 'on-activate', meaning "
|
||||
"the connection can only be activated if carrier is present, "
|
||||
"but will not be deactivated if carrier is lost.",
|
||||
"yes",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,6 @@ GQuark nm_setting_infiniband_error_quark (void);
|
|||
#define NM_SETTING_INFINIBAND_MAC_ADDRESS "mac-address"
|
||||
#define NM_SETTING_INFINIBAND_MTU "mtu"
|
||||
#define NM_SETTING_INFINIBAND_TRANSPORT_MODE "transport-mode"
|
||||
#define NM_SETTING_INFINIBAND_CARRIER_DETECT "carrier-detect"
|
||||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
@ -77,8 +76,6 @@ const GByteArray *nm_setting_infiniband_get_mac_address (NMSettingInfiniband
|
|||
guint32 nm_setting_infiniband_get_mtu (NMSettingInfiniband *setting);
|
||||
const char * nm_setting_infiniband_get_transport_mode (NMSettingInfiniband *setting);
|
||||
|
||||
const char * nm_setting_infiniband_get_carrier_detect (NMSettingInfiniband *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_SETTING_INFINIBAND_H */
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "nm-setting-vlan.h"
|
||||
#include "nm-param-spec-specialized.h"
|
||||
#include "nm-utils.h"
|
||||
#include "nm-utils-private.h"
|
||||
#include "nm-dbus-glib-types.h"
|
||||
#include "nm-setting-connection.h"
|
||||
#include "nm-setting-private.h"
|
||||
|
@ -76,7 +75,6 @@ typedef struct {
|
|||
guint32 flags;
|
||||
GSList *ingress_priority_map;
|
||||
GSList *egress_priority_map;
|
||||
char *carrier_detect;
|
||||
} NMSettingVlanPrivate;
|
||||
|
||||
enum {
|
||||
|
@ -87,7 +85,6 @@ enum {
|
|||
PROP_FLAGS,
|
||||
PROP_INGRESS_PRIORITY_MAP,
|
||||
PROP_EGRESS_PRIORITY_MAP,
|
||||
PROP_CARRIER_DETECT,
|
||||
LAST_PROP
|
||||
};
|
||||
|
||||
|
@ -437,21 +434,6 @@ nm_setting_vlan_clear_priorities (NMSettingVlan *setting, NMVlanPriorityMap map)
|
|||
set_map (setting, map, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_vlan_get_carrier_detect:
|
||||
* @setting: the #NMSettingVlan
|
||||
*
|
||||
* Returns: the connection's carrier-detection behavior;
|
||||
* See #NMSettingVlan:carrier-detect.
|
||||
**/
|
||||
const char *
|
||||
nm_setting_vlan_get_carrier_detect (NMSettingVlan *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_VLAN (setting), NULL);
|
||||
|
||||
return NM_SETTING_VLAN_GET_PRIVATE (setting)->carrier_detect;
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
|
||||
static void
|
||||
|
@ -547,16 +529,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->carrier_detect && !_nm_utils_carrier_detect_mode_valid (priv->carrier_detect)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_VLAN_ERROR,
|
||||
NM_SETTING_VLAN_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not a valid value for the property"),
|
||||
priv->carrier_detect);
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_VLAN_CARRIER_DETECT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -613,10 +585,6 @@ set_property (GObject *object, guint prop_id,
|
|||
priv->egress_priority_map =
|
||||
priority_stringlist_to_maplist (NM_VLAN_EGRESS_MAP, g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_free (priv->carrier_detect);
|
||||
priv->carrier_detect = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -662,9 +630,6 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_EGRESS_PRIORITY_MAP:
|
||||
g_value_take_boxed (value, priority_maplist_to_stringlist (priv->egress_priority_map));
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_value_set_string (value, nm_setting_vlan_get_carrier_detect (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -679,7 +644,6 @@ finalize (GObject *object)
|
|||
|
||||
g_free (priv->iface_name);
|
||||
g_free (priv->parent);
|
||||
g_free (priv->carrier_detect);
|
||||
nm_utils_slist_free (priv->ingress_priority_map, g_free);
|
||||
nm_utils_slist_free (priv->egress_priority_map, g_free);
|
||||
}
|
||||
|
@ -817,28 +781,4 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
|
|||
"'to' are unsigned integers, ie '7:3'.",
|
||||
DBUS_TYPE_G_LIST_OF_STRING,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
/**
|
||||
* NMSettingVlan:carrier-detect:
|
||||
*
|
||||
* Controls whether device carrier affects this connection. Possible values
|
||||
* are 'no', meaning the connection completely ignores carrier; 'yes',
|
||||
* meaning the connection can only be activated if carrier is present,
|
||||
* and will be deactivated automatically if carrier is lost; and
|
||||
* 'on-activate', meaning the connection can only be activated if carrier
|
||||
* is present, but will not be deactivated if carrier is lost.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CARRIER_DETECT,
|
||||
g_param_spec_string (NM_SETTING_VLAN_CARRIER_DETECT,
|
||||
"Carrier-detect",
|
||||
"Controls whether device carrier affects this connection. "
|
||||
"Possible values are 'no', meaning the connection completely "
|
||||
"ignores carrier; 'yes', meaning the connection can only be "
|
||||
"activated if carrier is present, and will be deactivated "
|
||||
"automatically if carrier is lost; and 'on-activate', meaning "
|
||||
"the connection can only be activated if carrier is present, "
|
||||
"but will not be deactivated if carrier is lost.",
|
||||
"yes",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
}
|
||||
|
|
|
@ -63,7 +63,6 @@ GQuark nm_setting_vlan_error_quark (void);
|
|||
#define NM_SETTING_VLAN_FLAGS "flags"
|
||||
#define NM_SETTING_VLAN_INGRESS_PRIORITY_MAP "ingress-priority-map"
|
||||
#define NM_SETTING_VLAN_EGRESS_PRIORITY_MAP "egress-priority-map"
|
||||
#define NM_SETTING_VLAN_CARRIER_DETECT "carrier-detect"
|
||||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
@ -143,8 +142,6 @@ gboolean nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
|
|||
NMVlanPriorityMap map,
|
||||
const char *str);
|
||||
|
||||
const char * nm_setting_vlan_get_carrier_detect (NMSettingVlan *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_SETTING_VLAN_H */
|
||||
|
|
|
@ -84,7 +84,6 @@ typedef struct {
|
|||
GPtrArray *s390_subchannels;
|
||||
char *s390_nettype;
|
||||
GHashTable *s390_options;
|
||||
char *carrier_detect;
|
||||
} NMSettingWiredPrivate;
|
||||
|
||||
enum {
|
||||
|
@ -100,7 +99,6 @@ enum {
|
|||
PROP_S390_SUBCHANNELS,
|
||||
PROP_S390_NETTYPE,
|
||||
PROP_S390_OPTIONS,
|
||||
PROP_CARRIER_DETECT,
|
||||
|
||||
LAST_PROP
|
||||
};
|
||||
|
@ -440,21 +438,6 @@ nm_setting_wired_get_valid_s390_options (NMSettingWired *setting)
|
|||
return valid_s390_opts;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_setting_wired_get_carrier_detect:
|
||||
* @setting: the #NMSettingWired
|
||||
*
|
||||
* Returns: the connection's carrier-detection behavior;
|
||||
* See #NMSettingWired:carrier-detect.
|
||||
**/
|
||||
const char *
|
||||
nm_setting_wired_get_carrier_detect (NMSettingWired *setting)
|
||||
{
|
||||
g_return_val_if_fail (NM_IS_SETTING_WIRED (setting), NULL);
|
||||
|
||||
return NM_SETTING_WIRED_GET_PRIVATE (setting)->carrier_detect;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
verify (NMSetting *setting, GSList *all_settings, GError **error)
|
||||
{
|
||||
|
@ -553,16 +536,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (priv->carrier_detect && !_nm_utils_carrier_detect_mode_valid (priv->carrier_detect)) {
|
||||
g_set_error (error,
|
||||
NM_SETTING_WIRED_ERROR,
|
||||
NM_SETTING_WIRED_ERROR_INVALID_PROPERTY,
|
||||
_("'%s' is not a valid value for the property"),
|
||||
priv->carrier_detect);
|
||||
g_prefix_error (error, "%s: ", NM_SETTING_WIRED_CARRIER_DETECT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -583,7 +556,6 @@ finalize (GObject *object)
|
|||
g_free (priv->port);
|
||||
g_free (priv->duplex);
|
||||
g_free (priv->s390_nettype);
|
||||
g_free (priv->carrier_detect);
|
||||
|
||||
g_hash_table_destroy (priv->s390_options);
|
||||
|
||||
|
@ -666,10 +638,6 @@ set_property (GObject *object, guint prop_id,
|
|||
if (new_hash)
|
||||
g_hash_table_foreach (new_hash, copy_hash, priv->s390_options);
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_free (priv->carrier_detect);
|
||||
priv->carrier_detect = g_value_dup_string (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -717,9 +685,6 @@ get_property (GObject *object, guint prop_id,
|
|||
case PROP_S390_OPTIONS:
|
||||
g_value_set_boxed (value, priv->s390_options);
|
||||
break;
|
||||
case PROP_CARRIER_DETECT:
|
||||
g_value_set_string (value, nm_setting_wired_get_carrier_detect (setting));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -939,29 +904,5 @@ nm_setting_wired_class_init (NMSettingWiredClass *setting_class)
|
|||
"'layer2', 'portname', 'protocol', among others.",
|
||||
DBUS_TYPE_G_MAP_OF_STRING,
|
||||
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
|
||||
|
||||
/**
|
||||
* NMSettingWired:carrier-detect:
|
||||
*
|
||||
* Controls whether device carrier affects this connection. Possible values
|
||||
* are 'no', meaning the connection completely ignores carrier; 'yes',
|
||||
* meaning the connection can only be activated if carrier is present,
|
||||
* and will be deactivated automatically if carrier is lost; and
|
||||
* 'on-activate', meaning the connection can only be activated if carrier
|
||||
* is present, but will not be deactivated if carrier is lost.
|
||||
**/
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_CARRIER_DETECT,
|
||||
g_param_spec_string (NM_SETTING_WIRED_CARRIER_DETECT,
|
||||
"Carrier-detect",
|
||||
"Controls whether device carrier affects this connection. "
|
||||
"Possible values are 'no', meaning the connection completely "
|
||||
"ignores carrier; 'yes', meaning the connection can only be "
|
||||
"activated if carrier is present, and will be deactivated "
|
||||
"automatically if carrier is lost; and 'on-activate', meaning "
|
||||
"the connection can only be activated if carrier is present, "
|
||||
"but will not be deactivated if carrier is lost.",
|
||||
"yes",
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,6 @@ GQuark nm_setting_wired_error_quark (void);
|
|||
#define NM_SETTING_WIRED_S390_SUBCHANNELS "s390-subchannels"
|
||||
#define NM_SETTING_WIRED_S390_NETTYPE "s390-nettype"
|
||||
#define NM_SETTING_WIRED_S390_OPTIONS "s390-options"
|
||||
#define NM_SETTING_WIRED_CARRIER_DETECT "carrier-detect"
|
||||
|
||||
typedef struct {
|
||||
NMSetting parent;
|
||||
|
@ -111,8 +110,6 @@ gboolean nm_setting_wired_remove_s390_option (NMSettingWired *setting
|
|||
const char *key);
|
||||
const char ** nm_setting_wired_get_valid_s390_options (NMSettingWired *setting);
|
||||
|
||||
const char * nm_setting_wired_get_carrier_detect (NMSettingWired *setting);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* NM_SETTING_WIRED_H */
|
||||
|
|
|
@ -35,8 +35,6 @@ gboolean _nm_utils_string_slist_validate (GSList *list,
|
|||
gboolean _nm_utils_gvalue_array_validate (GValueArray *elements,
|
||||
guint n_expected, ...);
|
||||
|
||||
gboolean _nm_utils_carrier_detect_mode_valid (const char *carrier_detect);
|
||||
|
||||
void _nm_value_transforms_register (void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -884,14 +884,6 @@ nm_utils_wpa_psk_valid (const char *psk)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_nm_utils_carrier_detect_mode_valid (const char *carrier_detect)
|
||||
{
|
||||
const char *valid_carrier_detect[] = { "no", "on-activate", "yes", NULL };
|
||||
|
||||
return _nm_utils_string_in_list (carrier_detect, valid_carrier_detect);
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_utils_ip4_addresses_from_gvalue:
|
||||
* @value: gvalue containing a GPtrArray of GArrays of guint32s
|
||||
|
|
|
@ -1123,7 +1123,6 @@ test_connection_diff_a_only (void)
|
|||
{ NM_SETTING_WIRED_S390_SUBCHANNELS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_WIRED_S390_NETTYPE, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_WIRED_S390_OPTIONS, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NM_SETTING_WIRED_CARRIER_DETECT, NM_SETTING_DIFF_RESULT_IN_A },
|
||||
{ NULL, NM_SETTING_DIFF_RESULT_UNKNOWN },
|
||||
} },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, {
|
||||
|
|
|
@ -125,11 +125,12 @@ can_interrupt_activation (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
NMDeviceAdsl *self = NM_DEVICE_ADSL (dev);
|
||||
|
||||
if (need_carrier && !NM_DEVICE_ADSL_GET_PRIVATE (self)->carrier)
|
||||
/* Can't do anything if there isn't a carrier */
|
||||
if (!NM_DEVICE_ADSL_GET_PRIVATE (self)->carrier)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -109,10 +109,10 @@ get_generic_capabilities (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
if (NM_DEVICE_GET_CLASS (dev)->hw_is_up)
|
||||
return NM_DEVICE_GET_CLASS (dev)->hw_is_up (dev) || !need_carrier;
|
||||
return NM_DEVICE_GET_CLASS (dev)->hw_is_up (dev);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -109,10 +109,10 @@ get_generic_capabilities (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
if (NM_DEVICE_GET_CLASS (dev)->hw_is_up)
|
||||
return NM_DEVICE_GET_CLASS (dev)->hw_is_up (dev) || !need_carrier;
|
||||
return NM_DEVICE_GET_CLASS (dev)->hw_is_up (dev);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1056,7 +1056,7 @@ deactivate (NMDevice *device)
|
|||
/*****************************************************************************/
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
NMDeviceBt *self = NM_DEVICE_BT (dev);
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
|
||||
|
@ -1085,7 +1085,7 @@ handle_availability_change (NMDeviceBt *self,
|
|||
return;
|
||||
}
|
||||
|
||||
available = nm_device_is_available (device, TRUE);
|
||||
available = nm_device_is_available (device);
|
||||
if (available == old_available)
|
||||
return;
|
||||
|
||||
|
@ -1116,7 +1116,7 @@ set_mm_running (NMDeviceBt *self, gboolean running)
|
|||
nm_device_get_iface (NM_DEVICE (self)),
|
||||
running ? "available" : "unavailable");
|
||||
|
||||
old_available = nm_device_is_available (NM_DEVICE (self), TRUE);
|
||||
old_available = nm_device_is_available (NM_DEVICE (self));
|
||||
priv->mm_running = running;
|
||||
handle_availability_change (self, old_available, NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE);
|
||||
|
||||
|
|
|
@ -187,9 +187,9 @@ can_interrupt_activation (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
return NM_DEVICE_VLAN_GET_PRIVATE (dev)->carrier || !need_carrier;
|
||||
return NM_DEVICE_VLAN_GET_PRIVATE (dev)->carrier ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
|
|
|
@ -1361,7 +1361,7 @@ complete_connection (NMDevice *device,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
NMDeviceWifi *self = NM_DEVICE_WIFI (dev);
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
|
@ -2369,7 +2369,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
|
|||
/* If the interface can now be activated because the supplicant is now
|
||||
* available, transition to DISCONNECTED.
|
||||
*/
|
||||
if ((devstate == NM_DEVICE_STATE_UNAVAILABLE) && nm_device_is_available (device, TRUE)) {
|
||||
if ((devstate == NM_DEVICE_STATE_UNAVAILABLE) && nm_device_is_available (device)) {
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
NM_DEVICE_STATE_REASON_SUPPLICANT_AVAILABLE);
|
||||
|
|
|
@ -289,11 +289,12 @@ can_interrupt_activation (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *dev, gboolean need_carrier)
|
||||
is_available (NMDevice *dev)
|
||||
{
|
||||
NMDeviceWired *self = NM_DEVICE_WIRED (dev);
|
||||
|
||||
if (need_carrier && !NM_DEVICE_WIRED_GET_PRIVATE (self)->carrier)
|
||||
/* Can't do anything if there isn't a carrier */
|
||||
if (!NM_DEVICE_WIRED_GET_PRIVATE (self)->carrier)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -1226,19 +1226,8 @@ carrier_changed (GObject *object, GParamSpec *param, gpointer user_data)
|
|||
return;
|
||||
}
|
||||
|
||||
if (priv->act_request) {
|
||||
NMConnection *connection;
|
||||
const char *carrier_detect;
|
||||
|
||||
connection = nm_act_request_get_connection (priv->act_request);
|
||||
carrier_detect = nm_connection_get_carrier_detect (connection);
|
||||
|
||||
if ( g_strcmp0 (carrier_detect, "no") == 0
|
||||
|| (!carrier && g_strcmp0 (carrier_detect, "on-activate") == 0))
|
||||
return;
|
||||
else if (!carrier && (!carrier_detect || strcmp (carrier_detect, "yes") == 0))
|
||||
defer_action = TRUE;
|
||||
}
|
||||
if (priv->act_request && !carrier)
|
||||
defer_action = TRUE;
|
||||
|
||||
nm_log_info (LOGD_HW | LOGD_DEVICE, "(%s): carrier now %s (device state %d%s)",
|
||||
nm_device_get_iface (self),
|
||||
|
@ -1285,7 +1274,7 @@ nm_device_get_connection (NMDevice *self)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nm_device_is_available (NMDevice *self, gboolean need_carrier)
|
||||
nm_device_is_available (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
|
||||
|
@ -1293,33 +1282,10 @@ nm_device_is_available (NMDevice *self, gboolean need_carrier)
|
|||
return FALSE;
|
||||
|
||||
if (NM_DEVICE_GET_CLASS (self)->is_available)
|
||||
return NM_DEVICE_GET_CLASS (self)->is_available (self, need_carrier);
|
||||
return NM_DEVICE_GET_CLASS (self)->is_available (self);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
nm_device_has_available_connection (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
const GSList *connections, *iter;
|
||||
|
||||
if (nm_device_is_available (self, TRUE))
|
||||
return TRUE;
|
||||
if (!nm_device_is_available (self, FALSE))
|
||||
return FALSE;
|
||||
|
||||
/* We're only available if there's an ignore-carrier connection */
|
||||
connections = nm_connection_provider_get_connections (priv->con_provider);
|
||||
for (iter = connections; iter; iter = iter->next) {
|
||||
const char *carrier_detect;
|
||||
|
||||
carrier_detect = nm_connection_get_carrier_detect (NM_CONNECTION (iter->data));
|
||||
if (g_strcmp0 (carrier_detect, "no") == 0)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_get_enabled (NMDevice *self)
|
||||
{
|
||||
|
@ -1419,7 +1385,6 @@ nm_device_get_best_auto_connection (NMDevice *dev,
|
|||
{
|
||||
guint32 caps;
|
||||
GSList *iter;
|
||||
gboolean need_ignore_carrier = FALSE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (dev), NULL);
|
||||
g_return_val_if_fail (specific_object != NULL, NULL);
|
||||
|
@ -1430,23 +1395,9 @@ nm_device_get_best_auto_connection (NMDevice *dev,
|
|||
if (!(caps & NM_DEVICE_CAP_NM_SUPPORTED))
|
||||
return NULL;
|
||||
|
||||
if (!nm_device_is_available (dev, TRUE)) {
|
||||
if (!nm_device_is_available (dev, FALSE))
|
||||
return NULL;
|
||||
need_ignore_carrier = TRUE;
|
||||
}
|
||||
|
||||
for (iter = connections; iter; iter = iter->next) {
|
||||
NMConnection *connection = NM_CONNECTION (iter->data);
|
||||
|
||||
if (need_ignore_carrier) {
|
||||
const char *carrier_detect;
|
||||
|
||||
carrier_detect = nm_connection_get_carrier_detect (connection);
|
||||
if (g_strcmp0 (carrier_detect, "no") != 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (NM_DEVICE_GET_CLASS (dev)->can_auto_connect (dev, connection, specific_object))
|
||||
return connection;
|
||||
}
|
||||
|
@ -5352,7 +5303,7 @@ nm_device_state_changed (NMDevice *device,
|
|||
* we can't change states again from the state handler for a variety of
|
||||
* reasons.
|
||||
*/
|
||||
if (nm_device_has_available_connection (device)) {
|
||||
if (nm_device_is_available (device)) {
|
||||
nm_log_dbg (LOGD_DEVICE, "(%s): device is available, will transition to DISCONNECTED",
|
||||
nm_device_get_iface (device));
|
||||
nm_device_queue_state (device, NM_DEVICE_STATE_DISCONNECTED, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
@ -5361,14 +5312,6 @@ nm_device_state_changed (NMDevice *device,
|
|||
nm_device_get_iface (device));
|
||||
}
|
||||
break;
|
||||
case NM_DEVICE_STATE_DISCONNECTED:
|
||||
/* If a previous connection was up despite not having carrier, then we're
|
||||
* actually UNAVAILABLE now.
|
||||
*/
|
||||
if ( old_state > NM_DEVICE_STATE_DISCONNECTED
|
||||
&& !nm_device_is_available (device, TRUE))
|
||||
nm_device_queue_state (device, NM_DEVICE_STATE_UNAVAILABLE, NM_DEVICE_STATE_REASON_CARRIER);
|
||||
break;
|
||||
case NM_DEVICE_STATE_ACTIVATED:
|
||||
nm_log_info (LOGD_DEVICE, "Activation (%s) successful, device activated.",
|
||||
nm_device_get_iface (device));
|
||||
|
|
|
@ -118,8 +118,7 @@ typedef struct {
|
|||
guint32 (* get_type_capabilities) (NMDevice *self);
|
||||
guint32 (* get_generic_capabilities) (NMDevice *self);
|
||||
|
||||
gboolean (* is_available) (NMDevice *self,
|
||||
gboolean need_carrier);
|
||||
gboolean (* is_available) (NMDevice *self);
|
||||
|
||||
gboolean (* get_enabled) (NMDevice *self);
|
||||
|
||||
|
@ -239,8 +238,7 @@ void nm_device_slave_notify_enslaved (NMDevice *dev,
|
|||
NMActRequest * nm_device_get_act_request (NMDevice *dev);
|
||||
NMConnection * nm_device_get_connection (NMDevice *dev);
|
||||
|
||||
gboolean nm_device_is_available (NMDevice *dev,
|
||||
gboolean need_carrier);
|
||||
gboolean nm_device_is_available (NMDevice *dev);
|
||||
|
||||
NMConnection * nm_device_get_best_auto_connection (NMDevice *dev,
|
||||
GSList *connections,
|
||||
|
|
|
@ -1901,22 +1901,13 @@ add_device (NMManager *self, NMDevice *device)
|
|||
/* Check if we should assume the device's active connection by matching its
|
||||
* config with an existing system connection.
|
||||
*/
|
||||
if ( nm_device_is_available (device, FALSE)
|
||||
&& nm_device_can_assume_connections (device)) {
|
||||
if (nm_device_can_assume_connections (device)) {
|
||||
GSList *connections = NULL;
|
||||
|
||||
connections = nm_settings_get_connections (priv->settings);
|
||||
existing = nm_device_find_assumable_connection (device, connections);
|
||||
g_slist_free (connections);
|
||||
|
||||
if (existing && !nm_device_is_available (device, TRUE)) {
|
||||
const char *carrier_detect;
|
||||
|
||||
carrier_detect = nm_connection_get_carrier_detect (existing);
|
||||
if (g_strcmp0 (carrier_detect, "no") != 0)
|
||||
existing = NULL;
|
||||
}
|
||||
|
||||
if (existing)
|
||||
nm_log_dbg (LOGD_DEVICE, "(%s): found existing device connection '%s'",
|
||||
nm_device_get_iface (device),
|
||||
|
@ -1943,7 +1934,7 @@ add_device (NMManager *self, NMDevice *device)
|
|||
system_create_virtual_devices (self);
|
||||
|
||||
/* If the device has a connection it can assume, do that now */
|
||||
if (existing && managed) {
|
||||
if (existing && managed && nm_device_is_available (device)) {
|
||||
NMActiveConnection *ac;
|
||||
GError *error = NULL;
|
||||
|
||||
|
@ -2887,7 +2878,7 @@ nm_manager_activate_connection (NMManager *manager,
|
|||
* in the UNAVAILABLE state here. Since we want to use it right
|
||||
* away, we transition it immediately to DISCONNECTED.
|
||||
*/
|
||||
if ( nm_device_is_available (device, FALSE)
|
||||
if ( nm_device_is_available (device)
|
||||
&& (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE)) {
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_DISCONNECTED,
|
||||
|
@ -2898,14 +2889,9 @@ nm_manager_activate_connection (NMManager *manager,
|
|||
|
||||
state = nm_device_get_state (device);
|
||||
if (state < NM_DEVICE_STATE_DISCONNECTED) {
|
||||
const char *carrier_detect = nm_connection_get_carrier_detect (connection);
|
||||
|
||||
if ( state != NM_DEVICE_STATE_UNAVAILABLE
|
||||
|| g_strcmp0 (carrier_detect, "no") != 0) {
|
||||
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNMANAGED_DEVICE,
|
||||
"Device not managed by NetworkManager or unavailable");
|
||||
return NULL;
|
||||
}
|
||||
g_set_error_literal (error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNMANAGED_DEVICE,
|
||||
"Device not managed by NetworkManager or unavailable");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* If this is an autoconnect request, but the device isn't allowing autoconnect
|
||||
|
|
|
@ -3437,14 +3437,6 @@ make_wired_setting (shvarFile *ifcfg,
|
|||
g_free (value);
|
||||
}
|
||||
|
||||
value = svGetValue(ifcfg, "CARRIER_DETECT", FALSE);
|
||||
if (!value || !strlen (value)) {
|
||||
g_free (value);
|
||||
value = g_strdup ("yes");
|
||||
}
|
||||
g_object_set (s_wired, NM_SETTING_WIRED_CARRIER_DETECT, value, NULL);
|
||||
g_free (value);
|
||||
|
||||
return (NMSetting *) s_wired;
|
||||
|
||||
error:
|
||||
|
@ -3546,14 +3538,6 @@ make_infiniband_setting (shvarFile *ifcfg,
|
|||
else
|
||||
g_object_set (s_infiniband, NM_SETTING_INFINIBAND_TRANSPORT_MODE, "datagram", NULL);
|
||||
|
||||
value = svGetValue(ifcfg, "CARRIER_DETECT", FALSE);
|
||||
if (!value || !strlen (value)) {
|
||||
g_free (value);
|
||||
value = g_strdup ("yes");
|
||||
}
|
||||
g_object_set (s_infiniband, NM_SETTING_INFINIBAND_CARRIER_DETECT, value, NULL);
|
||||
g_free (value);
|
||||
|
||||
return (NMSetting *) s_infiniband;
|
||||
}
|
||||
|
||||
|
@ -4095,14 +4079,6 @@ make_vlan_setting (shvarFile *ifcfg,
|
|||
parse_prio_map_list (s_vlan, ifcfg, "VLAN_INGRESS_PRIORITY_MAP", NM_VLAN_INGRESS_MAP);
|
||||
parse_prio_map_list (s_vlan, ifcfg, "VLAN_EGRESS_PRIORITY_MAP", NM_VLAN_EGRESS_MAP);
|
||||
|
||||
value = svGetValue(ifcfg, "CARRIER_DETECT", FALSE);
|
||||
if (!value || !strlen (value)) {
|
||||
g_free (value);
|
||||
value = g_strdup ("yes");
|
||||
}
|
||||
g_object_set (s_vlan, NM_SETTING_VLAN_CARRIER_DETECT, value, NULL);
|
||||
g_free (value);
|
||||
|
||||
if (out_master)
|
||||
*out_master = svGetValue (ifcfg, "MASTER", FALSE);
|
||||
return (NMSetting *) s_vlan;
|
||||
|
|
|
@ -988,8 +988,6 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e
|
|||
strcmp (transport_mode, "connected") == 0 ? "yes" : "no",
|
||||
FALSE);
|
||||
|
||||
svSetValue (ifcfg, "CARRIER_DETECT", nm_setting_infiniband_get_carrier_detect (s_infiniband), FALSE);
|
||||
|
||||
svSetValue (ifcfg, "TYPE", TYPE_INFINIBAND, FALSE);
|
||||
|
||||
return TRUE;
|
||||
|
@ -1112,8 +1110,6 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error)
|
|||
g_string_free (str, TRUE);
|
||||
}
|
||||
|
||||
svSetValue (ifcfg, "CARRIER_DETECT", nm_setting_wired_get_carrier_detect (s_wired), FALSE);
|
||||
|
||||
svSetValue (ifcfg, "TYPE", TYPE_ETHERNET, FALSE);
|
||||
|
||||
return TRUE;
|
||||
|
@ -1231,8 +1227,6 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired,
|
|||
}
|
||||
}
|
||||
|
||||
svSetValue (ifcfg, "CARRIER_DETECT", nm_setting_vlan_get_carrier_detect (s_vlan), FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ update_availability (NMDeviceWimax *self, gboolean old_available)
|
|||
NMDeviceState state;
|
||||
gboolean new_available, changed = FALSE;
|
||||
|
||||
new_available = nm_device_is_available (device, TRUE);
|
||||
new_available = nm_device_is_available (device);
|
||||
if (new_available == old_available)
|
||||
return FALSE;
|
||||
|
||||
|
@ -314,7 +314,7 @@ set_enabled (NMDevice *device, gboolean enabled)
|
|||
if (priv->enabled == enabled)
|
||||
return;
|
||||
|
||||
old_available = nm_device_is_available (NM_DEVICE (device), TRUE);
|
||||
old_available = nm_device_is_available (NM_DEVICE (device));
|
||||
priv->enabled = enabled;
|
||||
|
||||
nm_log_dbg (LOGD_WIMAX, "(%s): radio now %s",
|
||||
|
@ -610,7 +610,7 @@ get_generic_capabilities (NMDevice *dev)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
is_available (NMDevice *device, gboolean need_carrier)
|
||||
is_available (NMDevice *device)
|
||||
{
|
||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (device);
|
||||
const char *iface = nm_device_get_iface (device);
|
||||
|
@ -838,7 +838,7 @@ wmx_state_change_cb (struct wmxsdk *wmxsdk,
|
|||
return;
|
||||
|
||||
state = nm_device_get_state (NM_DEVICE (self));
|
||||
old_available = nm_device_is_available (NM_DEVICE (self), TRUE);
|
||||
old_available = nm_device_is_available (NM_DEVICE (self));
|
||||
|
||||
priv->status = new_status;
|
||||
if (priv->current_nsp)
|
||||
|
@ -1283,7 +1283,7 @@ static gboolean
|
|||
sdk_action_defer_cb (gpointer user_data)
|
||||
{
|
||||
NMDeviceWimax *self = NM_DEVICE_WIMAX (user_data);
|
||||
gboolean old_available = nm_device_is_available (NM_DEVICE (self), TRUE);
|
||||
gboolean old_available = nm_device_is_available (NM_DEVICE (self));
|
||||
|
||||
NM_DEVICE_WIMAX_GET_PRIVATE (self)->sdk_action_defer_id = 0;
|
||||
update_availability (self, old_available);
|
||||
|
|
Loading…
Reference in a new issue