Internalize control_state and ctl_conns.
-/* $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>
#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)
{
int
control_listen(void)
{
-
if (listen(control_state.fd, CONTROL_BACKLOG) == -1) {
log_warn("control_listen: listen");
return (-1);
-/* $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>
#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;
-/* $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>
}
/* listen on ripd control socket */
- TAILQ_INIT(&ctl_conns);
control_listen();
if ((pkt_ptr = calloc(1, IBUF_READ_SIZE)) == NULL)
-/* $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>
#include <netinet/in.h>
#include <netinet/ip.h>
-TAILQ_HEAD(ctl_conns, ctl_conn) ctl_conns;
u_int8_t *pkt_ptr;
/* neighbor events */
int flags;
};
+struct ctl_conn;
+
/* packet.c */
int send_packet(struct iface *, void *, size_t, struct sockaddr_in *);
void recv_packet(int, short, void *);