summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd/bgpd.h
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-06-20 17:49:47 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-06-20 17:49:47 +0000
commit8fed60822a3bbddc0dbd13b43d561fbd47c7446c (patch)
tree2b51ffaf2c62c02419f8b2e136de51f23f383135 /usr.sbin/bgpd/bgpd.h
parent73ccfbaa117160675169345630b3cbe6365ee6ba (diff)
implement file descriptor passing in the imsg/msgbuf framework, and use
it to let the main process to prepare new listening sockets (socket() and bind()) on behalf of the session engine, which of course cannot bind() to ports < 1024 any more once it dropped privileges. with some help from theo, claudio ok
Diffstat (limited to 'usr.sbin/bgpd/bgpd.h')
-rw-r--r--usr.sbin/bgpd/bgpd.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 967c45d1de2..d4d34ada083 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.126 2004/06/06 17:38:10 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.127 2004/06/20 17:49:46 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -83,6 +83,7 @@ struct buf {
ssize_t size;
ssize_t wpos;
ssize_t rpos;
+ int fd;
};
struct msgbuf {
@@ -109,6 +110,7 @@ struct bgpd_addr {
};
#define DEFAULT_LISTENER 0x01
+#define LISTENER_LISTENING 0x02
struct listen_addr {
TAILQ_ENTRY(listen_addr) entry;
@@ -238,11 +240,17 @@ struct network {
#define IMSG_HEADER_SIZE sizeof(struct imsg_hdr)
#define MAX_IMSGSIZE 8192
-struct imsgbuf {
+struct imsg_fd {
+ TAILQ_ENTRY(imsg_fd) entry;
int fd;
- pid_t pid;
- struct buf_read r;
- struct msgbuf w;
+};
+
+struct imsgbuf {
+ int fd;
+ pid_t pid;
+ TAILQ_HEAD(fds, imsg_fd) fds;
+ struct buf_read r;
+ struct msgbuf w;
};
enum imsg_type {
@@ -565,11 +573,13 @@ int imsg_read(struct imsgbuf *);
int imsg_get(struct imsgbuf *, struct imsg *);
int imsg_compose(struct imsgbuf *, int, u_int32_t, void *, u_int16_t);
int imsg_compose_pid(struct imsgbuf *, int, pid_t, void *, u_int16_t);
+int imsg_compose_fdpass(struct imsgbuf *, int, int, void *, u_int16_t);
struct buf *imsg_create(struct imsgbuf *, int, u_int32_t, u_int16_t);
struct buf *imsg_create_pid(struct imsgbuf *, int, pid_t, u_int16_t);
int imsg_add(struct buf *, void *, u_int16_t);
int imsg_close(struct imsgbuf *, struct buf *);
void imsg_free(struct imsg *);
+int imsg_get_fd(struct imsgbuf *);
/* kroute.c */
int kr_init(int);