2020-12-23 22:21:36 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2015-10-13 09:09:54 +02:00
|
|
|
/*
|
2019-10-01 09:20:35 +02:00
|
|
|
* Copyright (C) 2015 Red Hat, Inc.
|
2015-10-13 09:09:54 +02:00
|
|
|
*/
|
|
|
|
|
|
2021-02-12 15:01:09 +01:00
|
|
|
#include "libnm-core-impl/nm-default-libnm-core.h"
|
2015-10-13 09:09:54 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
#include "nm-setting-vxlan.h"
|
|
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
|
|
#include "nm-utils.h"
|
|
|
|
|
#include "nm-setting-private.h"
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:nm-setting-vxlan
|
|
|
|
|
* @short_description: Describes connection properties for VXLAN interfaces
|
|
|
|
|
*
|
|
|
|
|
* The #NMSettingVxlan object is a #NMSetting subclass that describes properties
|
|
|
|
|
* necessary for connection to VXLAN interfaces.
|
|
|
|
|
**/
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
#define DST_PORT_DEFAULT 8472
|
2015-10-13 09:09:54 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PARENT,
|
|
|
|
|
PROP_ID,
|
|
|
|
|
PROP_LOCAL,
|
|
|
|
|
PROP_REMOTE,
|
|
|
|
|
PROP_SOURCE_PORT_MIN,
|
|
|
|
|
PROP_SOURCE_PORT_MAX,
|
|
|
|
|
PROP_DESTINATION_PORT,
|
|
|
|
|
PROP_TOS,
|
|
|
|
|
PROP_TTL,
|
|
|
|
|
PROP_AGEING,
|
|
|
|
|
PROP_LIMIT,
|
|
|
|
|
PROP_LEARNING,
|
|
|
|
|
PROP_PROXY,
|
|
|
|
|
PROP_RSC,
|
|
|
|
|
PROP_L2_MISS,
|
|
|
|
|
PROP_L3_MISS, );
|
2015-10-13 09:09:54 +02:00
|
|
|
|
|
|
|
|
typedef struct {
|
2021-12-28 10:50:05 +01:00
|
|
|
char *parent;
|
|
|
|
|
char *local;
|
|
|
|
|
char *remote;
|
|
|
|
|
guint32 id;
|
|
|
|
|
guint32 source_port_min;
|
|
|
|
|
guint32 source_port_max;
|
|
|
|
|
guint32 destination_port;
|
|
|
|
|
guint32 tos;
|
|
|
|
|
guint32 ttl;
|
|
|
|
|
guint32 ageing;
|
|
|
|
|
guint32 limit;
|
|
|
|
|
bool proxy;
|
|
|
|
|
bool learning;
|
|
|
|
|
bool rsc;
|
|
|
|
|
bool l2_miss;
|
|
|
|
|
bool l3_miss;
|
2015-10-13 09:09:54 +02:00
|
|
|
} NMSettingVxlanPrivate;
|
|
|
|
|
|
2021-06-11 00:27:31 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:
|
|
|
|
|
*
|
|
|
|
|
* VXLAN Settings
|
|
|
|
|
*/
|
|
|
|
|
struct _NMSettingVxlan {
|
|
|
|
|
NMSetting parent;
|
2021-06-14 09:26:25 +02:00
|
|
|
/* In the past, this struct was public API. Preserve ABI! */
|
2021-06-11 00:27:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _NMSettingVxlanClass {
|
|
|
|
|
NMSettingClass parent;
|
|
|
|
|
/* In the past, this struct was public API. Preserve ABI! */
|
|
|
|
|
gpointer padding[4];
|
|
|
|
|
};
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
G_DEFINE_TYPE(NMSettingVxlan, nm_setting_vxlan, NM_TYPE_SETTING)
|
2015-10-13 09:09:54 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
#define NM_SETTING_VXLAN_GET_PRIVATE(o) \
|
|
|
|
|
(G_TYPE_INSTANCE_GET_PRIVATE((o), NM_TYPE_SETTING_VXLAN, NMSettingVxlanPrivate))
|
2015-10-13 09:09:54 +02:00
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
2015-10-13 09:09:54 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_parent:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:parent property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_vxlan_get_parent(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), NULL);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->parent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_id:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:id property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_id(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_local:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:local property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_vxlan_get_local(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), NULL);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->local;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_remote:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:remote property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
const char *
|
|
|
|
|
nm_setting_vxlan_get_remote(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), NULL);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->remote;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_source_port_min:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:source-port-min property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_source_port_min(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->source_port_min;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_source_port_max:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:source-port-max property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_source_port_max(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->source_port_max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_destination_port:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:destination-port property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_destination_port(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), DST_PORT_DEFAULT);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->destination_port;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_proxy:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:proxy property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_vxlan_get_proxy(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), FALSE);
|
|
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->proxy;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_ageing:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:ageing property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_ageing(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->ageing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_limit:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:limit property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_limit(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_tos:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:tos property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_tos(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->tos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_ttl:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:ttl property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
guint
|
|
|
|
|
nm_setting_vxlan_get_ttl(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), 0);
|
2021-12-28 10:50:05 +01:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->ttl;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_learning:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:learning property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_vxlan_get_learning(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), FALSE);
|
|
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->learning;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_rsc:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:rsc property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_vxlan_get_rsc(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), FALSE);
|
|
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->rsc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_l2_miss:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:l2_miss property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_vxlan_get_l2_miss(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), FALSE);
|
|
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->l2_miss;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_get_l3_miss:
|
|
|
|
|
* @setting: the #NMSettingVxlan
|
|
|
|
|
*
|
|
|
|
|
* Returns: the #NMSettingVxlan:l3_miss property of the setting
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
nm_setting_vxlan_get_l3_miss(NMSettingVxlan *setting)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail(NM_IS_SETTING_VXLAN(setting), FALSE);
|
|
|
|
|
return NM_SETTING_VXLAN_GET_PRIVATE(setting)->l3_miss;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-02 18:22:50 +02:00
|
|
|
/*****************************************************************************/
|
2015-10-13 09:09:54 +02:00
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
verify(NMSetting *setting, NMConnection *connection, GError **error)
|
|
|
|
|
{
|
2020-10-20 13:38:43 +02:00
|
|
|
NMSettingVxlanPrivate *priv = NM_SETTING_VXLAN_GET_PRIVATE(setting);
|
|
|
|
|
int addr_family = AF_UNSPEC;
|
|
|
|
|
gboolean remote_is_valid = TRUE;
|
|
|
|
|
gboolean local_is_valid = TRUE;
|
|
|
|
|
|
glib-aux: rename IP address related helpers from "nm-inet-utils.h"
- name things related to `in_addr_t`, `struct in6_addr`, `NMIPAddr` as
`nm_ip4_addr_*()`, `nm_ip6_addr_*()`, `nm_ip_addr_*()`, respectively.
- we have a wrapper `nm_inet_ntop()` for `inet_ntop()`. This name
of our wrapper is chosen to be familiar with the libc underlying
function. With this, also name functions that are about string
representations of addresses `nm_inet_*()`, `nm_inet4_*()`,
`nm_inet6_*()`. For example, `nm_inet_parse_str()`,
`nm_inet_is_normalized()`.
<<<<
R() {
git grep -l "$1" | xargs sed -i "s/\<$1\>/$2/g"
}
R NM_CMP_DIRECT_IN4ADDR_SAME_PREFIX NM_CMP_DIRECT_IP4_ADDR_SAME_PREFIX
R NM_CMP_DIRECT_IN6ADDR_SAME_PREFIX NM_CMP_DIRECT_IP6_ADDR_SAME_PREFIX
R NM_UTILS_INET_ADDRSTRLEN NM_INET_ADDRSTRLEN
R _nm_utils_inet4_ntop nm_inet4_ntop
R _nm_utils_inet6_ntop nm_inet6_ntop
R _nm_utils_ip4_get_default_prefix nm_ip4_addr_get_default_prefix
R _nm_utils_ip4_get_default_prefix0 nm_ip4_addr_get_default_prefix0
R _nm_utils_ip4_netmask_to_prefix nm_ip4_addr_netmask_to_prefix
R _nm_utils_ip4_prefix_to_netmask nm_ip4_addr_netmask_from_prefix
R nm_utils_inet4_ntop_dup nm_inet4_ntop_dup
R nm_utils_inet6_ntop_dup nm_inet6_ntop_dup
R nm_utils_inet_ntop nm_inet_ntop
R nm_utils_inet_ntop_dup nm_inet_ntop_dup
R nm_utils_ip4_address_clear_host_address nm_ip4_addr_clear_host_address
R nm_utils_ip4_address_is_link_local nm_ip4_addr_is_link_local
R nm_utils_ip4_address_is_loopback nm_ip4_addr_is_loopback
R nm_utils_ip4_address_is_zeronet nm_ip4_addr_is_zeronet
R nm_utils_ip4_address_same_prefix nm_ip4_addr_same_prefix
R nm_utils_ip4_address_same_prefix_cmp nm_ip4_addr_same_prefix_cmp
R nm_utils_ip6_address_clear_host_address nm_ip6_addr_clear_host_address
R nm_utils_ip6_address_same_prefix nm_ip6_addr_same_prefix
R nm_utils_ip6_address_same_prefix_cmp nm_ip6_addr_same_prefix_cmp
R nm_utils_ip6_is_ula nm_ip6_addr_is_ula
R nm_utils_ip_address_same_prefix nm_ip_addr_same_prefix
R nm_utils_ip_address_same_prefix_cmp nm_ip_addr_same_prefix_cmp
R nm_utils_ip_is_site_local nm_ip_addr_is_site_local
R nm_utils_ipaddr_is_normalized nm_inet_is_normalized
R nm_utils_ipaddr_is_valid nm_inet_is_valid
R nm_utils_ipx_address_clear_host_address nm_ip_addr_clear_host_address
R nm_utils_parse_inaddr nm_inet_parse_str
R nm_utils_parse_inaddr_bin nm_inet_parse_bin
R nm_utils_parse_inaddr_bin_full nm_inet_parse_bin_full
R nm_utils_parse_inaddr_prefix nm_inet_parse_with_prefix_str
R nm_utils_parse_inaddr_prefix_bin nm_inet_parse_with_prefix_bin
R test_nm_utils_ip6_address_same_prefix test_nm_ip_addr_same_prefix
./contrib/scripts/nm-code-format.sh -F
2022-08-19 13:15:20 +02:00
|
|
|
if (priv->remote && !nm_inet_parse_bin(addr_family, priv->remote, &addr_family, NULL))
|
2020-10-20 13:38:43 +02:00
|
|
|
remote_is_valid = FALSE;
|
glib-aux: rename IP address related helpers from "nm-inet-utils.h"
- name things related to `in_addr_t`, `struct in6_addr`, `NMIPAddr` as
`nm_ip4_addr_*()`, `nm_ip6_addr_*()`, `nm_ip_addr_*()`, respectively.
- we have a wrapper `nm_inet_ntop()` for `inet_ntop()`. This name
of our wrapper is chosen to be familiar with the libc underlying
function. With this, also name functions that are about string
representations of addresses `nm_inet_*()`, `nm_inet4_*()`,
`nm_inet6_*()`. For example, `nm_inet_parse_str()`,
`nm_inet_is_normalized()`.
<<<<
R() {
git grep -l "$1" | xargs sed -i "s/\<$1\>/$2/g"
}
R NM_CMP_DIRECT_IN4ADDR_SAME_PREFIX NM_CMP_DIRECT_IP4_ADDR_SAME_PREFIX
R NM_CMP_DIRECT_IN6ADDR_SAME_PREFIX NM_CMP_DIRECT_IP6_ADDR_SAME_PREFIX
R NM_UTILS_INET_ADDRSTRLEN NM_INET_ADDRSTRLEN
R _nm_utils_inet4_ntop nm_inet4_ntop
R _nm_utils_inet6_ntop nm_inet6_ntop
R _nm_utils_ip4_get_default_prefix nm_ip4_addr_get_default_prefix
R _nm_utils_ip4_get_default_prefix0 nm_ip4_addr_get_default_prefix0
R _nm_utils_ip4_netmask_to_prefix nm_ip4_addr_netmask_to_prefix
R _nm_utils_ip4_prefix_to_netmask nm_ip4_addr_netmask_from_prefix
R nm_utils_inet4_ntop_dup nm_inet4_ntop_dup
R nm_utils_inet6_ntop_dup nm_inet6_ntop_dup
R nm_utils_inet_ntop nm_inet_ntop
R nm_utils_inet_ntop_dup nm_inet_ntop_dup
R nm_utils_ip4_address_clear_host_address nm_ip4_addr_clear_host_address
R nm_utils_ip4_address_is_link_local nm_ip4_addr_is_link_local
R nm_utils_ip4_address_is_loopback nm_ip4_addr_is_loopback
R nm_utils_ip4_address_is_zeronet nm_ip4_addr_is_zeronet
R nm_utils_ip4_address_same_prefix nm_ip4_addr_same_prefix
R nm_utils_ip4_address_same_prefix_cmp nm_ip4_addr_same_prefix_cmp
R nm_utils_ip6_address_clear_host_address nm_ip6_addr_clear_host_address
R nm_utils_ip6_address_same_prefix nm_ip6_addr_same_prefix
R nm_utils_ip6_address_same_prefix_cmp nm_ip6_addr_same_prefix_cmp
R nm_utils_ip6_is_ula nm_ip6_addr_is_ula
R nm_utils_ip_address_same_prefix nm_ip_addr_same_prefix
R nm_utils_ip_address_same_prefix_cmp nm_ip_addr_same_prefix_cmp
R nm_utils_ip_is_site_local nm_ip_addr_is_site_local
R nm_utils_ipaddr_is_normalized nm_inet_is_normalized
R nm_utils_ipaddr_is_valid nm_inet_is_valid
R nm_utils_ipx_address_clear_host_address nm_ip_addr_clear_host_address
R nm_utils_parse_inaddr nm_inet_parse_str
R nm_utils_parse_inaddr_bin nm_inet_parse_bin
R nm_utils_parse_inaddr_bin_full nm_inet_parse_bin_full
R nm_utils_parse_inaddr_prefix nm_inet_parse_with_prefix_str
R nm_utils_parse_inaddr_prefix_bin nm_inet_parse_with_prefix_bin
R test_nm_utils_ip6_address_same_prefix test_nm_ip_addr_same_prefix
./contrib/scripts/nm-code-format.sh -F
2022-08-19 13:15:20 +02:00
|
|
|
if (priv->local && !nm_inet_parse_bin(addr_family, priv->local, &addr_family, NULL))
|
2020-10-20 13:38:43 +02:00
|
|
|
local_is_valid = FALSE;
|
|
|
|
|
|
|
|
|
|
if (!remote_is_valid) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid IP%s address"),
|
|
|
|
|
priv->remote,
|
|
|
|
|
addr_family == AF_UNSPEC ? "" : (addr_family == AF_INET ? "4" : "6"));
|
|
|
|
|
g_prefix_error(error, "%s.%s: ", NM_SETTING_VXLAN_SETTING_NAME, NM_SETTING_VXLAN_REMOTE);
|
|
|
|
|
return FALSE;
|
2015-10-13 09:09:54 +02:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2020-10-20 13:38:43 +02:00
|
|
|
if (!local_is_valid) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is not a valid IP%s address"),
|
|
|
|
|
priv->local,
|
|
|
|
|
addr_family == AF_UNSPEC ? "" : (addr_family == AF_INET ? "4" : "6"));
|
|
|
|
|
g_prefix_error(error, "%s.%s: ", NM_SETTING_VXLAN_SETTING_NAME, NM_SETTING_VXLAN_LOCAL);
|
|
|
|
|
return FALSE;
|
2015-10-13 09:09:54 +02:00
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2020-02-12 18:01:13 +01:00
|
|
|
if (priv->parent && !nm_utils_ifname_valid_kernel(priv->parent, NULL)
|
2015-10-13 09:09:54 +02:00
|
|
|
&& !nm_utils_is_uuid(priv->parent)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("'%s' is neither an UUID nor an interface name"),
|
|
|
|
|
priv->parent);
|
|
|
|
|
g_prefix_error(error, "%s.%s: ", NM_SETTING_VXLAN_SETTING_NAME, NM_SETTING_VXLAN_PARENT);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
if ((priv->source_port_min || priv->source_port_max)
|
|
|
|
|
&& (priv->source_port_min > priv->source_port_max)) {
|
|
|
|
|
g_set_error(error,
|
|
|
|
|
NM_CONNECTION_ERROR,
|
|
|
|
|
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
|
|
|
|
_("%d is greater than local port max %d"),
|
|
|
|
|
priv->source_port_min,
|
|
|
|
|
priv->source_port_max);
|
|
|
|
|
g_prefix_error(error,
|
|
|
|
|
"%s.%s: ",
|
|
|
|
|
NM_SETTING_VXLAN_SETTING_NAME,
|
|
|
|
|
NM_SETTING_VXLAN_SOURCE_PORT_MIN);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-11 08:32:54 +01:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
static void
|
2019-12-12 11:52:11 +01:00
|
|
|
nm_setting_vxlan_init(NMSettingVxlan *self)
|
2021-12-28 10:50:05 +01:00
|
|
|
{}
|
2019-01-11 08:32:54 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* nm_setting_vxlan_new:
|
|
|
|
|
*
|
|
|
|
|
* Creates a new #NMSettingVxlan object with default values.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): the new empty #NMSettingVxlan object
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
|
|
|
|
NMSetting *
|
|
|
|
|
nm_setting_vxlan_new(void)
|
|
|
|
|
{
|
2020-11-12 15:57:06 +01:00
|
|
|
return g_object_new(NM_TYPE_SETTING_VXLAN, NULL);
|
2019-01-11 08:32:54 +01:00
|
|
|
}
|
|
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
static void
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
nm_setting_vxlan_class_init(NMSettingVxlanClass *klass)
|
2015-10-13 09:09:54 +02:00
|
|
|
{
|
2021-11-09 13:28:54 +01:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
2021-06-17 22:53:52 +02:00
|
|
|
NMSettingClass *setting_class = NM_SETTING_CLASS(klass);
|
2021-11-09 13:28:54 +01:00
|
|
|
GArray *properties_override = _nm_sett_info_property_override_create_array();
|
2015-10-13 09:09:54 +02:00
|
|
|
|
libnm/trivial: cleanup variable names in settings' class-init functions
- Don't use @parent_class name. This local variable (and @object_class) is
the class instance up-cast to the pointer types of the parents. The point
here is not that it is the direct parent. The point is, that it's the
NMSettingClass type.
Also, it can only be used inconsistently, in face of NMSettingIP4Config,
who's parent type is NMSettingIPConfig. Clearly, inside
nm-setting-ip4-config.c we wouldn't want to use the "parent_class"
name. Consistently rename @parent_class to @setting_class.
- Also rename the pointer to the own class to @klass. "setting_class" is also the
wrong name for that, because the right name would be something like
"setting_6lowpan_class".
However, "klass" is preferred over the latter, because we commonly create new
GObject implementations by copying an existing one. Generic names like "klass"
and "self" inside a type implementation make that simpler.
- drop useless comments like
/* virtual functions */
/* Properties */
It's better to logically and visually structure the code, and avoid trival
remarks about that. They only end up being used inconsistently. If you
even need a stronger visual separator, then an 80 char /****/ line
should be preferred.
2018-07-28 10:43:21 +02:00
|
|
|
g_type_class_add_private(klass, sizeof(NMSettingVxlanPrivate));
|
2015-10-13 09:09:54 +02:00
|
|
|
|
2021-12-28 10:50:05 +01:00
|
|
|
object_class->get_property = _nm_setting_property_get_property_direct;
|
|
|
|
|
object_class->set_property = _nm_setting_property_set_property_direct;
|
2015-10-13 09:09:54 +02:00
|
|
|
|
libnm: rework setting metadata for property handling
NMSetting internally already tracked a list of all proper GObject properties
and D-Bus-only properties.
Rework the tracking of the list, so that:
- instead of attaching the data to the GType of the setting via
g_type_set_qdata(), it is tracked in a static array indexed by
NMMetaSettingType. This allows to find the setting-data by simple
pointer arithmetic, instead of taking a look and iterating (like
g_type_set_qdata() does).
Note, that this is still thread safe, because the static table entry is
initialized in the class-init function with _nm_setting_class_commit().
And it only accessed by following a NMSettingClass instance, thus
the class constructor already ran (maybe not for all setting classes,
but for the particular one that we look up).
I think this makes initialization of the metadata simpler to
understand.
Previously, in a first phase each class would attach the metadata
to the GType as setting_property_overrides_quark(). Then during
nm_setting_class_ensure_properties() it would merge them and
set as setting_properties_quark(). Now, during the first phase,
we only incrementally build a properties_override GArray, which
we finally hand over during nm_setting_class_commit().
- sort the property infos by name and do binary search.
Also expose this meta data types as internal API in nm-setting-private.h.
While not accessed yet, it can prove beneficial, to have direct (internal)
access to these structures.
Also, rename NMSettingProperty to NMSettInfoProperty to use a distinct
naming scheme. We already have 40+ subclasses of NMSetting that are called
NMSetting*. Likewise, NMMetaSetting* is heavily used already. So, choose a
new, distinct name.
2018-07-28 15:26:03 +02:00
|
|
|
setting_class->verify = verify;
|
2015-10-13 09:09:54 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:parent:
|
|
|
|
|
*
|
|
|
|
|
* If given, specifies the parent interface name or parent connection UUID.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_PARENT,
|
|
|
|
|
PROP_PARENT,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
parent);
|
2021-06-28 17:28:21 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:id:
|
|
|
|
|
*
|
2017-05-28 17:34:31 +03:00
|
|
|
* Specifies the VXLAN Network Identifier (or VXLAN Segment Identifier) to
|
2015-10-13 09:09:54 +02:00
|
|
|
* use.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_ID,
|
|
|
|
|
PROP_ID,
|
|
|
|
|
0,
|
|
|
|
|
(1 << 24) - 1,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
id);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:local:
|
|
|
|
|
*
|
|
|
|
|
* If given, specifies the source IP address to use in outgoing packets.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_LOCAL,
|
|
|
|
|
PROP_LOCAL,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
local,
|
|
|
|
|
.direct_set_string_ip_address_addr_family =
|
|
|
|
|
AF_UNSPEC + 1);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:remote:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the unicast destination IP address to use in outgoing packets
|
|
|
|
|
* when the destination link layer address is not known in the VXLAN device
|
|
|
|
|
* forwarding database, or the multicast IP address to join.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_string(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_REMOTE,
|
|
|
|
|
PROP_REMOTE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
remote,
|
|
|
|
|
.direct_set_string_ip_address_addr_family =
|
|
|
|
|
AF_UNSPEC + 1);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:source-port-min:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the minimum UDP source port to communicate to the remote VXLAN
|
|
|
|
|
* tunnel endpoint.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_SOURCE_PORT_MIN,
|
|
|
|
|
PROP_SOURCE_PORT_MIN,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT16,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
source_port_min);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:source-port-max:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the maximum UDP source port to communicate to the remote VXLAN
|
|
|
|
|
* tunnel endpoint.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_SOURCE_PORT_MAX,
|
|
|
|
|
PROP_SOURCE_PORT_MAX,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT16,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
source_port_max);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:destination-port:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the UDP destination port to communicate to the remote VXLAN
|
|
|
|
|
* tunnel endpoint.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_DESTINATION_PORT,
|
|
|
|
|
PROP_DESTINATION_PORT,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT16,
|
|
|
|
|
DST_PORT_DEFAULT,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
destination_port);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:ageing:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the lifetime in seconds of FDB entries learnt by the kernel.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_AGEING,
|
|
|
|
|
PROP_AGEING,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
300,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
ageing);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:limit:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the maximum number of FDB entries. A value of zero means that
|
|
|
|
|
* the kernel will store unlimited entries.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_LIMIT,
|
|
|
|
|
PROP_LIMIT,
|
|
|
|
|
0,
|
|
|
|
|
G_MAXUINT32,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
limit);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:tos:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the TOS value to use in outgoing packets.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_TOS,
|
|
|
|
|
PROP_TOS,
|
|
|
|
|
0,
|
|
|
|
|
255,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
tos);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:ttl:
|
|
|
|
|
*
|
|
|
|
|
* Specifies the time-to-live value to use in outgoing packets.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-12-28 10:50:05 +01:00
|
|
|
_nm_setting_property_define_direct_uint32(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_TTL,
|
|
|
|
|
PROP_TTL,
|
|
|
|
|
0,
|
|
|
|
|
255,
|
|
|
|
|
0,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
ttl);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:proxy:
|
|
|
|
|
*
|
|
|
|
|
* Specifies whether ARP proxy is turned on.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_PROXY,
|
|
|
|
|
PROP_PROXY,
|
|
|
|
|
FALSE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
proxy);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:learning:
|
|
|
|
|
*
|
|
|
|
|
* Specifies whether unknown source link layer addresses and IP addresses
|
|
|
|
|
* are entered into the VXLAN device forwarding database.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_LEARNING,
|
|
|
|
|
PROP_LEARNING,
|
|
|
|
|
TRUE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
learning);
|
2021-06-17 22:53:52 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:rsc:
|
|
|
|
|
*
|
|
|
|
|
* Specifies whether route short circuit is turned on.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_RSC,
|
|
|
|
|
PROP_RSC,
|
|
|
|
|
FALSE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
rsc);
|
2021-06-17 22:53:52 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:l2-miss:
|
|
|
|
|
*
|
|
|
|
|
* Specifies whether netlink LL ADDR miss notifications are generated.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_L2_MISS,
|
|
|
|
|
PROP_L2_MISS,
|
|
|
|
|
FALSE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
l2_miss);
|
2020-09-28 16:03:33 +02:00
|
|
|
|
2015-10-13 09:09:54 +02:00
|
|
|
/**
|
|
|
|
|
* NMSettingVxlan:l3-miss:
|
|
|
|
|
*
|
|
|
|
|
* Specifies whether netlink IP ADDR miss notifications are generated.
|
|
|
|
|
*
|
|
|
|
|
* Since: 1.2
|
|
|
|
|
**/
|
2021-06-28 17:28:21 +02:00
|
|
|
_nm_setting_property_define_direct_boolean(properties_override,
|
|
|
|
|
obj_properties,
|
|
|
|
|
NM_SETTING_VXLAN_L3_MISS,
|
|
|
|
|
PROP_L3_MISS,
|
|
|
|
|
FALSE,
|
|
|
|
|
NM_SETTING_PARAM_INFERRABLE,
|
|
|
|
|
NMSettingVxlanPrivate,
|
|
|
|
|
l3_miss);
|
2019-01-11 08:28:26 +01:00
|
|
|
|
|
|
|
|
g_object_class_install_properties(object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
libnm: rework setting metadata for property handling
NMSetting internally already tracked a list of all proper GObject properties
and D-Bus-only properties.
Rework the tracking of the list, so that:
- instead of attaching the data to the GType of the setting via
g_type_set_qdata(), it is tracked in a static array indexed by
NMMetaSettingType. This allows to find the setting-data by simple
pointer arithmetic, instead of taking a look and iterating (like
g_type_set_qdata() does).
Note, that this is still thread safe, because the static table entry is
initialized in the class-init function with _nm_setting_class_commit().
And it only accessed by following a NMSettingClass instance, thus
the class constructor already ran (maybe not for all setting classes,
but for the particular one that we look up).
I think this makes initialization of the metadata simpler to
understand.
Previously, in a first phase each class would attach the metadata
to the GType as setting_property_overrides_quark(). Then during
nm_setting_class_ensure_properties() it would merge them and
set as setting_properties_quark(). Now, during the first phase,
we only incrementally build a properties_override GArray, which
we finally hand over during nm_setting_class_commit().
- sort the property infos by name and do binary search.
Also expose this meta data types as internal API in nm-setting-private.h.
While not accessed yet, it can prove beneficial, to have direct (internal)
access to these structures.
Also, rename NMSettingProperty to NMSettInfoProperty to use a distinct
naming scheme. We already have 40+ subclasses of NMSetting that are called
NMSetting*. Likewise, NMMetaSetting* is heavily used already. So, choose a
new, distinct name.
2018-07-28 15:26:03 +02:00
|
|
|
|
2021-06-28 14:53:16 +02:00
|
|
|
_nm_setting_class_commit(setting_class,
|
|
|
|
|
NM_META_SETTING_TYPE_VXLAN,
|
|
|
|
|
NULL,
|
|
|
|
|
properties_override,
|
|
|
|
|
NM_SETT_INFO_PRIVATE_OFFSET_FROM_CLASS);
|
2015-10-13 09:09:54 +02:00
|
|
|
}
|