diff options
author | Kevin P. Fleming <kevin@km6g.us> | 2020-02-08 15:34:35 -0500 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-02-10 15:36:46 +0900 |
commit | 87f9d6ea8efa55b5fc26b537588d1425287cd57f (patch) | |
tree | df2e94a372666845c71ebc3dd3a76a3220adf859 /src | |
parent | a0be5386168a39337d879a9f7d4bd224a42250f2 (diff) | |
download | systemd-87f9d6ea8efa55b5fc26b537588d1425287cd57f.tar.gz |
network: Improve variable name for address generation
The logic which can produce an IPv6 address using SLAAC produces an
address, not a prefix, so the boolean variable used to detect whether
it succeeded should reflect that.
Diffstat (limited to 'src')
-rw-r--r-- | src/network/networkd-ndisc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c index 12f8c1a1dc..cf0cd8ed5b 100644 --- a/src/network/networkd-ndisc.c +++ b/src/network/networkd-ndisc.c @@ -255,7 +255,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) { } static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_t lifetime_preferred, Address *address) { - bool prefix = false; + bool have_address = false; struct in6_addr addr; IPv6Token *j; Iterator i; @@ -274,18 +274,18 @@ static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_ return r; if (stableprivate_address_is_valid(&address->in_addr.in6)) { - prefix = true; + have_address = true; break; } } } else if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_STATIC) { memcpy(((uint8_t *)&address->in_addr.in6) + 8, ((uint8_t *) &j->prefix) + 8, 8); - prefix = true; + have_address = true; break; } - /* fallback to eui64 if prefixstable or static do not match */ - if (!prefix) { + /* fall back to EUI-64 if neither prefixstable nor static provide an address */ + if (!have_address) { /* see RFC4291 section 2.5.1 */ address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0]; address->in_addr.in6.s6_addr[8] ^= 1 << 1; |