mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-23 17:34:00 +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 "log-link.h"
|
||||||
#include "random-util.h"
|
#include "random-util.h"
|
||||||
#include "siphash24.h"
|
#include "siphash24.h"
|
||||||
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "time-util.h"
|
#include "time-util.h"
|
||||||
|
|
||||||
@ -79,10 +80,25 @@ struct sd_ipv4acd {
|
|||||||
#define log_ipv4acd(acd, fmt, ...) \
|
#define log_ipv4acd(acd, fmt, ...) \
|
||||||
log_ipv4acd_errno(acd, 0, fmt, ##__VA_ARGS__)
|
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) {
|
static void ipv4acd_set_state(sd_ipv4acd *acd, IPv4ACDState st, bool reset_counter) {
|
||||||
assert(acd);
|
assert(acd);
|
||||||
assert(st < _IPV4ACD_STATE_MAX);
|
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)
|
if (st == acd->state && !reset_counter)
|
||||||
acd->n_iteration++;
|
acd->n_iteration++;
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user