zebra: Add command to configure default for link-state, and make it sticky
* Provide a way for the user to specify their own preference for the default
behaviour of link-detect, independent of the compiled in default.
Add a global "default link-detect (on|off)" command to zebra, to set
the default policy for link-detect accordingly. The command is "sticky" -
when set it will stay set and always be written out, regardless of how it
compares to the baked-in, compile-time default.
The per-interface "link-detect" command is similarly made sticky.
* zebra/interface.h: (zebra_if_linkdetect;) enum for link-detect configured
state.
(struct zebra_if_defaults) Global link-detect default
(struct zebra_if) Add field for per-iface link-detect default.
* lib/if.c: (if_create_vrf) Remove the default flag setting on if-create
here, it's a zebra flag so do it in zebra's if_zebra_new_hook
* zebra/interface.c: Add static storage for global defaults.
(if_zebra_new_hook) Set the link-detect flag on new ifaces according to the
baked in default or else the configured global default.
(config_write_zebra_if_defaults,default_linkdetect_cmd) global link-detect
command and config write out machinery.
(linkdetect_cmd) Set the configuration state rather than the flag.
The new hook will then set the interface flag when the if comes up.
(if_config_write) Write config according to configured state, not the
low-level flag.
(zebra_if_init) add new commands.
4 files changed