summaryrefslogtreecommitdiff
path: root/proto/rip/config.Y
diff options
context:
space:
mode:
Diffstat (limited to 'proto/rip/config.Y')
-rw-r--r--proto/rip/config.Y22
1 files changed, 18 insertions, 4 deletions
diff --git a/proto/rip/config.Y b/proto/rip/config.Y
index e15599e0..4ec45c7a 100644
--- a/proto/rip/config.Y
+++ b/proto/rip/config.Y
@@ -98,15 +98,29 @@ rip_iface_start:
rip_iface_finish:
{
+ /* Default mode is broadcast for RIPv1, multicast for RIPv2 and RIPng */
+ if (!RIP_IFACE->mode)
+ RIP_IFACE->mode = (rip_cfg_is_v2() && (RIP_IFACE->version == RIP_V1)) ?
+ RIP_IM_BROADCAST : RIP_IM_MULTICAST;
+
RIP_IFACE->passwords = get_passwords();
if (!RIP_IFACE->auth_type != !RIP_IFACE->passwords)
log(L_WARN "Authentication and password options should be used together");
- /* Default mode is broadcast for RIPv1, multicast for RIPv2 and RIPng */
- if (!RIP_IFACE->mode)
- RIP_IFACE->mode = (rip_cfg_is_v2() && (RIP_IFACE->version == RIP_V1)) ?
- RIP_IM_BROADCAST : RIP_IM_MULTICAST;
+ if (RIP_IFACE->passwords)
+ {
+ struct password_item *pass;
+ WALK_LIST(pass, *RIP_IFACE->passwords)
+ {
+ if (pass->alg && (RIP_IFACE->auth_type != RIP_AUTH_CRYPTO))
+ cf_error("Password algorithm option requires cryptographic authentication");
+
+ /* Set default crypto algorithm (MD5) */
+ if (!pass->alg && (RIP_IFACE->auth_type == RIP_AUTH_CRYPTO))
+ pass->alg = ALG_MD5;
+ }
+ }
RIP_CFG->min_timeout_time = MIN_(RIP_CFG->min_timeout_time, RIP_IFACE->timeout_time);
RIP_CFG->max_garbage_time = MAX_(RIP_CFG->max_garbage_time, RIP_IFACE->garbage_time);