mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 17:00:08 +01:00
cli: add vxlan support
This commit is contained in:
parent
95dfd99afc
commit
7da440b798
4 changed files with 469 additions and 3 deletions
|
|
@ -120,6 +120,7 @@ extern NmcOutputField nmc_fields_setting_dcb[];
|
|||
extern NmcOutputField nmc_fields_setting_tun[];
|
||||
extern NmcOutputField nmc_fields_setting_ip_tunnel[];
|
||||
extern NmcOutputField nmc_fields_setting_macvlan[];
|
||||
extern NmcOutputField nmc_fields_setting_vxlan[];
|
||||
|
||||
/* Available settings for 'connection show <con>' - profile part */
|
||||
static NmcOutputField nmc_fields_settings_names[] = {
|
||||
|
|
@ -151,6 +152,7 @@ static NmcOutputField nmc_fields_settings_names[] = {
|
|||
SETTING_FIELD (NM_SETTING_TUN_SETTING_NAME, nmc_fields_setting_tun + 1), /* 25 */
|
||||
SETTING_FIELD (NM_SETTING_IP_TUNNEL_SETTING_NAME, nmc_fields_setting_ip_tunnel + 1), /* 26 */
|
||||
SETTING_FIELD (NM_SETTING_MACVLAN_SETTING_NAME, nmc_fields_setting_macvlan + 1), /* 27 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_SETTING_NAME, nmc_fields_setting_vxlan + 1), /* 28 */
|
||||
{NULL, NULL, 0, NULL, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTINGS_NAMES_ALL_X NM_SETTING_CONNECTION_SETTING_NAME","\
|
||||
|
|
@ -179,7 +181,8 @@ static NmcOutputField nmc_fields_settings_names[] = {
|
|||
NM_SETTING_DCB_SETTING_NAME"," \
|
||||
NM_SETTING_TUN_SETTING_NAME"," \
|
||||
NM_SETTING_IP_TUNNEL_SETTING_NAME"," \
|
||||
NM_SETTING_MACVLAN_SETTING_NAME
|
||||
NM_SETTING_MACVLAN_SETTING_NAME"," \
|
||||
NM_SETTING_VXLAN_SETTING_NAME
|
||||
#define NMC_FIELDS_SETTINGS_NAMES_ALL NMC_FIELDS_SETTINGS_NAMES_ALL_X
|
||||
|
||||
/* Active connection data */
|
||||
|
|
@ -429,6 +432,13 @@ usage_connection_add (void)
|
|||
" macvlan: dev <parent device (connection UUID, ifname, or MAC)>\n"
|
||||
" mode vepa|bridge|private|passthru|source\n"
|
||||
" [tap yes|no]\n\n"
|
||||
" vxlan: id <VXLAN ID>\n"
|
||||
" remote <IP of multicast group or remote address>\n"
|
||||
" [dev <parent device (ifname or connection UUID)>]\n"
|
||||
" [local <source IP>]\n"
|
||||
" [source-port-min <0-65535>]\n"
|
||||
" [source-port-max <0-65535>]\n"
|
||||
" [destination-port <0-65535>]\n\n"
|
||||
" SLAVE_OPTIONS:\n"
|
||||
" bridge: [priority <0-63>]\n"
|
||||
" [path-cost <1-65535>]\n"
|
||||
|
|
@ -2826,6 +2836,14 @@ static const NameItem nmc_macvlan_settings [] = {
|
|||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
|
||||
static const NameItem nmc_vxlan_settings [] = {
|
||||
{ NM_SETTING_CONNECTION_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_VXLAN_SETTING_NAME, NULL, NULL, TRUE },
|
||||
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NM_SETTING_IP6_CONFIG_SETTING_NAME, NULL, NULL, FALSE },
|
||||
{ NULL, NULL, NULL, FALSE }
|
||||
};
|
||||
|
||||
/* Available connection types */
|
||||
static const NameItem nmc_valid_connection_types[] = {
|
||||
{ NM_SETTING_GENERIC_SETTING_NAME, NULL, nmc_generic_settings },
|
||||
|
|
@ -2850,6 +2868,7 @@ static const NameItem nmc_valid_connection_types[] = {
|
|||
{ NM_SETTING_TUN_SETTING_NAME, NULL, nmc_tun_settings },
|
||||
{ NM_SETTING_IP_TUNNEL_SETTING_NAME, NULL, nmc_ip_tunnel_settings },
|
||||
{ NM_SETTING_MACVLAN_SETTING_NAME, NULL, nmc_macvlan_settings },
|
||||
{ NM_SETTING_VXLAN_SETTING_NAME, NULL, nmc_vxlan_settings },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
@ -4222,7 +4241,6 @@ do_questionnaire_adsl (gboolean echo, char **password, char **encapsulation)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
do_questionnaire_macvlan (char **tap)
|
||||
{
|
||||
|
|
@ -4249,6 +4267,85 @@ do_questionnaire_macvlan (char **tap)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
do_questionnaire_vxlan (char **parent, char **local, char **src_port_min,
|
||||
char **src_port_max, char **dst_port)
|
||||
{
|
||||
unsigned long tmp;
|
||||
gboolean once_more;
|
||||
|
||||
/* Ask for optional 'vxlan' arguments. */
|
||||
if (!want_provide_opt_args (_("VXLAN"), 4))
|
||||
return;
|
||||
|
||||
if (!*parent) {
|
||||
do {
|
||||
*parent = nmc_readline (_("Parent device [none]: "));
|
||||
once_more = *parent
|
||||
&& !nm_utils_is_uuid (*parent)
|
||||
&& !nm_utils_iface_valid_name (*parent);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'dev': '%s' is neither UUID nor interface name.\n"),
|
||||
*parent);
|
||||
g_free (*parent);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
|
||||
if (!*local) {
|
||||
do {
|
||||
*local = nmc_readline (_("Local address [none]: "));
|
||||
once_more = *local
|
||||
&& !nm_utils_ipaddr_valid (AF_INET, *local)
|
||||
&& !nm_utils_ipaddr_valid (AF_INET6, *local);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'local': '%s' is not a valid IP address.\n"),
|
||||
*local);
|
||||
g_free (*local);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
|
||||
if (!*src_port_min) {
|
||||
do {
|
||||
*src_port_min = nmc_readline (_("Minimum source port [0]: "));
|
||||
*src_port_min = *src_port_min ? *src_port_min : g_strdup ("0");
|
||||
once_more = !nmc_string_to_uint (*src_port_min, TRUE, 0, 65535, &tmp);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'source-port-min': '%s' is not a valid number <0-65535>.\n"),
|
||||
*src_port_min);
|
||||
g_free (*src_port_min);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
|
||||
if (!*src_port_max) {
|
||||
do {
|
||||
*src_port_max = nmc_readline (_("Maximum source port [0]: "));
|
||||
*src_port_max = *src_port_max ? *src_port_max : g_strdup ("0");
|
||||
once_more = !nmc_string_to_uint (*src_port_max, TRUE, 0, 65535, &tmp);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'source-port-max': '%s' is not a valid number <0-65535>.\n"),
|
||||
*src_port_max);
|
||||
g_free (*src_port_max);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
|
||||
if (!*dst_port) {
|
||||
do {
|
||||
*dst_port = nmc_readline (_("Destination port [8472]: "));
|
||||
*dst_port = *dst_port ? *dst_port : g_strdup ("8472");
|
||||
once_more = !nmc_string_to_uint (*dst_port, TRUE, 0, 65535, &tmp);
|
||||
if (once_more) {
|
||||
g_print (_("Error: 'destination-port': '%s' is not a valid number <0-65535>.\n"),
|
||||
*dst_port);
|
||||
g_free (*dst_port);
|
||||
}
|
||||
} while (once_more);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
split_address (char* str, char **ip, char **rest)
|
||||
{
|
||||
|
|
@ -4720,6 +4817,7 @@ complete_connection_by_type (NMConnection *connection,
|
|||
NMSettingTun *s_tun;
|
||||
NMSettingIPTunnel *s_ip_tunnel;
|
||||
NMSettingMacvlan *s_macvlan;
|
||||
NMSettingVxlan *s_vxlan;
|
||||
const char *slave_type;
|
||||
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
|
||||
|
|
@ -6119,6 +6217,144 @@ cleanup_tun:
|
|||
cleanup_tunnel:
|
||||
g_free (remote_ask);
|
||||
g_free (mode_ask);
|
||||
} else if (!strcmp (con_type, NM_SETTING_VXLAN_SETTING_NAME)) {
|
||||
/* Build up the settings required for 'vxlan' */
|
||||
gboolean success = FALSE;
|
||||
char *id_ask = NULL;
|
||||
const char *id = NULL;
|
||||
char *remote_ask = NULL;
|
||||
const char *remote = NULL;
|
||||
const char *parent_c = NULL, *local_c = NULL;
|
||||
const char *src_port_min_c = NULL, *src_port_max_c = NULL;
|
||||
const char *dst_port_c = NULL;
|
||||
char *parent = NULL, *local = NULL;
|
||||
char *src_port_min = NULL, *src_port_max = NULL, *dst_port = NULL;
|
||||
unsigned long int vni;
|
||||
unsigned long sport_min = G_MAXULONG, sport_max = G_MAXULONG;
|
||||
unsigned long dport = G_MAXULONG;
|
||||
nmc_arg_t exp_args[] = { {"id", TRUE, &id, !ask},
|
||||
{"remote", TRUE, &remote, !ask},
|
||||
{"dev", TRUE, &parent_c, FALSE},
|
||||
{"local", TRUE, &local_c, FALSE},
|
||||
{"source-port-min", TRUE, &src_port_min_c, FALSE},
|
||||
{"source-port-max", TRUE, &src_port_max_c, FALSE},
|
||||
{"destination-port", TRUE, &dst_port_c, FALSE},
|
||||
{NULL} };
|
||||
|
||||
if (!nmc_parse_args (exp_args, FALSE, &argc, &argv, error))
|
||||
return FALSE;
|
||||
|
||||
if (!id && ask)
|
||||
id = id_ask = nmc_readline (_("VXLAN ID: "));
|
||||
if (!id) {
|
||||
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'id' is required."));
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
|
||||
if (!remote && ask)
|
||||
remote = remote_ask = nmc_readline (_("Remote: "));
|
||||
if (!remote) {
|
||||
g_set_error_literal (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'remote' is required."));
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
|
||||
if (!nmc_string_to_uint (id, TRUE, 0, (1UL << 24) - 1, &vni)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'id': '%s' is not valid; use <0-16777215>."), id);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
|
||||
parent = g_strdup (parent_c);
|
||||
local = g_strdup (local_c);
|
||||
src_port_min = g_strdup (src_port_min_c);
|
||||
src_port_max = g_strdup (src_port_max_c);
|
||||
dst_port = g_strdup (dst_port_c);
|
||||
|
||||
if (ask)
|
||||
do_questionnaire_vxlan (&parent, &local, &src_port_min, &src_port_max, &dst_port);
|
||||
|
||||
if (parent) {
|
||||
if ( !nm_utils_is_uuid (parent)
|
||||
&& !nm_utils_iface_valid_name (parent)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'dev': '%s' is neither UUID nor interface name."),
|
||||
parent);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !nm_utils_ipaddr_valid (AF_INET, remote)
|
||||
&& !nm_utils_ipaddr_valid (AF_INET6, remote)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'remote': '%s' is not a valid IP address"),
|
||||
remote);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
|
||||
if (local) {
|
||||
if ( !nm_utils_ipaddr_valid (AF_INET, local)
|
||||
&& !nm_utils_ipaddr_valid (AF_INET6, local)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'local': '%s' is not a valid IP address"),
|
||||
local);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
}
|
||||
|
||||
if (src_port_min) {
|
||||
if (!nmc_string_to_uint (src_port_min, TRUE, 0, 65535, &sport_min)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'source-port-min': %s is not valid; use <0-65535>."),
|
||||
src_port_min);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
}
|
||||
|
||||
if (src_port_max) {
|
||||
if (!nmc_string_to_uint (src_port_max, TRUE, 0, 65535, &sport_max)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'source-port-max': %s is not valid; use <0-65535>."),
|
||||
src_port_max);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
}
|
||||
|
||||
if (dst_port) {
|
||||
if (!nmc_string_to_uint (dst_port, TRUE, 0, 65535, &dport)) {
|
||||
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
|
||||
_("Error: 'destination-port': %s is not valid; use <0-65535>."),
|
||||
dst_port);
|
||||
goto cleanup_vxlan;
|
||||
}
|
||||
}
|
||||
|
||||
/* Add 'vxlan' setting */
|
||||
s_vxlan = (NMSettingVxlan *) nm_setting_vxlan_new ();
|
||||
nm_connection_add_setting (connection, NM_SETTING (s_vxlan));
|
||||
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_ID, (guint) vni, NULL);
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_REMOTE, remote, NULL);
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_LOCAL, local, NULL);
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_PARENT, parent, NULL);
|
||||
|
||||
if (sport_min != G_MAXULONG)
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_SOURCE_PORT_MIN, sport_min, NULL);
|
||||
if (sport_max != G_MAXULONG)
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_SOURCE_PORT_MAX, sport_max, NULL);
|
||||
if (dport != G_MAXULONG)
|
||||
g_object_set (s_vxlan, NM_SETTING_VXLAN_DESTINATION_PORT, dport, NULL);
|
||||
|
||||
success = TRUE;
|
||||
|
||||
cleanup_vxlan:
|
||||
g_free (id_ask);
|
||||
g_free (remote_ask);
|
||||
g_free (parent);
|
||||
g_free (local);
|
||||
g_free (src_port_min);
|
||||
g_free (src_port_max);
|
||||
if (!success)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
|||
|
|
@ -412,7 +412,7 @@ _nmcli_compl_ARGS()
|
|||
# user friendly. Only complete them, if the current word already starts with an "8".
|
||||
_nmcli_list "802-3-ethernet 802-11-wireless 802-11-olpc-mesh"
|
||||
else
|
||||
_nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bridge team pppoe adsl tun ip-tunnel macvlan"
|
||||
_nmcli_list "ethernet wifi wimax gsm cdma infiniband bluetooth vpn olpc-mesh vlan bond bridge team pppoe adsl tun ip-tunnel macvlan vxlan"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -764,6 +764,46 @@ NmcOutputField nmc_fields_setting_macvlan[] = {
|
|||
NM_SETTING_MACVLAN_TAP
|
||||
#define NMC_FIELDS_SETTING_MACVLAN_COMMON NMC_FIELDS_SETTING_MACVLAN_ALL
|
||||
|
||||
/* Available fields for NM_SETTING_VXLAN_SETTING_NAME */
|
||||
NmcOutputField nmc_fields_setting_vxlan[] = {
|
||||
SETTING_FIELD ("name"), /* 0 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_PARENT), /* 1 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_ID), /* 2 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_LOCAL), /* 3 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_REMOTE), /* 4 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_SOURCE_PORT_MIN), /* 5 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_SOURCE_PORT_MAX), /* 6 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_DESTINATION_PORT), /* 7 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_TOS), /* 8 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_TTL), /* 9 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_AGEING), /* 10 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_LIMIT), /* 11 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_LEARNING), /* 12 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_PROXY), /* 13 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_RSC), /* 14 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_L2_MISS), /* 15 */
|
||||
SETTING_FIELD (NM_SETTING_VXLAN_L3_MISS), /* 16 */
|
||||
{NULL, NULL, 0, NULL, FALSE, FALSE, 0}
|
||||
};
|
||||
#define NMC_FIELDS_SETTING_VXLAN_ALL "name"","\
|
||||
NM_SETTING_VXLAN_PARENT","\
|
||||
NM_SETTING_VXLAN_ID","\
|
||||
NM_SETTING_VXLAN_LOCAL","\
|
||||
NM_SETTING_VXLAN_REMOTE","\
|
||||
NM_SETTING_VXLAN_SOURCE_PORT_MIN","\
|
||||
NM_SETTING_VXLAN_SOURCE_PORT_MAX","\
|
||||
NM_SETTING_VXLAN_DESTINATION_PORT","\
|
||||
NM_SETTING_VXLAN_TOS","\
|
||||
NM_SETTING_VXLAN_TTL","\
|
||||
NM_SETTING_VXLAN_AGEING","\
|
||||
NM_SETTING_VXLAN_LIMIT","\
|
||||
NM_SETTING_VXLAN_LEARNING","\
|
||||
NM_SETTING_VXLAN_PROXY","\
|
||||
NM_SETTING_VXLAN_RSC","\
|
||||
NM_SETTING_VXLAN_L2_MISS","\
|
||||
NM_SETTING_VXLAN_L3_MISS
|
||||
#define NMC_FIELDS_SETTING_VXLAN_COMMON NMC_FIELDS_SETTING_VXLAN_ALL
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
static char *
|
||||
wep_key_type_to_string (NMWepKeyType type)
|
||||
|
|
@ -1937,6 +1977,24 @@ nmc_property_macvlan_set_mode (NMSetting *setting, const char *prop,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* --- NM_SETTING_VXLAN_SETTING_NAME property get functions --- */
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_parent, NM_SETTING_VXLAN_PARENT)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_id, NM_SETTING_VXLAN_ID)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_local, NM_SETTING_VXLAN_LOCAL)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_remote, NM_SETTING_VXLAN_REMOTE)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_source_port_min, NM_SETTING_VXLAN_SOURCE_PORT_MIN)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_source_port_max, NM_SETTING_VXLAN_SOURCE_PORT_MAX)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_destination_port, NM_SETTING_VXLAN_DESTINATION_PORT)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_tos, NM_SETTING_VXLAN_TOS)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_ttl, NM_SETTING_VXLAN_TTL)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_ageing, NM_SETTING_VXLAN_AGEING)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_limit, NM_SETTING_VXLAN_LIMIT)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_learning, NM_SETTING_VXLAN_LEARNING)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_proxy, NM_SETTING_VXLAN_PROXY)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_rsc, NM_SETTING_VXLAN_RSC)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_l2_miss, NM_SETTING_VXLAN_L2_MISS)
|
||||
DEFINE_GETTER (nmc_property_vxlan_get_l3_miss, NM_SETTING_VXLAN_L3_MISS)
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
|
|
@ -7332,6 +7390,120 @@ nmc_properties_init (void)
|
|||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
/* Add editable properties for NM_SETTING_VXLAN_SETTING_NAME */
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, PARENT),
|
||||
nmc_property_vxlan_get_parent,
|
||||
nmc_property_set_string,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, ID),
|
||||
nmc_property_vxlan_get_id,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, LOCAL),
|
||||
nmc_property_vxlan_get_local,
|
||||
nmc_property_set_string,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, REMOTE),
|
||||
nmc_property_vxlan_get_remote,
|
||||
nmc_property_set_string,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, SOURCE_PORT_MIN),
|
||||
nmc_property_vxlan_get_source_port_min,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, SOURCE_PORT_MAX),
|
||||
nmc_property_vxlan_get_source_port_max,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, DESTINATION_PORT),
|
||||
nmc_property_vxlan_get_destination_port,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, TOS),
|
||||
nmc_property_vxlan_get_tos,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, TTL),
|
||||
nmc_property_vxlan_get_ttl,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, AGEING),
|
||||
nmc_property_vxlan_get_ageing,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, LIMIT),
|
||||
nmc_property_vxlan_get_limit,
|
||||
nmc_property_set_uint,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, LEARNING),
|
||||
nmc_property_vxlan_get_learning,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, PROXY),
|
||||
nmc_property_vxlan_get_proxy,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, RSC),
|
||||
nmc_property_vxlan_get_rsc,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, L2_MISS),
|
||||
nmc_property_vxlan_get_l2_miss,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
nmc_add_prop_funcs (GLUE (VXLAN, L3_MISS),
|
||||
nmc_property_vxlan_get_l3_miss,
|
||||
nmc_property_set_bool,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -8577,6 +8749,47 @@ setting_macvlan_details (NMSetting *setting, NmCli *nmc, const char *one_prop,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
setting_vxlan_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets)
|
||||
{
|
||||
NMSettingVxlan *s_vxlan = NM_SETTING_VXLAN (setting);
|
||||
NmcOutputField *tmpl, *arr;
|
||||
size_t tmpl_len;
|
||||
|
||||
g_return_val_if_fail (NM_IS_SETTING_VXLAN (s_vxlan), FALSE);
|
||||
|
||||
tmpl = nmc_fields_setting_vxlan;
|
||||
tmpl_len = sizeof (nmc_fields_setting_vxlan);
|
||||
nmc->print_fields.indices = parse_output_fields (one_prop ? one_prop : NMC_FIELDS_SETTING_VXLAN_ALL,
|
||||
tmpl, FALSE, NULL, NULL);
|
||||
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_FIELD_NAMES);
|
||||
g_ptr_array_add (nmc->output_data, arr);
|
||||
|
||||
arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX);
|
||||
set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting)));
|
||||
set_val_str (arr, 1, nmc_property_vxlan_get_parent (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 2, nmc_property_vxlan_get_id (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 3, nmc_property_vxlan_get_local (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 4, nmc_property_vxlan_get_remote (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 5, nmc_property_vxlan_get_source_port_min (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 6, nmc_property_vxlan_get_source_port_max (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 7, nmc_property_vxlan_get_destination_port (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 8, nmc_property_vxlan_get_tos (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 9, nmc_property_vxlan_get_ttl (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 10, nmc_property_vxlan_get_ageing (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 11, nmc_property_vxlan_get_limit (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 12, nmc_property_vxlan_get_learning (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 13, nmc_property_vxlan_get_proxy (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 14, nmc_property_vxlan_get_rsc (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 15, nmc_property_vxlan_get_l2_miss (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
set_val_str (arr, 16, nmc_property_vxlan_get_l3_miss (setting, NMC_PROPERTY_GET_PRETTY));
|
||||
g_ptr_array_add (nmc->output_data, arr);
|
||||
|
||||
print_data (nmc); /* Print all data */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
const char *sname;
|
||||
gboolean (*func) (NMSetting *setting, NmCli *nmc, const char *one_prop, gboolean secrets);
|
||||
|
|
@ -8611,6 +8824,7 @@ static const SettingDetails detail_printers[] = {
|
|||
{ NM_SETTING_TUN_SETTING_NAME, setting_tun_details },
|
||||
{ NM_SETTING_IP_TUNNEL_SETTING_NAME, setting_ip_tunnel_details },
|
||||
{ NM_SETTING_MACVLAN_SETTING_NAME, setting_macvlan_details },
|
||||
{ NM_SETTING_VXLAN_SETTING_NAME, setting_vxlan_details },
|
||||
{ NULL },
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -694,6 +694,22 @@ The value can be prefixed with \fBifname/\fP, \fBuuid/\fP or \fBid/\fP to disamb
|
|||
.RE
|
||||
.RS
|
||||
.TP
|
||||
.B vxlan:
|
||||
.IP "\fIid <VXLAN ID>\fP" 42
|
||||
\(en VXLAN Network Identifer to use
|
||||
.IP "\fIremote <IP>\fP" 42
|
||||
\(en unicast destination IP address or multicast IP address to join
|
||||
.IP "\fI[local <IP>]\fP" 42
|
||||
\(en source IP address
|
||||
.IP "\fI[source-port-min <0-65535>]\fP" 42
|
||||
\(en minimum UDP source port to communicate to the remote VXLAN tunnel endpoint
|
||||
.IP "\fI[source-port-max <0-65535>]\fP" 42
|
||||
\(en maximum UDP source port to communicate to the remote VXLAN tunnel endpoint
|
||||
.IP "\fI[destination-port <0-65535>]\fP" 42
|
||||
\(en UDP destination port to communicate to the remote VXLAN tunnel endpoint
|
||||
.RE
|
||||
.RS
|
||||
.TP
|
||||
.B SLAVE_OPTIONS:
|
||||
.RE
|
||||
.RS
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue