core: merge branch 'th/l3cfg-18'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/854
This commit is contained in:
Thomas Haller 2021-05-18 13:43:44 +02:00
commit 890eda4db8
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
24 changed files with 306 additions and 157 deletions

View file

@ -105,9 +105,11 @@ ForEachMacros: ['c_list_for_each',
'nm_ip_config_iter_ip_route_for_each',
'nm_json_array_foreach',
'nm_json_object_foreach',
'nm_l3_config_data_iter_ip_address_for_each',
'nm_l3_config_data_iter_ip4_address_for_each',
'nm_l3_config_data_iter_ip4_route_for_each',
'nm_l3_config_data_iter_ip6_address_for_each',
'nm_l3_config_data_iter_ip_route_for_each',
'nm_l3_config_data_iter_ip4_route_for_each',
'nm_l3_config_data_iter_ip6_route_for_each',
'nm_l3_config_data_iter_obj_for_each',
'nm_manager_for_each_active_connection',

View file

@ -197,18 +197,20 @@ nm_dhcp_lease_get_options(NMDhcpLease *lease)
return (GHashTable *) lease;
}
static inline void
static inline NMDhcpLease *
nm_dhcp_lease_ref(NMDhcpLease *lease)
{
if (lease)
g_hash_table_ref((GHashTable *) lease);
return lease;
}
static inline void
static inline NMDhcpLease *
nm_dhcp_lease_unref(NMDhcpLease *lease)
{
if (lease)
g_hash_table_unref((GHashTable *) lease);
return NULL;
}
static inline const char *

View file

@ -109,8 +109,6 @@ nm_device_activate_ip6_state_done(NMDevice *self)
return nm_device_activate_get_ip_state(self, AF_INET6) == NM_DEVICE_IP_STATE_DONE;
}
void nm_device_set_dhcp_anycast_address(NMDevice *device, const char *addr);
gboolean nm_device_dhcp4_renew(NMDevice *device, gboolean release);
gboolean nm_device_dhcp6_renew(NMDevice *device, gboolean release);

View file

@ -499,9 +499,6 @@ typedef struct _NMDevicePrivate {
NMDeviceStageState stage1_sriov_state : 3;
/* Generic DHCP stuff */
char *dhcp_anycast_address;
char *current_stable_id;
/* Proxy Configuration */
@ -8901,6 +8898,21 @@ ensure_con_ip_config(NMDevice *self, int addr_family)
/*****************************************************************************/
static const char *
_device_get_dhcp_anycast_address(NMDevice *self)
{
NMDeviceClass *klass;
nm_assert(NM_IS_DEVICE(self));
klass = NM_DEVICE_GET_CLASS(self);
if (klass->get_dhcp_anycast_address)
return klass->get_dhcp_anycast_address(self);
return NULL;
}
static void
dhcp4_cleanup(NMDevice *self, CleanupType cleanup_type, gboolean release)
{
@ -9469,7 +9481,7 @@ dhcp4_start(NMDevice *self)
_prop_get_connection_mud_url(self, s_con, &mud_url_free),
client_id,
_prop_get_ipvx_dhcp_timeout(self, AF_INET),
priv->dhcp_anycast_address,
_device_get_dhcp_anycast_address(self),
NULL,
vendor_class_identifier,
reject_servers,
@ -9922,7 +9934,7 @@ dhcp6_start_with_link_ready(NMDevice *self, NMConnection *connection)
iaid,
iaid_explicit,
_prop_get_ipvx_dhcp_timeout(self, AF_INET6),
priv->dhcp_anycast_address,
_device_get_dhcp_anycast_address(self),
nm_setting_ip6_config_get_ip6_privacy(NM_SETTING_IP6_CONFIG(s_ip6)),
priv->dhcp6.needed_prefixes,
&error);
@ -15075,20 +15087,6 @@ nm_device_set_unmanaged_by_quitting(NMDevice *self)
/*****************************************************************************/
void
nm_device_set_dhcp_anycast_address(NMDevice *self, const char *addr)
{
NMDevicePrivate *priv;
g_return_if_fail(NM_IS_DEVICE(self));
g_return_if_fail(!addr || nm_utils_hwaddr_valid(addr, ETH_ALEN));
priv = NM_DEVICE_GET_PRIVATE(self);
g_free(priv->dhcp_anycast_address);
priv->dhcp_anycast_address = g_strdup(addr);
}
void
nm_device_reapply_settings_immediately(NMDevice *self)
{
@ -18448,7 +18446,6 @@ finalize(GObject *object)
g_free(priv->driver_version);
g_free(priv->firmware_version);
g_free(priv->type_desc);
g_free(priv->dhcp_anycast_address);
g_free(priv->current_stable_id);
g_hash_table_unref(priv->ip6_saved_properties);

View file

@ -412,6 +412,8 @@ typedef struct _NMDeviceClass {
gboolean (*set_platform_mtu)(NMDevice *self, guint32 mtu);
const char *(*get_dhcp_anycast_address)(NMDevice *self);
} NMDeviceClass;
GType nm_device_get_type(void);

View file

@ -122,6 +122,17 @@ complete_connection(NMDevice * device,
/*****************************************************************************/
static const char *
get_dhcp_anycast_address(NMDevice *device)
{
NMSettingOlpcMesh *s_mesh;
s_mesh = nm_device_get_applied_setting(device, NM_TYPE_SETTING_OLPC_MESH);
return s_mesh ? nm_setting_olpc_mesh_get_dhcp_anycast_address(s_mesh) : NULL;
}
/*****************************************************************************/
static NMActStageReturn
act_stage1_prepare(NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
@ -178,7 +189,6 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
NMDeviceOlpcMesh * self = NM_DEVICE_OLPC_MESH(device);
NMSettingOlpcMesh *s_mesh;
GBytes * ssid;
const char * anycast_addr;
gboolean success;
s_mesh = nm_device_get_applied_setting(device, NM_TYPE_SETTING_OLPC_MESH);
@ -197,9 +207,6 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason)
return NM_ACT_STAGE_RETURN_FAILURE;
}
anycast_addr = nm_setting_olpc_mesh_get_dhcp_anycast_address(s_mesh);
nm_device_set_dhcp_anycast_address(device, anycast_addr);
if (!_mesh_set_channel(self, nm_setting_olpc_mesh_get_channel(s_mesh))) {
_LOGW(LOGD_WIFI, "Unable to set the mesh channel");
return NM_ACT_STAGE_RETURN_FAILURE;
@ -527,6 +534,7 @@ nm_device_olpc_mesh_class_init(NMDeviceOlpcMeshClass *klass)
device_class->act_stage2_config = act_stage2_config;
device_class->state_changed = state_changed;
device_class->get_dhcp_timeout_for_device = get_dhcp_timeout_for_device;
device_class->get_dhcp_anycast_address = get_dhcp_anycast_address;
obj_properties[PROP_COMPANION] = g_param_spec_string(NM_DEVICE_OLPC_MESH_COMPANION,
"",

View file

@ -13,6 +13,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include "libnm-glib-aux/nm-dedup-multi.h"
#include "libnm-glib-aux/nm-random-utils.h"
@ -33,6 +34,7 @@ static guint signals[LAST_SIGNAL] = {0};
NM_GOBJECT_PROPERTIES_DEFINE(NMDhcpClient,
PROP_ADDR_FAMILY,
PROP_ANYCAST_ADDRESS,
PROP_FLAGS,
PROP_HWADDR,
PROP_BROADCAST_HWADDR,
@ -61,6 +63,7 @@ typedef struct _NMDhcpClientPrivate {
char * hostname;
const char ** reject_servers;
char * mud_url;
char * anycast_address;
GBytes * vendor_class_identifier;
pid_t pid;
guint timeout_id;
@ -280,6 +283,14 @@ nm_dhcp_client_set_client_id_bin(NMDhcpClient *self,
_set_client_id(self, b, TRUE);
}
const char *
nm_dhcp_client_get_anycast_address(NMDhcpClient *self)
{
g_return_val_if_fail(NM_IS_DHCP_CLIENT(self), NULL);
return NM_DHCP_CLIENT_GET_PRIVATE(self)->anycast_address;
}
const char *
nm_dhcp_client_get_hostname(NMDhcpClient *self)
{
@ -574,7 +585,6 @@ nm_dhcp_client_stop_watch_child(NMDhcpClient *self, pid_t pid)
gboolean
nm_dhcp_client_start_ip4(NMDhcpClient *self,
GBytes * client_id,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
{
@ -594,10 +604,7 @@ nm_dhcp_client_start_ip4(NMDhcpClient *self,
nm_dhcp_client_set_client_id(self, client_id);
return NM_DHCP_CLIENT_GET_CLASS(self)->ip4_start(self,
dhcp_anycast_addr,
last_ip4_address,
error);
return NM_DHCP_CLIENT_GET_CLASS(self)->ip4_start(self, last_ip4_address, error);
}
gboolean
@ -634,7 +641,6 @@ gboolean
nm_dhcp_client_start_ip6(NMDhcpClient * self,
GBytes * client_id,
gboolean enforce_duid,
const char * dhcp_anycast_addr,
const struct in6_addr * ll_addr,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
@ -663,8 +669,11 @@ nm_dhcp_client_start_ip6(NMDhcpClient * self,
else
_LOGI("activation: beginning transaction (timeout in %u seconds)", (guint) priv->timeout);
return NM_DHCP_CLIENT_GET_CLASS(self)
->ip6_start(self, dhcp_anycast_addr, ll_addr, privacy, needed_prefixes, error);
return NM_DHCP_CLIENT_GET_CLASS(self)->ip6_start(self,
ll_addr,
privacy,
needed_prefixes,
error);
}
void
@ -1073,6 +1082,10 @@ set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *ps
/* construct-only */
priv->hwaddr = g_value_dup_boxed(value);
break;
case PROP_ANYCAST_ADDRESS:
/* construct-only */
priv->anycast_address = g_value_dup_string(value);
break;
case PROP_BROADCAST_HWADDR:
/* construct-only */
priv->bcast_hwaddr = g_value_dup_boxed(value);
@ -1162,6 +1175,8 @@ constructed(GObject *object)
nm_assert(!NM_FLAGS_ANY(priv->client_flags, NM_DHCP_CLIENT_FLAGS_REQUEST_BROADCAST));
}
nm_assert(!priv->anycast_address || nm_utils_hwaddr_valid(priv->anycast_address, ETH_ALEN));
G_OBJECT_CLASS(nm_dhcp_client_parent_class)->constructed(object);
}
#endif
@ -1185,6 +1200,7 @@ dispose(GObject *object)
nm_clear_g_free(&priv->iface);
nm_clear_g_free(&priv->hostname);
nm_clear_g_free(&priv->uuid);
nm_clear_g_free(&priv->anycast_address);
nm_clear_g_free(&priv->mud_url);
nm_clear_g_free(&priv->reject_servers);
nm_clear_pointer(&priv->client_id, g_bytes_unref);
@ -1259,6 +1275,13 @@ nm_dhcp_client_class_init(NMDhcpClientClass *client_class)
AF_UNSPEC,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_ANYCAST_ADDRESS] =
g_param_spec_string(NM_DHCP_CLIENT_ANYCAST_ADDRESS,
"",
"",
NULL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
obj_properties[PROP_UUID] =
g_param_spec_string(NM_DHCP_CLIENT_UUID,
"",

View file

@ -25,6 +25,7 @@
(G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_DHCP_CLIENT, NMDhcpClientClass))
#define NM_DHCP_CLIENT_ADDR_FAMILY "addr-family"
#define NM_DHCP_CLIENT_ANYCAST_ADDRESS "anycast-address"
#define NM_DHCP_CLIENT_FLAGS "flags"
#define NM_DHCP_CLIENT_HWADDR "hwaddr"
#define NM_DHCP_CLIENT_BROADCAST_HWADDR "broadcast-hwaddr"
@ -82,17 +83,13 @@ typedef enum _nm_packed {
typedef struct {
GObjectClass parent;
gboolean (*ip4_start)(NMDhcpClient *self,
const char * anycast_addr,
const char * last_ip4_address,
GError ** error);
gboolean (*ip4_start)(NMDhcpClient *self, const char *last_ip4_address, GError **error);
gboolean (*accept)(NMDhcpClient *self, GError **error);
gboolean (*decline)(NMDhcpClient *self, const char *error_message, GError **error);
gboolean (*ip6_start)(NMDhcpClient * self,
const char * anycast_addr,
const struct in6_addr * ll_addr,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
@ -132,6 +129,8 @@ GBytes *nm_dhcp_client_get_hw_addr(NMDhcpClient *self);
GBytes *nm_dhcp_client_get_broadcast_hw_addr(NMDhcpClient *self);
const char *nm_dhcp_client_get_anycast_address(NMDhcpClient *self);
guint32 nm_dhcp_client_get_route_table(NMDhcpClient *self);
void nm_dhcp_client_set_route_table(NMDhcpClient *self, guint32 route_table);
@ -160,14 +159,12 @@ GBytes *nm_dhcp_client_get_vendor_class_identifier(NMDhcpClient *self);
gboolean nm_dhcp_client_start_ip4(NMDhcpClient *self,
GBytes * client_id,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error);
gboolean nm_dhcp_client_start_ip6(NMDhcpClient * self,
GBytes * client_id,
gboolean enforce_duid,
const char * dhcp_anycast_addr,
const struct in6_addr * ll_addr,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,

View file

@ -291,7 +291,7 @@ char *
nm_dhcp_dhclient_create_config(const char * interface,
int addr_family,
GBytes * client_id,
const char * anycast_addr,
const char * anycast_address,
const char * hostname,
guint32 timeout,
gboolean use_fqdn,
@ -308,7 +308,8 @@ nm_dhcp_dhclient_create_config(const char * interface,
gboolean reset_reqlist = FALSE;
int i;
g_return_val_if_fail(!anycast_addr || nm_utils_hwaddr_valid(anycast_addr, ETH_ALEN), NULL);
g_return_val_if_fail(!anycast_address || nm_utils_hwaddr_valid(anycast_address, ETH_ALEN),
NULL);
g_return_val_if_fail(NM_IN_SET(addr_family, AF_INET, AF_INET6), NULL);
g_return_val_if_fail(!reject_servers || addr_family == AF_INET, NULL);
nm_assert(!out_new_client_id || !*out_new_client_id);
@ -508,14 +509,14 @@ nm_dhcp_dhclient_create_config(const char * interface,
g_string_append_c(new_contents, '\n');
if (anycast_addr) {
if (anycast_address) {
g_string_append_printf(new_contents,
"interface \"%s\" {\n"
" initial-interval 1; \n"
" anycast-mac ethernet %s;\n"
"}\n",
interface,
anycast_addr);
anycast_address);
}
return g_string_free(g_steal_pointer(&new_contents), FALSE);

View file

@ -151,7 +151,7 @@ merge_dhclient_config(NMDhcpDhclient * self,
const char * iface,
const char * conf_file,
GBytes * client_id,
const char * anycast_addr,
const char * anycast_address,
const char * hostname,
guint32 timeout,
gboolean use_fqdn,
@ -180,7 +180,7 @@ merge_dhclient_config(NMDhcpDhclient * self,
new = nm_dhcp_dhclient_create_config(iface,
addr_family,
client_id,
anycast_addr,
anycast_address,
hostname,
timeout,
use_fqdn,
@ -280,7 +280,7 @@ create_dhclient_config(NMDhcpDhclient * self,
const char * iface,
const char * uuid,
GBytes * client_id,
const char * dhcp_anycast_addr,
const char * anycast_address,
const char * hostname,
guint32 timeout,
gboolean use_fqdn,
@ -312,7 +312,7 @@ create_dhclient_config(NMDhcpDhclient * self,
iface,
new,
client_id,
dhcp_anycast_addr,
anycast_address,
hostname,
timeout,
use_fqdn,
@ -514,10 +514,7 @@ dhclient_start(NMDhcpClient *client,
}
static gboolean
ip4_start(NMDhcpClient *client,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
ip4_start(NMDhcpClient *client, const char *last_ip4_address, GError **error)
{
NMDhcpDhclient * self = NM_DHCP_DHCLIENT(client);
NMDhcpDhclientPrivate *priv = NM_DHCP_DHCLIENT_GET_PRIVATE(self);
@ -532,7 +529,7 @@ ip4_start(NMDhcpClient *client,
nm_dhcp_client_get_iface(client),
nm_dhcp_client_get_uuid(client),
client_id,
dhcp_anycast_addr,
nm_dhcp_client_get_anycast_address(client),
nm_dhcp_client_get_hostname(client),
nm_dhcp_client_get_timeout(client),
NM_FLAGS_HAS(nm_dhcp_client_get_client_flags(client), NM_DHCP_CLIENT_FLAGS_USE_FQDN),
@ -556,7 +553,6 @@ ip4_start(NMDhcpClient *client,
static gboolean
ip6_start(NMDhcpClient * client,
const char * dhcp_anycast_addr,
const struct in6_addr * ll_addr,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
@ -573,7 +569,7 @@ ip6_start(NMDhcpClient * client,
nm_dhcp_client_get_iface(client),
nm_dhcp_client_get_uuid(client),
NULL,
dhcp_anycast_addr,
nm_dhcp_client_get_anycast_address(client),
nm_dhcp_client_get_hostname(client),
nm_dhcp_client_get_timeout(client),
TRUE,

View file

@ -161,10 +161,7 @@ dhcpcanon_start(NMDhcpClient *client,
}
static gboolean
ip4_start(NMDhcpClient *client,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
ip4_start(NMDhcpClient *client, const char *last_ip4_address, GError **error)
{
return dhcpcanon_start(client, NULL, NULL, FALSE, NULL, 0, error);
}

View file

@ -65,10 +65,7 @@ nm_dhcp_dhcpcd_get_path(void)
}
static gboolean
ip4_start(NMDhcpClient *client,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
ip4_start(NMDhcpClient *client, const char *last_ip4_address, GError **error)
{
NMDhcpDhcpcd * self = NM_DHCP_DHCPCD(client);
gs_unref_ptrarray GPtrArray *argv = NULL;

View file

@ -214,7 +214,7 @@ client_start(NMDhcpManager * self,
gboolean iaid_explicit,
guint32 timeout,
NMDhcpClientFlags client_flags,
const char * dhcp_anycast_addr,
const char * anycast_address,
const char * hostname,
NMDhcpHostnameFlags hostname_flags,
const char * mud_url,
@ -337,6 +337,8 @@ client_start(NMDhcpManager * self,
reject_servers,
NM_DHCP_CLIENT_FLAGS,
(guint) client_flags,
NM_DHCP_CLIENT_ANYCAST_ADDRESS,
anycast_address,
NULL);
nm_assert(client && c_list_is_empty(&client->dhcp_client_lst));
c_list_link_tail(&priv->dhcp_client_lst_head, &client->dhcp_client_lst);
@ -372,16 +374,11 @@ client_start(NMDhcpManager * self,
*/
if (addr_family == AF_INET) {
success = nm_dhcp_client_start_ip4(client,
dhcp_client_id,
dhcp_anycast_addr,
last_ip4_address,
error);
success = nm_dhcp_client_start_ip4(client, dhcp_client_id, last_ip4_address, error);
} else {
success = nm_dhcp_client_start_ip6(client,
dhcp_client_id,
enforce_duid,
dhcp_anycast_addr,
ipv6_ll_addr,
privacy,
needed_prefixes,
@ -415,7 +412,7 @@ nm_dhcp_manager_start_ip4(NMDhcpManager * self,
const char * mud_url,
GBytes * dhcp_client_id,
guint32 timeout,
const char * dhcp_anycast_addr,
const char * anycast_address,
const char * last_ip_address,
GBytes * vendor_class_identifier,
const char *const * reject_servers,
@ -475,7 +472,7 @@ nm_dhcp_manager_start_ip4(NMDhcpManager * self,
FALSE,
timeout,
client_flags | (use_fqdn ? NM_DHCP_CLIENT_FLAGS_USE_FQDN : NM_DHCP_CLIENT_FLAGS_NONE),
dhcp_anycast_addr,
anycast_address,
hostname,
hostname_flags,
mud_url,
@ -507,7 +504,7 @@ nm_dhcp_manager_start_ip6(NMDhcpManager * self,
guint32 iaid,
gboolean iaid_explicit,
guint32 timeout,
const char * dhcp_anycast_addr,
const char * anycast_address,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
GError ** error)
@ -542,7 +539,7 @@ nm_dhcp_manager_start_ip6(NMDhcpManager * self,
iaid_explicit,
timeout,
client_flags | NM_DHCP_CLIENT_FLAGS_USE_FQDN,
dhcp_anycast_addr,
anycast_address,
hostname,
hostname_flags,
mud_url,

View file

@ -49,7 +49,7 @@ NMDhcpClient *nm_dhcp_manager_start_ip4(NMDhcpManager * manager,
const char * mud_url,
GBytes * dhcp_client_id,
guint32 timeout,
const char * dhcp_anycast_addr,
const char * anycast_address,
const char * last_ip_address,
GBytes * vendor_class_identifier,
const char *const * reject_servers,
@ -73,7 +73,7 @@ NMDhcpClient *nm_dhcp_manager_start_ip6(NMDhcpManager * manager,
guint32 iaid,
gboolean iaid_explicit,
guint32 timeout,
const char * dhcp_anycast_addr,
const char * anycast_address,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
GError ** error);

View file

@ -874,7 +874,7 @@ dhcp4_event_cb(int fd, GIOCondition condition, gpointer user_data)
}
static gboolean
nettools_create(NMDhcpNettools *self, const char *dhcp_anycast_addr, GError **error)
nettools_create(NMDhcpNettools *self, GError **error)
{
NMDhcpNettoolsPrivate *priv = NM_DHCP_NETTOOLS_GET_PRIVATE(self);
nm_auto(n_dhcp4_client_config_freep) NDhcp4ClientConfig *config = NULL;
@ -893,6 +893,8 @@ nettools_create(NMDhcpNettools *self, const char *dhcp_anycast_addr, GError **er
g_return_val_if_fail(!priv->client, FALSE);
/* TODO: honor nm_dhcp_client_get_anycast_address() */
hwaddr = nm_dhcp_client_get_hw_addr(NM_DHCP_CLIENT(self));
if (!hwaddr || !(hwaddr_arr = g_bytes_get_data(hwaddr, &hwaddr_len))
|| (arp_type = nm_utils_arp_type_detect_from_hwaddrlen(hwaddr_len)) < 0) {
@ -1035,10 +1037,7 @@ fqdn_flags_to_wire(NMDhcpHostnameFlags flags)
}
static gboolean
ip4_start(NMDhcpClient *client,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
ip4_start(NMDhcpClient *client, const char *last_ip4_address, GError **error)
{
nm_auto(n_dhcp4_client_probe_config_freep) NDhcp4ClientProbeConfig *config = NULL;
NMDhcpNettools * self = NM_DHCP_NETTOOLS(client);
@ -1052,7 +1051,7 @@ ip4_start(NMDhcpClient *client,
g_return_val_if_fail(!priv->probe, FALSE);
if (!nettools_create(self, dhcp_anycast_addr, error))
if (!nettools_create(self, error))
return FALSE;
r = n_dhcp4_client_probe_config_new(&config);

View file

@ -543,10 +543,7 @@ dhcp_event_cb(sd_dhcp_client *client, int event, gpointer user_data)
}
static gboolean
ip4_start(NMDhcpClient *client,
const char * dhcp_anycast_addr,
const char * last_ip4_address,
GError ** error)
ip4_start(NMDhcpClient *client, const char *last_ip4_address, GError **error)
{
nm_auto(sd_dhcp_client_unrefp) sd_dhcp_client *sd_client = NULL;
NMDhcpSystemd * self = NM_DHCP_SYSTEMD(client);
@ -572,6 +569,8 @@ ip4_start(NMDhcpClient *client,
g_return_val_if_fail(!priv->client4, FALSE);
g_return_val_if_fail(!priv->client6, FALSE);
/* TODO: honor nm_dhcp_client_get_anycast_address() */
r = sd_dhcp_client_new(&sd_client, FALSE);
if (r < 0) {
nm_utils_error_set_errno(error, r, "failed to create dhcp-client: %s");
@ -912,7 +911,6 @@ dhcp6_event_cb(sd_dhcp6_client *client, int event, gpointer user_data)
static gboolean
ip6_start(NMDhcpClient * client,
const char * dhcp_anycast_addr,
const struct in6_addr * ll_addr,
NMSettingIP6ConfigPrivacy privacy,
guint needed_prefixes,
@ -931,6 +929,8 @@ ip6_start(NMDhcpClient * client,
g_return_val_if_fail(!priv->client4, FALSE);
g_return_val_if_fail(!priv->client6, FALSE);
/* TODO: honor nm_dhcp_client_get_anycast_address() */
if (!(duid = nm_dhcp_client_get_client_id(client))
|| !(duid_arr = g_bytes_get_data(duid, &duid_len)) || duid_len < 2) {
nm_utils_error_set_literal(error, NM_UTILS_ERROR_UNKNOWN, "missing DUID");

View file

@ -87,9 +87,6 @@ typedef struct {
CList ip_config_lst_head;
GVariant *config_variant;
NMDnsConfigIPData *best_ip_config_4;
NMDnsConfigIPData *best_ip_config_6;
bool ip_config_lst_need_sort : 1;
bool configs_lst_need_sort : 1;
@ -1851,7 +1848,6 @@ nm_dns_manager_set_ip_config(NMDnsManager * self,
NMDnsConfigIPData * ip_data;
NMDnsConfigData * data;
int ifindex;
NMDnsConfigIPData ** p_best;
g_return_val_if_fail(NM_IS_DNS_MANAGER(self), FALSE);
g_return_val_if_fail(NM_IS_IP_CONFIG(ip_config), FALSE);
@ -1870,10 +1866,6 @@ nm_dns_manager_set_ip_config(NMDnsManager * self,
if (ip_config_type == NM_DNS_IP_CONFIG_TYPE_REMOVED) {
if (!ip_data)
return FALSE;
if (priv->best_ip_config_4 == ip_data)
priv->best_ip_config_4 = NULL;
if (priv->best_ip_config_6 == ip_data)
priv->best_ip_config_6 = NULL;
/* deleting a config doesn't invalidate the configs' sort order. */
_dns_config_ip_data_free(ip_data);
if (c_list_is_empty(&data->data_lst_head))
@ -1906,20 +1898,6 @@ nm_dns_manager_set_ip_config(NMDnsManager * self,
priv->ip_config_lst_need_sort = TRUE;
p_best = NM_IS_IP4_CONFIG(ip_config) ? &priv->best_ip_config_4 : &priv->best_ip_config_6;
if (ip_config_type == NM_DNS_IP_CONFIG_TYPE_BEST_DEVICE) {
/* Only one best-device per IP version is allowed */
if (*p_best != ip_data) {
if (*p_best)
(*p_best)->ip_config_type = NM_DNS_IP_CONFIG_TYPE_DEFAULT;
*p_best = ip_data;
}
} else {
if (*p_best == ip_data)
*p_best = NULL;
}
changed:
if (!priv->updates_queue) {
gs_free_error GError *error = NULL;
@ -2584,9 +2562,6 @@ dispose(GObject *object)
g_clear_object(&priv->sd_resolve_plugin);
_clear_plugin(self);
priv->best_ip_config_4 = NULL;
priv->best_ip_config_6 = NULL;
c_list_for_each_entry_safe (ip_data, ip_data_safe, &priv->ip_config_lst_head, ip_config_lst)
_dns_config_ip_data_free(ip_data);

View file

@ -796,8 +796,8 @@ nm_l3_config_data_lookup_route(const NML3ConfigData * self,
int addr_family,
const NMPlatformIPRoute *needle)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
NMPObject obj_stack;
const int IS_IPv4 = NM_IS_IPv4(addr_family);
NMPObject obj_stack;
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
nm_assert_addr_family(addr_family);
@ -895,7 +895,7 @@ nmtst_l3_config_data_get_obj_at(const NML3ConfigData *self, NMPObjectType obj_ty
gboolean
nm_l3_config_data_has_routes_with_type_local(const NML3ConfigData *self, int addr_family)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
NML3ConfigData * self_mutable;
NMDedupMultiIter iter;
const NMPObject *obj;
@ -1230,7 +1230,7 @@ nm_l3_config_data_add_route_full(NML3ConfigData * self,
const NMPObject ** out_obj_new,
gboolean * out_changed_best_default_route)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
nm_auto_nmpobj const NMPObject *obj_old = NULL;
const NMPObject * obj_new_2;
gboolean changed = FALSE;
@ -1364,6 +1364,14 @@ nm_l3_config_data_add_wins(NML3ConfigData *self, in_addr_t wins)
return _garray_inaddr_add(&self->wins, AF_INET, &wins);
}
const in_addr_t *
nm_l3_config_data_get_nis_servers(const NML3ConfigData *self, guint *out_len)
{
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
return _garray_inaddr_get(self->nis_servers, out_len);
}
gboolean
nm_l3_config_data_add_nis_server(NML3ConfigData *self, in_addr_t nis_server)
{
@ -1372,6 +1380,14 @@ nm_l3_config_data_add_nis_server(NML3ConfigData *self, in_addr_t nis_server)
return _garray_inaddr_add(&self->nis_servers, AF_INET, &nis_server);
}
const char *
nm_l3_config_data_get_nis_domain(const NML3ConfigData *self)
{
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
return self->nis_domain;
}
gboolean
nm_l3_config_data_set_nis_domain(NML3ConfigData *self, const char *nis_domain)
{
@ -1452,10 +1468,57 @@ nm_l3_config_data_add_dns_option(NML3ConfigData *self, int addr_family, const ch
return TRUE;
}
const char *const *
nm_l3_config_data_get_dns_options(const NML3ConfigData *self, int addr_family, guint *out_len)
{
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
nm_assert_addr_family(addr_family);
nm_assert(out_len);
return nm_strv_ptrarray_get_unsafe(self->dns_options_x[NM_IS_IPv4(addr_family)], out_len);
}
gboolean
nm_l3_config_data_get_dns_priority(const NML3ConfigData *self, int addr_family, int *out_prio)
{
switch (addr_family) {
case AF_UNSPEC:
if (NM_FLAGS_ANY(self->flags, NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_4)) {
if (NM_FLAGS_ANY(self->flags, NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_6)) {
NM_SET_OUT(out_prio, MIN(self->dns_priority_4, self->dns_priority_6));
return TRUE;
}
NM_SET_OUT(out_prio, self->dns_priority_4);
return TRUE;
}
if (NM_FLAGS_ANY(self->flags, NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_6)) {
NM_SET_OUT(out_prio, self->dns_priority_6);
return TRUE;
}
break;
case AF_INET:
if (NM_FLAGS_ANY(self->flags, NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_4)) {
NM_SET_OUT(out_prio, self->dns_priority_4);
return TRUE;
}
break;
case AF_INET6:
if (NM_FLAGS_ANY(self->flags, NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY_6)) {
NM_SET_OUT(out_prio, self->dns_priority_6);
return TRUE;
}
break;
default:
nm_assert_not_reached();
}
NM_SET_OUT(out_prio, 0);
return FALSE;
}
gboolean
nm_l3_config_data_set_dns_priority(NML3ConfigData *self, int addr_family, int dns_priority)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
const NML3ConfigDatFlags has_dns_priority_flag =
NM_L3_CONFIG_DAT_FLAGS_HAS_DNS_PRIORITY(IS_IPv4);
@ -1471,6 +1534,14 @@ nm_l3_config_data_set_dns_priority(NML3ConfigData *self, int addr_family, int dn
return TRUE;
}
NMSettingConnectionMdns
nm_l3_config_data_get_mdns(const NML3ConfigData *self)
{
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
return self->mdns;
}
gboolean
nm_l3_config_data_set_mdns(NML3ConfigData *self, NMSettingConnectionMdns mdns)
{
@ -1483,6 +1554,14 @@ nm_l3_config_data_set_mdns(NML3ConfigData *self, NMSettingConnectionMdns mdns)
return TRUE;
}
NMSettingConnectionLlmnr
nm_l3_config_data_get_llmnr(const NML3ConfigData *self)
{
nm_assert(_NM_IS_L3_CONFIG_DATA(self, TRUE));
return self->llmnr;
}
gboolean
nm_l3_config_data_set_llmnr(NML3ConfigData *self, NMSettingConnectionLlmnr llmnr)
{
@ -1509,7 +1588,7 @@ nm_l3_config_data_set_route_table_sync(NML3ConfigData * self,
int addr_family,
NMIPRouteTableSyncMode route_table_sync)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
nm_assert(_NM_IS_L3_CONFIG_DATA(self, FALSE));
nm_assert_addr_family(addr_family);
@ -1780,13 +1859,16 @@ _dedup_multi_index_cmp(const NML3ConfigData *a, const NML3ConfigData *b, NMPObje
}
int
nm_l3_config_data_cmp(const NML3ConfigData *a, const NML3ConfigData *b)
nm_l3_config_data_cmp_full(const NML3ConfigData *a,
const NML3ConfigData *b,
NML3ConfigCmpFlags cmp_flags)
{
int IS_IPv4;
NM_CMP_SELF(a, b);
NM_CMP_DIRECT(a->ifindex, b->ifindex);
if (!NM_FLAGS_HAS(cmp_flags, NM_L3_CONFIG_CMP_FLAGS_IGNORE_IFINDEX))
NM_CMP_DIRECT(a->ifindex, b->ifindex);
NM_CMP_DIRECT(a->flags, b->flags);
@ -1863,7 +1945,7 @@ _data_get_direct_route_for_host(const NML3ConfigData *self,
gconstpointer host,
guint32 route_table)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
const NMPObject * best_route_obj = NULL;
const NMPlatformIPXRoute *best_route = NULL;
const NMPObject * item_obj;
@ -1998,7 +2080,7 @@ nm_l3_config_data_add_dependent_routes(NML3ConfigData *self,
guint32 route_metric,
gboolean is_vrf)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
gs_unref_ptrarray GPtrArray *extra_onlink_routes = NULL;
const NMPObject * my_addr_obj;
const NMPObject * my_route_obj;
@ -2209,7 +2291,7 @@ _init_from_connection_ip(NML3ConfigData *self,
guint32 route_table,
guint32 route_metric)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
NMSettingIPConfig *s_ip;
guint naddresses;
guint nroutes;
@ -2433,7 +2515,7 @@ _init_from_platform(NML3ConfigData * self,
NMPlatform * platform,
NMSettingIP6ConfigPrivacy ipv6_privacy_rfc4941)
{
const gboolean IS_IPv4 = NM_IS_IPv4(addr_family);
const int IS_IPv4 = NM_IS_IPv4(addr_family);
const NMDedupMultiHeadEntry *head_entry;
const NMPObject * plobj = NULL;
NMDedupMultiIter iter;
@ -2534,6 +2616,9 @@ nm_l3_config_data_merge(NML3ConfigData * self,
nm_assert(default_route_table_x[1] != 0);
nm_assert(default_route_metric_x[0] != 0); /* IPv6 route metric cannot be zero. */
nm_assert(!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_CLONE)
|| nm_utils_is_power_of_two(merge_flags));
for (IS_IPv4 = 1; IS_IPv4 >= 0; IS_IPv4--) {
const int addr_family = IS_IPv4 ? AF_INET : AF_INET6;
const NML3ConfigDatFlags has_dns_priority_flag =
@ -2588,28 +2673,31 @@ nm_l3_config_data_merge(NML3ConfigData * self,
} \
G_STMT_END
if (r_src->table_any) {
_ensure_r();
r.rx.table_any = FALSE;
r.rx.table_coerced = default_route_table_x[IS_IPv4];
}
if (r_src->metric_any) {
_ensure_r();
r.rx.metric_any = FALSE;
r.rx.metric = nm_add_clamped_u32(r.rx.metric, default_route_metric_x[IS_IPv4]);
}
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT(r_src)) {
if (NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_DEFAULT_ROUTES)
&& !NM_FLAGS_HAS(src->flags,
NM_L3_CONFIG_DAT_FLAGS_IGNORE_MERGE_NO_DEFAULT_ROUTES))
continue;
if (default_route_penalty_x && default_route_penalty_x[IS_IPv4] > 0) {
if (!NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_CLONE)) {
if (r_src->table_any) {
_ensure_r();
r.rx.table_any = FALSE;
r.rx.table_coerced = default_route_table_x[IS_IPv4];
}
if (r_src->metric_any) {
_ensure_r();
r.rx.metric_any = FALSE;
r.rx.metric =
nm_utils_ip_route_metric_penalize(r.rx.metric,
default_route_penalty_x[IS_IPv4]);
nm_add_clamped_u32(r.rx.metric, default_route_metric_x[IS_IPv4]);
}
if (NM_PLATFORM_IP_ROUTE_IS_DEFAULT(r_src)) {
if (NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_NO_DEFAULT_ROUTES)
&& !NM_FLAGS_HAS(src->flags,
NM_L3_CONFIG_DAT_FLAGS_IGNORE_MERGE_NO_DEFAULT_ROUTES))
continue;
if (default_route_penalty_x && default_route_penalty_x[IS_IPv4] > 0) {
_ensure_r();
r.rx.metric =
nm_utils_ip_route_metric_penalize(r.rx.metric,
default_route_penalty_x[IS_IPv4]);
}
}
}
@ -2689,8 +2777,16 @@ nm_l3_config_data_merge(NML3ConfigData * self,
if (self->ip6_mtu == 0u)
self->ip6_mtu = src->ip6_mtu;
/* self->source does not get merged. */
/* self->dhcp_lease_x does not get merged. */
if (NM_FLAGS_HAS(merge_flags, NM_L3_CONFIG_MERGE_FLAGS_CLONE)) {
_nm_unused nm_auto_unref_dhcplease NMDhcpLease *dhcp_lease_6 =
g_steal_pointer(&self->dhcp_lease_x[0]);
_nm_unused nm_auto_unref_dhcplease NMDhcpLease *dhcp_lease_4 =
g_steal_pointer(&self->dhcp_lease_x[1]);
self->source = src->source;
self->dhcp_lease_x[0] = nm_dhcp_lease_ref(self->dhcp_lease_x[0]);
self->dhcp_lease_x[1] = nm_dhcp_lease_ref(self->dhcp_lease_x[1]);
}
}
NML3ConfigData *
@ -2707,6 +2803,17 @@ nm_l3_config_data_new_clone(const NML3ConfigData *src, int ifindex)
ifindex = src->ifindex;
self = nm_l3_config_data_new(src->multi_idx, ifindex);
nm_l3_config_data_merge(self, src, NM_L3_CONFIG_MERGE_FLAGS_NONE, NULL, NULL, NULL, NULL, NULL);
nm_l3_config_data_merge(self,
src,
NM_L3_CONFIG_MERGE_FLAGS_CLONE,
NULL,
NULL,
NULL,
NULL,
NULL);
nm_assert(nm_l3_config_data_cmp_full(src, self, NM_L3_CONFIG_CMP_FLAGS_IGNORE_IFINDEX) == 0);
nm_assert(nm_l3_config_data_get_ifindex(self) == ifindex);
return self;
}

View file

@ -60,6 +60,8 @@ typedef enum {
* Note that if the respective NML3ConfigData has NM_L3_CONFIG_DAT_FLAGS_IGNORE_MERGE_NO_DEFAULT_ROUTES
* set, this flag gets ignored during merge.
* @NM_L3_CONFIG_MERGE_FLAGS_NO_DNS: don't merge DNS information
* @NM_L3_CONFIG_MERGE_FLAGS_CLONE: clone is also implemented via "merge".
* In that case, it takes all settings.
*/
typedef enum _nm_packed {
NM_L3_CONFIG_MERGE_FLAGS_NONE = 0,
@ -67,6 +69,7 @@ typedef enum _nm_packed {
NM_L3_CONFIG_MERGE_FLAGS_NO_ROUTES = (1LL << 1),
NM_L3_CONFIG_MERGE_FLAGS_NO_DEFAULT_ROUTES = (1LL << 2),
NM_L3_CONFIG_MERGE_FLAGS_NO_DNS = (1LL << 3),
NM_L3_CONFIG_MERGE_FLAGS_CLONE = (1LL << 4),
} NML3ConfigMergeFlags;
/*****************************************************************************/
@ -191,7 +194,20 @@ NMDedupMultiIndex *nm_l3_config_data_get_multi_idx(const NML3ConfigData *self);
/*****************************************************************************/
int nm_l3_config_data_cmp(const NML3ConfigData *a, const NML3ConfigData *b);
typedef enum {
NM_L3_CONFIG_CMP_FLAGS_NONE,
NM_L3_CONFIG_CMP_FLAGS_IGNORE_IFINDEX = (1LL << 0),
} NML3ConfigCmpFlags;
int nm_l3_config_data_cmp_full(const NML3ConfigData *a,
const NML3ConfigData *b,
NML3ConfigCmpFlags cmp_flags);
static inline int
nm_l3_config_data_cmp(const NML3ConfigData *a, const NML3ConfigData *b)
{
return nm_l3_config_data_cmp_full(a, b, NM_L3_CONFIG_CMP_FLAGS_NONE);
}
static inline gboolean
nm_l3_config_data_equal(const NML3ConfigData *a, const NML3ConfigData *b)
@ -236,6 +252,11 @@ nm_l3_config_data_lookup_routes(const NML3ConfigData *self, int addr_family)
for (nm_dedup_multi_iter_init((iter), nm_l3_config_data_lookup_objs((self), (type))); \
nm_platform_dedup_multi_iter_next_obj((iter), (obj), (type));)
#define nm_l3_config_data_iter_ip_address_for_each(iter, self, addr_family, address) \
for (nm_dedup_multi_iter_init((iter), \
nm_l3_config_data_lookup_addresses((self), (addr_family))); \
nm_platform_dedup_multi_iter_next_ip_address((iter), (address));)
#define nm_l3_config_data_iter_ip4_address_for_each(iter, self, address) \
for (nm_dedup_multi_iter_init((iter), nm_l3_config_data_lookup_addresses((self), AF_INET)); \
nm_platform_dedup_multi_iter_next_ip4_address((iter), (address));)
@ -244,6 +265,10 @@ nm_l3_config_data_lookup_routes(const NML3ConfigData *self, int addr_family)
for (nm_dedup_multi_iter_init((iter), nm_l3_config_data_lookup_addresses((self), AF_INET6)); \
nm_platform_dedup_multi_iter_next_ip6_address((iter), (address));)
#define nm_l3_config_data_iter_ip_route_for_each(iter, self, addr_family, route) \
for (nm_dedup_multi_iter_init((iter), nm_l3_config_data_lookup_routes((self), (addr_family))); \
nm_platform_dedup_multi_iter_next_ip_route((iter), (route));)
#define nm_l3_config_data_iter_ip4_route_for_each(iter, self, route) \
for (nm_dedup_multi_iter_init((iter), nm_l3_config_data_lookup_routes((self), AF_INET)); \
nm_platform_dedup_multi_iter_next_ip4_route((iter), (route));)
@ -409,8 +434,12 @@ nm_l3_config_data_add_route_6(NML3ConfigData *self, const NMPlatformIP6Route *rt
const NMPObject *nm_l3_config_data_get_best_default_route(const NML3ConfigData *self,
int addr_family);
NMSettingConnectionMdns nm_l3_config_data_get_mdns(const NML3ConfigData *self);
gboolean nm_l3_config_data_set_mdns(NML3ConfigData *self, NMSettingConnectionMdns mdns);
NMSettingConnectionLlmnr nm_l3_config_data_get_llmnr(const NML3ConfigData *self);
gboolean nm_l3_config_data_set_llmnr(NML3ConfigData *self, NMSettingConnectionLlmnr llmnr);
NMIPRouteTableSyncMode nm_l3_config_data_get_route_table_sync(const NML3ConfigData *self,
@ -445,13 +474,17 @@ gboolean nm_l3_config_data_add_nameserver(NML3ConfigData *
gboolean nm_l3_config_data_clear_nameservers(NML3ConfigData *self, int addr_family);
const in_addr_t *nm_l3_config_data_get_nis_servers(const NML3ConfigData *self, guint *out_len);
gboolean nm_l3_config_data_add_nis_server(NML3ConfigData *self, in_addr_t nis_server);
const char *nm_l3_config_data_get_nis_domain(const NML3ConfigData *self);
gboolean nm_l3_config_data_set_nis_domain(NML3ConfigData *self, const char *nis_domain);
const char *const *
nm_l3_config_data_get_domains(const NML3ConfigData *self, int addr_family, guint *out_len);
gboolean nm_l3_config_data_set_nis_domain(NML3ConfigData *self, const char *nis_domain);
gboolean nm_l3_config_data_add_domain(NML3ConfigData *self, int addr_family, const char *domain);
const char *const *
@ -464,6 +497,12 @@ gboolean nm_l3_config_data_add_search(NML3ConfigData *self, int addr_family, con
gboolean
nm_l3_config_data_add_dns_option(NML3ConfigData *self, int addr_family, const char *dns_option);
const char *const *
nm_l3_config_data_get_dns_options(const NML3ConfigData *self, int addr_family, guint *out_len);
gboolean
nm_l3_config_data_get_dns_priority(const NML3ConfigData *self, int addr_family, int *out_prio);
gboolean
nm_l3_config_data_set_dns_priority(NML3ConfigData *self, int addr_family, int dns_priority);

View file

@ -173,6 +173,8 @@ struct _NMDedupMultiIndex *nm_netns_get_multi_idx(NMNetns *self);
static inline struct _NMDedupMultiIndex *
nm_l3cfg_get_multi_idx(const NML3Cfg *self)
{
g_return_val_if_fail(NM_IS_L3CFG(self), NULL);
return nm_netns_get_multi_idx(self->priv.netns);
}
@ -181,7 +183,7 @@ nm_l3cfg_get_multi_idx(const NML3Cfg *self)
static inline int
nm_l3cfg_get_ifindex(const NML3Cfg *self)
{
nm_assert(NM_IS_L3CFG(self));
g_return_val_if_fail(NM_IS_L3CFG(self), 0);
return self->priv.ifindex;
}

View file

@ -254,6 +254,8 @@ nm_setting_olpc_mesh_class_init(NMSettingOlpcMeshClass *klass)
* Anycast DHCP MAC address used when requesting an IP address via DHCP.
* The specific anycast address used determines which DHCP server class
* answers the request.
*
* This is currently only implemented by dhclient DHCP plugin.
**/
obj_properties[PROP_DHCP_ANYCAST_ADDRESS] =
g_param_spec_string(NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS,

View file

@ -290,6 +290,14 @@ nm_ip4_addr_is_localhost(in_addr_t addr4)
return (addr4 & htonl(0xFF000000u)) == htonl(0x7F000000u);
}
static inline gconstpointer
nm_ip_addr_from_packed_array(int addr_family, gconstpointer ipaddr_arr, gsize idx)
{
return NM_IS_IPv4(addr_family)
? ((gconstpointer) & (((const struct in_addr *) ipaddr_arr)[idx]))
: ((gconstpointer) & (((const struct in6_addr *) ipaddr_arr)[idx]));
}
/*****************************************************************************/
struct ether_addr;

View file

@ -2,7 +2,7 @@
#define DESCRIBE_DOC_NM_SETTING_6LOWPAN_PARENT N_("If given, specifies the parent interface name or parent connection UUID from which this 6LowPAN interface should be created.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_CHANNEL N_("Channel on which the mesh network to join is located.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_DHCP_ANYCAST_ADDRESS N_("Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request. This is currently only implemented by dhclient DHCP plugin.")
#define DESCRIBE_DOC_NM_SETTING_OLPC_MESH_SSID N_("SSID of the mesh network to join.")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_AP_ISOLATION N_("Configures AP isolation, which prevents communication between wireless devices connected to this AP. This property can be set to a value different from NM_TERNARY_DEFAULT (-1) only when the interface is configured in AP mode. If set to NM_TERNARY_TRUE (1), devices are not able to communicate with each other. This increases security because it protects devices against attacks from other clients in the network. At the same time, it prevents devices to access resources on the same wireless networks as file shares, printers, etc. If set to NM_TERNARY_FALSE (0), devices can talk to each other. When set to NM_TERNARY_DEFAULT (-1), the global default is used; in case the global default is unspecified it is assumed to be NM_TERNARY_FALSE (0).")
#define DESCRIBE_DOC_NM_SETTING_WIRELESS_BAND N_("802.11 frequency band of the network. One of \"a\" for 5GHz 802.11a or \"bg\" for 2.4GHz 802.11. This will lock associations to the Wi-Fi network to the specific band, i.e. if \"a\" is specified, the device will not associate with the same network in the 2.4GHz band even if the network's settings are compatible. This setting depends on specific driver capability and may not work with all drivers.")

View file

@ -14,7 +14,7 @@
description="Channel on which the mesh network to join is located." />
<property name="dhcp-anycast-address"
alias="dhcp-anycast"
description="Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request." />
description="Anycast DHCP MAC address used when requesting an IP address via DHCP. The specific anycast address used determines which DHCP server class answers the request. This is currently only implemented by dhclient DHCP plugin." />
</setting>
<setting name="802-11-wireless"
alias="wifi" >