Remi Locherer([email protected]) on 2019.06.08 18:37:39 +0200:
> Clear unused redist_list the same way as in ospfd.
> 
> OK?

reads good
ok benno@

> Remi
> 
> 
> Index: ospf6d.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.h,v
> retrieving revision 1.39
> diff -u -p -r1.39 ospf6d.h
> --- ospf6d.h  29 Dec 2018 16:04:31 -0000      1.39
> +++ ospf6d.h  8 Jun 2019 13:43:26 -0000
> @@ -364,13 +364,14 @@ struct redistribute {
>       u_int8_t                        prefixlen;
>       char                            dependon[IFNAMSIZ];
>  };
> +SIMPLEQ_HEAD(redist_list, redistribute);
>  
>  struct ospfd_conf {
>       struct event            ev;
>       struct in_addr          rtr_id;
>       LIST_HEAD(, area)       area_list;
>       LIST_HEAD(, vertex)     cand_list;
> -     SIMPLEQ_HEAD(, redistribute) redist_list;
> +     struct redist_list      redist_list;
>  
>       u_int32_t               opts;
>  #define OSPFD_OPT_VERBOSE    0x00000001
> @@ -522,6 +523,7 @@ int                carp_demote_set(char *, int);
>  /* parse.y */
>  struct ospfd_conf    *parse_config(char *, int);
>  int                   cmdline_symset(char *);
> +void                  conf_clear_redist_list(struct redist_list *);
>  
>  /* interface.c */
>  int           if_init(void);
> Index: ospfe.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/ospfe.c,v
> retrieving revision 1.55
> diff -u -p -r1.55 ospfe.c
> --- ospfe.c   1 Sep 2018 19:21:10 -0000       1.55
> +++ ospfe.c   8 Jun 2019 13:56:31 -0000
> @@ -74,7 +74,6 @@ ospfe(struct ospfd_conf *xconf, int pipe
>  {
>       struct area     *area;
>       struct iface    *iface;
> -     struct redistribute *r;
>       struct passwd   *pw;
>       struct event     ev_sigint, ev_sigterm;
>       pid_t            pid;
> @@ -174,10 +173,7 @@ ospfe(struct ospfd_conf *xconf, int pipe
>       event_add(&oeconf->ev, NULL);
>  
>       /* remove unneeded config stuff */
> -     while ((r = SIMPLEQ_FIRST(&oeconf->redist_list)) != NULL) {
> -             SIMPLEQ_REMOVE_HEAD(&oeconf->redist_list, entry);
> -             free(r);
> -     }
> +     conf_clear_redist_list(&oeconf->redist_list);
>  
>       /* listen on ospfd control socket */
>       TAILQ_INIT(&ctl_conns);
> Index: parse.y
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/parse.y,v
> retrieving revision 1.44
> diff -u -p -r1.44 parse.y
> --- parse.y   26 May 2019 09:27:09 -0000      1.44
> +++ parse.y   8 Jun 2019 16:36:49 -0000
> @@ -1203,6 +1203,16 @@ conf_check_rdomain(u_int rdomain)
>  }
>  
>  void
> +conf_clear_redist_list(struct redist_list *rl)
> +{
> +     struct redistribute *r;
> +     while ((r = SIMPLEQ_FIRST(rl)) != NULL) {
> +             SIMPLEQ_REMOVE_HEAD(rl, entry);
> +             free(r);
> +     }
> +}
> +
> +void
>  clear_config(struct ospfd_conf *xconf)
>  {
>       struct area     *a;
> @@ -1211,6 +1221,8 @@ clear_config(struct ospfd_conf *xconf)
>               LIST_REMOVE(a, entry);
>               area_del(a);
>       }
> +
> +     conf_clear_redist_list(&xconf->redist_list);
>  
>       free(xconf);
>  }
> Index: rde.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/ospf6d/rde.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 rde.c
> --- rde.c     12 Jul 2018 13:45:03 -0000      1.79
> +++ rde.c     8 Jun 2019 13:56:14 -0000
> @@ -118,7 +118,6 @@ rde(struct ospfd_conf *xconf, int pipe_p
>       struct event             ev_sigint, ev_sigterm;
>       struct timeval           now;
>       struct passwd           *pw;
> -     struct redistribute     *r;
>       pid_t                    pid;
>  
>       switch (pid = fork()) {
> @@ -200,10 +199,8 @@ rde(struct ospfd_conf *xconf, int pipe_p
>       cand_list_init();
>       rt_init();
>  
> -     while ((r = SIMPLEQ_FIRST(&rdeconf->redist_list)) != NULL) {
> -             SIMPLEQ_REMOVE_HEAD(&rdeconf->redist_list, entry);
> -             free(r);
> -     }
> +     /* remove unneeded stuff from config */
> +     conf_clear_redist_list(&rdeconf->redist_list);
>  
>       gettimeofday(&now, NULL);
>       rdeconf->uptime = now.tv_sec;
> 

Reply via email to