network: use sysctl_read_ip_property()
This commit is contained in:
parent
a6b3b0aace
commit
826a3602d8
|
@ -1907,20 +1907,12 @@ static int link_configure_addrgen_mode(Link *link) {
|
|||
|
||||
if (!link_ipv6ll_enabled(link))
|
||||
ipv6ll_mode = IN6_ADDR_GEN_MODE_NONE;
|
||||
else {
|
||||
const char *p = NULL;
|
||||
_cleanup_free_ char *stable_secret = NULL;
|
||||
|
||||
p = strjoina("/proc/sys/net/ipv6/conf/", link->ifname, "/stable_secret");
|
||||
|
||||
else if (sysctl_read_ip_property(AF_INET6, link->ifname, "stable_secret", NULL) < 0)
|
||||
/* The file may not exist. And event if it exists, when stable_secret is unset,
|
||||
* then reading the file fails and EIO is returned. */
|
||||
r = read_one_line_file(p, &stable_secret);
|
||||
if (r < 0)
|
||||
ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
|
||||
else
|
||||
ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
|
||||
}
|
||||
* reading the file fails with EIO. */
|
||||
ipv6ll_mode = IN6_ADDR_GEN_MODE_EUI64;
|
||||
else
|
||||
ipv6ll_mode = IN6_ADDR_GEN_MODE_STABLE_PRIVACY;
|
||||
|
||||
r = sd_netlink_message_append_u8(req, IFLA_INET6_ADDR_GEN_MODE, ipv6ll_mode);
|
||||
if (r < 0)
|
||||
|
|
Loading…
Reference in New Issue