|
Packit Service |
87a54e |
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2007 - 2008 Novell, Inc.
|
|
Packit |
5756e2 |
* Copyright (C) 2007 - 2012 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-default.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-device-ethernet.h"
|
|
Packit |
5756e2 |
|
|
Packit Service |
d0b836 |
#include <linux/if_ether.h>
|
|
Packit Service |
d0b836 |
|
|
Packit Service |
a1bd4f |
#include "nm-libnm-utils.h"
|
|
Packit |
5756e2 |
#include "nm-setting-connection.h"
|
|
Packit |
5756e2 |
#include "nm-setting-wired.h"
|
|
Packit |
5756e2 |
#include "nm-setting-pppoe.h"
|
|
Packit Service |
a1bd4f |
#include "nm-setting-veth.h"
|
|
Packit |
5756e2 |
#include "nm-utils.h"
|
|
Packit |
5756e2 |
#include "nm-object-private.h"
|
|
Packit Service |
a1bd4f |
#include "nm-device-veth.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PERM_HW_ADDRESS,
|
|
Packit Service |
a1bd4f |
PROP_SPEED,
|
|
Packit Service |
a1bd4f |
PROP_CARRIER,
|
|
Packit Service |
a1bd4f |
PROP_S390_SUBCHANNELS, );
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
typedef struct _NMDeviceEthernetPrivate {
|
|
Packit Service |
a1bd4f |
char ** s390_subchannels;
|
|
Packit Service |
a1bd4f |
char * perm_hw_address;
|
|
Packit Service |
a1bd4f |
guint32 speed;
|
|
Packit Service |
a1bd4f |
bool carrier;
|
|
Packit Service |
a1bd4f |
} NMDeviceEthernetPrivate;
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
G_DEFINE_TYPE(NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NM_DEVICE_ETHERNET_GET_PRIVATE(self) \
|
|
Packit Service |
a1bd4f |
_NM_GET_PRIVATE_PTR(self, NMDeviceEthernet, NM_IS_DEVICE_ETHERNET, NMObject)
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* nm_device_ethernet_get_hw_address: (skip)
|
|
Packit |
5756e2 |
* @device: a #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Gets the active hardware (MAC) address of the #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Returns: the active hardware address. This is the internal string used by the
|
|
Packit |
5756e2 |
* device, and must not be modified.
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Deprecated: 1.24: Use nm_device_get_hw_address() instead.
|
|
Packit |
5756e2 |
**/
|
|
Packit |
5756e2 |
const char *
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_hw_address(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_return_val_if_fail(NM_IS_DEVICE_ETHERNET(device), NULL);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return nm_device_get_hw_address(NM_DEVICE(device));
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* nm_device_ethernet_get_permanent_hw_address:
|
|
Packit |
5756e2 |
* @device: a #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Gets the permanent hardware (MAC) address of the #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Returns: the permanent hardware address. This is the internal string used by the
|
|
Packit |
5756e2 |
* device, and must not be modified.
|
|
Packit |
5756e2 |
**/
|
|
Packit |
5756e2 |
const char *
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_permanent_hw_address(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_return_val_if_fail(NM_IS_DEVICE_ETHERNET(device), NULL);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return _nml_coerce_property_str_not_empty(
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ETHERNET_GET_PRIVATE(device)->perm_hw_address);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* nm_device_ethernet_get_speed:
|
|
Packit |
5756e2 |
* @device: a #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Gets the speed of the #NMDeviceEthernet in Mbit/s.
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Returns: the speed of the device in Mbit/s
|
|
Packit |
5756e2 |
**/
|
|
Packit |
5756e2 |
guint32
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_speed(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_return_val_if_fail(NM_IS_DEVICE_ETHERNET(device), 0);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return NM_DEVICE_ETHERNET_GET_PRIVATE(device)->speed;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* nm_device_ethernet_get_carrier:
|
|
Packit |
5756e2 |
* @device: a #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Whether the device has carrier.
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Returns: %TRUE if the device has carrier
|
|
Packit |
5756e2 |
**/
|
|
Packit |
5756e2 |
gboolean
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_carrier(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_return_val_if_fail(NM_IS_DEVICE_ETHERNET(device), FALSE);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return NM_DEVICE_ETHERNET_GET_PRIVATE(device)->carrier;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* nm_device_ethernet_get_s390_subchannels:
|
|
Packit |
5756e2 |
* @device: a #NMDeviceEthernet
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Return the list of s390 subchannels if the device supports them.
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Returns: (transfer none) (element-type utf8): array of strings, each specifying
|
|
Packit |
5756e2 |
* one subchannel the s390 device uses to communicate to the host.
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* Since: 1.2
|
|
Packit |
5756e2 |
**/
|
|
Packit Service |
a1bd4f |
const char *const *
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_s390_subchannels(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_return_val_if_fail(NM_IS_DEVICE_ETHERNET(device), NULL);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
return (const char *const *) NM_DEVICE_ETHERNET_GET_PRIVATE(device)->s390_subchannels;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
match_subchans(NMDeviceEthernet *self, NMSettingWired *s_wired, gboolean *try_mac)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(self);
|
|
Packit Service |
a1bd4f |
const char *const * subchans;
|
|
Packit Service |
a1bd4f |
gsize num1, num2;
|
|
Packit Service |
a1bd4f |
gsize i, j;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
*try_mac = TRUE;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
subchans = nm_setting_wired_get_s390_subchannels(s_wired);
|
|
Packit Service |
a1bd4f |
num1 = NM_PTRARRAY_LEN(subchans);
|
|
Packit Service |
a1bd4f |
num2 = NM_PTRARRAY_LEN(priv->s390_subchannels);
|
|
Packit Service |
a1bd4f |
/* connection has no subchannels */
|
|
Packit Service |
a1bd4f |
if (num1 == 0)
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit Service |
a1bd4f |
/* connection requires subchannels but the device has none */
|
|
Packit Service |
a1bd4f |
if (num2 == 0)
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
/* number of subchannels differ */
|
|
Packit Service |
a1bd4f |
if (num1 != num2)
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Make sure each subchannel in the connection is a subchannel of this device */
|
|
Packit Service |
a1bd4f |
for (i = 0; subchans[i]; i++) {
|
|
Packit Service |
a1bd4f |
const char *candidate = subchans[i];
|
|
Packit Service |
a1bd4f |
gboolean found = FALSE;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
for (j = 0; priv->s390_subchannels[j]; j++) {
|
|
Packit Service |
a1bd4f |
if (!g_strcmp0(priv->s390_subchannels[j], candidate))
|
|
Packit Service |
a1bd4f |
found = TRUE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
if (!found)
|
|
Packit Service |
a1bd4f |
return FALSE; /* a subchannel was not found */
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
*try_mac = FALSE;
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
connection_compatible(NMDevice *device, NMConnection *connection, GError **error)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMSettingWired *s_wired;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
if (!NM_DEVICE_CLASS(nm_device_ethernet_parent_class)
|
|
Packit Service |
a1bd4f |
->connection_compatible(device, connection, error))
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
if (nm_connection_is_type(connection, NM_SETTING_PPPOE_SETTING_NAME)
|
|
Packit Service |
a1bd4f |
|| nm_connection_is_type(connection, NM_SETTING_WIRED_SETTING_NAME)
|
|
Packit Service |
a1bd4f |
|| (nm_connection_is_type(connection, NM_SETTING_VETH_SETTING_NAME)
|
|
Packit Service |
a1bd4f |
&& NM_IS_DEVICE_VETH(device))) {
|
|
Packit Service |
a1bd4f |
/* NOP */
|
|
Packit Service |
a1bd4f |
} else {
|
|
Packit Service |
a1bd4f |
g_set_error_literal(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
|
Packit Service |
a1bd4f |
_("The connection was not an Ethernet or PPPoE connection."));
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
s_wired = nm_connection_get_setting_wired(connection);
|
|
Packit Service |
a1bd4f |
/* Wired setting optional for PPPoE */
|
|
Packit Service |
a1bd4f |
if (s_wired) {
|
|
Packit Service |
a1bd4f |
const char * perm_addr, *s_mac;
|
|
Packit Service |
a1bd4f |
gboolean try_mac = TRUE;
|
|
Packit Service |
a1bd4f |
const char *const *mac_blacklist;
|
|
Packit Service |
a1bd4f |
int i;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Check s390 subchannels */
|
|
Packit Service |
a1bd4f |
if (!match_subchans(NM_DEVICE_ETHERNET(device), s_wired, &try_mac)) {
|
|
Packit Service |
a1bd4f |
g_set_error_literal(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
|
Packit Service |
a1bd4f |
_("The connection and device differ in S390 subchannels."));
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Check MAC address */
|
|
Packit Service |
a1bd4f |
perm_addr = nm_device_ethernet_get_permanent_hw_address(NM_DEVICE_ETHERNET(device));
|
|
Packit Service |
a1bd4f |
s_mac = nm_setting_wired_get_mac_address(s_wired);
|
|
Packit Service |
a1bd4f |
if (perm_addr) {
|
|
Packit Service |
a1bd4f |
/* Virtual devices will have empty permanent addr but they should not be excluded
|
|
Packit Service |
a1bd4f |
* from the MAC address check specified in the connection */
|
|
Packit Service |
a1bd4f |
if (*perm_addr == 0)
|
|
Packit Service |
a1bd4f |
perm_addr = nm_device_get_hw_address(NM_DEVICE(device));
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
if (!nm_utils_hwaddr_valid(perm_addr, ETH_ALEN)) {
|
|
Packit Service |
a1bd4f |
g_set_error(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_FAILED,
|
|
Packit Service |
a1bd4f |
_("Invalid device MAC address %s."),
|
|
Packit Service |
a1bd4f |
perm_addr);
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
if (try_mac && s_mac && !nm_utils_hwaddr_matches(s_mac, -1, perm_addr, -1)) {
|
|
Packit Service |
a1bd4f |
g_set_error_literal(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
|
Packit Service |
a1bd4f |
_("The MACs of the device and the connection do not match."));
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* Check for MAC address blacklist */
|
|
Packit Service |
a1bd4f |
mac_blacklist = nm_setting_wired_get_mac_address_blacklist(s_wired);
|
|
Packit Service |
a1bd4f |
for (i = 0; mac_blacklist[i]; i++) {
|
|
Packit Service |
a1bd4f |
if (!nm_utils_hwaddr_valid(mac_blacklist[i], ETH_ALEN)) {
|
|
Packit Service |
a1bd4f |
g_warn_if_reached();
|
|
Packit Service |
a1bd4f |
g_set_error(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
|
Packit Service |
a1bd4f |
_("Invalid MAC in the blacklist: %s."),
|
|
Packit Service |
a1bd4f |
mac_blacklist[i]);
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
if (nm_utils_hwaddr_matches(mac_blacklist[i], -1, perm_addr, -1)) {
|
|
Packit Service |
a1bd4f |
g_set_error(error,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR,
|
|
Packit Service |
a1bd4f |
NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
|
|
Packit Service |
a1bd4f |
_("Device MAC (%s) is blacklisted by the connection."),
|
|
Packit Service |
a1bd4f |
perm_addr);
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static GType
|
|
Packit Service |
a1bd4f |
get_setting_type(NMDevice *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return NM_TYPE_SETTING_WIRED;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/*****************************************************************************/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_init(NMDeviceEthernet *device)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate *priv;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
priv = G_TYPE_INSTANCE_GET_PRIVATE(device, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
device->_priv = priv;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
finalize(GObject *object)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(object);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
g_free(priv->perm_hw_address);
|
|
Packit Service |
a1bd4f |
g_strfreev(priv->s390_subchannels);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
G_OBJECT_CLASS(nm_device_ethernet_parent_class)->finalize(object);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMDeviceEthernet * device = NM_DEVICE_ETHERNET(object);
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE(device);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
switch (prop_id) {
|
|
Packit Service |
a1bd4f |
case PROP_PERM_HW_ADDRESS:
|
|
Packit Service |
a1bd4f |
g_value_set_string(value, nm_device_ethernet_get_permanent_hw_address(device));
|
|
Packit Service |
a1bd4f |
break;
|
|
Packit Service |
a1bd4f |
case PROP_SPEED:
|
|
Packit Service |
a1bd4f |
g_value_set_uint(value, nm_device_ethernet_get_speed(device));
|
|
Packit Service |
a1bd4f |
break;
|
|
Packit Service |
a1bd4f |
case PROP_CARRIER:
|
|
Packit Service |
a1bd4f |
g_value_set_boolean(value, nm_device_ethernet_get_carrier(device));
|
|
Packit Service |
a1bd4f |
break;
|
|
Packit Service |
a1bd4f |
case PROP_S390_SUBCHANNELS:
|
|
Packit Service |
a1bd4f |
g_value_set_boxed(value, priv->s390_subchannels);
|
|
Packit Service |
a1bd4f |
break;
|
|
Packit Service |
a1bd4f |
default:
|
|
Packit Service |
a1bd4f |
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
|
Packit Service |
a1bd4f |
break;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wired = NML_DBUS_META_IFACE_INIT_PROP(
|
|
Packit Service |
a1bd4f |
NM_DBUS_INTERFACE_DEVICE_WIRED,
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_get_type,
|
|
Packit Service |
d0b836 |
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_20,
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_IFACE_DBUS_PROPERTIES(
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT_B("Carrier", PROP_CARRIER, NMDeviceEthernetPrivate, carrier),
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT_FCN("HwAddress",
|
|
Packit Service |
a1bd4f |
0,
|
|
Packit Service |
a1bd4f |
"s",
|
|
Packit Service |
a1bd4f |
_nm_device_notify_update_prop_hw_address),
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT_S("PermHwAddress",
|
|
Packit Service |
a1bd4f |
PROP_PERM_HW_ADDRESS,
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate,
|
|
Packit Service |
a1bd4f |
perm_hw_address),
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT_AS("S390Subchannels",
|
|
Packit Service |
a1bd4f |
PROP_S390_SUBCHANNELS,
|
|
Packit Service |
a1bd4f |
NMDeviceEthernetPrivate,
|
|
Packit Service |
a1bd4f |
s390_subchannels),
|
|
Packit Service |
a1bd4f |
NML_DBUS_META_PROPERTY_INIT_U("Speed", PROP_SPEED, NMDeviceEthernetPrivate, speed), ),
|
|
Packit Service |
a1bd4f |
.base_struct_offset = G_STRUCT_OFFSET(NMDeviceEthernet, _priv), );
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nm_device_ethernet_class_init(NMDeviceEthernetClass *klass)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
GObjectClass * object_class = G_OBJECT_CLASS(klass);
|
|
Packit Service |
a1bd4f |
NMDeviceClass *device_class = NM_DEVICE_CLASS(klass);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
g_type_class_add_private(klass, sizeof(NMDeviceEthernetPrivate));
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
object_class->get_property = get_property;
|
|
Packit Service |
a1bd4f |
object_class->finalize = finalize;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
device_class->connection_compatible = connection_compatible;
|
|
Packit Service |
a1bd4f |
device_class->get_setting_type = get_setting_type;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/**
|
|
Packit Service |
a1bd4f |
* NMDeviceEthernet:perm-hw-address:
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* The permanent hardware (MAC) address of the device.
|
|
Packit Service |
a1bd4f |
**/
|
|
Packit Service |
a1bd4f |
obj_properties[PROP_PERM_HW_ADDRESS] =
|
|
Packit Service |
a1bd4f |
g_param_spec_string(NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS,
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
NULL,
|
|
Packit Service |
a1bd4f |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/**
|
|
Packit Service |
a1bd4f |
* NMDeviceEthernet:speed:
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* The speed of the device.
|
|
Packit Service |
a1bd4f |
**/
|
|
Packit Service |
a1bd4f |
obj_properties[PROP_SPEED] = g_param_spec_uint(NM_DEVICE_ETHERNET_SPEED,
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
0,
|
|
Packit Service |
a1bd4f |
G_MAXUINT32,
|
|
Packit Service |
a1bd4f |
0,
|
|
Packit Service |
a1bd4f |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/**
|
|
Packit Service |
a1bd4f |
* NMDeviceEthernet:carrier:
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Whether the device has carrier.
|
|
Packit Service |
a1bd4f |
**/
|
|
Packit Service |
a1bd4f |
obj_properties[PROP_CARRIER] = g_param_spec_boolean(NM_DEVICE_ETHERNET_CARRIER,
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
FALSE,
|
|
Packit Service |
a1bd4f |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/**
|
|
Packit Service |
a1bd4f |
* NMDeviceEthernet:s390-subchannels:
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Identifies subchannels of this network device used for
|
|
Packit Service |
a1bd4f |
* communication with z/VM or s390 host.
|
|
Packit Service |
a1bd4f |
*
|
|
Packit Service |
a1bd4f |
* Since: 1.2
|
|
Packit Service |
a1bd4f |
**/
|
|
Packit Service |
a1bd4f |
obj_properties[PROP_S390_SUBCHANNELS] =
|
|
Packit Service |
a1bd4f |
g_param_spec_boxed(NM_DEVICE_ETHERNET_S390_SUBCHANNELS,
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
"",
|
|
Packit Service |
a1bd4f |
G_TYPE_STRV,
|
|
Packit Service |
a1bd4f |
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
_nml_dbus_meta_class_init_with_properties(object_class, &_nml_dbus_meta_iface_nm_device_wired);
|
|
Packit |
5756e2 |
}
|