mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 09:58:07 +02:00
core: cleanup setting ifa_flags in ndisc_config_changed()
Some refactoring and one change: If we don't have system-support, don't set IFA_F_MANAGETEMPADDR.
This commit is contained in:
parent
057b63979e
commit
2f83894498
2 changed files with 37 additions and 42 deletions
|
|
@ -7385,26 +7385,7 @@ ndisc_config_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_in
|
|||
{
|
||||
NMNDiscConfigMap changed = changed_int;
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
int i;
|
||||
int system_support;
|
||||
guint32 ifa_flags = 0x00;
|
||||
|
||||
/*
|
||||
* Check, whether kernel is recent enough to help user space handling RA.
|
||||
* If it's not supported, we have no ipv6-privacy and must add autoconf
|
||||
* addresses as /128. The reason for the /128 is to prevent the kernel
|
||||
* from adding a prefix route for this address.
|
||||
**/
|
||||
system_support = nm_platform_check_support_kernel_extended_ifa_flags (nm_device_get_platform (self));
|
||||
|
||||
if (system_support)
|
||||
ifa_flags = IFA_F_NOPREFIXROUTE;
|
||||
if ( priv->ndisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR
|
||||
|| priv->ndisc_use_tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR)
|
||||
{
|
||||
/* without system_support, this flag will be ignored. Still set it, doesn't seem to do any harm. */
|
||||
ifa_flags |= IFA_F_MANAGETEMPADDR;
|
||||
}
|
||||
guint i;
|
||||
|
||||
g_return_if_fail (priv->act_request);
|
||||
|
||||
|
|
@ -7420,10 +7401,27 @@ ndisc_config_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_in
|
|||
}
|
||||
|
||||
if (changed & NM_NDISC_CONFIG_ADDRESSES) {
|
||||
guint8 plen;
|
||||
guint32 ifa_flags;
|
||||
|
||||
/* Check, whether kernel is recent enough to help user space handling RA.
|
||||
* If it's not supported, we have no ipv6-privacy and must add autoconf
|
||||
* addresses as /128. The reason for the /128 is to prevent the kernel
|
||||
* from adding a prefix route for this address. */
|
||||
ifa_flags = 0;
|
||||
if (nm_platform_check_support_kernel_extended_ifa_flags (nm_device_get_platform (self))) {
|
||||
ifa_flags |= IFA_F_NOPREFIXROUTE;
|
||||
if (NM_IN_SET (priv->ndisc_use_tempaddr, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR))
|
||||
ifa_flags |= IFA_F_MANAGETEMPADDR;
|
||||
plen = 64;
|
||||
} else
|
||||
plen = 128;
|
||||
|
||||
nm_ip6_config_reset_addresses_ndisc (priv->ac_ip6_config,
|
||||
rdata->addresses,
|
||||
rdata->addresses_n,
|
||||
system_support ? 64 : 128,
|
||||
plen,
|
||||
ifa_flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,26 +154,6 @@ ndisc_config_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_in
|
|||
NMNDiscConfigMap changed = changed_int;
|
||||
static NMIP6Config *ndisc_config = NULL;
|
||||
NMIP6Config *existing;
|
||||
int system_support;
|
||||
guint32 ifa_flags = 0x00;
|
||||
|
||||
/*
|
||||
* Check, whether kernel is recent enough, to help user space handling RA.
|
||||
* If it's not supported, we have no ipv6-privacy and must add autoconf
|
||||
* addresses as /128.
|
||||
* The reason for the /128 is to prevent the kernel
|
||||
* from adding a prefix route for this address.
|
||||
**/
|
||||
system_support = nm_platform_check_support_kernel_extended_ifa_flags (NM_PLATFORM_GET);
|
||||
|
||||
if (system_support)
|
||||
ifa_flags = IFA_F_NOPREFIXROUTE;
|
||||
if (global_opt.tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR
|
||||
|| global_opt.tempaddr == NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR)
|
||||
{
|
||||
/* without system_support, this flag will be ignored. Still set it, doesn't seem to do any harm. */
|
||||
ifa_flags |= IFA_F_MANAGETEMPADDR;
|
||||
}
|
||||
|
||||
existing = nm_ip6_config_capture (nm_platform_get_multi_idx (NM_PLATFORM_GET),
|
||||
NM_PLATFORM_GET, gl.ifindex, FALSE, global_opt.tempaddr);
|
||||
|
|
@ -193,10 +173,27 @@ ndisc_config_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_in
|
|||
}
|
||||
|
||||
if (changed & NM_NDISC_CONFIG_ADDRESSES) {
|
||||
guint8 plen;
|
||||
guint32 ifa_flags;
|
||||
|
||||
/* Check, whether kernel is recent enough to help user space handling RA.
|
||||
* If it's not supported, we have no ipv6-privacy and must add autoconf
|
||||
* addresses as /128. The reason for the /128 is to prevent the kernel
|
||||
* from adding a prefix route for this address. */
|
||||
ifa_flags = 0;
|
||||
if (nm_platform_check_support_kernel_extended_ifa_flags (NM_PLATFORM_GET)) {
|
||||
ifa_flags |= IFA_F_NOPREFIXROUTE;
|
||||
if (NM_IN_SET (global_opt.tempaddr, NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR,
|
||||
NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR))
|
||||
ifa_flags |= IFA_F_MANAGETEMPADDR;
|
||||
plen = 64;
|
||||
} else
|
||||
plen = 128;
|
||||
|
||||
nm_ip6_config_reset_addresses_ndisc (ndisc_config,
|
||||
rdata->addresses,
|
||||
rdata->addresses_n,
|
||||
system_support ? 64 : 128,
|
||||
plen,
|
||||
ifa_flags);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue