Commit 5da77c0e authored by Lubomir Rintel's avatar Lubomir Rintel 🥕

client: support wpan setting

parent 89011938
......@@ -660,6 +660,7 @@ const NmcMetaGenericInfo *const metagen_con_active_general[_NMC_GENERIC_INFO_TYP
NM_SETTING_MACSEC_SETTING_NAME"," \
NM_SETTING_MACVLAN_SETTING_NAME"," \
NM_SETTING_VXLAN_SETTING_NAME"," \
NM_SETTING_WPAN_SETTING_NAME","\
NM_SETTING_PROXY_SETTING_NAME"," \
NM_SETTING_TC_CONFIG_SETTING_NAME
// NM_SETTING_DUMMY_SETTING_NAME
......@@ -890,7 +891,10 @@ usage_connection_add (void)
" [source-port-min <0-65535>]\n"
" [source-port-max <0-65535>]\n"
" [destination-port <0-65535>]\n\n"
" dummy: \n\n"
" wpan: [short-addr <0x0000-0xffff>]\n\n"
" [pan-id <0x0000-0xffff>]\n\n"
" [mac <MAC address>]\n\n"
" dummy:\n\n"
" SLAVE_OPTIONS:\n"
" bridge: [priority <0-63>]\n"
" [path-cost <1-65535>]\n"
......
......@@ -1200,6 +1200,11 @@ _set_fcn_gobject_mtu (ARGS_SET_FCN)
return TRUE;
}
/* Ideally we'll be able to get this from a public header. */
#ifndef IEEE802154_ADDR_LEN
#define IEEE802154_ADDR_LEN 8
#endif
static gboolean
_set_fcn_gobject_mac (ARGS_SET_FCN)
{
......@@ -1211,9 +1216,11 @@ _set_fcn_gobject_mac (ARGS_SET_FCN)
else
mode = NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT;
if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND)
if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND) {
valid = nm_utils_hwaddr_valid (value, INFINIBAND_ALEN);
else {
} else if (mode == NM_META_PROPERTY_TYPE_MAC_MODE_WPAN) {
valid = nm_utils_hwaddr_valid (value, IEEE802154_ADDR_LEN);
} else {
valid = nm_utils_hwaddr_valid (value, ETH_ALEN)
|| ( mode == NM_META_PROPERTY_TYPE_MAC_MODE_CLONED
&& NM_CLONED_MAC_IS_SPECIAL (value));
......@@ -7435,6 +7442,52 @@ static const NMMetaPropertyInfo *const property_infos_WIRELESS_SECURITY[] = {
NULL
};
#undef _CURRENT_NM_META_SETTING_TYPE
#define _CURRENT_NM_META_SETTING_TYPE NM_META_SETTING_TYPE_WPAN
static const NMMetaPropertyInfo *const property_infos_WPAN[] = {
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_MAC_ADDRESS,
.property_type = &_pt_gobject_mac,
.is_cli_option = TRUE,
.property_alias = "mac",
.prompt = N_("MAC [none]"),
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (mac,
.mode = NM_META_PROPERTY_TYPE_MAC_MODE_WPAN,
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_SHORT_ADDRESS,
.is_cli_option = TRUE,
.property_alias = "short-addr",
.prompt = N_("Short address (<0x0000-0xffff>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.base = 16,
.value_infos = INT_VALUE_INFOS (
{
.value = G_MAXUINT16,
.nick = "unset",
}
),
),
),
PROPERTY_INFO_WITH_DESC (NM_SETTING_WPAN_PAN_ID,
.is_cli_option = TRUE,
.inf_flags = NM_META_PROPERTY_INF_FLAG_REQD,
.property_alias = "pan-id",
.prompt = N_("PAN Identifier (<0x0000-0xffff>)"),
.property_type = &_pt_gobject_int,
.property_typ_data = DEFINE_PROPERTY_TYP_DATA_SUBTYPE (gobject_int, \
.base = 16,
.value_infos = INT_VALUE_INFOS (
{
.value = G_MAXUINT16,
.nick = "unset",
}
),
),
),
NULL
};
/*****************************************************************************/
static void
......@@ -7595,6 +7648,7 @@ _setting_init_fcn_wireless (ARGS_SETTING_INIT_FCN)
#define SETTING_PRETTY_NAME_WIRED N_("Wired Ethernet")
#define SETTING_PRETTY_NAME_WIRELESS N_("Wi-Fi connection")
#define SETTING_PRETTY_NAME_WIRELESS_SECURITY N_("Wi-Fi security settings")
#define SETTING_PRETTY_NAME_WPAN N_("WPAN settings")
#define NM_META_SETTING_VALID_PARTS(...) \
((const NMMetaSettingValidPartItem *const[]) { __VA_ARGS__ NULL })
......@@ -7836,6 +7890,12 @@ const NMMetaSettingInfoEditor nm_meta_setting_infos_editor[] = {
SETTING_INFO (WIRELESS_SECURITY,
.alias = "wifi-sec",
),
SETTING_INFO (WPAN,
.valid_parts = NM_META_SETTING_VALID_PARTS (
NM_META_SETTING_VALID_PART_ITEM (CONNECTION, TRUE),
NM_META_SETTING_VALID_PART_ITEM (WPAN, TRUE),
),
),
};
/*****************************************************************************/
......
......@@ -163,6 +163,7 @@ typedef enum {
NM_META_PROPERTY_TYPE_MAC_MODE_DEFAULT,
NM_META_PROPERTY_TYPE_MAC_MODE_CLONED,
NM_META_PROPERTY_TYPE_MAC_MODE_INFINIBAND,
NM_META_PROPERTY_TYPE_MAC_MODE_WPAN,
} NMMetaPropertyTypeMacMode;
typedef struct _NMMetaEnvironment NMMetaEnvironment;
......
......@@ -2003,6 +2003,17 @@ It's equivalent to the <literal>+bond.options 'option=value'</literal> syntax.</
</tbody>
</tgroup></table>
<table><title>WPAN options</title><tgroup cols="2">
<thead>
<row><entry>Alias</entry><entry>Property</entry></row>
</thead>
<tbody>
<row><entry align="left">mac</entry><entry align="left"><link linkend="nm-settings.property.wpan.mac">wpan.mac</link></entry></row>
<row><entry align="left">short-addr</entry><entry align="left"><link linkend="nm-settings.property.wpan.short-addr">wpan.short-addr</link></entry></row>
<row><entry align="left">pan-id</entry><entry align="left"><link linkend="nm-settings.property.wpan.pan-id">wpan.pan-id</link></entry></row>
</tbody>
</tgroup></table>
<table><title>IPv4 options</title><tgroup cols="3">
<thead>
<row><entry>Alias</entry><entry>Property</entry><entry>Note</entry></row>
......
......@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2017 Red Hat, Inc.
* Copyright 2017 - 2018 Red Hat, Inc.
*/
#include "nm-default.h"
......@@ -63,6 +63,7 @@
#include "nm-setting-wired.h"
#include "nm-setting-wireless.h"
#include "nm-setting-wireless-security.h"
#include "nm-setting-wpan.h"
/*****************************************************************************/
......@@ -340,6 +341,11 @@ const NMMetaSettingInfo nm_meta_setting_infos[] = {
.setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
.get_setting_gtype = nm_setting_wireless_security_get_type,
},
[NM_META_SETTING_TYPE_WPAN] = {
.meta_type = NM_META_SETTING_TYPE_WPAN,
.setting_name = NM_SETTING_WPAN_SETTING_NAME,
.get_setting_gtype = nm_setting_wpan_get_type,
},
[NM_META_SETTING_TYPE_UNKNOWN] = {
.meta_type = NM_META_SETTING_TYPE_UNKNOWN,
......
......@@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2017 Red Hat, Inc.
* Copyright 2017 - 2018 Red Hat, Inc.
*/
#ifndef __NM_META_SETTING_H__
......@@ -95,6 +95,7 @@ typedef enum {
NM_META_SETTING_TYPE_WIRED,
NM_META_SETTING_TYPE_WIRELESS,
NM_META_SETTING_TYPE_WIRELESS_SECURITY,
NM_META_SETTING_TYPE_WPAN,
NM_META_SETTING_TYPE_UNKNOWN,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment