summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2019-10-01 08:57:49 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2019-10-01 08:57:49 +0000
commit450816d7b5114ad6aea520d91f38b4d8bcb4bf62 (patch)
tree4236a437d9e83e1856f7bb673f81285180e5313f /usr.sbin/bgpd
parentbc579f37932988e17515b9c58d26909daa30e90a (diff)
For portable kr_init() returns an fd of -1 which now would end up in an
immediate exit of bgpd. Instead pass the fd via pointer arg. OK benno@
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.c4
-rw-r--r--usr.sbin/bgpd/bgpd.h4
-rw-r--r--usr.sbin/bgpd/kroute.c7
3 files changed, 8 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 4e6923552cb..2ffd8f7900f 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.225 2019/08/08 11:33:08 claudio Exp $ */
+/* $OpenBSD: bgpd.c,v 1.226 2019/10/01 08:57:47 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -234,7 +234,7 @@ main(int argc, char *argv[])
imsg_init(ibuf_se, pipe_m2s[0]);
imsg_init(ibuf_rde, pipe_m2r[0]);
mrt_init(ibuf_rde, ibuf_se);
- if ((rfd = kr_init()) == -1)
+ if (kr_init(&rfd) == -1)
quit = 1;
keyfd = pfkey_init();
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 52f269f49bd..0d8fca64158 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.393 2019/09/27 10:33:06 claudio Exp $ */
+/* $OpenBSD: bgpd.h,v 1.394 2019/10/01 08:57:47 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -1185,7 +1185,7 @@ int prefixset_cmp(struct prefixset_item *, struct prefixset_item *);
RB_PROTOTYPE(prefixset_tree, prefixset_item, entry, prefixset_cmp);
/* kroute.c */
-int kr_init(void);
+int kr_init(int *);
int ktable_update(u_int, char *, int, u_int8_t);
void ktable_preload(void);
void ktable_postload(u_int8_t);
diff --git a/usr.sbin/bgpd/kroute.c b/usr.sbin/bgpd/kroute.c
index 183860a3c7d..b95f4f922cc 100644
--- a/usr.sbin/bgpd/kroute.c
+++ b/usr.sbin/bgpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.238 2019/08/08 20:06:29 claudio Exp $ */
+/* $OpenBSD: kroute.c,v 1.239 2019/10/01 08:57:48 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -213,7 +213,7 @@ RB_GENERATE(kif_tree, kif_node, entry, kif_compare)
*/
int
-kr_init(void)
+kr_init(int *fd)
{
int opt = 0, rcvbuf, default_rcvbuf;
unsigned int tid = RTABLE_ANY;
@@ -257,7 +257,8 @@ kr_init(void)
if (fetchifs(0) == -1)
return (-1);
- return (kr_state.fd);
+ *fd = kr_state.fd;
+ return (0);
}
int