ifupdown: Don't configure errornous interfaces.

Do not configure interfaces which have a configuration know to be broken.
  Currently this only happens when using "inherit" to an non-existing iface
  or to an iface and not a template, and having allow_any_iface_as_template
  set to 0.

  In those cases broken ifaces will not be configured unless ifup/ifdown is
  invoked with --force.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
This commit is contained in:
Maximilian Wilhelm 2020-09-25 02:15:16 +02:00
parent fafce2f262
commit 8dc2295006
5 changed files with 76 additions and 24 deletions

View file

@ -3,6 +3,7 @@
* Purpose: bring interfaces up or down
*
* Copyright (c) 2020 Ariadne Conill <ariadne@dereferenced.org>
* Copyright (c) 2020 Maximilian Wilhelm <max@sdn.clinic>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -105,6 +106,12 @@ skip_interface(struct lif_interface *iface, const char *ifname)
if (exec_opts.force)
return false;
if (iface->has_config_error)
{
fprintf(stderr, "%s: skipping interface %s due to config errors\n", argv0, ifname);
return true;
}
if (up && iface->refcount > 0)
{
if (exec_opts.verbose)