summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/ospfd.c
diff options
context:
space:
mode:
authordenis <denis@cvs.openbsd.org>2019-05-16 05:49:23 +0000
committerdenis <denis@cvs.openbsd.org>2019-05-16 05:49:23 +0000
commitca1f41f0d9a2ad5c4e0193436498df3855fb7945 (patch)
treec001f609e604274cca2f05db75f61a425bca9aab /usr.sbin/ospfd/ospfd.c
parentb33c2587535ca3a0d92508d82555ba4fe51740ad (diff)
Do not change router-id on reload if unspecified.
OK remi@
Diffstat (limited to 'usr.sbin/ospfd/ospfd.c')
-rw-r--r--usr.sbin/ospfd/ospfd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index efb150fa63c..fb933af6a33 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.107 2019/03/26 20:39:33 remi Exp $ */
+/* $OpenBSD: ospfd.c,v 1.108 2019/05/16 05:49:22 denis Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -185,6 +185,8 @@ main(int argc, char *argv[])
kif_clear();
exit(1);
}
+ if (ospfd_conf->rtr_id.s_addr == 0)
+ ospfd_conf->rtr_id.s_addr = get_rtr_id();
if (sockname == NULL) {
if (asprintf(&sockname, "%s.%d", OSPFD_SOCKET,
@@ -642,6 +644,10 @@ ospf_reload(void)
if ((xconf = parse_config(conffile, ospfd_conf->opts)) == NULL)
return (-1);
+ /* No router-id was specified, keep existing value */
+ if (xconf->rtr_id.s_addr == 0)
+ xconf->rtr_id.s_addr = ospfd_conf->rtr_id.s_addr;
+
/* Abort the reload if rtr_id changed */
if (ospfd_conf->rtr_id.s_addr != xconf->rtr_id.s_addr) {
log_warnx("router-id changed: restart required");