diff options
author | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-02-02 13:13:17 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2015-03-27 13:57:13 +0200 |
commit | 851c9f82736c89d423b244a292e153ec7124d309 (patch) | |
tree | 6f270a444a47b1d83738fa4f83d021aa89ffe0cc /src/network/networkd-address.c | |
parent | 350e7a14dd66d79cbc94f4b49b6a58ccb8a4d1c1 (diff) |
systemd-networkd: Use IFA_F_NOPREFIXROUTE with IPv6 addresses
The IFA_F_NOPREFIXROUTE flag prevents the kernel from creating new onlink
prefixes when a DHCPv6 IPv6 address with a prefix length is set from user
space. IPv6 routing will follow the onlink status from Router Advertisment
Prefix Information options or any manually set route, which is the correct
thing to do.
As this flag has a larger value than what fits into an unsigned char, update
the flag attribute to an uint32_t and set it with an IFA_FLAGS attribute
when writing netlink messages to the kernel.
Diffstat (limited to 'src/network/networkd-address.c')
-rw-r--r-- | src/network/networkd-address.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 255ff77022..85acc49945 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -209,10 +209,18 @@ int address_update(Address *address, Link *link, if (r < 0) return log_error_errno(r, "Could not set prefixlen: %m"); - r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT); + address->flags |= IFA_F_PERMANENT; + + r = sd_rtnl_message_addr_set_flags(req, address->flags & 0xff); if (r < 0) return log_error_errno(r, "Could not set flags: %m"); + if (address->flags & ~0xff) { + r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags); + if (r < 0) + return log_error_errno(r, "Could not set extended flags: %m"); + } + r = sd_rtnl_message_addr_set_scope(req, address->scope); if (r < 0) return log_error_errno(r, "Could not set scope: %m"); @@ -335,10 +343,18 @@ int address_configure(Address *address, Link *link, if (r < 0) return log_error_errno(r, "Could not set prefixlen: %m"); - r = sd_rtnl_message_addr_set_flags(req, IFA_F_PERMANENT); + address->flags |= IFA_F_PERMANENT; + + r = sd_rtnl_message_addr_set_flags(req, (address->flags & 0xff)); if (r < 0) return log_error_errno(r, "Could not set flags: %m"); + if (address->flags & ~0xff) { + r = sd_rtnl_message_append_u32(req, IFA_FLAGS, address->flags); + if (r < 0) + return log_error_errno(r, "Could not set extended flags: %m"); + } + r = sd_rtnl_message_addr_set_scope(req, address->scope); if (r < 0) return log_error_errno(r, "Could not set scope: %m"); |