mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
sd-ipv4acd: logs current state
This commit is contained in:
parent
3f2c0d8520
commit
878c035a48
@ -21,6 +21,7 @@
|
||||
#include "log-link.h"
|
||||
#include "random-util.h"
|
||||
#include "siphash24.h"
|
||||
#include "string-table.h"
|
||||
#include "string-util.h"
|
||||
#include "time-util.h"
|
||||
|
||||
@ -79,10 +80,25 @@ struct sd_ipv4acd {
|
||||
#define log_ipv4acd(acd, fmt, ...) \
|
||||
log_ipv4acd_errno(acd, 0, fmt, ##__VA_ARGS__)
|
||||
|
||||
static const char * const ipv4acd_state_table[_IPV4ACD_STATE_MAX] = {
|
||||
[IPV4ACD_STATE_INIT] = "init",
|
||||
[IPV4ACD_STATE_STARTED] = "started",
|
||||
[IPV4ACD_STATE_WAITING_PROBE] = "waiting-probe",
|
||||
[IPV4ACD_STATE_PROBING] = "probing",
|
||||
[IPV4ACD_STATE_WAITING_ANNOUNCE] = "waiting-announce",
|
||||
[IPV4ACD_STATE_ANNOUNCING] = "announcing",
|
||||
[IPV4ACD_STATE_RUNNING] = "running",
|
||||
};
|
||||
|
||||
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(ipv4acd_state, IPv4ACDState);
|
||||
|
||||
static void ipv4acd_set_state(sd_ipv4acd *acd, IPv4ACDState st, bool reset_counter) {
|
||||
assert(acd);
|
||||
assert(st < _IPV4ACD_STATE_MAX);
|
||||
|
||||
if (st != acd->state)
|
||||
log_ipv4acd(acd, "%s -> %s", ipv4acd_state_to_string(acd->state), ipv4acd_state_to_string(st));
|
||||
|
||||
if (st == acd->state && !reset_counter)
|
||||
acd->n_iteration++;
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user