Commit dac51747 authored by Thomas Haller's avatar Thomas Haller

platform: workaround older kernels that don't accept extended address flags via netlink

Extended address flags are represented by the additional netlink
attribute IFA_FLAGS. Older kernels don't know this flag and refuse
the messages RTM_NEWADDR and RTMDEL_ADDR when it contains unknown
attributes. See net/core/rtnetlink.c, rtnetlink_rcv_msg(). This was
fixed by kernel commit 661d2967b3f1b34eeaa7e212e7b9bbe8ee072b59.

libnl was fixed in commit 5206c050504f8676a24854519b9c351470fb7cc6 only to
send the additional netlink attribute, when there are actually flags
that make this necessary.

This commit changes nm-platform to strip the flags to &= 0xFF, if we detect
that the kernel does not understand extended address flags. Thomas Haller's avatarThomas Haller <>
parent f73e3669
......@@ -2828,8 +2828,19 @@ build_rtnl_addr (int family,
rtnl_addr_set_valid_lifetime (rtnladdr, lifetime);
rtnl_addr_set_preferred_lifetime (rtnladdr, preferred);
if (flags)
if (flags) {
if ((flags & ~0xFF) && !check_support_kernel_extended_ifa_flags (nm_platform_get ())) {
/* Older kernels don't accept unknown netlink attributes.
* With commit libnl commit 5206c050504f8676a24854519b9c351470fb7cc6, libnl will only set
* the extended address flags attribute IFA_FLAGS when necessary (> 8 bit). But it's up to
* us not to shove those extended flags on to older kernels.
* Just silently clear them. The kernel should ignore those unknown flags anyway. */
flags &= 0xFF;
rtnl_addr_set_flags (rtnladdr, flags);
if (label && *label)
rtnl_addr_set_label (rtnladdr, label);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment