Blame src/libnm-core-impl/nm-setting-wired.c

Packit Service dff8e4
/* SPDX-License-Identifier: LGPL-2.1-or-later */
Packit Service dff8e4
/*
Packit Service dff8e4
 * Copyright (C) 2007 - 2014 Red Hat, Inc.
Packit Service dff8e4
 * Copyright (C) 2007 - 2008 Novell, Inc.
Packit Service dff8e4
 */
Packit Service dff8e4
Packit Service dff8e4
#include "libnm-core-impl/nm-default-libnm-core.h"
Packit Service dff8e4
Packit Service dff8e4
#include "nm-setting-wired.h"
Packit Service dff8e4
Packit Service dff8e4
#include <net/ethernet.h>
Packit Service dff8e4
Packit Service dff8e4
#include "nm-utils.h"
Packit Service dff8e4
#include "libnm-core-aux-intern/nm-common-macros.h"
Packit Service dff8e4
#include "nm-utils-private.h"
Packit Service dff8e4
#include "nm-setting-private.h"
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * SECTION:nm-setting-wired
Packit Service dff8e4
 * @short_description: Describes connection properties for Ethernet-based networks
Packit Service dff8e4
 *
Packit Service dff8e4
 * The #NMSettingWired object is a #NMSetting subclass that describes properties
Packit Service dff8e4
 * necessary for connection to Ethernet networks.
Packit Service dff8e4
 **/
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
G_STATIC_ASSERT(NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS
Packit Service dff8e4
                == (NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT | NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE));
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
NM_GOBJECT_PROPERTIES_DEFINE(NMSettingWired,
Packit Service dff8e4
                             PROP_PORT,
Packit Service dff8e4
                             PROP_SPEED,
Packit Service dff8e4
                             PROP_DUPLEX,
Packit Service dff8e4
                             PROP_AUTO_NEGOTIATE,
Packit Service dff8e4
                             PROP_MAC_ADDRESS,
Packit Service dff8e4
                             PROP_CLONED_MAC_ADDRESS,
Packit Service dff8e4
                             PROP_GENERATE_MAC_ADDRESS_MASK,
Packit Service dff8e4
                             PROP_MAC_ADDRESS_BLACKLIST,
Packit Service dff8e4
                             PROP_MTU,
Packit Service dff8e4
                             PROP_S390_SUBCHANNELS,
Packit Service dff8e4
                             PROP_S390_NETTYPE,
Packit Service dff8e4
                             PROP_S390_OPTIONS,
Packit Service dff8e4
                             PROP_WAKE_ON_LAN,
Packit Service dff8e4
                             PROP_WAKE_ON_LAN_PASSWORD, );
Packit Service dff8e4
Packit Service dff8e4
typedef struct {
Packit Service dff8e4
    struct {
Packit Service dff8e4
        NMUtilsNamedValue *arr;
Packit Service dff8e4
        guint              len;
Packit Service dff8e4
        guint              n_alloc;
Packit Service dff8e4
    } s390_options;
Packit Service dff8e4
    GArray *                mac_address_blacklist;
Packit Service dff8e4
    char **                 s390_subchannels;
Packit Service dff8e4
    char *                  port;
Packit Service dff8e4
    char *                  duplex;
Packit Service dff8e4
    char *                  device_mac_address;
Packit Service dff8e4
    char *                  cloned_mac_address;
Packit Service dff8e4
    char *                  generate_mac_address_mask;
Packit Service dff8e4
    char *                  s390_nettype;
Packit Service dff8e4
    char *                  wol_password;
Packit Service dff8e4
    NMSettingWiredWakeOnLan wol;
Packit Service dff8e4
    guint32                 speed;
Packit Service dff8e4
    guint32                 mtu;
Packit Service dff8e4
    bool                    auto_negotiate : 1;
Packit Service dff8e4
} NMSettingWiredPrivate;
Packit Service dff8e4
Packit Service dff8e4
G_DEFINE_TYPE(NMSettingWired, nm_setting_wired, NM_TYPE_SETTING)
Packit Service dff8e4
Packit Service dff8e4
#define NM_SETTING_WIRED_GET_PRIVATE(o) \
Packit Service dff8e4
    (G_TYPE_INSTANCE_GET_PRIVATE((o), NM_TYPE_SETTING_WIRED, NMSettingWiredPrivate))
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
static const char *const valid_s390_opts[] = {
Packit Service dff8e4
    "bridge_role",
Packit Service dff8e4
    "broadcast_mode",
Packit Service dff8e4
    "buffer_count",
Packit Service dff8e4
    "canonical_macaddr",
Packit Service dff8e4
    "checksumming",
Packit Service dff8e4
    "ctcprot",
Packit Service dff8e4
    "fake_broadcast",
Packit Service dff8e4
    "inter",
Packit Service dff8e4
    "inter_jumbo",
Packit Service dff8e4
    "ipato_add4",
Packit Service dff8e4
    "ipato_add6",
Packit Service dff8e4
    "ipato_enable",
Packit Service dff8e4
    "ipato_invert4",
Packit Service dff8e4
    "ipato_invert6",
Packit Service dff8e4
    "isolation",
Packit Service dff8e4
    "lancmd_timeout",
Packit Service dff8e4
    "large_send",
Packit Service dff8e4
    "layer2",
Packit Service dff8e4
    "portname",
Packit Service dff8e4
    "portno",
Packit Service dff8e4
    "priority_queueing",
Packit Service dff8e4
    "protocol",
Packit Service dff8e4
    "route4",
Packit Service dff8e4
    "route6",
Packit Service dff8e4
    "rxip_add4",
Packit Service dff8e4
    "rxip_add6",
Packit Service dff8e4
    "sniffer",
Packit Service dff8e4
    "total",
Packit Service dff8e4
    "vipa_add4",
Packit Service dff8e4
    "vipa_add6",
Packit Service dff8e4
    NULL,
Packit Service dff8e4
};
Packit Service dff8e4
Packit Service dff8e4
gboolean
Packit Service dff8e4
_nm_setting_wired_is_valid_s390_option(const char *option)
Packit Service dff8e4
{
Packit Service dff8e4
    if (NM_MORE_ASSERT_ONCE(10)) {
Packit Service dff8e4
        gsize i;
Packit Service dff8e4
Packit Service dff8e4
        nm_assert(NM_PTRARRAY_LEN(valid_s390_opts) + 1u == G_N_ELEMENTS(valid_s390_opts));
Packit Service dff8e4
Packit Service dff8e4
        for (i = 0; i < G_N_ELEMENTS(valid_s390_opts); i++) {
Packit Service dff8e4
            if (i == G_N_ELEMENTS(valid_s390_opts) - 1u)
Packit Service dff8e4
                nm_assert(!valid_s390_opts[i]);
Packit Service dff8e4
            else {
Packit Service dff8e4
                nm_assert(valid_s390_opts[i]);
Packit Service dff8e4
                nm_assert(valid_s390_opts[i][0] != '\0');
Packit Service dff8e4
                if (i > 0)
Packit Service dff8e4
                    nm_assert(strcmp(valid_s390_opts[i - 1], valid_s390_opts[i]) < 0);
Packit Service dff8e4
            }
Packit Service dff8e4
        }
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    return option
Packit Service dff8e4
           && (nm_utils_strv_find_binary_search(valid_s390_opts,
Packit Service dff8e4
                                                G_N_ELEMENTS(valid_s390_opts) - 1,
Packit Service dff8e4
                                                option)
Packit Service dff8e4
               >= 0);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
gboolean
Packit Service dff8e4
_nm_setting_wired_is_valid_s390_option_value(const char *name, const char *option)
Packit Service dff8e4
{
Packit Service dff8e4
    nm_assert(name);
Packit Service dff8e4
Packit Service dff8e4
    if (!option)
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
Packit Service dff8e4
    /* For historic reasons, the s390-options values were not validated beyond
Packit Service dff8e4
     * simple length check (below).
Packit Service dff8e4
     *
Packit Service dff8e4
     * Here, for certain (recently added) options we add strict validation.
Packit Service dff8e4
     * As this is only done for a few hand picked options, do it right here.
Packit Service dff8e4
     *
Packit Service dff8e4
     * Maybe we should find a backward compatible way to validate all options.
Packit Service dff8e4
     * In that case, the validation should become more elaborate, like we do
Packit Service dff8e4
     * for bond options. */
Packit Service dff8e4
Packit Service dff8e4
    if (nm_streq(name, "bridge_role")) {
Packit Service dff8e4
        return NM_IN_STRSET(option, "primary", "secondary", "none");
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    return option[0] != '\0' && strlen(option) <= NM_SETTING_WIRED_S390_OPTION_MAX_LEN;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_port:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:port property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_port(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->port;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_speed:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:speed property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
guint32
Packit Service dff8e4
nm_setting_wired_get_speed(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->speed;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_duplex:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:duplex property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_duplex(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->duplex;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_auto_negotiate:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:auto-negotiate property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_get_auto_negotiate(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->auto_negotiate;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_mac_address:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:mac-address property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_mac_address(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->device_mac_address;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_cloned_mac_address:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:cloned-mac-address property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_cloned_mac_address(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->cloned_mac_address;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_generate_mac_address_mask:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:generate-mac-address-mask property of the setting
Packit Service dff8e4
 *
Packit Service dff8e4
 * Since: 1.4
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_generate_mac_address_mask(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->generate_mac_address_mask;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_mac_address_blacklist:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:mac-address-blacklist property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *const *
Packit Service dff8e4
nm_setting_wired_get_mac_address_blacklist(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    return (const char *const *) priv->mac_address_blacklist->data;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_num_mac_blacklist_items:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the number of blacklisted MAC addresses
Packit Service dff8e4
 **/
Packit Service dff8e4
guint32
Packit Service dff8e4
nm_setting_wired_get_num_mac_blacklist_items(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->mac_address_blacklist->len;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_mac_blacklist_item:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @idx: the zero-based index of the MAC address entry
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the blacklisted MAC address string (hex-digits-and-colons notation)
Packit Service dff8e4
 * at index @idx
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_mac_blacklist_item(NMSettingWired *setting, guint32 idx)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    g_return_val_if_fail(idx <= priv->mac_address_blacklist->len, NULL);
Packit Service dff8e4
Packit Service dff8e4
    return g_array_index(priv->mac_address_blacklist, const char *, idx);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_add_mac_blacklist_item:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @mac: the MAC address string (hex-digits-and-colons notation) to blacklist
Packit Service dff8e4
 *
Packit Service dff8e4
 * Adds a new MAC address to the #NMSettingWired:mac-address-blacklist property.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: %TRUE if the MAC address was added; %FALSE if the MAC address
Packit Service dff8e4
 * is invalid or was already present
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_add_mac_blacklist_item(NMSettingWired *setting, const char *mac)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
    const char *           candidate;
Packit Service dff8e4
    int                    i;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
    g_return_val_if_fail(mac != NULL, FALSE);
Packit Service dff8e4
Packit Service dff8e4
    if (!nm_utils_hwaddr_valid(mac, ETH_ALEN))
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    for (i = 0; i < priv->mac_address_blacklist->len; i++) {
Packit Service dff8e4
        candidate = g_array_index(priv->mac_address_blacklist, char *, i);
Packit Service dff8e4
        if (nm_utils_hwaddr_matches(mac, -1, candidate, -1))
Packit Service dff8e4
            return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    mac = nm_utils_hwaddr_canonical(mac, ETH_ALEN);
Packit Service dff8e4
    g_array_append_val(priv->mac_address_blacklist, mac);
Packit Service dff8e4
    _notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
Packit Service dff8e4
    return TRUE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_remove_mac_blacklist_item:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @idx: index number of the MAC address
Packit Service dff8e4
 *
Packit Service dff8e4
 * Removes the MAC address at index @idx from the blacklist.
Packit Service dff8e4
 **/
Packit Service dff8e4
void
Packit Service dff8e4
nm_setting_wired_remove_mac_blacklist_item(NMSettingWired *setting, guint32 idx)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
Packit Service dff8e4
    g_return_if_fail(NM_IS_SETTING_WIRED(setting));
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    g_return_if_fail(idx < priv->mac_address_blacklist->len);
Packit Service dff8e4
Packit Service dff8e4
    g_array_remove_index(priv->mac_address_blacklist, idx);
Packit Service dff8e4
    _notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_remove_mac_blacklist_item_by_value:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @mac: the MAC address string (hex-digits-and-colons notation) to remove from
Packit Service dff8e4
 * the blacklist
Packit Service dff8e4
 *
Packit Service dff8e4
 * Removes the MAC address @mac from the blacklist.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: %TRUE if the MAC address was found and removed; %FALSE if it was not.
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_remove_mac_blacklist_item_by_value(NMSettingWired *setting, const char *mac)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
    const char *           candidate;
Packit Service dff8e4
    int                    i;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
    g_return_val_if_fail(mac != NULL, FALSE);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    for (i = 0; i < priv->mac_address_blacklist->len; i++) {
Packit Service dff8e4
        candidate = g_array_index(priv->mac_address_blacklist, char *, i);
Packit Service dff8e4
        if (!nm_utils_hwaddr_matches(mac, -1, candidate, -1)) {
Packit Service dff8e4
            g_array_remove_index(priv->mac_address_blacklist, i);
Packit Service dff8e4
            _notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
Packit Service dff8e4
            return TRUE;
Packit Service dff8e4
        }
Packit Service dff8e4
    }
Packit Service dff8e4
    return FALSE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_clear_mac_blacklist_items:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Removes all blacklisted MAC addresses.
Packit Service dff8e4
 **/
Packit Service dff8e4
void
Packit Service dff8e4
nm_setting_wired_clear_mac_blacklist_items(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_if_fail(NM_IS_SETTING_WIRED(setting));
Packit Service dff8e4
Packit Service dff8e4
    g_array_set_size(NM_SETTING_WIRED_GET_PRIVATE(setting)->mac_address_blacklist, 0);
Packit Service dff8e4
    _notify(setting, PROP_MAC_ADDRESS_BLACKLIST);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_mtu:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the #NMSettingWired:mtu property of the setting
Packit Service dff8e4
 **/
Packit Service dff8e4
guint32
Packit Service dff8e4
nm_setting_wired_get_mtu(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->mtu;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_s390_subchannels:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Return the list of s390 subchannels that identify the device that this
Packit Service dff8e4
 * connection is applicable to.  The connection should only be used in
Packit Service dff8e4
 * conjunction with that device.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: (transfer none) (element-type utf8): array of strings, each specifying
Packit Service dff8e4
 *   one subchannel the s390 device uses to communicate to the host.
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *const *
Packit Service dff8e4
nm_setting_wired_get_s390_subchannels(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return (const char *const *) NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_subchannels;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_s390_nettype:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns the s390 device type this connection should apply to.  Will be one
Packit Service dff8e4
 * of 'qeth', 'lcs', or 'ctc'.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the s390 device type
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_s390_nettype(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_nettype;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_num_s390_options:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns the number of s390-specific options that should be set for this
Packit Service dff8e4
 * device when it is activated.  This can be used to retrieve each s390
Packit Service dff8e4
 * option individually using nm_setting_wired_get_s390_option().
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the number of s390-specific device options
Packit Service dff8e4
 **/
Packit Service dff8e4
guint32
Packit Service dff8e4
nm_setting_wired_get_num_s390_options(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), 0);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->s390_options.len;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_s390_option:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @idx: index of the desired option, from 0 to
Packit Service dff8e4
 * nm_setting_wired_get_num_s390_options() - 1
Packit Service dff8e4
 * @out_key: (allow-none) (out) (transfer none): on return, the key name of the s390 specific
Packit Service dff8e4
 *   option; this value is owned by the setting and should not be modified
Packit Service dff8e4
 * @out_value: (allow-none) (out) (transfer none): on return, the value of the key of the
Packit Service dff8e4
 *   s390 specific option; this value is owned by the setting and should not be
Packit Service dff8e4
 *   modified
Packit Service dff8e4
 *
Packit Service dff8e4
 * Given an index, return the value of the s390 option at that index.  indexes
Packit Service dff8e4
 * are *not* guaranteed to be static across modifications to options done by
Packit Service dff8e4
 * nm_setting_wired_add_s390_option() and nm_setting_wired_remove_s390_option(),
Packit Service dff8e4
 * and should not be used to refer to options except for short periods of time
Packit Service dff8e4
 * such as during option iteration.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: %TRUE on success if the index was valid and an option was found,
Packit Service dff8e4
 * %FALSE if the index was invalid (ie, greater than the number of options
Packit Service dff8e4
 * currently held by the setting)
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_get_s390_option(NMSettingWired *setting,
Packit Service dff8e4
                                 guint32         idx,
Packit Service dff8e4
                                 const char **   out_key,
Packit Service dff8e4
                                 const char **   out_value)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
Packit Service dff8e4
    /* with LTO and optimization, the compiler complains that the
Packit Service dff8e4
     * output variables are not initialized. In practice, the function
Packit Service dff8e4
     * only sets the output on success. But make the compiler happy.
Packit Service dff8e4
     */
Packit Service dff8e4
    NM_SET_OUT(out_key, NULL);
Packit Service dff8e4
    NM_SET_OUT(out_value, NULL);
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(idx < priv->s390_options.len, FALSE);
Packit Service dff8e4
Packit Service dff8e4
    NM_SET_OUT(out_key, priv->s390_options.arr[idx].name);
Packit Service dff8e4
    NM_SET_OUT(out_value, priv->s390_options.arr[idx].value_str);
Packit Service dff8e4
    return TRUE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_s390_option_by_key:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @key: the key for which to retrieve the value
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns the value associated with the s390-specific option specified by
Packit Service dff8e4
 * @key, if it exists.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the value, or %NULL if the key/value pair was never added to the
Packit Service dff8e4
 * setting; the value is owned by the setting and must not be modified
Packit Service dff8e4
 **/
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_s390_option_by_key(NMSettingWired *setting, const char *key)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
    gssize                 idx;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
    g_return_val_if_fail(key, NULL);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
Packit Service dff8e4
    idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
Packit Service dff8e4
    if (idx < 0)
Packit Service dff8e4
        return NULL;
Packit Service dff8e4
    return priv->s390_options.arr[idx].value_str;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_add_s390_option:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @key: key name for the option
Packit Service dff8e4
 * @value: value for the option
Packit Service dff8e4
 *
Packit Service dff8e4
 * Add an option to the table. If the key already exists, the value gets
Packit Service dff8e4
 * replaced.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Before 1.32, the function would assert that the key is valid. Since then,
Packit Service dff8e4
 * an invalid key gets silently added but renders the profile as invalid.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: since 1.32 this always returns %TRUE.
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_add_s390_option(NMSettingWired *setting, const char *key, const char *value)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
    gssize                 idx;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
    g_return_val_if_fail(key, FALSE);
Packit Service dff8e4
    g_return_val_if_fail(value, FALSE);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
Packit Service dff8e4
    idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
Packit Service dff8e4
    if (idx < 0) {
Packit Service dff8e4
        gsize dst_idx = ~idx;
Packit Service dff8e4
Packit Service dff8e4
        g_return_val_if_fail(priv->s390_options.len < G_MAXUINT32 - 1u, FALSE);
Packit Service dff8e4
Packit Service dff8e4
        if (priv->s390_options.n_alloc < ((gsize) priv->s390_options.len) + 1u) {
Packit Service dff8e4
            priv->s390_options.n_alloc = NM_MAX(4u, (((gsize) priv->s390_options.len) + 1u) * 2u);
Packit Service dff8e4
            priv->s390_options.arr =
Packit Service dff8e4
                g_realloc(priv->s390_options.arr,
Packit Service dff8e4
                          priv->s390_options.n_alloc * sizeof(NMUtilsNamedValue));
Packit Service dff8e4
        }
Packit Service dff8e4
        if (dst_idx < priv->s390_options.len) {
Packit Service dff8e4
            memmove(&priv->s390_options.arr[dst_idx + 1u],
Packit Service dff8e4
                    &priv->s390_options.arr[dst_idx],
Packit Service dff8e4
                    (priv->s390_options.len - dst_idx) * sizeof(NMUtilsNamedValue));
Packit Service dff8e4
        }
Packit Service dff8e4
        priv->s390_options.arr[dst_idx] = (NMUtilsNamedValue){
Packit Service dff8e4
            .name      = g_strdup(key),
Packit Service dff8e4
            .value_str = g_strdup(value),
Packit Service dff8e4
        };
Packit Service dff8e4
        priv->s390_options.len++;
Packit Service dff8e4
    } else {
Packit Service dff8e4
        if (!nm_utils_strdup_reset(&priv->s390_options.arr[idx].value_str_mutable, value))
Packit Service dff8e4
            return TRUE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    _notify(setting, PROP_S390_OPTIONS);
Packit Service dff8e4
    return TRUE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_remove_s390_option:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 * @key: key name for the option to remove
Packit Service dff8e4
 *
Packit Service dff8e4
 * Remove the s390-specific option referenced by @key from the internal option
Packit Service dff8e4
 * list.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: %TRUE if the option was found and removed from the internal option
Packit Service dff8e4
 * list, %FALSE if it was not.
Packit Service dff8e4
 **/
Packit Service dff8e4
gboolean
Packit Service dff8e4
nm_setting_wired_remove_s390_option(NMSettingWired *setting, const char *key)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv;
Packit Service dff8e4
    gsize                  dst_idx;
Packit Service dff8e4
    gssize                 idx;
Packit Service dff8e4
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), FALSE);
Packit Service dff8e4
    g_return_val_if_fail(key, FALSE);
Packit Service dff8e4
Packit Service dff8e4
    priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
Packit Service dff8e4
    idx = nm_utils_named_value_list_find(priv->s390_options.arr, priv->s390_options.len, key, TRUE);
Packit Service dff8e4
    if (idx < 0)
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
Packit Service dff8e4
    dst_idx = idx;
Packit Service dff8e4
Packit Service dff8e4
    g_free((char *) priv->s390_options.arr[dst_idx].name);
Packit Service dff8e4
    g_free((char *) priv->s390_options.arr[dst_idx].value_str);
Packit Service dff8e4
    if (dst_idx + 1u != priv->s390_options.len) {
Packit Service dff8e4
        memmove(&priv->s390_options.arr[dst_idx],
Packit Service dff8e4
                &priv->s390_options.arr[dst_idx + 1u],
Packit Service dff8e4
                (priv->s390_options.len - dst_idx - 1u) * sizeof(NMUtilsNamedValue));
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    priv->s390_options.len--;
Packit Service dff8e4
Packit Service dff8e4
    _notify(setting, PROP_S390_OPTIONS);
Packit Service dff8e4
    return TRUE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
_s390_options_clear(NMSettingWiredPrivate *priv)
Packit Service dff8e4
{
Packit Service dff8e4
    guint i;
Packit Service dff8e4
Packit Service dff8e4
    for (i = 0; i < priv->s390_options.len; i++) {
Packit Service dff8e4
        g_free((char *) priv->s390_options.arr[i].name);
Packit Service dff8e4
        g_free((char *) priv->s390_options.arr[i].value_str);
Packit Service dff8e4
    }
Packit Service dff8e4
    nm_clear_g_free(&priv->s390_options.arr);
Packit Service dff8e4
    priv->s390_options.len     = 0;
Packit Service dff8e4
    priv->s390_options.n_alloc = 0;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
void
Packit Service dff8e4
_nm_setting_wired_clear_s390_options(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_if_fail(NM_IS_SETTING_WIRED(setting));
Packit Service dff8e4
Packit Service dff8e4
    _s390_options_clear(NM_SETTING_WIRED_GET_PRIVATE(setting));
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_valid_s390_options:
Packit Service dff8e4
 * @setting: (allow-none): the #NMSettingWired. This argument is unused
Packit Service dff8e4
 *   and you may pass %NULL.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns a list of valid s390 options.
Packit Service dff8e4
 *
Packit Service dff8e4
 * The @setting argument is unused and %NULL may be passed instead.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: (transfer none): a %NULL-terminated array of strings of valid s390 options.
Packit Service dff8e4
 **/
Packit Service dff8e4
const char **
Packit Service dff8e4
nm_setting_wired_get_valid_s390_options(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    return (const char **) valid_s390_opts;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_wake_on_lan:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns the Wake-on-LAN options enabled for the connection
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the Wake-on-LAN options
Packit Service dff8e4
 *
Packit Service dff8e4
 * Since: 1.2
Packit Service dff8e4
 */
Packit Service dff8e4
NMSettingWiredWakeOnLan
Packit Service dff8e4
nm_setting_wired_get_wake_on_lan(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NM_SETTING_WIRED_WAKE_ON_LAN_NONE);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->wol;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_get_wake_on_lan_password:
Packit Service dff8e4
 * @setting: the #NMSettingWired
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns the Wake-on-LAN password. This only applies to
Packit Service dff8e4
 * %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: the Wake-on-LAN setting password, or %NULL if there is no password.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Since: 1.2
Packit Service dff8e4
 */
Packit Service dff8e4
const char *
Packit Service dff8e4
nm_setting_wired_get_wake_on_lan_password(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    g_return_val_if_fail(NM_IS_SETTING_WIRED(setting), NULL);
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_WIRED_GET_PRIVATE(setting)->wol_password;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static gboolean
Packit Service dff8e4
verify(NMSetting *setting, NMConnection *connection, GError **error)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv  = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    GError *               local = NULL;
Packit Service dff8e4
    guint                  i;
Packit Service dff8e4
Packit Service dff8e4
    if (!NM_IN_STRSET(priv->port, NULL, "tp", "aui", "bnc", "mii")) {
Packit Service dff8e4
        g_set_error(error,
Packit Service dff8e4
                    NM_CONNECTION_ERROR,
Packit Service dff8e4
                    NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                    _("'%s' is not a valid Ethernet port value"),
Packit Service dff8e4
                    priv->port);
Packit Service dff8e4
        g_prefix_error(error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_PORT);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (!NM_IN_STRSET(priv->duplex, NULL, "half", "full")) {
Packit Service dff8e4
        g_set_error(error,
Packit Service dff8e4
                    NM_CONNECTION_ERROR,
Packit Service dff8e4
                    NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                    _("'%s' is not a valid duplex value"),
Packit Service dff8e4
                    priv->duplex);
Packit Service dff8e4
        g_prefix_error(error, "%s.%s: ", NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_WIRED_DUPLEX);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (priv->device_mac_address && !nm_utils_hwaddr_valid(priv->device_mac_address, ETH_ALEN)) {
Packit Service dff8e4
        g_set_error(error,
Packit Service dff8e4
                    NM_CONNECTION_ERROR,
Packit Service dff8e4
                    NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                    _("'%s' is not a valid MAC address"),
Packit Service dff8e4
                    priv->device_mac_address);
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_MAC_ADDRESS);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    for (i = 0; i < priv->mac_address_blacklist->len; i++) {
Packit Service dff8e4
        const char *mac = g_array_index(priv->mac_address_blacklist, const char *, i);
Packit Service dff8e4
Packit Service dff8e4
        if (!nm_utils_hwaddr_valid(mac, ETH_ALEN)) {
Packit Service dff8e4
            g_set_error(error,
Packit Service dff8e4
                        NM_CONNECTION_ERROR,
Packit Service dff8e4
                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                        _("'%s' is not a valid MAC address"),
Packit Service dff8e4
                        mac);
Packit Service dff8e4
            g_prefix_error(error,
Packit Service dff8e4
                           "%s.%s: ",
Packit Service dff8e4
                           NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                           NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST);
Packit Service dff8e4
            return FALSE;
Packit Service dff8e4
        }
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (priv->s390_subchannels) {
Packit Service dff8e4
        guint len = g_strv_length(priv->s390_subchannels);
Packit Service dff8e4
Packit Service dff8e4
        if (len != 2 && len != 3) {
Packit Service dff8e4
            g_set_error_literal(error,
Packit Service dff8e4
                                NM_CONNECTION_ERROR,
Packit Service dff8e4
                                NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                                _("property is invalid"));
Packit Service dff8e4
            g_prefix_error(error,
Packit Service dff8e4
                           "%s.%s: ",
Packit Service dff8e4
                           NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                           NM_SETTING_WIRED_S390_SUBCHANNELS);
Packit Service dff8e4
            return FALSE;
Packit Service dff8e4
        }
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (!NM_IN_STRSET(priv->s390_nettype, NULL, "qeth", "lcs", "ctc")) {
Packit Service dff8e4
        g_set_error_literal(error,
Packit Service dff8e4
                            NM_CONNECTION_ERROR,
Packit Service dff8e4
                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                            _("property is invalid"));
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_S390_NETTYPE);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    for (i = 0; i < priv->s390_options.len; i++) {
Packit Service dff8e4
        const NMUtilsNamedValue *v = &priv->s390_options.arr[i];
Packit Service dff8e4
Packit Service dff8e4
        nm_assert(v->name);
Packit Service dff8e4
Packit Service dff8e4
        if (!_nm_setting_wired_is_valid_s390_option(v->name)) {
Packit Service dff8e4
            g_set_error(error,
Packit Service dff8e4
                        NM_CONNECTION_ERROR,
Packit Service dff8e4
                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                        _("invalid key '%s'"),
Packit Service dff8e4
                        v->name);
Packit Service dff8e4
            g_prefix_error(error,
Packit Service dff8e4
                           "%s.%s: ",
Packit Service dff8e4
                           NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                           NM_SETTING_WIRED_S390_OPTIONS);
Packit Service dff8e4
            return FALSE;
Packit Service dff8e4
        }
Packit Service dff8e4
        if (!_nm_setting_wired_is_valid_s390_option_value(v->name, v->value_str)) {
Packit Service dff8e4
            g_set_error(error,
Packit Service dff8e4
                        NM_CONNECTION_ERROR,
Packit Service dff8e4
                        NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                        _("invalid value for key '%s'"),
Packit Service dff8e4
                        v->name);
Packit Service dff8e4
            g_prefix_error(error,
Packit Service dff8e4
                           "%s.%s: ",
Packit Service dff8e4
                           NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                           NM_SETTING_WIRED_S390_OPTIONS);
Packit Service dff8e4
            return FALSE;
Packit Service dff8e4
        }
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (priv->cloned_mac_address && !NM_CLONED_MAC_IS_SPECIAL(priv->cloned_mac_address)
Packit Service dff8e4
        && !nm_utils_hwaddr_valid(priv->cloned_mac_address, ETH_ALEN)) {
Packit Service dff8e4
        g_set_error(error,
Packit Service dff8e4
                    NM_CONNECTION_ERROR,
Packit Service dff8e4
                    NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                    _("'%s' is not a valid MAC address"),
Packit Service dff8e4
                    priv->cloned_mac_address);
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_CLONED_MAC_ADDRESS);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    /* generate-mac-address-mask only makes sense with cloned-mac-address "random" or
Packit Service dff8e4
     * "stable". Still, let's not be so strict about that and accept the value
Packit Service dff8e4
     * even if it is unused. */
Packit Service dff8e4
    if (!_nm_utils_generate_mac_address_mask_parse(priv->generate_mac_address_mask,
Packit Service dff8e4
                                                   NULL,
Packit Service dff8e4
                                                   NULL,
Packit Service dff8e4
                                                   NULL,
Packit Service dff8e4
                                                   &local)) {
Packit Service dff8e4
        g_set_error_literal(error,
Packit Service dff8e4
                            NM_CONNECTION_ERROR,
Packit Service dff8e4
                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                            local->message);
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK);
Packit Service dff8e4
        g_error_free(local);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (NM_FLAGS_ANY(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS)
Packit Service dff8e4
        && !nm_utils_is_power_of_two(priv->wol)) {
Packit Service dff8e4
        g_set_error_literal(error,
Packit Service dff8e4
                            NM_CONNECTION_ERROR,
Packit Service dff8e4
                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                            _("Wake-on-LAN mode 'default' and 'ignore' are exclusive flags"));
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_WAKE_ON_LAN);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (priv->wol_password && !NM_FLAGS_HAS(priv->wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) {
Packit Service dff8e4
        g_set_error_literal(error,
Packit Service dff8e4
                            NM_CONNECTION_ERROR,
Packit Service dff8e4
                            NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                            _("Wake-on-LAN password can only be used with magic packet mode"));
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    if (priv->wol_password && !nm_utils_hwaddr_valid(priv->wol_password, ETH_ALEN)) {
Packit Service dff8e4
        g_set_error(error,
Packit Service dff8e4
                    NM_CONNECTION_ERROR,
Packit Service dff8e4
                    NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
                    _("'%s' is not a valid MAC address"),
Packit Service dff8e4
                    priv->wol_password);
Packit Service dff8e4
        g_prefix_error(error,
Packit Service dff8e4
                       "%s.%s: ",
Packit Service dff8e4
                       NM_SETTING_WIRED_SETTING_NAME,
Packit Service dff8e4
                       NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD);
Packit Service dff8e4
        return FALSE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    /* Normalizable properties - just return NM_SETTING_VERIFY_NORMALIZABLE for compatibility
Packit Service dff8e4
     * with legacy nm-connection-editor which used to save "full" duplex connection as default
Packit Service dff8e4
     */
Packit Service dff8e4
Packit Service dff8e4
    if (((priv->speed) && (!priv->duplex)) || ((!priv->speed) && (priv->duplex))) {
Packit Service dff8e4
        g_set_error_literal(
Packit Service dff8e4
            error,
Packit Service dff8e4
            NM_CONNECTION_ERROR,
Packit Service dff8e4
            NM_CONNECTION_ERROR_INVALID_PROPERTY,
Packit Service dff8e4
            priv->auto_negotiate
Packit Service dff8e4
                ? _("both speed and duplex should have a valid value or both should be unset")
Packit Service dff8e4
                : _("both speed and duplex are required for static link configuration"));
Packit Service dff8e4
        return NM_SETTING_VERIFY_NORMALIZABLE;
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    return TRUE;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static NMTernary
Packit Service dff8e4
compare_property(const NMSettInfoSetting *sett_info,
Packit Service dff8e4
                 guint                    property_idx,
Packit Service dff8e4
                 NMConnection *           con_a,
Packit Service dff8e4
                 NMSetting *              set_a,
Packit Service dff8e4
                 NMConnection *           con_b,
Packit Service dff8e4
                 NMSetting *              set_b,
Packit Service dff8e4
                 NMSettingCompareFlags    flags)
Packit Service dff8e4
{
Packit Service dff8e4
    if (nm_streq(sett_info->property_infos[property_idx].name,
Packit Service dff8e4
                 NM_SETTING_WIRED_CLONED_MAC_ADDRESS)) {
Packit Service dff8e4
        return !set_b
Packit Service dff8e4
               || nm_streq0(NM_SETTING_WIRED_GET_PRIVATE(set_a)->cloned_mac_address,
Packit Service dff8e4
                            NM_SETTING_WIRED_GET_PRIVATE(set_b)->cloned_mac_address);
Packit Service dff8e4
    }
Packit Service dff8e4
Packit Service dff8e4
    return NM_SETTING_CLASS(nm_setting_wired_parent_class)
Packit Service dff8e4
        ->compare_property(sett_info, property_idx, con_a, set_a, con_b, set_b, flags);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static GVariant *
Packit Service dff8e4
_override_autoneg_get(const NMSettInfoSetting *               sett_info,
Packit Service dff8e4
                      guint                                   property_idx,
Packit Service dff8e4
                      NMConnection *                          connection,
Packit Service dff8e4
                      NMSetting *                             setting,
Packit Service dff8e4
                      NMConnectionSerializationFlags          flags,
Packit Service dff8e4
                      const NMConnectionSerializationOptions *options)
Packit Service dff8e4
{
Packit Service dff8e4
    return g_variant_new_boolean(nm_setting_wired_get_auto_negotiate((NMSettingWired *) setting));
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
clear_blacklist_item(char **item_p)
Packit Service dff8e4
{
Packit Service dff8e4
    g_free(*item_p);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWired *       setting = NM_SETTING_WIRED(object);
Packit Service dff8e4
    NMSettingWiredPrivate *priv    = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
    GHashTable *           hash;
Packit Service dff8e4
    guint                  i;
Packit Service dff8e4
Packit Service dff8e4
    switch (prop_id) {
Packit Service dff8e4
    case PROP_PORT:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_port(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_SPEED:
Packit Service dff8e4
        g_value_set_uint(value, nm_setting_wired_get_speed(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_DUPLEX:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_duplex(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_AUTO_NEGOTIATE:
Packit Service dff8e4
        g_value_set_boolean(value, nm_setting_wired_get_auto_negotiate(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MAC_ADDRESS:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_mac_address(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_CLONED_MAC_ADDRESS:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_cloned_mac_address(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_GENERATE_MAC_ADDRESS_MASK:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_generate_mac_address_mask(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MAC_ADDRESS_BLACKLIST:
Packit Service dff8e4
        g_value_set_boxed(value, (char **) priv->mac_address_blacklist->data);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MTU:
Packit Service dff8e4
        g_value_set_uint(value, nm_setting_wired_get_mtu(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_SUBCHANNELS:
Packit Service dff8e4
        g_value_set_boxed(value, priv->s390_subchannels);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_NETTYPE:
Packit Service dff8e4
        g_value_set_string(value, nm_setting_wired_get_s390_nettype(setting));
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_OPTIONS:
Packit Service dff8e4
        hash = g_hash_table_new_full(nm_str_hash, g_str_equal, g_free, g_free);
Packit Service dff8e4
        for (i = 0; i < priv->s390_options.len; i++) {
Packit Service dff8e4
            g_hash_table_insert(hash,
Packit Service dff8e4
                                g_strdup(priv->s390_options.arr[i].name),
Packit Service dff8e4
                                g_strdup(priv->s390_options.arr[i].value_str));
Packit Service dff8e4
        }
Packit Service dff8e4
        g_value_take_boxed(value, hash);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_WAKE_ON_LAN:
Packit Service dff8e4
        g_value_set_uint(value, priv->wol);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_WAKE_ON_LAN_PASSWORD:
Packit Service dff8e4
        g_value_set_string(value, priv->wol_password);
Packit Service dff8e4
        break;
Packit Service dff8e4
    default:
Packit Service dff8e4
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Packit Service dff8e4
        break;
Packit Service dff8e4
    }
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(object);
Packit Service dff8e4
    const char *const *    blacklist;
Packit Service dff8e4
    const char *           mac;
Packit Service dff8e4
Packit Service dff8e4
    switch (prop_id) {
Packit Service dff8e4
    case PROP_PORT:
Packit Service dff8e4
        g_free(priv->port);
Packit Service dff8e4
        priv->port = g_value_dup_string(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_SPEED:
Packit Service dff8e4
        priv->speed = g_value_get_uint(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_DUPLEX:
Packit Service dff8e4
        g_free(priv->duplex);
Packit Service dff8e4
        priv->duplex = g_value_dup_string(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_AUTO_NEGOTIATE:
Packit Service dff8e4
        priv->auto_negotiate = g_value_get_boolean(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MAC_ADDRESS:
Packit Service dff8e4
        g_free(priv->device_mac_address);
Packit Service dff8e4
        priv->device_mac_address =
Packit Service dff8e4
            _nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), ETH_ALEN);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_CLONED_MAC_ADDRESS:
Packit Service dff8e4
        g_free(priv->cloned_mac_address);
Packit Service dff8e4
        priv->cloned_mac_address =
Packit Service dff8e4
            _nm_utils_hwaddr_canonical_or_invalid(g_value_get_string(value), ETH_ALEN);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_GENERATE_MAC_ADDRESS_MASK:
Packit Service dff8e4
        g_free(priv->generate_mac_address_mask);
Packit Service dff8e4
        priv->generate_mac_address_mask = g_value_dup_string(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MAC_ADDRESS_BLACKLIST:
Packit Service dff8e4
        blacklist = g_value_get_boxed(value);
Packit Service dff8e4
        g_array_set_size(priv->mac_address_blacklist, 0);
Packit Service dff8e4
        if (blacklist && *blacklist) {
Packit Service dff8e4
            guint i;
Packit Service dff8e4
Packit Service dff8e4
            for (i = 0; blacklist[i]; i++) {
Packit Service dff8e4
                mac = _nm_utils_hwaddr_canonical_or_invalid(blacklist[i], ETH_ALEN);
Packit Service dff8e4
                g_array_append_val(priv->mac_address_blacklist, mac);
Packit Service dff8e4
            }
Packit Service dff8e4
        }
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_MTU:
Packit Service dff8e4
        priv->mtu = g_value_get_uint(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_SUBCHANNELS:
Packit Service dff8e4
        if (priv->s390_subchannels)
Packit Service dff8e4
            g_strfreev(priv->s390_subchannels);
Packit Service dff8e4
        priv->s390_subchannels = g_value_dup_boxed(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_NETTYPE:
Packit Service dff8e4
        g_free(priv->s390_nettype);
Packit Service dff8e4
        priv->s390_nettype = g_value_dup_string(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_S390_OPTIONS:
Packit Service dff8e4
    {
Packit Service dff8e4
        GHashTable *hash;
Packit Service dff8e4
Packit Service dff8e4
        _s390_options_clear(priv);
Packit Service dff8e4
Packit Service dff8e4
        hash = g_value_get_boxed(value);
Packit Service dff8e4
Packit Service dff8e4
        priv->s390_options.n_alloc = nm_g_hash_table_size(hash);
Packit Service dff8e4
Packit Service dff8e4
        if (priv->s390_options.n_alloc > 0u) {
Packit Service dff8e4
            gboolean       invalid_content = FALSE;
Packit Service dff8e4
            GHashTableIter iter;
Packit Service dff8e4
            const char *   key;
Packit Service dff8e4
            const char *   val;
Packit Service dff8e4
            guint          j;
Packit Service dff8e4
            guint          i;
Packit Service dff8e4
Packit Service dff8e4
            priv->s390_options.arr = g_new(NMUtilsNamedValue, priv->s390_options.n_alloc);
Packit Service dff8e4
Packit Service dff8e4
            g_hash_table_iter_init(&iter, hash);
Packit Service dff8e4
            while (g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
Packit Service dff8e4
                if (!key || !val) {
Packit Service dff8e4
                    invalid_content = TRUE;
Packit Service dff8e4
                    continue;
Packit Service dff8e4
                }
Packit Service dff8e4
Packit Service dff8e4
                nm_assert(priv->s390_options.len < priv->s390_options.n_alloc);
Packit Service dff8e4
Packit Service dff8e4
                priv->s390_options.arr[priv->s390_options.len] = (NMUtilsNamedValue){
Packit Service dff8e4
                    .name      = g_strdup(key),
Packit Service dff8e4
                    .value_str = g_strdup(val),
Packit Service dff8e4
                };
Packit Service dff8e4
                priv->s390_options.len++;
Packit Service dff8e4
            }
Packit Service dff8e4
            if (priv->s390_options.len > 1) {
Packit Service dff8e4
                nm_utils_named_value_list_sort(priv->s390_options.arr,
Packit Service dff8e4
                                               priv->s390_options.len,
Packit Service dff8e4
                                               NULL,
Packit Service dff8e4
                                               NULL);
Packit Service dff8e4
                /* prune duplicate keys. This is only possible if @hash does not use
Packit Service dff8e4
                 * g_str_equal() as compare function (which would be a bug).
Packit Service dff8e4
                 * Still, handle this, because we use later binary sort and rely
Packit Service dff8e4
                 * on unique names. One bug here, should not bork the remainder
Packit Service dff8e4
                 * of the program. */
Packit Service dff8e4
                j = 1;
Packit Service dff8e4
                for (i = 1; i < priv->s390_options.len; i++) {
Packit Service dff8e4
                    if (nm_streq(priv->s390_options.arr[j - 1].name,
Packit Service dff8e4
                                 priv->s390_options.arr[i].name)) {
Packit Service dff8e4
                        g_free((char *) priv->s390_options.arr[i].name);
Packit Service dff8e4
                        g_free((char *) priv->s390_options.arr[i].value_str);
Packit Service dff8e4
                        invalid_content = TRUE;
Packit Service dff8e4
                        continue;
Packit Service dff8e4
                    }
Packit Service dff8e4
                    priv->s390_options.arr[j++] = priv->s390_options.arr[i];
Packit Service dff8e4
                }
Packit Service dff8e4
                priv->s390_options.len = j;
Packit Service dff8e4
            }
Packit Service dff8e4
Packit Service dff8e4
            g_return_if_fail(!invalid_content);
Packit Service dff8e4
        }
Packit Service dff8e4
    } break;
Packit Service dff8e4
    case PROP_WAKE_ON_LAN:
Packit Service dff8e4
        priv->wol = g_value_get_uint(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    case PROP_WAKE_ON_LAN_PASSWORD:
Packit Service dff8e4
        g_free(priv->wol_password);
Packit Service dff8e4
        priv->wol_password = g_value_dup_string(value);
Packit Service dff8e4
        break;
Packit Service dff8e4
    default:
Packit Service dff8e4
        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
Packit Service dff8e4
        break;
Packit Service dff8e4
    }
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/*****************************************************************************/
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
nm_setting_wired_init(NMSettingWired *setting)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(setting);
Packit Service dff8e4
Packit Service dff8e4
    /* We use GArray rather than GPtrArray so it will automatically be NULL-terminated */
Packit Service dff8e4
    priv->mac_address_blacklist = g_array_new(TRUE, FALSE, sizeof(char *));
Packit Service dff8e4
    g_array_set_clear_func(priv->mac_address_blacklist, (GDestroyNotify) clear_blacklist_item);
Packit Service dff8e4
Packit Service dff8e4
    priv->wol = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT;
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
/**
Packit Service dff8e4
 * nm_setting_wired_new:
Packit Service dff8e4
 *
Packit Service dff8e4
 * Creates a new #NMSettingWired object with default values.
Packit Service dff8e4
 *
Packit Service dff8e4
 * Returns: (transfer full): the new empty #NMSettingWired object
Packit Service dff8e4
 **/
Packit Service dff8e4
NMSetting *
Packit Service dff8e4
nm_setting_wired_new(void)
Packit Service dff8e4
{
Packit Service dff8e4
    return g_object_new(NM_TYPE_SETTING_WIRED, NULL);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
finalize(GObject *object)
Packit Service dff8e4
{
Packit Service dff8e4
    NMSettingWiredPrivate *priv = NM_SETTING_WIRED_GET_PRIVATE(object);
Packit Service dff8e4
Packit Service dff8e4
    g_free(priv->port);
Packit Service dff8e4
    g_free(priv->duplex);
Packit Service dff8e4
    g_free(priv->s390_nettype);
Packit Service dff8e4
Packit Service dff8e4
    _s390_options_clear(priv);
Packit Service dff8e4
Packit Service dff8e4
    g_free(priv->device_mac_address);
Packit Service dff8e4
    g_free(priv->cloned_mac_address);
Packit Service dff8e4
    g_free(priv->generate_mac_address_mask);
Packit Service dff8e4
    g_array_unref(priv->mac_address_blacklist);
Packit Service dff8e4
Packit Service dff8e4
    if (priv->s390_subchannels)
Packit Service dff8e4
        g_strfreev(priv->s390_subchannels);
Packit Service dff8e4
Packit Service dff8e4
    g_free(priv->wol_password);
Packit Service dff8e4
Packit Service dff8e4
    G_OBJECT_CLASS(nm_setting_wired_parent_class)->finalize(object);
Packit Service dff8e4
}
Packit Service dff8e4
Packit Service dff8e4
static void
Packit Service dff8e4
nm_setting_wired_class_init(NMSettingWiredClass *klass)
Packit Service dff8e4
{
Packit Service dff8e4
    GObjectClass *  object_class        = G_OBJECT_CLASS(klass);
Packit Service dff8e4
    NMSettingClass *setting_class       = NM_SETTING_CLASS(klass);
Packit Service dff8e4
    GArray *        properties_override = _nm_sett_info_property_override_create_array();
Packit Service dff8e4
Packit Service dff8e4
    g_type_class_add_private(klass, sizeof(NMSettingWiredPrivate));
Packit Service dff8e4
Packit Service dff8e4
    object_class->get_property = get_property;
Packit Service dff8e4
    object_class->set_property = set_property;
Packit Service dff8e4
    object_class->finalize     = finalize;
Packit Service dff8e4
Packit Service dff8e4
    setting_class->verify           = verify;
Packit Service dff8e4
    setting_class->compare_property = compare_property;
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:port:
Packit Service dff8e4
     *
Packit Service dff8e4
     * Specific port type to use if the device supports multiple
Packit Service dff8e4
     * attachment methods.  One of "tp" (Twisted Pair), "aui" (Attachment Unit
Packit Service dff8e4
     * Interface), "bnc" (Thin Ethernet) or "mii" (Media Independent Interface).
Packit Service dff8e4
     * If the device supports only one port type, this setting is ignored.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: port
Packit Service dff8e4
     * variable: (none)
Packit Service dff8e4
     * description: The property is not saved by the plugin.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_PORT] = g_param_spec_string(NM_SETTING_WIRED_PORT,
Packit Service dff8e4
                                                    "",
Packit Service dff8e4
                                                    "",
Packit Service dff8e4
                                                    NULL,
Packit Service dff8e4
                                                    G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:speed:
Packit Service dff8e4
     *
Packit Service dff8e4
     * When a value greater than 0 is set, configures the device to use
Packit Service dff8e4
     * the specified speed. If "auto-negotiate" is "yes" the specified
Packit Service dff8e4
     * speed will be the only one advertised during link negotiation:
Packit Service dff8e4
     * this works only for BASE-T 802.3 specifications and is useful for
Packit Service dff8e4
     * enforcing gigabit speeds, as in this case link negotiation is
Packit Service dff8e4
     * mandatory.
Packit Service dff8e4
     * If the value is unset (0, the default), the link configuration will be
Packit Service dff8e4
     * either skipped (if "auto-negotiate" is "no", the default) or will
Packit Service dff8e4
     * be auto-negotiated (if "auto-negotiate" is "yes") and the local device
Packit Service dff8e4
     * will advertise all the supported speeds.
Packit Service dff8e4
     * In Mbit/s, ie 100 == 100Mbit/s.
Packit Service dff8e4
     * Must be set together with the "duplex" property when non-zero.
Packit Service dff8e4
     * Before specifying a speed value be sure your device supports it.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: speed
Packit Service dff8e4
     * variable: ETHTOOL_OPTS
Packit Service dff8e4
     * description: Fixed speed for the ethernet link. It is added as "speed"
Packit Service dff8e4
     *    parameter in the ETHTOOL_OPTS variable.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_SPEED] = g_param_spec_uint(NM_SETTING_WIRED_SPEED,
Packit Service dff8e4
                                                   "",
Packit Service dff8e4
                                                   "",
Packit Service dff8e4
                                                   0,
Packit Service dff8e4
                                                   G_MAXUINT32,
Packit Service dff8e4
                                                   0,
Packit Service dff8e4
                                                   G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:duplex:
Packit Service dff8e4
     *
Packit Service dff8e4
     * When a value is set, either "half" or "full", configures the device
Packit Service dff8e4
     * to use the specified duplex mode. If "auto-negotiate" is "yes" the
Packit Service dff8e4
     * specified duplex mode will be the only one advertised during link
Packit Service dff8e4
     * negotiation: this works only for BASE-T 802.3 specifications and is
Packit Service dff8e4
     * useful for enforcing gigabits modes, as in these cases link negotiation
Packit Service dff8e4
     * is mandatory.
Packit Service dff8e4
     * If the value is unset (the default), the link configuration will be
Packit Service dff8e4
     * either skipped (if "auto-negotiate" is "no", the default) or will
Packit Service dff8e4
     * be auto-negotiated (if "auto-negotiate" is "yes") and the local device
Packit Service dff8e4
     * will advertise all the supported duplex modes.
Packit Service dff8e4
     * Must be set together with the "speed" property if specified.
Packit Service dff8e4
     * Before specifying a duplex mode be sure your device supports it.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: duplex
Packit Service dff8e4
     * variable: ETHTOOL_OPTS
Packit Service dff8e4
     * description: Fixed duplex mode for the ethernet link. It is added as
Packit Service dff8e4
     *    "duplex" parameter in the ETHOOL_OPTS variable.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_DUPLEX] = g_param_spec_string(NM_SETTING_WIRED_DUPLEX,
Packit Service dff8e4
                                                      "",
Packit Service dff8e4
                                                      "",
Packit Service dff8e4
                                                      NULL,
Packit Service dff8e4
                                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:auto-negotiate:
Packit Service dff8e4
     *
Packit Service dff8e4
     * When %TRUE, enforce auto-negotiation of speed and duplex mode.
Packit Service dff8e4
     * If "speed" and "duplex" properties are both specified, only that
Packit Service dff8e4
     * single mode will be advertised and accepted during the link
Packit Service dff8e4
     * auto-negotiation process: this works only for BASE-T 802.3 specifications
Packit Service dff8e4
     * and is useful for enforcing gigabits modes, as in these cases link
Packit Service dff8e4
     * negotiation is mandatory.
Packit Service dff8e4
     * When %FALSE, "speed" and "duplex" properties should be both set or
Packit Service dff8e4
     * link configuration will be skipped.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: auto-negotiate
Packit Service dff8e4
     * variable: ETHTOOL_OPTS
Packit Service dff8e4
     * description: Whether link speed and duplex autonegotiation is enabled.
Packit Service dff8e4
     *    It is not saved only if disabled and no values are provided for the
Packit Service dff8e4
     *    "speed" and "duplex" parameters (skips link configuration).
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_AUTO_NEGOTIATE] =
Packit Service dff8e4
        g_param_spec_boolean(NM_SETTING_WIRED_AUTO_NEGOTIATE,
Packit Service dff8e4
                             "",
Packit Service dff8e4
                             "",
Packit Service dff8e4
                             FALSE,
Packit Service dff8e4
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
    _nm_properties_override_gobj(properties_override,
Packit Service dff8e4
                                 obj_properties[PROP_AUTO_NEGOTIATE],
Packit Service dff8e4
                                 NM_SETT_INFO_PROPERT_TYPE(.dbus_type   = G_VARIANT_TYPE_BOOLEAN,
Packit Service dff8e4
                                                           .to_dbus_fcn = _override_autoneg_get, ));
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:mac-address:
Packit Service dff8e4
     *
Packit Service dff8e4
     * If specified, this connection will only apply to the Ethernet device
Packit Service dff8e4
     * whose permanent MAC address matches. This property does not change the
Packit Service dff8e4
     * MAC address of the device (i.e. MAC spoofing).
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---keyfile---
Packit Service dff8e4
     * property: mac-address
Packit Service dff8e4
     * format: usual hex-digits-and-colons notation
Packit Service dff8e4
     * description: MAC address in traditional hex-digits-and-colons notation
Packit Service dff8e4
     *   (e.g. 00:22:68:12:79:A2), or semicolon separated list of 6 bytes (obsolete)
Packit Service dff8e4
     *   (e.g. 0;34;104;18;121;162)
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     * ---ifcfg-rh---
Packit Service dff8e4
     * property: mac-address
Packit Service dff8e4
     * variable: HWADDR
Packit Service dff8e4
     * description: Hardware address of the device in traditional hex-digits-and-colons
Packit Service dff8e4
     *    notation (e.g. 00:22:68:14:5A:05).
Packit Service dff8e4
     *    Note that for initscripts this is the current MAC address of the device as found
Packit Service dff8e4
     *    during ifup. For NetworkManager this is the permanent MAC address. Or in case no
Packit Service dff8e4
     *    permanent MAC address exists, the MAC address initially configured on the device.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_MAC_ADDRESS] = g_param_spec_string(
Packit Service dff8e4
        NM_SETTING_WIRED_MAC_ADDRESS,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        NULL,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
    _nm_properties_override_gobj(properties_override,
Packit Service dff8e4
                                 obj_properties[PROP_MAC_ADDRESS],
Packit Service dff8e4
                                 &nm_sett_info_propert_type_mac_address);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:cloned-mac-address:
Packit Service dff8e4
     *
Packit Service dff8e4
     * If specified, request that the device use this MAC address instead.
Packit Service dff8e4
     * This is known as MAC cloning or spoofing.
Packit Service dff8e4
     *
Packit Service dff8e4
     * Beside explicitly specifying a MAC address, the special values "preserve", "permanent",
Packit Service dff8e4
     * "random" and "stable" are supported.
Packit Service dff8e4
     * "preserve" means not to touch the MAC address on activation.
Packit Service dff8e4
     * "permanent" means to use the permanent hardware address if the device
Packit Service dff8e4
     * has one (otherwise this is treated as "preserve").
Packit Service dff8e4
     * "random" creates a random MAC address on each connect.
Packit Service dff8e4
     * "stable" creates a hashed MAC address based on connection.stable-id and a
Packit Service dff8e4
     * machine dependent key.
Packit Service dff8e4
     *
Packit Service dff8e4
     * If unspecified, the value can be overwritten via global defaults, see manual
Packit Service dff8e4
     * of NetworkManager.conf. If still unspecified, it defaults to "preserve"
Packit Service dff8e4
     * (older versions of NetworkManager may use a different default value).
Packit Service dff8e4
     *
Packit Service dff8e4
     * On D-Bus, this field is expressed as "assigned-mac-address" or the deprecated
Packit Service dff8e4
     * "cloned-mac-address".
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---keyfile---
Packit Service dff8e4
     * property: cloned-mac-address
Packit Service dff8e4
     * format: usual hex-digits-and-colons notation
Packit Service dff8e4
     * description: Cloned MAC address in traditional hex-digits-and-colons notation
Packit Service dff8e4
     *   (e.g. 00:22:68:12:79:B2), or semicolon separated list of 6 bytes (obsolete)
Packit Service dff8e4
     *   (e.g. 0;34;104;18;121;178).
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     * ---ifcfg-rh---
Packit Service dff8e4
     * property: cloned-mac-address
Packit Service dff8e4
     * variable: MACADDR
Packit Service dff8e4
     * description: Cloned (spoofed) MAC address in traditional hex-digits-and-colons
Packit Service dff8e4
     *    notation (e.g. 00:22:68:14:5A:99).
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     * ---dbus---
Packit Service dff8e4
     * property: cloned-mac-address
Packit Service dff8e4
     * format: byte array
Packit Service dff8e4
     * description: This D-Bus field is deprecated in favor of "assigned-mac-address"
Packit Service dff8e4
     *    which is more flexible and allows specifying special variants like "random".
Packit Service dff8e4
     *    For libnm and nmcli, this field is called "cloned-mac-address".
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_CLONED_MAC_ADDRESS] = g_param_spec_string(
Packit Service dff8e4
        NM_SETTING_WIRED_CLONED_MAC_ADDRESS,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        NULL,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
    _nm_properties_override_gobj(properties_override,
Packit Service dff8e4
                                 obj_properties[PROP_CLONED_MAC_ADDRESS],
Packit Service dff8e4
                                 &nm_sett_info_propert_type_cloned_mac_address);
Packit Service dff8e4
Packit Service dff8e4
    /* ---dbus---
Packit Service dff8e4
     * property: assigned-mac-address
Packit Service dff8e4
     * format: string
Packit Service dff8e4
     * description: The new field for the cloned MAC address. It can be either
Packit Service dff8e4
     *   a hardware address in ASCII representation, or one of the special values
Packit Service dff8e4
     *   "preserve", "permanent", "random" or "stable".
Packit Service dff8e4
     *   This field replaces the deprecated "cloned-mac-address" on D-Bus, which
Packit Service dff8e4
     *   can only contain explicit hardware addresses. Note that this property
Packit Service dff8e4
     *   only exists in D-Bus API. libnm and nmcli continue to call this property
Packit Service dff8e4
     *   "cloned-mac-address".
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    _nm_properties_override_dbus(properties_override,
Packit Service dff8e4
                                 "assigned-mac-address",
Packit Service dff8e4
                                 &nm_sett_info_propert_type_assigned_mac_address);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:generate-mac-address-mask:
Packit Service dff8e4
     *
Packit Service dff8e4
     * With #NMSettingWired:cloned-mac-address setting "random" or "stable",
Packit Service dff8e4
     * by default all bits of the MAC address are scrambled and a locally-administered,
Packit Service dff8e4
     * unicast MAC address is created. This property allows to specify that certain bits
Packit Service dff8e4
     * are fixed. Note that the least significant bit of the first MAC address will
Packit Service dff8e4
     * always be unset to create a unicast MAC address.
Packit Service dff8e4
     *
Packit Service dff8e4
     * If the property is %NULL, it is eligible to be overwritten by a default
Packit Service dff8e4
     * connection setting. If the value is still %NULL or an empty string, the
Packit Service dff8e4
     * default is to create a locally-administered, unicast MAC address.
Packit Service dff8e4
     *
Packit Service dff8e4
     * If the value contains one MAC address, this address is used as mask. The set
Packit Service dff8e4
     * bits of the mask are to be filled with the current MAC address of the device,
Packit Service dff8e4
     * while the unset bits are subject to randomization.
Packit Service dff8e4
     * Setting "FE:FF:FF:00:00:00" means to preserve the OUI of the current MAC address
Packit Service dff8e4
     * and only randomize the lower 3 bytes using the "random" or "stable" algorithm.
Packit Service dff8e4
     *
Packit Service dff8e4
     * If the value contains one additional MAC address after the mask,
Packit Service dff8e4
     * this address is used instead of the current MAC address to fill the bits
Packit Service dff8e4
     * that shall not be randomized. For example, a value of
Packit Service dff8e4
     * "FE:FF:FF:00:00:00 68:F7:28:00:00:00" will set the OUI of the MAC address
Packit Service dff8e4
     * to 68:F7:28, while the lower bits are randomized. A value of
Packit Service dff8e4
     * "02:00:00:00:00:00 00:00:00:00:00:00" will create a fully scrambled
Packit Service dff8e4
     * globally-administered, burned-in MAC address.
Packit Service dff8e4
     *
Packit Service dff8e4
     * If the value contains more than one additional MAC addresses, one of
Packit Service dff8e4
     * them is chosen randomly. For example, "02:00:00:00:00:00 00:00:00:00:00:00 02:00:00:00:00:00"
Packit Service dff8e4
     * will create a fully scrambled MAC address, randomly locally or globally
Packit Service dff8e4
     * administered.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: generate-mac-address-mask
Packit Service dff8e4
     * variable: GENERATE_MAC_ADDRESS_MASK(+)
Packit Service dff8e4
     * description: the MAC address mask for generating randomized and stable
Packit Service dff8e4
     *   cloned-mac-address.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_GENERATE_MAC_ADDRESS_MASK] = g_param_spec_string(
Packit Service dff8e4
        NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        NULL,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:mac-address-blacklist:
Packit Service dff8e4
     *
Packit Service dff8e4
     * If specified, this connection will never apply to the Ethernet device
Packit Service dff8e4
     * whose permanent MAC address matches an address in the list.  Each MAC
Packit Service dff8e4
     * address is in the standard hex-digits-and-colons notation
Packit Service dff8e4
     * (00:11:22:33:44:55).
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---keyfile---
Packit Service dff8e4
     * property: mac-address-blacklist
Packit Service dff8e4
     * format: list of MACs (separated with semicolons)
Packit Service dff8e4
     * description: MAC address blacklist.
Packit Service dff8e4
     * example: mac-address-blacklist= 00:22:68:12:79:A6;00:22:68:12:79:78
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     * ---ifcfg-rh---
Packit Service dff8e4
     * property: mac-address-blacklist
Packit Service dff8e4
     * variable: HWADDR_BLACKLIST(+)
Packit Service dff8e4
     * description: It denies usage of the connection for any device whose address
Packit Service dff8e4
     *   is listed.
Packit Service dff8e4
     * example: HWADDR_BLACKLIST="00:22:68:11:69:08 00:11:22:11:44:55"
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_MAC_ADDRESS_BLACKLIST] = g_param_spec_boxed(
Packit Service dff8e4
        NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        G_TYPE_STRV,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:mtu:
Packit Service dff8e4
     *
Packit Service dff8e4
     * If non-zero, only transmit packets of the specified size or smaller,
Packit Service dff8e4
     * breaking larger packets up into multiple Ethernet frames.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: mtu
Packit Service dff8e4
     * variable: MTU
Packit Service dff8e4
     * description: MTU of the interface.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_MTU] = g_param_spec_uint(NM_SETTING_WIRED_MTU,
Packit Service dff8e4
                                                 "",
Packit Service dff8e4
                                                 "",
Packit Service dff8e4
                                                 0,
Packit Service dff8e4
                                                 G_MAXUINT32,
Packit Service dff8e4
                                                 0,
Packit Service dff8e4
                                                 G_PARAM_READWRITE | NM_SETTING_PARAM_FUZZY_IGNORE
Packit Service dff8e4
                                                     | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:s390-subchannels:
Packit Service dff8e4
     *
Packit Service dff8e4
     * Identifies specific subchannels that this network device uses for
Packit Service dff8e4
     * communication with z/VM or s390 host.  Like the
Packit Service dff8e4
     * #NMSettingWired:mac-address property for non-z/VM devices, this property
Packit Service dff8e4
     * can be used to ensure this connection only applies to the network device
Packit Service dff8e4
     * that uses these subchannels.  The list should contain exactly 3 strings,
Packit Service dff8e4
     * and each string may only be composed of hexadecimal characters and the
Packit Service dff8e4
     * period (.) character.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: s390-subchannels
Packit Service dff8e4
     * variable: SUBCHANNELS
Packit Service dff8e4
     * description: Subchannels for IBM S390 hosts.
Packit Service dff8e4
     * example: SUBCHANNELS=0.0.b00a,0.0.b00b,0.0.b00c
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_S390_SUBCHANNELS] = g_param_spec_boxed(
Packit Service dff8e4
        NM_SETTING_WIRED_S390_SUBCHANNELS,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        G_TYPE_STRV,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:s390-nettype:
Packit Service dff8e4
     *
Packit Service dff8e4
     * s390 network device type; one of "qeth", "lcs", or "ctc", representing
Packit Service dff8e4
     * the different types of virtual network devices available on s390 systems.
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: s390-nettype
Packit Service dff8e4
     * variable: NETTYPE
Packit Service dff8e4
     * values: "qeth", "lcs" or "ctc"
Packit Service dff8e4
     * description: Network type of the S390 host.
Packit Service dff8e4
     * example: NETTYPE=qeth
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_S390_NETTYPE] = g_param_spec_string(
Packit Service dff8e4
        NM_SETTING_WIRED_S390_NETTYPE,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        NULL,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:s390-options: (type GHashTable(utf8,utf8)):
Packit Service dff8e4
     *
Packit Service dff8e4
     * Dictionary of key/value pairs of s390-specific device options.  Both keys
Packit Service dff8e4
     * and values must be strings.  Allowed keys include "portno", "layer2",
Packit Service dff8e4
     * "portname", "protocol", among others.  Key names must contain only
Packit Service dff8e4
     * alphanumeric characters (ie, [a-zA-Z0-9]).
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: s390-options
Packit Service dff8e4
     * variable: OPTIONS and PORTNAME, CTCPROTO,
Packit Service dff8e4
     * description: S390 device options. All options go to OPTIONS, except for
Packit Service dff8e4
     *   "portname" and "ctcprot" that have their own variables.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_S390_OPTIONS] = g_param_spec_boxed(
Packit Service dff8e4
        NM_SETTING_WIRED_S390_OPTIONS,
Packit Service dff8e4
        "",
Packit Service dff8e4
        "",
Packit Service dff8e4
        G_TYPE_HASH_TABLE,
Packit Service dff8e4
        G_PARAM_READWRITE | NM_SETTING_PARAM_INFERRABLE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
    _nm_properties_override_gobj(properties_override,
Packit Service dff8e4
                                 obj_properties[PROP_S390_OPTIONS],
Packit Service dff8e4
                                 &nm_sett_info_propert_type_strdict);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:wake-on-lan:
Packit Service dff8e4
     *
Packit Service dff8e4
     * The #NMSettingWiredWakeOnLan options to enable. Not all devices support all options.
Packit Service dff8e4
     * May be any combination of %NM_SETTING_WIRED_WAKE_ON_LAN_PHY,
Packit Service dff8e4
     * %NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST, %NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST,
Packit Service dff8e4
     * %NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST, %NM_SETTING_WIRED_WAKE_ON_LAN_ARP,
Packit Service dff8e4
     * %NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC or the special values
Packit Service dff8e4
     * %NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT (to use global settings) and
Packit Service dff8e4
     * %NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE (to disable management of Wake-on-LAN in
Packit Service dff8e4
     * NetworkManager).
Packit Service dff8e4
     *
Packit Service dff8e4
     * Since: 1.2
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: wake-on-lan
Packit Service dff8e4
     * variable: ETHTOOL_OPTS, ETHTOOL_WAKE_ON_LAN
Packit Service dff8e4
     * description: Wake on Lan mode for ethernet. The setting "ignore" is expressed
Packit Service dff8e4
     * with "ETHTOOL_WAKE_ON_LAN=ignore". Otherwise, the "ETHTOOL_OPTS" variable is set
Packit Service dff8e4
     * with the value "wol" and several of the characters "p|u|m|b|a|g|s|f|d" as explained
Packit Service dff8e4
     * in the ethtool manual page.
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_WAKE_ON_LAN] =
Packit Service dff8e4
        g_param_spec_uint(NM_SETTING_WIRED_WAKE_ON_LAN,
Packit Service dff8e4
                          "",
Packit Service dff8e4
                          "",
Packit Service dff8e4
                          0,
Packit Service dff8e4
                          G_MAXUINT32,
Packit Service dff8e4
                          NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT,
Packit Service dff8e4
                          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    /**
Packit Service dff8e4
     * NMSettingWired:wake-on-lan-password:
Packit Service dff8e4
     *
Packit Service dff8e4
     * If specified, the password used with magic-packet-based
Packit Service dff8e4
     * Wake-on-LAN, represented as an Ethernet MAC address.  If %NULL,
Packit Service dff8e4
     * no password will be required.
Packit Service dff8e4
     *
Packit Service dff8e4
     * Since: 1.2
Packit Service dff8e4
     **/
Packit Service dff8e4
    /* ---ifcfg-rh---
Packit Service dff8e4
     * property: wake-on-lan-password
Packit Service dff8e4
     * variable: ETHTOOL_OPTS
Packit Service dff8e4
     * description: Password for secure-on based Wake-on-Lan. It is added as "sopass"
Packit Service dff8e4
     *    parameter in the ETHTOOL_OPTS variable.
Packit Service dff8e4
     * example: ETHTOOL_OPTS="wol gs sopass 00:11:22:33:44:55"
Packit Service dff8e4
     * ---end---
Packit Service dff8e4
     */
Packit Service dff8e4
    obj_properties[PROP_WAKE_ON_LAN_PASSWORD] =
Packit Service dff8e4
        g_param_spec_string(NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD,
Packit Service dff8e4
                            "",
Packit Service dff8e4
                            "",
Packit Service dff8e4
                            NULL,
Packit Service dff8e4
                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
Packit Service dff8e4
Packit Service dff8e4
    g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
Packit Service dff8e4
Packit Service dff8e4
    _nm_setting_class_commit_full(setting_class,
Packit Service dff8e4
                                  NM_META_SETTING_TYPE_WIRED,
Packit Service dff8e4
                                  NULL,
Packit Service dff8e4
                                  properties_override);
Packit Service dff8e4
}