Commit graph

59 commits

Author SHA1 Message Date
Ariadne Conill
045211514b lifecycle: skip parent interfaces marked as explicitly configured when going down
these interfaces will be taken down by ifdown itself when appropriate
2020-10-21 09:18:54 -06:00
Maximilian Wilhelm
de207a5950 lifecyle: Use lif_address_format_cidr() for IF_ADDRESSES
Previously IF_ADDRESSES would not contain a prefix length if the address
  entry in the configuration did not was in CIDR format but had a netmask
  set seperately. This commit fixes that behaviour and computes a CIDR
  netmask if necessary.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-14 01:47:49 +02:00
Ariadne Conill
122a54377d lifecycle: break dependency cycles when calculating the full dependency graph 2020-10-08 02:01:46 -06:00
Ariadne Conill
175f002b3e lifecycle: add lif_interface.is_pending to break dependency cycles 2020-10-08 01:49:44 -06:00
Maximilian Wilhelm
5302bee850 lifecycle: Don't leak allocated memory.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-06 04:50:02 +02:00
Maximilian Wilhelm
1a2298a759 lifecycle: Use snprintf() in favor of sprintf()
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-06 04:50:02 +02:00
Maximilian Wilhelm
99b0d67b8e lifecycle: Remove debugging statement.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-06 04:50:02 +02:00
Maximilian Wilhelm
8a58c0ae6d lifecycle: Expose all adresses and gateways via the environment.
Gather all IP addresses and gateways and expose them as IF_ADDRESSES and
  IF_GATEWAYS environment variables to executors. This eliminates the need
  to run ifquery from execuctors which would have to parse the config file
  again on every run.

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-06 04:43:12 +02:00
Maximilian Wilhelm
9ee3a874d4 Add support for bonding / LAGs.
* Add a bond executor
  * Add mappings from ifupdown1/2
  * Add a detailed man page
  * Remove legacy compatiblity glue for setups with 'requires' only

  The current implementation has to work around the fact that member interfaces
  will be already up then the bond is created. This is simply done by downing
  them, adding them to the bundle and upping them again. This can possible be
  done in a nicer way after revisiting the ordering of plugin execution (#12).

  Closes #91

Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-10-04 01:35:41 +02:00
Maximilian Wilhelm
8dc2295006 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>
2020-09-25 02:15:16 +02:00
Ariadne Conill
580f054d7e lifecycle: do not allow lif_lifecycle_run() on a template 2020-09-23 11:39:45 -06:00
Ariadne Conill
4b30dc4573 lifecycle: if lif_config.allow_addon_scripts is disabled, don't run addon scripts 2020-09-14 17:26:45 -06:00
Ariadne Conill
a6e022ad99 lifecycle: re-sort the interface collection by hand 2020-09-09 19:21:41 -06:00
Ariadne Conill
258e2e8a52 lifecycle: return the maximum tree depth for the dependency tree when counting depth 2020-09-09 18:12:13 -06:00
Ariadne Conill
8c8727e30f lifecycle: drop redundant lif_lifecycle_query_dependents().
since we now precompile the full dependency tree, including depths,
we no longer need to re-query each leaf for dependency information.
2020-09-09 17:40:57 -06:00
Ariadne Conill
2569503afa lifecycle: add lif_lifecycle_count_rdepends(), which calculates reverse dependency depth 2020-09-09 17:39:26 -06:00
Ariadne Conill
e6c6f49143 lifecycle: remove redundant lif_state_upsert() call
this will be handled by lif_state_ref_if(), which also updates the
refcounting.
2020-09-09 16:01:04 -06:00
Ariadne Conill
5a0b53cd73 libifupdown: add interface being run for each executor 2020-09-09 15:50:16 -06:00
Ariadne Conill
00da19a381 lifecycle: add create/destroy phases 2020-09-09 14:36:07 -06:00
Ariadne Conill
f139bc2416 lifecycle: consider an interface eligible for takedown if it has only one dependent (itself) 2020-09-08 15:50:32 -06:00
Ariadne Conill
6603ff1000 lifecycle: use refcounting to defer interface teardown 2020-09-08 15:28:36 -06:00
Ariadne Conill
3b10494b40 change lif_interface.is_up to lif_interface.refcount 2020-09-08 14:41:25 -06:00
Ariadne Conill
ae1dc41c88 lifecycle: constify lif_interface access in several functions 2020-09-07 13:41:11 -06:00
Maximilian Wilhelm
570679c5bf lifecycle: Make sure to return true when script dir doesn't exist.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-08-27 12:10:12 +02:00
Maximilian Wilhelm
61ed18db2c lifecycle: Check if script dir exist before executing run-parts.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-08-27 01:15:51 +02:00
Ariadne Conill
4d64176ea3 execute: note the phase each executor is being invoked in 2020-08-26 02:06:36 -06:00
Ariadne Conill
aefaaa7457 lifecycle: only print skipping interface message if verbose 2020-08-24 11:33:56 -06:00
Ariadne Conill
de20e5f8a9 lifecycle: handle executors in reverse order when taking an interface down 2020-08-24 11:04:48 -06:00
Ariadne Conill
aba4b18862 lifecycle: add some helpful debug 2020-08-24 10:36:17 -06:00
Ariadne Conill
e5c592f2c1 remove lif_interface.is_dhcp too 2020-08-20 03:14:57 -06:00
Ariadne Conill
1964a99e5d lifecycle: don't insert a requires entry if it would be empty 2020-07-31 17:12:13 -06:00
Ariadne Conill
edfb91c05f lifecycle: separate environment building into build_environment() 2020-07-29 02:24:10 -06:00
Ariadne Conill
fb5ff4eac2 lifecycle: add support for learning dependents from executors (ref #5) 2020-07-28 13:46:25 -06:00
Ariadne Conill
08805f7de3 lifecycle: handle_commands_for_phase(): drop unused lifname variable 2020-07-26 03:39:58 -06:00
Ariadne Conill
be00984946 lifecycle: stop bringing up links, use link executor instead 2020-07-26 03:38:55 -06:00
Ariadne Conill
12307aeb9d lifecycle: remove static address configuration (replaced with static executor) 2020-07-26 03:20:35 -06:00
Ariadne Conill
cae16c5758 simplify loopback 2020-07-26 02:59:15 -06:00
Ariadne Conill
9e4e17707f lifecycle: expose INTERFACES_FILE env var to executors 2020-07-26 02:50:01 -06:00
Ariadne Conill
7eeb7c98b5 libifupdown: lifecycle: remove built-in dhcp implementation 2020-07-25 02:50:45 -06:00
Ariadne Conill
95a72b5663 libifupdown: lifecycle: implement native executor support 2020-07-25 02:19:15 -06:00
Ariadne Conill
f8c14fc233 libifupdown: lifecycle: if in verbose mode, export VERBOSE to executors 2020-07-25 02:18:53 -06:00
Ariadne Conill
83d64b0a69 libifupdown: lifecycle: IFACE env variable should be set to the logical ifname 2020-07-25 02:18:35 -06:00
Ariadne Conill
d582e405b6 lifecycle: simplify netmask fallback path 2020-07-25 01:02:05 -06:00
Ariadne Conill
60633e4acb lifecycle: add backwards compat for netmask triples 2020-07-25 00:58:32 -06:00
Ariadne Conill
a3c138b9b2 interface-file: add some backwards compatibility hacks with use (ref #3) 2020-07-24 04:39:41 -06:00
Ariadne Conill
5c75cdcab0 libifupdown: inline the tokenization functions 2020-07-24 04:12:42 -06:00
Ariadne Conill
101db509c1 lifecycle: note transient state changes when executing in verbose mode 2020-07-24 03:51:31 -06:00
Ariadne Conill
38537339ab lifecycle: implement requires keyword 2020-07-24 03:42:34 -06:00
Ariadne Conill
b9f1ae8254 lifecycle: rewrite bond-xmit-hash-policy as IF_BOND_XMIT_HASH_POLICY when building env 2020-07-24 01:03:44 -06:00
Ariadne Conill
89f2110254 lifecycle: fix taking default routes down 2020-07-24 00:11:37 -06:00