diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-09 13:47:09 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-01-09 13:47:09 +0000 |
commit | 715650b30ccfc3f0aa534bc491db3fab23f000c1 (patch) | |
tree | 2d98a017e1af53f36e45edd0cc711283193de8de /usr.sbin/bgpd/imsg.c | |
parent | 7333e1e290962bbaaf8ff960f0c9c46a44ada85c (diff) |
get us a stateful imsg relaying framework, and the first receiver,
IMSG_CTL_KROUTE, to have the kroute structs forming the fib sent to a
control socket.
ok claudio@
Diffstat (limited to 'usr.sbin/bgpd/imsg.c')
-rw-r--r-- | usr.sbin/bgpd/imsg.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/usr.sbin/bgpd/imsg.c b/usr.sbin/bgpd/imsg.c index ec5b21a4b0d..94c6e52a0c0 100644 --- a/usr.sbin/bgpd/imsg.c +++ b/usr.sbin/bgpd/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.19 2004/01/06 03:43:50 henning Exp $ */ +/* $OpenBSD: imsg.c,v 1.20 2004/01/09 13:47:07 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -25,6 +25,9 @@ #include "bgpd.h" +int imsg_compose_core(struct imsgbuf *, int, u_int32_t, void *, u_int16_t, + pid_t); + void imsg_init(struct imsgbuf *ibuf, int sock) { @@ -32,6 +35,7 @@ imsg_init(struct imsgbuf *ibuf, int sock) bzero(&ibuf->r, sizeof(ibuf->r)); ibuf->sock = sock; ibuf->w.sock = sock; + ibuf->pid = getpid(); } int @@ -92,8 +96,22 @@ imsg_get(struct imsgbuf *ibuf, struct imsg *imsg) int imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data, + u_int16_t dlen) +{ + return (imsg_compose_core(ibuf, type, peerid, data, dlen, ibuf->pid)); +} + +int +imsg_compose_pid(struct imsgbuf *ibuf, int type, pid_t pid, void *data, u_int16_t datalen) { + return (imsg_compose_core(ibuf, type, 0, data, datalen, pid)); +} + +int +imsg_compose_core(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data, + u_int16_t datalen, pid_t pid) +{ struct buf *wbuf; struct imsg_hdr hdr; int n; @@ -101,6 +119,7 @@ imsg_compose(struct imsgbuf *ibuf, int type, u_int32_t peerid, void *data, hdr.len = datalen + IMSG_HEADER_SIZE; hdr.type = type; hdr.peerid = peerid; + hdr.pid = pid; wbuf = buf_open(hdr.len); if (wbuf == NULL) { logit(LOG_CRIT, "imsg_compose: buf_open error"); |