Skip to content

Commit 87f9d6e

Browse files
kpflemingyuwata
authored andcommitted
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.
1 parent a0be538 commit 87f9d6e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/network/networkd-ndisc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ static int ndisc_router_process_default(Link *link, sd_ndisc_router *rt) {
255255
}
256256

257257
static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_t lifetime_preferred, Address *address) {
258-
bool prefix = false;
258+
bool have_address = false;
259259
struct in6_addr addr;
260260
IPv6Token *j;
261261
Iterator i;
@@ -274,18 +274,18 @@ static int ndisc_router_generate_address(Link *link, unsigned prefixlen, uint32_
274274
return r;
275275

276276
if (stableprivate_address_is_valid(&address->in_addr.in6)) {
277-
prefix = true;
277+
have_address = true;
278278
break;
279279
}
280280
}
281281
} else if (j->address_generation_type == IPV6_TOKEN_ADDRESS_GENERATION_STATIC) {
282282
memcpy(((uint8_t *)&address->in_addr.in6) + 8, ((uint8_t *) &j->prefix) + 8, 8);
283-
prefix = true;
283+
have_address = true;
284284
break;
285285
}
286286

287-
/* fallback to eui64 if prefixstable or static do not match */
288-
if (!prefix) {
287+
/* fall back to EUI-64 if neither prefixstable nor static provide an address */
288+
if (!have_address) {
289289
/* see RFC4291 section 2.5.1 */
290290
address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0];
291291
address->in_addr.in6.s6_addr[8] ^= 1 << 1;

0 commit comments

Comments
 (0)