mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
sd-ndisc: do not print "(null)" in the log message
If we received RA with no flags set, or with an invalid preference,
previously "(null)" was printed.
Follow-up for 238ed432c3.
Fixes https://github.com/systemd/systemd/pull/32308#discussion_r1600940289.
This commit is contained in:
committed by
Luca Boccassi
parent
6840ecb8ef
commit
a925620f5f
@@ -203,9 +203,10 @@ int sd_ndisc_router_get_preference(sd_ndisc_router *rt, uint8_t *ret) {
|
||||
}
|
||||
|
||||
static const char* const ndisc_router_preference_table[] = {
|
||||
[SD_NDISC_PREFERENCE_LOW] = "low",
|
||||
[SD_NDISC_PREFERENCE_MEDIUM] = "medium",
|
||||
[SD_NDISC_PREFERENCE_HIGH] = "high",
|
||||
[SD_NDISC_PREFERENCE_LOW] = "low",
|
||||
[SD_NDISC_PREFERENCE_MEDIUM] = "medium",
|
||||
[SD_NDISC_PREFERENCE_HIGH] = "high",
|
||||
[SD_NDISC_PREFERENCE_RESERVED] = "reserved",
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP_TO_STRING(ndisc_router_preference, int);
|
||||
|
||||
@@ -248,10 +248,10 @@ static int ndisc_handle_router(sd_ndisc *nd, ICMP6Packet *packet) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
log_ndisc(nd, "Received Router Advertisement from %s: flags=0x%0*"PRIx64"%s%s%s, preference=%s, lifetime=%s",
|
||||
log_ndisc(nd, "Received Router Advertisement from %s: flags=0x%0*"PRIx64"(%s), preference=%s, lifetime=%s",
|
||||
IN6_ADDR_TO_STRING(&a),
|
||||
flags & UINT64_C(0x00ffffffffffff00) ? 14 : 2, flags, /* suppress too many zeros if no extension */
|
||||
s ? " (" : "", s, s ? ")" : "",
|
||||
s ?: "none",
|
||||
ndisc_router_preference_to_string(pref),
|
||||
FORMAT_TIMESPAN(lifetime, USEC_PER_SEC));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user