diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 10:00:37 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2021-01-19 10:00:37 +0000 |
commit | a6c6f76bbc3a501550ecfc390a263a3a380d0b4c (patch) | |
tree | 4b3b6ca47cb4abef04d089a6268a69238a10bb0b /usr.sbin/ripd | |
parent | d242493a1b8970c42b6a811af85cbf64875d87c8 (diff) |
Apply same cleanup to the control code as in ospfd.
Internalize control_state and ctl_conns.
Diffstat (limited to 'usr.sbin/ripd')
-rw-r--r-- | usr.sbin/ripd/control.c | 11 | ||||
-rw-r--r-- | usr.sbin/ripd/control.h | 8 | ||||
-rw-r--r-- | usr.sbin/ripd/ripe.c | 3 | ||||
-rw-r--r-- | usr.sbin/ripd/ripe.h | 5 |
4 files changed, 14 insertions, 13 deletions
diff --git a/usr.sbin/ripd/control.c b/usr.sbin/ripd/control.c index c36818bad2e..e377c7ee860 100644 --- a/usr.sbin/ripd/control.c +++ b/usr.sbin/ripd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.26 2018/11/04 07:52:55 remi Exp $ */ +/* $OpenBSD: control.c,v 1.27 2021/01/19 10:00:36 claudio Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -32,12 +32,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(char *path) { @@ -86,7 +94,6 @@ control_init(char *path) int control_listen(void) { - if (listen(control_state.fd, CONTROL_BACKLOG) == -1) { log_warn("control_listen: listen"); return (-1); diff --git a/usr.sbin/ripd/control.h b/usr.sbin/ripd/control.h index 5b443693bad..2169049699c 100644 --- a/usr.sbin/ripd/control.h +++ b/usr.sbin/ripd/control.h @@ -1,4 +1,4 @@ -/* $OpenBSD: control.h,v 1.6 2018/11/04 07:52:55 remi Exp $ */ +/* $OpenBSD: control.h,v 1.7 2021/01/19 10:00:36 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/ripd/ripe.c b/usr.sbin/ripd/ripe.c index 87eb088228a..58aae5c7b3f 100644 --- a/usr.sbin/ripd/ripe.c +++ b/usr.sbin/ripd/ripe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ripe.c,v 1.25 2019/12/11 21:04:59 remi Exp $ */ +/* $OpenBSD: ripe.c,v 1.26 2021/01/19 10:00:36 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -182,7 +182,6 @@ ripe(struct ripd_conf *xconf, int pipe_parent2ripe[2], int pipe_ripe2rde[2], } /* listen on ripd control socket */ - TAILQ_INIT(&ctl_conns); control_listen(); if ((pkt_ptr = calloc(1, IBUF_READ_SIZE)) == NULL) diff --git a/usr.sbin/ripd/ripe.h b/usr.sbin/ripd/ripe.h index 7dc48139c1d..0adfc0b3487 100644 --- a/usr.sbin/ripd/ripe.h +++ b/usr.sbin/ripd/ripe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ripe.h,v 1.12 2017/01/17 16:30:54 jca Exp $ */ +/* $OpenBSD: ripe.h,v 1.13 2021/01/19 10:00:36 claudio Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -25,7 +25,6 @@ #include <netinet/in.h> #include <netinet/ip.h> -TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns; u_int8_t *pkt_ptr; /* neighbor events */ @@ -72,6 +71,8 @@ struct nbr { int flags; }; +struct ctl_conn; + /* packet.c */ int send_packet(struct iface *, void *, size_t, struct sockaddr_in *); void recv_packet(int, short, void *); |