On Wed, May 15, 2019 at 03:52:57PM +0200, Denis Fondras wrote:
> When router-id is unspecified, ospfd will choose the lowest IP address of the
> host. I added an area and an IP lower than the existing ones and on reload
> ospfd asked me to restart and did not activate the new area.
>
> Why would it update the router-id in such a case ?
>
> This diff changes this behaviour. When router-id is not explicitely changed,
> keep the existing setting.
makes sense to me.
OK remi@
>
> Index: ospfd.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/ospfd.c,v
> retrieving revision 1.107
> diff -u -p -r1.107 ospfd.c
> --- ospfd.c 26 Mar 2019 20:39:33 -0000 1.107
> +++ ospfd.c 15 May 2019 13:19:52 -0000
> @@ -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,
> @@ -641,6 +643,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) {
> Index: ospfd.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/ospfd.h,v
> retrieving revision 1.103
> diff -u -p -r1.103 ospfd.h
> --- ospfd.h 28 Dec 2018 19:25:10 -0000 1.103
> +++ ospfd.h 15 May 2019 13:19:52 -0000
> @@ -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 *);
>
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospfd/parse.y,v
> retrieving revision 1.96
> diff -u -p -r1.96 parse.y
> --- parse.y 29 Apr 2019 05:14:38 -0000 1.96
> +++ parse.y 15 May 2019 13:19:52 -0000
> @@ -83,7 +83,6 @@ int symset(const char *, const char *,
> 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;
> @@ -1253,9 +1252,6 @@ parse_config(char *filename, int opts)
> clear_config(conf);
> return (NULL);
> }
> -
> - if (conf->rtr_id.s_addr == 0)
> - conf->rtr_id.s_addr = get_rtr_id();
>
> return (conf);
> }
>