Commit graph

72 commits

Author SHA1 Message Date
Beniamino Galvani
2cc02a3a1b platform: add support for {rto_min,quickack,lock-advmss} route attributes 2022-06-27 11:38:43 +02:00
Thomas Haller
ab1fa010a3
platform: drop redundant check for plen in nm_platform_ip4_address_generate_device_route() 2022-05-24 10:53:59 +02:00
Thomas Haller
3bd210a8f1
l3cfg: fix clearing IPv6 temporary addresses to avoid stale addresses
IPv6 temporary addresses are configured by kernel, with the
"ipv6.ip6-privacy" setting ("use_tempaddr" sysctl) and the
IFA_F_MANAGETEMPADDR flag.

As such, the idea was that during reapply we would not remove them.
However, that is wrong.

The only case when we want to keep those addresses, is if during reapply
we are going to configure the same primary address (with mngtmpaddr
flag) again. Otherwise, theses addresses must always go away.

This is quite serious. This not only affects Reapply. Also during disconnect
we clear IP configuration via l3cfg.
Have an ethernet profile active with "ipv6.ip6-privacy". Unplug
the cable, the device disconnects but the temporary IPv6 address is not
cleared. As such, nm_device_generate_connection() will now generate
an external profile (with "ipv6.method=disabled" and no manual IP addresses).
The result is, that the device cannot properly autoconnect again,
once you replug the cable.

This is serious for disconnect. But I could not actually reproduce the
problem using reapply. That is, because during reapply we usually
toggle ipv6_disable sysctl, which drops all IPv6 addresses. I still
went through the effort of trying to preserve addresses that we still
want to have, because I am not sure whether there are cases where we
don't toggle ipv6_disable. Also, doing ipv6_disable during reapply is
bad anyway, and we might want to avoid that in the future.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
(cherry picked from commit 518f6124c6)
2022-05-09 19:27:06 +02:00
Thomas Haller
fd1d0a79dc
platform: log skipped addresses in nm_platform_ip_address_sync()
This is generally useful. Don't only log with more logging.

(cherry picked from commit 4c67970e4c)
2022-05-03 22:17:01 +02:00
Thomas Haller
e92639d89c
platform: ensure the platform cache is up to date during nm_platform_ip_address_sync()
Since commit 528a63d9cc ('platform: avoid unnecessary configuration of
IP address in nm_platform_ip_address_sync()'), we no longer configure the
IP address if it is in the platform cache. But the cache might not be
up to date. Process any pending netlink events.

https://bugzilla.redhat.com/show_bug.cgi?id=2073926

Fixes: 528a63d9cc ('platform: avoid unnecessary configuration of IP address in nm_platform_ip_address_sync()')
(cherry picked from commit 7f427ac4e6)
2022-05-03 22:16:29 +02:00
Thomas Haller
555891fe8d
platform: simplify loop for IPv6 addresses in nm_platform_ip_address_sync()
(cherry picked from commit 9b930cd962)
2022-05-03 12:18:45 +02:00
Thomas Haller
169d74b2e4
platform: fix handling IPv6 address index in nm_platform_ip_address_sync()
Fixes: 4a548423b9 ('core: change order/priority of static IPv6 addresses relative to autoconf6/DHCPv6')
(cherry picked from commit b52941ac34)
2022-05-03 12:18:43 +02:00
Thomas Haller
a1835c2c05
platform: re-configure one address at a time in nm_platform_ip_address_sync()
Try to do one change at a time when reconfiguring addresses, to not
remove several/all addresses at once.

For IP addresses, kernel cares about the order in which they were added.
This mostly affects source address selection, and the "secondary" flag
for IPv4 addresses. The order is thus related to the priority of an
address.

There is no direct kernel API to change the order. Instead, we have to
add them in the correct order. During a sync, if an address already
exists in the wrong order, we need to remove it, and re-add it.
Btw, with IPv4 addresses added first via netlink are the primary
address, while with IPv6 it's reverse.

Previously, we would first iterate over all addresses and remove those
that had a conflicting order. This means, that we would potentially
remove all addresses for a short while, before readding them. That seems
problematic.

Instead, first track all addresses that are in the wrong order. And in
the step when we add/update the address, remove it. We now only remove
and address shortly before re-adding it. This way the time for which the
address on the interface is missing is shorter. More importantly, we will
never remove all addresses at the same time.

(cherry picked from commit a6fd641634)
2022-05-03 12:18:40 +02:00
Thomas Haller
171d70bbf7
core: change order/priority of static IPv6 addresses relative to autoconf6/DHCPv6
The order of addresses can matter for source address selection.
This is described in RFC 6724 section 5, but if the rules don't
determine a clear winner, the order matters.

Change the relative order of IPv6 addresses. Previously, we would prefer
autoconf6, over DHCPv6, over manual addresses. Now that got reverted
to make more sense and be consistent with IPv4.
Also, if we had multiple autoconf6 addresses (received at different
moments in time), then previously a newly received address would be
added with highest priority. Now, the older address will be preferred
and that order will be enforced (this can be a problem, see (*) below).

For IPv4, it's all simple and sensible. When we add addresses in kernel
via netlink, the first address (of a subnet) becomes the primary.
Note that we only control the order of addresses of the same subnet.
The addresses in ipv4.addresses" are sorted with primary address first.
In the same way is the order for addresses in NML3ConfigData and for
@known_addresses in nm_platform_ip_address_sync(), all primary-first.
Also, manual addresses are sorted with higher priority compared to DHCPv4
addresses (at least since NetworkManager 1.36). That means the way how we
merge NML3ConfigData makes sense (nm_l3_config_data_merge()) because we first
merge the static configuration, then the DHCPv4 configuration, where we just
append the lower priority DHCPv4 addresses.

For IPv6, the address priority is messed up. On netlink/kernel, the last added
address becomes the preferred one (we thus need to add them in the order of
lowest priority first). Consequently and historically, the IPv6 addresses in
@known_addresses parameter to nm_platform_ip_address_sync() were
lowest priority first. And so they were tracked in NML3ConfigData
and in the profile ("ipv6.addresses"). That is confusing.
Also, we usually want to merge NML3ConfigData with different priorities
(e.g. static configuration from the profile before autoconf6/DHCPv6),
as we do with IPv4. However, since internally IPv6 addresses are tracked in
reverse order, it means later NML3ConfigData would be appended and get effectively
a higher priority. That means, autoconf6 addresses were preferred over DHCPv6 and
over manual "ipv6.addresses", respectively. That seems undesirable and inconsistent
with IPv4. Change that. This is a change in behavior.

Note that changing the order of addresses means to remove and re-add
them in the right (inverse) order, with lease important first. This
means, when we add a new address with lower priority, we need to remove
all higher priority addresses temporarily, before readding them. That
is a problem(*).

Note that in the profile, "ipv6.addresses" is still tracked in reverse
order. This did not change, but might change later.

(cherry picked from commit 4a548423b9)
2022-05-03 12:18:33 +02:00
Thomas Haller
09832c5639
platform: use nm_utils_ip4_address_clear_host_address()
We have this util function, presumably because it's good to have it.
Use it.

(cherry picked from commit 3a545fd041)
2022-05-03 12:18:18 +02:00
Thomas Haller
57065cc50d
platform: guard logging statements with check whether logging is enabled
(cherry picked from commit 4fc25d523a)
2022-05-03 12:18:17 +02:00
Thomas Haller
14b920d3cf
all: avoid using global string buffer for to-string methods
These string functions allow to omit the string buffer. This is for
convenience, to use a global (thread-local) buffer. I think that is
error prone and we should drop that "convenience" feature.

At various places, pass a stack allocated buffer.

(cherry picked from commit b87afac8e8)
2022-05-03 12:18:13 +02:00
Thomas Haller
c21034f494
all: use "NM_UTILS_TO_STRING_BUFFER_SIZE" macro
(cherry picked from commit 02a8d21e4e)
2022-05-03 12:18:12 +02:00
Thomas Haller
429540a6b7
platform: avoid unnecessary configuration of IP address in nm_platform_ip_address_sync()
We call sync many times. Often there is nothing to update. Check the
cache first, before (re) adding it.

Note that many addresses have a limited lifetime, that is, a lifetime
that keeps counting down with seconds granularity. For those (common)
cases we will only avoid the call to kernel if there are two syncs
within less than a second.

(cherry picked from commit 528a63d9cc)
2022-05-03 12:18:10 +02:00
Thomas Haller
aa764f5fcc
platform: add nm_platform_ip_address_get() helper
(cherry picked from commit a815212214)
2022-05-03 12:18:09 +02:00
Thomas Haller
e38dac5226
platform: rename local variable in nm_platform_ip_address_sync()
(cherry picked from commit 31299473cd)
2022-05-03 12:18:08 +02:00
Thomas Haller
1f05866821
platform: make "idx" argument in _addr_array_clean_expired() mandatory
There is only one caller of _addr_array_clean_expired(), and it always
provides the "idx" pointer.

(cherry picked from commit de9f174d51)
2022-05-03 12:18:08 +02:00
Thomas Haller
2e6d45cb4e
platform: add ascending/descending functions for ip6_address_scope_cmp*()
It seems easier to read, than passing a boolean parameter.

(cherry picked from commit 305f11069f)
2022-05-03 12:18:07 +02:00
Thomas Haller
e9d3ba66df
platform: allocate result array when needed in nm_platform_ip_{address,route}_get_prune_list()
It is rather unlikely, that we call this function with no existing
routes/addresses. Hence, usually this does not safe an allocation
of the GPtrArray.

However, it's slightly less code and makes more sense this way
(instead of checking afterwards, whether the array is empty and
destroy it).

(cherry picked from commit 6bc9b73c55)
2022-05-03 12:18:07 +02:00
Thomas Haller
d361bfc945
platform: add logging statements to nm_platform_ip_address_sync() for printf() debugging
The code is disabled at compile time. It's only useful for printf
debugging to modify the source to get more logging.

(cherry picked from commit fcb4033a81)
2022-05-03 12:18:07 +02:00
Fernando Fernandez Mancera
a494c00901 l3cfg: drop NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once
ASSUME is causing more troubles than benefits it provides. This patch is
dropping NM_L3_CFG_COMMIT_TYPE_ASSUME and assume_config_once. NM3LCfg
will commit as if the sys-iface-state is MANAGED.

This patch is part of the effort to remove ASSUME from NetworkManager.
After ASSUME is dropped when starting NetworkManager it will take full
control of the interface, re-configuring it. The interface will be
managed from the start instead of assumed and then managed.

This will solve the situations where an interface is half-up and then a
restart happens. When NetworkManager is back it won't add the missing
addresses (which is what assume does) so the interface will fail during
the activation and will require a full activation.

https://bugzilla.redhat.com/show_bug.cgi?id=2050216
https://bugzilla.redhat.com/show_bug.cgi?id=2077605
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1196
(cherry picked from commit bf5927b978)
2022-04-28 12:03:46 +02:00
Thomas Haller
ea6625ce97 platform: add semantic comparison for IP addresses and add "nm_platform_vtable_address"
We already have a comparison of NMPlatformIPXAddress with the modes
"full" and "id". The former is needed to fully compare two addresses,
the latter as identity for tracking addresses in the cache.

In NetworkManager we also use the NMPlatformIP[46]Address structure to
track the addresses we want to configure. When we add them in kernel,
we will later see them in the platform cache. However, some fields
will be slightly different. For example, "addr_source" address will
always be "kernel", because that one is not a field we configure in
kernel. Also, the "n_ifa_flags" probably differ (getting "permanent"
and "secondary" flags).

Add a compare function that can ignore such differences.

Also add nm_platform_vtable_address for accessing the IPv4 and IPv6
methods generically (based on an "IS_IPv4" variable).

(cherry picked from commit ef1b60c061)
2022-04-28 12:03:41 +02:00
Thomas Haller
9e40474c71 platform: make "now" timestamp an in/out parameter to nmp_utils_lifetime_get()
nmp_utils_lifetime_get() calculates the lifetime of addresses,
and it bases the result on a "now" timestamp.

If you have two addresses and calculate their expiry, then we want to
base it on top of the same "now" timestamp, meaning, we should
only call nm_utils_get_monotonic_timestamp_sec() once. This is also a
performance optimization. But much more importantly, when we make a
comparison at a certain moment, we need that all sides have the same
understanding of the current timestamp.

But nmp_utils_lifetime_get() does not always require the now timestamp.
And the caller doesn't know, whether it will need it (short of knowing
how nmp_utils_lifetime_get() is implemented). So, make the now parameter
an in/out argument. If we pass in an already valid now timestamp, use
that. Otherwise, fetch the current time and also return it.

(cherry picked from commit deb37401e9)
2022-04-28 12:03:30 +02:00
Thomas Haller
0bdb2e97d9
platform: track IPv4 subnets with prefix length in nm_platform_ip_address_sync()
The entire point of the dance in nm_platform_ip_address_sync() is to ensure that
conflicting IPv4 addresses are in their right order, that is, they have
the right primary/secondary flag.

Kernel only sets secondary flags for addresses that are in the same
subnet, and we also only care about the relative order of addresses
that are in the same subnet. In particular, because we rely on kernel's
"secondary" flag to implement this.

But kernel only treads addresses as secondary, if they share the exact
same subnet. For example, 192.168.0.5/24 and 192.168.0.6/25 would not
be treated as primary/secondary but just as unrelated addresses, even if
the address cleared of it's host part is the same.

This means, we must not only hash the network part of the addresses, but
also the prefix length. Implement that, by tracking the full NMPObject.

(cherry picked from commit 619dc2fcab)
2022-04-08 16:27:00 +02:00
Thomas Haller
a8e96e3c4b
platform: move known_subnets variable to inner scope in nm_platform_ip_address_sync()
(cherry picked from commit e1431b43a2)
2022-04-08 16:27:00 +02:00
Thomas Haller
41b56cb2b9
platform: fix undefined behavior for pointer comparison in ip4_addr_subnets_is_plain_address()
Fixes: 2f68a50041 ('platform: fix the order of addition of primary and secondary IPv4 addresses')
(cherry picked from commit 40f22e69c8)
2022-04-08 16:26:59 +02:00
Thomas Haller
8736cc8618
platform: fix returning error from nm_platform_ip_address_sync()
None of the callers really handle the return value of nm_platform_ip_address_sync()
or whether the function encountered problems. What would they anyway do
about that?

For IPv4 we were already ignoring errors to add addresses, but for IPv6 we
aborted. That seems wrong. As the caller does not really handle errors,
I think we should follow through and add all addresses in case of error.

Still, also collect a overall "success" of the function and return it.

(cherry picked from commit cedaa191d4)
2022-04-08 16:26:59 +02:00
Thomas Haller
4c3197b377
platform: fix address order in nm_platform_ip_address_sync()
In the past, nm_platform_ip_address_sync() only had the @known_addresses
argument. We would figure out which addresses to delete and which to preserve,
based on what addresses were known. That means, @known_addresses must have contained
all the addresses we wanted to preserve, even the external ones. That approach
was inherently racy.

Instead, nowadays we have the addresses we want to configure (@known_addresses)
and the addresses we want to delete (@prune_addresses). This started to change in
commit dadfc3abd5 ('platform: allow injecting the list of addresses to prune'),
but only commit 58287cbcc0 ('core: rework IP configuration in NetworkManager using
layer 3 configuration') actually changed to pass separate @prune_addresses argument.

However, the order of IP addresses matters and there is no sensible kernel API
to configure the order (short of adding them in the right order), we still need
to look at all the addresses, check their order, and possibly delete some.
That is, we need to handle addresses we want to delete (@prune_addresses)
but still look at all addresses in platform (@plat_addresses) to check
their order.

Now, first handle @prune_addresses. That's simple. These are just the
addresses we want to delete. Second, get the list of all addresses in
platform (@plat_addresses) and check the order.

Note that if there is an external address that interferes with our
desired order, we will leave it untouched. Thus, such external addresses
might prevent us from getting the order as desired. But that's just
how it is. Don't add addresses outside of NetworkManager to avoid that.

Fixes: 58287cbcc0 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
(cherry picked from commit 80f8e23992)
2022-04-08 16:26:58 +02:00
Vojtech Bubela
e4ad8f8a9b
platform: Add change link functions to nm-platform
Since updating options of bridge is now done with netlink we need
support function for that in nm-platform.
2022-04-02 22:39:07 +02:00
Emmanuel Grumbach
965c55f0da platform: add Intel vendor command to get the device from CSME
This will allow us to let CSME know that we are ready to connect and it
can remove the "OS_NOT_OWNER" rfkill.
2022-03-07 14:10:19 +02:00
Emmanuel Grumbach
526c4b3293 platform: add the plumbing to get the CSME connection info
This allows to fetch the information about the AP that CSME if connected
to. It'll allow us to connect to the exact same AP and shaving off the
scan from the connection, improving the connection time.
2022-03-07 13:55:43 +02:00
Thomas Haller
4067ac23c7
platform: log ifindex when releasing slave from master 2022-02-23 17:07:16 +01:00
Thomas Haller
1a1c22e38c
platform: fix chaining up finalize() in NMPlatform
This also causes leaks with recent glib, which can be found via valgrind.

Fixes: c7b3862503 ('platform: add network namespace support to platform')
2022-02-21 22:11:02 +01:00
Thomas Haller
b58711f20d
platform: don't print NUL gateway in nm_platform_ip[46]_route_to_string()
Currently, for NMPlatformIP[46]Route always has a gateway, even if it's
possibly set to 0.0.0.0/::. Not sure whether kernel has a further
distinction between no-gateway and all-zero gateway.

Anyway. For us, a gateway of 0.0.0.0/:: means the same as having no
gateway. We cannot differentiate the two (nor do we need to).

Don't print that in nm_platform_ip[46]_route_to_string().

Also, because we are going to add blackhole route types, which cannot
have a next-hop. But we do this change for all routes types, because
it makes sense in general (and also what `ip route show` prints).
2022-02-09 19:13:03 +01:00
Beniamino Galvani
ae28d2251a core: set force-commit flag for generated routes
The force-commit flag is used to force the commit of an address or a
route from DHCP/RA even when it was removed from platform externally
(for example because it expired). Routes generated from the l3cd
should also have the flag set.

Without this, NM properly re-adds the DHCP address after the lease is
lost and obtained again, but fails to add the prefix-route.

Fixes: 2838b1c5e8 ('core: track force-commit flag for l3cd and platform objects')

https://bugzilla.redhat.com/show_bug.cgi?id=2033991
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1049
2022-01-12 15:01:42 +01:00
Thomas Haller
615221a99c format: reformat source tree with clang-format 13.0
We use clang-format for automatic formatting of our source files.
Since clang-format is actively maintained software, the actual
formatting depends on the used version of clang-format. That is
unfortunate and painful, but really unavoidable unless clang-format
would be strictly bug-compatible.

So the version that we must use is from the current Fedora release, which
is also tested by our gitlab-ci. Previously, we were using Fedora 34 with
clang-tools-extra-12.0.1-1.fc34.x86_64.

As Fedora 35 comes along, we need to update our formatting as Fedora 35
comes with version "13.0.0~rc1-1.fc35".
An alternative would be to freeze on version 12, but that has different
problems (like, it's cumbersome to rebuild clang 12 on Fedora 35 and it
would be cumbersome for our developers which are on Fedora 35 to use a
clang that they cannot easily install).

The (differently painful) solution is to reformat from time to time, as we
switch to a new Fedora (and thus clang) version.
Usually we would expect that such a reformatting brings minor changes.
But this time, the changes are huge. That is mentioned in the release
notes [1] as

  Makes PointerAligment: Right working with AlignConsecutiveDeclarations. (Fixes https://llvm.org/PR27353)

[1] https://releases.llvm.org/13.0.0/tools/clang/docs/ReleaseNotes.html#clang-format
2021-11-29 09:31:09 +00:00
Beniamino Galvani
2838b1c5e8 core: track force-commit flag for l3cd and platform objects
Problem: if l3cfg commits an address and routes from DHCP, when the
address expires those objects are removed automatically. NM tracks the
objects as missing as if the user removed them. This is to prevent
l3cfg to committing them again. If the lease if renewed, l3cfg should
be allowed to commit those objects again.

Introduce a l3cd flag to indicate that it should be force-committed
once, and propagate this flag to platform objects. In this way, l3cfg
can avoid committing again objects that are removed externally, but it
can commit them when the l3cd changes.

Fixes-test: @bridge_down_to_l2_only
2021-11-18 16:21:35 +01:00
Thomas Haller
58287cbcc0 core: rework IP configuration in NetworkManager using layer 3 configuration
Completely rework IP configuration in the daemon. Use NML3Cfg as layer 3
manager for the IP configuration of an interface. Use NML3ConfigData as
pieces of configuration that the various components collect and
configure. NMDevice is managing most of the IP configuration at a higher
level, that is, it starts DHCP and other IP methods. Rework the state
handling there.

This is a huge rework of how NetworkManager daemon handles IP
configuration. Some fallout is to be expected.

It appears the patch deletes many lines of code. That is not accurate, because
you also have to count the files `src/core/nm-l3*`, which were unused previously.

Co-authored-by: Beniamino Galvani <bgalvani@redhat.com>
2021-11-18 16:21:29 +01:00
Thomas Haller
e47dd2ee22
l3cfg: configure dependent routes when creating combined config 2021-09-27 07:55:32 +02:00
Beniamino Galvani
864e4e6369 platform: allow disabling caching of tc objects
Introduce a construct-only property for platform objects to enable or
disable the caching of tc objects. When disabled, the netlink socket
doesn't receive netlink events for tc objects, and objects are never
added to the cache. This commit doesn't change behavior yet.
2021-09-20 13:27:16 +02:00
Beniamino Galvani
3981bff2a0 core: rework tc sync functions
Update nm_platform_qdisc_sync() and nm_platform_tfilter_sync() to
avoid looking into the platform cache, so that we no longer require to
keep tc and qdiscs in the cache.

There is no API in kernel to retrieve tc objects only for a specific
interface, so NM had to receive all tc events, even for unmanaged
interfaces.  This could cause high CPU usage in some scenarios with
many objects.

Instead, try to delete root qdiscs and filters and then add the known
ones.

Also, combine the two functions together since they are related. In
particular, removing all qdiscs also removes all attached filters.
2021-09-20 13:27:15 +02:00
Beniamino Galvani
d9b2e9d7ea platform: add methods to delete tc qdiscs and tfilters
Introduce two platform methods to delete tc qdiscs and filters by
ifindex and parent.
2021-09-20 13:27:15 +02:00
Beniamino Galvani
8003ca68f7 platform: preserve IPv6 multicast route added by kernel
Kernels < 5.11 add a route like:

  unicast ff00::/8 dev $IFACE proto boot scope global metric 256 pref medium

to allow sending and receiving IPv6 multicast traffic. Ensure it's not
removed it when we do a route sync in mode ALL.

In kernel 5.11 there were commits:

  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ceed9038b2783d14e0422bdc6fd04f70580efb4c
  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a826b04303a40d52439aa141035fca5654ccaccd

After those the route looks like

  multicast ff00::/8 dev $IFACE proto kernel metric 256 pref medium

As NM ignores routes with rtm_type multicast, the code in this commit
is not needed on newer kernels.

https://bugzilla.redhat.com/show_bug.cgi?id=2004212
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/984
2021-09-20 10:27:38 +02:00
Thomas Haller
a909a4b305
platform: move ip4acd_not_ready flag to NMPlatformIP4Address
This flag is only relevant for IPv4. That is, because the way we do
ACD/DAD is fundamentally different between IPv4 and IPv6. For IPv4, we
use libn-acd while IPv6 we configure the address in kernel and wait for
the tentative flag to go away.
2021-09-08 18:33:44 +02:00
Thomas Haller
e07b41c430
platform: add assume_config_once flags to NMPlatformIP{Address,Route}
NMPlatformIP{Address,Route} are mainly the structs that we receive via
netlink and get cached in the NMPlatform cache.

However, the same structures are also used by the upper layers to track
which addresses to add.

Add a flag to addresses and routes, for a certain behavior, relevant
during NML3Cfg commit. The idea is that during commits for NML3Cfg of
type NM_L3_CFG_COMMIT_TYPE_ASSUME, no new addresses are added that
are not already configured. In some cases, we want to override that,
and need a flag to track that. More about that later.
2021-09-08 18:33:44 +02:00
Thomas Haller
7df4b2a2eb
platform: use IFA_F_SECONDARY instead of IFA_F_TEMPORARY
These names are aliases. Prefer one over the other.
2021-09-08 18:33:43 +02:00
Thomas Haller
31df5d554a
platform: add missing flags to nm_platform_addr_flags2str() 2021-09-08 18:33:43 +02:00
Thomas Haller
4b6e119010
all: pass pointer to "struct NMUtilsIPv6IfaceId" to functions instead of struct
While NMUtilsIPv6IfaceId is only 8 bytes large, it seems unidiomatic to
pass the plain struct around.

With a "const NMUtilsIPv6IfaceId *" argument it is more clear what the
meaning of this is.

Change to use pointers.
2021-08-31 16:49:46 +02:00
Thomas Haller
bcd2c99aab
platform: require RTA_PREF support in kernel
The preference for IPv6 routes was added in kernel v4.1,
22 June 2015. It is even in latest RHEL7 kernels.

Drop trying to be compatible with such old kernels.
2021-08-31 16:41:57 +02:00
Thomas Haller
eb1c266280
platform: require extended IFA_FLAGS support in kernel
We use extended IFA_FLAGS for IFA_F_MANAGETEMPADDR (IPv6) and
IFA_F_NOPREFIXROUTE (IPv4 and IPv6).

These flags for IPv4 were added to kernel 3.14, 30 March, 2014.
The flag for IPv4 was added to kernel 4.4, 11 January 2016.
Even latest RHEL-7 kernels have backport for IFA_F_NOPREFIXROUTE
for IPv4 (rh#1221311).

Drop this. The backward compatibility code paths are likely broken
anyway, and add considerable complexity.
2021-08-31 16:41:57 +02:00