summaryrefslogtreecommitdiff
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
parentb33c2587535ca3a0d92508d82555ba4fe51740ad (diff)
Do not change router-id on reload if unspecified.
OK remi@
-rw-r--r--usr.sbin/ospfd/ospfd.c8
-rw-r--r--usr.sbin/ospfd/ospfd.h3
-rw-r--r--usr.sbin/ospfd/parse.y6
3 files changed, 10 insertions, 7 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");
diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h
index 8cab0810910..0088a788b53 100644
--- a/usr.sbin/ospfd/ospfd.h
+++ b/usr.sbin/ospfd/ospfd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.h,v 1.103 2018/12/28 19:25:10 remi Exp $ */
+/* $OpenBSD: ospfd.h,v 1.104 2019/05/16 05:49:22 denis Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -561,6 +561,7 @@ int carp_demote_set(char *, int);
/* parse.y */
struct ospfd_conf *parse_config(char *, int);
+u_int32_t get_rtr_id(void);
int cmdline_symset(char *);
void conf_clear_redist_list(struct redist_list *);
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y
index 01d410ed838..50e6d396b9d 100644
--- a/usr.sbin/ospfd/parse.y
+++ b/usr.sbin/ospfd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.96 2019/04/29 05:14:38 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.97 2019/05/16 05:49:22 denis Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -83,7 +83,6 @@ int symset(const char *, const char *, int);
char *symget(const char *);
void clear_config(struct ospfd_conf *xconf);
-u_int32_t get_rtr_id(void);
int host(const char *, struct in_addr *, struct in_addr *);
static struct ospfd_conf *conf;
@@ -1254,9 +1253,6 @@ parse_config(char *filename, int opts)
return (NULL);
}
- if (conf->rtr_id.s_addr == 0)
- conf->rtr_id.s_addr = get_rtr_id();
-
return (conf);
}