[ospfd] Add passive-interface default support
2006-10-22 Yar Tikhiy <yar@comp.chem.msu.su>
* (general) Add support for passive-interface default (with
minor edits by Paul Jakma).
* ospf_interface.h: Add OSPF_IF_PASSIVE_STATUS macro, looking
at configured value, or the global 'default' value, as
required.
* ospf_interface.c: (ospf_if_new_hook) Leave passive
unconfigured per default, allowing global 'default' to
take effect for unconfigured interfaces.
* ospf_packet.c: (various) use OSPF_IF_PASSIVE_STATUS
* ospf_vty.c: (ospf_passive_interface_default) new function,
unset passive from all interfaces if default is enabled, as
the per-iface settings become redundant.
(ospf_passive_interface_update) new func, update passive
setting taking global default into account.
({no,}ospf_passive_interface_addr_cmd) Add support for
'default' variant of command.
(show_ip_ospf_interface_sub) Update to take global
default into account when printing passive status.
(ospf_config_write) ditto.
* ospfd.c: (ospf_new) set global passive-interface default.
* ospfd.h: (struct ospf) Add field for global
passive-interface.
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index 5a825ea..79b178d 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -50,6 +50,13 @@
DECLARE_IF_PARAM (u_char, type); /* type of interface */
#define OSPF_IF_ACTIVE 0
#define OSPF_IF_PASSIVE 1
+
+#define OSPF_IF_PASSIVE_STATUS(O) \
+ (OSPF_IF_PARAM_CONFIGURED((O)->params, passive_interface) ? \
+ (O)->params->passive_interface : \
+ (OSPF_IF_PARAM_CONFIGURED(IF_DEF_PARAMS((O)->ifp), passive_interface) ? \
+ IF_DEF_PARAMS((O)->ifp)->passive_interface : \
+ (O)->ospf->passive_interface_default))
DECLARE_IF_PARAM (u_int32_t, v_hello); /* Hello Interval */
DECLARE_IF_PARAM (u_int32_t, v_wait); /* Router Dead Interval */