1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

loopback-setup: set IFA_F_NOPREFIXROUTE when configuring 'lo' ipv6 address

Otherwise the kernel will set up two routes to ::1, one in the "main",
and one in the "local" routing table.

Fixes: #25819
This commit is contained in:
Lennart Poettering 2023-05-31 09:42:45 +02:00
parent 40fb9eebbc
commit 8557425aaf

View File

@ -114,9 +114,15 @@ static int add_ipv6_address(sd_netlink *rtnl, struct state *s) {
if (r < 0)
return r;
r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT);
uint32_t flags = IFA_F_PERMANENT|IFA_F_NOPREFIXROUTE;
r = sd_rtnl_message_addr_set_flags(req, flags & 0xffu); /* rtnetlink wants low 8 bit of flags via regular flags field… */
if (r < 0)
return r;
if ((flags & ~0xffu) != 0) {
r = sd_netlink_message_append_u32(req, IFA_FLAGS, flags); /* …and the rest of the flags via IFA_FLAGS */
if (r < 0)
return r;
}
r = sd_rtnl_message_addr_set_scope(req, RT_SCOPE_HOST);
if (r < 0)