summaryrefslogtreecommitdiffstats
path: root/src/shared/loopback-setup.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-04-22 21:41:17 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-04-23 01:45:45 +0200
commit5662811e34a4c553ec4c5684d66061192427a1b3 (patch)
tree18118b4f6664d52cdc5f6686125ad6be751413d3 /src/shared/loopback-setup.c
parenttest: extend the "hashed" unit names coverage a bit (diff)
downloadsystemd-5662811e34a4c553ec4c5684d66061192427a1b3.tar.xz
systemd-5662811e34a4c553ec4c5684d66061192427a1b3.zip
loopback-setup: tweak message if loopback device is already set up
Diffstat (limited to '')
-rw-r--r--src/shared/loopback-setup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/loopback-setup.c b/src/shared/loopback-setup.c
index 76022ce423..8434c887d9 100644
--- a/src/shared/loopback-setup.c
+++ b/src/shared/loopback-setup.c
@@ -17,6 +17,7 @@ struct state {
int rcode;
const char *error_message;
const char *success_message;
+ const char *eexist_message;
};
static int generic_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userdata) {
@@ -30,7 +31,9 @@ static int generic_handler(sd_netlink *rtnl, sd_netlink_message *m, void *userda
errno = 0;
r = sd_netlink_message_get_errno(m);
- if (r < 0)
+ if (r == -EEXIST && s->eexist_message)
+ log_debug_errno(r, "%s", s->eexist_message);
+ else if (r < 0)
log_debug_errno(r, "%s: %m", s->error_message);
else
log_debug("%s", s->success_message);
@@ -157,9 +160,11 @@ int loopback_setup(void) {
struct state state_4 = {
.error_message = "Failed to add address 127.0.0.1 to loopback interface",
.success_message = "Successfully added address 127.0.0.1 to loopback interface",
+ .eexist_message = "127.0.0.1 has already been added to loopback interface",
}, state_6 = {
.error_message = "Failed to add address ::1 to loopback interface",
.success_message = "Successfully added address ::1 to loopback interface",
+ .eexist_message = "::1 has already been added to loopback interface",
}, state_up = {
.error_message = "Failed to bring loopback interface up",
.success_message = "Successfully brought loopback interface up",