From 15b0a9229431dc75425c229b2f94e680db49d594 Mon Sep 17 00:00:00 2001 From: "Ondrej Zajicek (work)" Date: Tue, 23 Jul 2019 01:52:18 +0200 Subject: RPKI: Fix reconfiguration when ssh parameters are undefined --- proto/bgp/bgp.c | 6 ++---- proto/rpki/rpki.c | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'proto') diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index 98e66c67..309d2231 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -2011,12 +2011,10 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF) ((byte *) new) + sizeof(struct proto_config), // password item is last and must be checked separately OFFSETOF(struct bgp_config, password) - sizeof(struct proto_config)) - && ((!old->password && !new->password) - || (old->password && new->password && !strcmp(old->password, new->password))) + && !bstrcmp(old->password, new->password) && ((!old->remote_range && !new->remote_range) || (old->remote_range && new->remote_range && net_equal(old->remote_range, new->remote_range))) - && ((!old->dynamic_name && !new->dynamic_name) - || (old->dynamic_name && new->dynamic_name && !strcmp(old->dynamic_name, new->dynamic_name))) + && !bstrcmp(old->dynamic_name, new->dynamic_name) && (old->dynamic_name_digits == new->dynamic_name_digits); /* FIXME: Move channel reconfiguration to generic protocol code ? */ diff --git a/proto/rpki/rpki.c b/proto/rpki/rpki.c index 36097dc5..70cd0cdd 100644 --- a/proto/rpki/rpki.c +++ b/proto/rpki/rpki.c @@ -687,9 +687,9 @@ rpki_reconfigure_cache(struct rpki_proto *p UNUSED, struct rpki_cache *cache, st { struct rpki_tr_ssh_config *ssh_old = (void *) old->tr_config.spec; struct rpki_tr_ssh_config *ssh_new = (void *) new->tr_config.spec; - if ((strcmp(ssh_old->bird_private_key, ssh_new->bird_private_key) != 0) || - (strcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) != 0) || - (strcmp(ssh_old->user, ssh_new->user) != 0)) + if (bstrcmp(ssh_old->bird_private_key, ssh_new->bird_private_key) || + bstrcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) || + bstrcmp(ssh_old->user, ssh_new->user)) { CACHE_TRACE(D_EVENTS, cache, "Settings of SSH transport configuration changed"); try_fast_reconnect = 1; -- cgit v1.2.3