Commit 5fec30d9 authored by Dan Winship's avatar Dan Winship

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.
parent 1ca47453
......@@ -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)