diff options
author | Katerina Kubecova <katerina.kubecova@nic.cz> | 2024-04-11 14:53:39 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2024-04-16 15:30:59 +0200 |
commit | e6dbde68836ab632126614fa5588268120997548 (patch) | |
tree | dd575ad515790c83f4ad040251367ebcfee1d16e /proto | |
parent | 13c10ee06241d4538603d21954be0c2db08911ba (diff) |
BFD: Set password per session
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bfd/bfd.c | 4 | ||||
-rw-r--r-- | proto/bfd/bfd.h | 2 | ||||
-rw-r--r-- | proto/bfd/packets.c | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/proto/bfd/bfd.c b/proto/bfd/bfd.c index 41d8e210..4f8499ba 100644 --- a/proto/bfd/bfd.c +++ b/proto/bfd/bfd.c @@ -174,6 +174,8 @@ bfd_merge_options(const struct bfd_iface_config *cf, const struct bfd_options *o .idle_tx_int = opts->idle_tx_int ?: cf->idle_tx_int, .multiplier = opts->multiplier ?: cf->multiplier, .passive = opts->passive_set ? opts->passive : cf->passive, + .auth_type = opts->auth_type ?: cf->auth_type, + .passwords = opts->passwords ?: cf->passwords, }; } @@ -1195,7 +1197,7 @@ bfd_show_session(struct bfd_session *s, int details) const char *ifname = (s->ifa && s->ifa->iface) ? s->ifa->iface->name : "---"; btime tx_int = s->last_tx ? MAX(s->des_min_tx_int, s->rem_min_rx_int) : 0; btime timeout = (btime) MAX(s->req_min_rx_int, s->rem_min_tx_int) * s->rem_detect_mult; - u8 auth_type = s->ifa->cf->auth_type; + u8 auth_type = s->cf.auth_type; loc_state = (loc_state < 4) ? loc_state : 0; rem_state = (rem_state < 4) ? rem_state : 0; diff --git a/proto/bfd/bfd.h b/proto/bfd/bfd.h index e711bc80..847c6b14 100644 --- a/proto/bfd/bfd.h +++ b/proto/bfd/bfd.h @@ -69,6 +69,8 @@ struct bfd_session_config u32 idle_tx_int; u8 multiplier; u8 passive; + u8 auth_type; /* Authentication type (BFD_AUTH_*) */ + list *passwords; /* Passwords for authentication */ }; struct bfd_neighbor diff --git a/proto/bfd/packets.c b/proto/bfd/packets.c index e2ec5988..aec91ca6 100644 --- a/proto/bfd/packets.c +++ b/proto/bfd/packets.c @@ -109,7 +109,7 @@ const u8 bfd_auth_type_to_hash_alg[] = { static void bfd_fill_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_ctl_packet *pkt) { - struct bfd_iface_config *cf = s->ifa->cf; + struct bfd_session_config *cf = &s->cf; struct password_item *pass = password_find(cf->passwords, 0); uint meticulous = 0; @@ -179,7 +179,7 @@ bfd_fill_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_c static int bfd_check_authentication(struct bfd_proto *p, struct bfd_session *s, struct bfd_ctl_packet *pkt) { - struct bfd_iface_config *cf = s->ifa->cf; + struct bfd_session_config *cf = &s->cf; const char *err_dsc = NULL; uint err_val = 0; uint auth_type = 0; @@ -306,7 +306,7 @@ bfd_send_ctl(struct bfd_proto *p, struct bfd_session *s, int final) else if (s->poll_active) pkt->flags |= BFD_FLAG_POLL; - if (s->ifa->cf->auth_type) + if (s->cf.auth_type) bfd_fill_authentication(p, s, pkt); if (sk->tbuf != sk->tpos) |