diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 12:23:31 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 12:23:31 +0000 |
commit | bb027611161c80704e1505937bb846bd0171bd9f (patch) | |
tree | 4b86add2c8acd7a7a85240905f4ec80973cca5c3 /usr.sbin | |
parent | a71a6cf2e79253914b73b8bdca7c94debfd1a877 (diff) |
Cleanup control like in the other routing daemons. Move control_state
and ctl_conns to control.c cleanup headers and the engine accordingly.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/dvmrpd/control.c | 11 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/control.h | 8 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.c | 4 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpe.h | 6 |
4 files changed, 14 insertions, 15 deletions
diff --git a/usr.sbin/dvmrpd/control.c b/usr.sbin/dvmrpd/control.c index 6392a1a11a9..3bc6db24c62 100644 --- a/usr.sbin/dvmrpd/control.c +++ b/usr.sbin/dvmrpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.23 2017/01/08 23:04:42 krw Exp $ */ +/* $OpenBSD: control.c,v 1.24 2021/01/19 12:23:30 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -33,12 +33,20 @@ #include "log.h" #include "control.h" +TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns = TAILQ_HEAD_INITIALIZER(ctl_conns); + #define CONTROL_BACKLOG 5 struct ctl_conn *control_connbyfd(int); struct ctl_conn *control_connbypid(pid_t); void control_close(int); +struct { + struct event ev; + struct event evt; + int fd; +} control_state; + int control_init(void) { @@ -87,7 +95,6 @@ control_init(void) int control_listen(void) { - if (listen(control_state.fd, CONTROL_BACKLOG) == -1) { log_warn("control_listen: listen"); return (-1); diff --git a/usr.sbin/dvmrpd/control.h b/usr.sbin/dvmrpd/control.h index 6caf137c042..8fada0fed5f 100644 --- a/usr.sbin/dvmrpd/control.h +++ b/usr.sbin/dvmrpd/control.h @@ -1,4 +1,4 @@ -/* $OpenBSD: control.h,v 1.5 2015/02/09 11:46:27 claudio Exp $ */ +/* $OpenBSD: control.h,v 1.6 2021/01/19 12:23:30 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -23,12 +23,6 @@ #include <sys/time.h> #include <event.h> -struct { - struct event ev; - struct event evt; - int fd; -} control_state; - struct ctl_conn { TAILQ_ENTRY(ctl_conn) entry; struct imsgev iev; diff --git a/usr.sbin/dvmrpd/dvmrpe.c b/usr.sbin/dvmrpd/dvmrpe.c index 6b2c11daf9b..57cb6ec8ca5 100644 --- a/usr.sbin/dvmrpd/dvmrpe.c +++ b/usr.sbin/dvmrpd/dvmrpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.c,v 1.20 2021/01/19 11:46:10 claudio Exp $ */ +/* $OpenBSD: dvmrpe.c,v 1.21 2021/01/19 12:23:30 claudio Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -49,7 +49,6 @@ volatile sig_atomic_t dvmrpe_quit = 0; struct dvmrpd_conf *deconf = NULL; struct imsgev *iev_main; struct imsgev *iev_rde; -struct ctl_conn *ctl_conn; void dvmrpe_sig_handler(int sig, short event, void *bula) @@ -167,7 +166,6 @@ dvmrpe(struct dvmrpd_conf *xconf, int pipe_parent2dvmrpe[2], event_add(&deconf->ev, NULL); /* listen on dvmrpd control socket */ - TAILQ_INIT(&ctl_conns); control_listen(); /* start interfaces */ diff --git a/usr.sbin/dvmrpd/dvmrpe.h b/usr.sbin/dvmrpd/dvmrpe.h index 031d2bca627..535c29b5577 100644 --- a/usr.sbin/dvmrpd/dvmrpe.h +++ b/usr.sbin/dvmrpd/dvmrpe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpe.h,v 1.6 2021/01/19 11:46:10 claudio Exp $ */ +/* $OpenBSD: dvmrpe.h,v 1.7 2021/01/19 12:23:30 claudio Exp $ */ /* * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org> @@ -24,8 +24,6 @@ #include <netinet/in.h> #include <netinet/ip.h> -TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns; - /* neighbor events */ enum nbr_event { NBR_EVT_NOTHING, @@ -85,6 +83,8 @@ struct rr_entry { struct route_report *re; }; +struct ctl_conn; + /* ask_nbrs2.c */ int send_ask_nbrs2(struct iface *, struct in_addr, void *, int); void recv_ask_nbrs2(struct nbr *, char *, u_int16_t); |