chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
networkd: smooth transition from ipv4ll to dhcp address
[elogind.git]
/
src
/
network
/
networkd-wait-online.c
diff --git
a/src/network/networkd-wait-online.c
b/src/network/networkd-wait-online.c
index 900dc05125a800e9be402993205c4034d66f08c8..e62859e1cf9c8b229204a2e853329173026f7c0e 100644
(file)
--- a/
src/network/networkd-wait-online.c
+++ b/
src/network/networkd-wait-online.c
@@
-20,8
+20,10
@@
***/
#include "sd-event.h"
***/
#include "sd-event.h"
+#include "event-util.h"
#include "sd-daemon.h"
#include "sd-network.h"
#include "sd-daemon.h"
#include "sd-network.h"
+#include "network-util.h"
#include "util.h"
#include "util.h"
@@
-38,20
+40,15
@@
static bool all_configured(void) {
_cleanup_free_ char *state = NULL;
r = sd_network_get_link_state(indices[i], &state);
_cleanup_free_ char *state = NULL;
r = sd_network_get_link_state(indices[i], &state);
- if (r < 0)
+ if (r == -EUNATCH)
+ continue;
+ if (r < 0 || !streq(state, "configured"))
return false;
return false;
- if (streq(state, "configured"))
- one_ready = true;
-
- if (!streq(state, "configured") && !streq(state, "unmanaged"))
- return false;
+ one_ready = true;
}
}
- if (one_ready)
- return true;
-
- return false;
+ return one_ready;
}
static int event_handler(sd_event_source *s, int fd, uint32_t revents,
}
static int event_handler(sd_event_source *s, int fd, uint32_t revents,
@@
-67,9
+64,9
@@
static int event_handler(sd_event_source *s, int fd, uint32_t revents,
}
int main(int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
-
sd_event *event
;
-
sd_event_source *event_source
;
-
sd_network_monitor *monitor
;
+
_cleanup_event_unref_ sd_event *event = NULL
;
+
_cleanup_event_source_unref_ sd_event_source *event_source = NULL
;
+
_cleanup_network_monitor_unref_ sd_network_monitor *monitor = NULL
;
int r, fd, events;
log_set_target(LOG_TARGET_AUTO);
int r, fd, events;
log_set_target(LOG_TARGET_AUTO);
@@
-122,7
+119,7
@@
int main(int argc, char *argv[]) {
sd_notify(false,
"READY=1\n"
sd_notify(false,
"READY=1\n"
- "STATUS=Waiting for network connec
it
ons...");
+ "STATUS=Waiting for network connec
ti
ons...");
r = sd_event_loop(event);
if (r < 0) {
r = sd_event_loop(event);
if (r < 0) {
@@
-134,9
+131,5
@@
out:
sd_notify(false,
"STATUS=All interfaces configured...");
sd_notify(false,
"STATUS=All interfaces configured...");
- sd_event_source_unref(event_source);
- sd_event_unref(event);
- sd_network_monitor_unref(monitor);
-
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}