summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ospf6d
diff options
context:
space:
mode:
authorremi <remi@openbsd.org>2019-06-11 05:00:09 +0000
committerremi <remi@openbsd.org>2019-06-11 05:00:09 +0000
commit02570afa0145566fa5e5b8b083884999997c1084 (patch)
tree9d04c5816778c76656905da907f1e4bc76812dae /usr.sbin/ospf6d
parentbump up the ring sizes for dlg@ (diff)
downloadwireguard-openbsd-02570afa0145566fa5e5b8b083884999997c1084.tar.xz
wireguard-openbsd-02570afa0145566fa5e5b8b083884999997c1084.zip
Introduce conf_clear_redist_list() (from ospfd) and use it in all 3 procs.
ok benno@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r--usr.sbin/ospf6d/ospf6d.h6
-rw-r--r--usr.sbin/ospf6d/ospfe.c8
-rw-r--r--usr.sbin/ospf6d/parse.y14
-rw-r--r--usr.sbin/ospf6d/rde.c9
4 files changed, 22 insertions, 15 deletions
diff --git a/usr.sbin/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h
index c34fa715d03..5f77a35f637 100644
--- a/usr.sbin/ospf6d/ospf6d.h
+++ b/usr.sbin/ospf6d/ospf6d.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospf6d.h,v 1.39 2018/12/29 16:04:31 remi Exp $ */
+/* $OpenBSD: ospf6d.h,v 1.40 2019/06/11 05:00:09 remi Exp $ */
/*
* Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org>
@@ -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);
diff --git a/usr.sbin/ospf6d/ospfe.c b/usr.sbin/ospf6d/ospfe.c
index b6dfe33b306..209c392490c 100644
--- a/usr.sbin/ospf6d/ospfe.c
+++ b/usr.sbin/ospf6d/ospfe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfe.c,v 1.55 2018/09/01 19:21:10 remi Exp $ */
+/* $OpenBSD: ospfe.c,v 1.56 2019/06/11 05:00:09 remi Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -74,7 +74,6 @@ ospfe(struct ospfd_conf *xconf, int pipe_parent2ospfe[2], int pipe_ospfe2rde[2],
{
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_parent2ospfe[2], int pipe_ospfe2rde[2],
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);
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y
index 4a9b5331946..69339f9cd27 100644
--- a/usr.sbin/ospf6d/parse.y
+++ b/usr.sbin/ospf6d/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.44 2019/05/26 09:27:09 remi Exp $ */
+/* $OpenBSD: parse.y,v 1.45 2019/06/11 05:00:09 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -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;
@@ -1212,6 +1222,8 @@ clear_config(struct ospfd_conf *xconf)
area_del(a);
}
+ conf_clear_redist_list(&xconf->redist_list);
+
free(xconf);
}
diff --git a/usr.sbin/ospf6d/rde.c b/usr.sbin/ospf6d/rde.c
index a057d32c957..ce080bec411 100644
--- a/usr.sbin/ospf6d/rde.c
+++ b/usr.sbin/ospf6d/rde.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde.c,v 1.79 2018/07/12 13:45:03 remi Exp $ */
+/* $OpenBSD: rde.c,v 1.80 2019/06/11 05:00:09 remi Exp $ */
/*
* Copyright (c) 2004, 2005 Claudio Jeker <claudio@openbsd.org>
@@ -118,7 +118,6 @@ rde(struct ospfd_conf *xconf, int pipe_parent2rde[2], int pipe_ospfe2rde[2],
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_parent2rde[2], int pipe_ospfe2rde[2],
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;