summaryrefslogtreecommitdiff
path: root/src/network/networkd-wait-online.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-01-29 07:34:34 +0100
committerTom Gundersen <teg@jklm.no>2015-01-31 15:26:08 +0100
commit79b1f37d95f08fe7620b071eec51d2810ed077c9 (patch)
treea80e71691b9b8dd57639c5d5351a41a154dec1c7 /src/network/networkd-wait-online.c
parent233ba5c3a0f73e01fe6149fd8c377826a83c2a0a (diff)
networkd-wait-online: allow specific devices to be ignored
In addition to the loopback device, also explicitly configured devices to be ignored. Suggested by Charles Devereaux <systemd@guylhem.net>.
Diffstat (limited to 'src/network/networkd-wait-online.c')
-rw-r--r--src/network/networkd-wait-online.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/network/networkd-wait-online.c b/src/network/networkd-wait-online.c
index 32a8d85301..826ab929cc 100644
--- a/src/network/networkd-wait-online.c
+++ b/src/network/networkd-wait-online.c
@@ -29,6 +29,7 @@
static bool arg_quiet = false;
static char **arg_interfaces = NULL;
+static char **arg_ignore = NULL;
static void help(void) {
printf("%s [OPTIONS...]\n\n"
@@ -37,6 +38,7 @@ static void help(void) {
" --version Print version string\n"
" -q --quiet Do not show status information\n"
" -i --interface=INTERFACE Block until at least these interfaces have appeared\n"
+ " --ignore=INTERFACE Don't take these interfaces into account\n"
, program_invocation_short_name);
}
@@ -44,6 +46,7 @@ static int parse_argv(int argc, char *argv[]) {
enum {
ARG_VERSION = 0x100,
+ ARG_IGNORE,
};
static const struct option options[] = {
@@ -51,6 +54,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "version", no_argument, NULL, ARG_VERSION },
{ "quiet", no_argument, NULL, 'q' },
{ "interface", required_argument, NULL, 'i' },
+ { "ignore", required_argument, NULL, ARG_IGNORE },
{}
};
@@ -82,6 +86,12 @@ static int parse_argv(int argc, char *argv[]) {
break;
+ case ARG_IGNORE:
+ if (strv_extend(&arg_ignore, optarg) < 0)
+ return log_oom();
+
+ break;
+
case '?':
return -EINVAL;
@@ -111,7 +121,7 @@ int main(int argc, char *argv[]) {
assert_se(sigprocmask_many(SIG_BLOCK, SIGTERM, SIGINT, -1) == 0);
- r = manager_new(&m, arg_interfaces);
+ r = manager_new(&m, arg_interfaces, arg_ignore);
if (r < 0) {
log_error_errno(r, "Could not create manager: %m");
goto finish;
@@ -135,5 +145,8 @@ int main(int argc, char *argv[]) {
finish:
sd_notify(false, "STATUS=All interfaces configured...");
+ strv_free(arg_interfaces);
+ strv_free(arg_ignore);
+
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}