-/* $OpenBSD: control.c,v 1.10 2024/08/24 09:44:41 florian Exp $ */
+/* $OpenBSD: control.c,v 1.11 2024/08/24 16:34:23 florian Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
{
struct ctl_conn *c;
- if ((c = control_connbypid(imsg->hdr.pid)) == NULL)
+ if ((c = control_connbypid(imsg_get_pid(imsg))) == NULL)
return (0);
- return (imsg_compose_event(&c->iev, imsg->hdr.type, 0, imsg->hdr.pid,
- -1, imsg->data, IMSG_DATA_SIZE(*imsg)));
+ return (imsg_forward_event(&c->iev, imsg));
}
#endif /* SMALL */
-/* $OpenBSD: slaacd.c,v 1.71 2024/08/24 09:44:41 florian Exp $ */
+/* $OpenBSD: slaacd.c,v 1.72 2024/08/24 16:34:23 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
return (ret);
}
+int
+imsg_forward_event(struct imsgev *iev, struct imsg *imsg)
+{
+ int ret;
+
+ if ((ret = imsg_forward(&iev->ibuf, imsg)) != -1)
+ imsg_event_add(iev);
+
+ return (ret);
+}
static int
main_imsg_send_ipc_sockets(struct imsgbuf *frontend_buf,
struct imsgbuf *engine_buf)
-/* $OpenBSD: slaacd.h,v 1.39 2024/08/24 09:42:40 florian Exp $ */
+/* $OpenBSD: slaacd.h,v 1.40 2024/08/24 16:34:23 florian Exp $ */
/*
* Copyright (c) 2017 Florian Obser <florian@openbsd.org>
#define MAX_RDNS_COUNT 8 /* max nameserver in a RTM_PROPOSAL */
-#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
-
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);
void imsg_event_add(struct imsgev *);
int imsg_compose_event(struct imsgev *, uint16_t, uint32_t, pid_t,
int, void *, uint16_t);
+int imsg_forward_event(struct imsgev *, struct imsg *);
#ifndef SMALL
const char *sin6_to_str(struct sockaddr_in6 *);
const char *i2s(uint32_t);