RPKI: Fix reconfiguration when ssh parameters are undefined
This commit is contained in:
parent
d843c27478
commit
15b0a92294
5 changed files with 29 additions and 9 deletions
|
@ -89,6 +89,19 @@ t_time(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
t_bstrcmp(void)
|
||||||
|
{
|
||||||
|
bt_assert(bstrcmp("aa", "aa") == 0);
|
||||||
|
bt_assert(bstrcmp("aa", "bb") == -1);
|
||||||
|
bt_assert(bstrcmp("bb", "aa") == 1);
|
||||||
|
bt_assert(bstrcmp(NULL, NULL) == 0);
|
||||||
|
bt_assert(bstrcmp(NULL, "bb") == -1);
|
||||||
|
bt_assert(bstrcmp("bb", NULL) == 1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -97,6 +110,7 @@ main(int argc, char *argv[])
|
||||||
bt_test_suite(t_simple, "printf without varargs");
|
bt_test_suite(t_simple, "printf without varargs");
|
||||||
bt_test_suite(t_router_id, "print router id");
|
bt_test_suite(t_router_id, "print router id");
|
||||||
bt_test_suite(t_time, "print time");
|
bt_test_suite(t_time, "print time");
|
||||||
|
bt_test_suite(t_bstrcmp, "bstrcmp");
|
||||||
|
|
||||||
return bt_exit_value();
|
return bt_exit_value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,15 @@ memset32(void *D, u32 val, uint n)
|
||||||
dst[i] = val;
|
dst[i] = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
bstrcmp(const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
if (s1 && s2)
|
||||||
|
return strcmp(s1, s2);
|
||||||
|
else
|
||||||
|
return !s2 - !s1;
|
||||||
|
}
|
||||||
|
|
||||||
#define ROUTER_ID_64_LENGTH 23
|
#define ROUTER_ID_64_LENGTH 23
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2011,12 +2011,10 @@ bgp_reconfigure(struct proto *P, struct proto_config *CF)
|
||||||
((byte *) new) + sizeof(struct proto_config),
|
((byte *) new) + sizeof(struct proto_config),
|
||||||
// password item is last and must be checked separately
|
// password item is last and must be checked separately
|
||||||
OFFSETOF(struct bgp_config, password) - sizeof(struct proto_config))
|
OFFSETOF(struct bgp_config, password) - sizeof(struct proto_config))
|
||||||
&& ((!old->password && !new->password)
|
&& !bstrcmp(old->password, new->password)
|
||||||
|| (old->password && new->password && !strcmp(old->password, new->password)))
|
|
||||||
&& ((!old->remote_range && !new->remote_range)
|
&& ((!old->remote_range && !new->remote_range)
|
||||||
|| (old->remote_range && new->remote_range && net_equal(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)
|
&& !bstrcmp(old->dynamic_name, new->dynamic_name)
|
||||||
|| (old->dynamic_name && new->dynamic_name && !strcmp(old->dynamic_name, new->dynamic_name)))
|
|
||||||
&& (old->dynamic_name_digits == new->dynamic_name_digits);
|
&& (old->dynamic_name_digits == new->dynamic_name_digits);
|
||||||
|
|
||||||
/* FIXME: Move channel reconfiguration to generic protocol code ? */
|
/* FIXME: Move channel reconfiguration to generic protocol code ? */
|
||||||
|
|
|
@ -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_old = (void *) old->tr_config.spec;
|
||||||
struct rpki_tr_ssh_config *ssh_new = (void *) new->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) ||
|
if (bstrcmp(ssh_old->bird_private_key, ssh_new->bird_private_key) ||
|
||||||
(strcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) != 0) ||
|
bstrcmp(ssh_old->cache_public_key, ssh_new->cache_public_key) ||
|
||||||
(strcmp(ssh_old->user, ssh_new->user) != 0))
|
bstrcmp(ssh_old->user, ssh_new->user))
|
||||||
{
|
{
|
||||||
CACHE_TRACE(D_EVENTS, cache, "Settings of SSH transport configuration changed");
|
CACHE_TRACE(D_EVENTS, cache, "Settings of SSH transport configuration changed");
|
||||||
try_fast_reconnect = 1;
|
try_fast_reconnect = 1;
|
||||||
|
|
|
@ -387,8 +387,7 @@ log_switch(int initial, list *logs, char *new_syslog_name)
|
||||||
current_log_list = logs;
|
current_log_list = logs;
|
||||||
|
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
if (current_syslog_name && new_syslog_name &&
|
if (!bstrcmp(current_syslog_name, new_syslog_name))
|
||||||
!strcmp(current_syslog_name, new_syslog_name))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (current_syslog_name)
|
if (current_syslog_name)
|
||||||
|
|
Loading…
Reference in a new issue