summaryrefslogtreecommitdiff
path: root/usr.sbin/bgpd
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2004-01-04 19:39:47 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2004-01-04 19:39:47 +0000
commit5b0dae60071f3691da10254fc987c1f5f086e9ad (patch)
tree407496dab0c706903e705cc31bec478982404159 /usr.sbin/bgpd
parentf96f673c3d6c854eb7853103f6a09e6b33c4ace0 (diff)
-new imsg CTL_RELOAD
-upong receival in the SE forward to parent -make sending messages from SE to parent work for that (was not required before) -parent reacts to that just like a SIGHUP, reread config file
Diffstat (limited to 'usr.sbin/bgpd')
-rw-r--r--usr.sbin/bgpd/bgpd.c8
-rw-r--r--usr.sbin/bgpd/bgpd.h5
-rw-r--r--usr.sbin/bgpd/control.c5
-rw-r--r--usr.sbin/bgpd/session.c14
-rw-r--r--usr.sbin/bgpd/session.h4
5 files changed, 29 insertions, 7 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c
index 6b95380fe77..2254203a2f0 100644
--- a/usr.sbin/bgpd/bgpd.c
+++ b/usr.sbin/bgpd/bgpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.c,v 1.52 2004/01/03 20:37:34 henning Exp $ */
+/* $OpenBSD: bgpd.c,v 1.53 2004/01/04 19:39:46 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -426,6 +426,12 @@ dispatch_imsg(struct imsgbuf *ibuf, int idx, struct mrt_config *conf)
kroute_nexthop_delete(ina);
}
break;
+ case IMSG_CTL_RELOAD:
+ if (idx != PFD_PIPE_SESSION)
+ logit(LOG_CRIT, "reload request not from SE");
+ else
+ reconfig = 1;
+ break;
default:
break;
}
diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h
index 2f97b8a0c74..0037e2ba3b4 100644
--- a/usr.sbin/bgpd/bgpd.h
+++ b/usr.sbin/bgpd/bgpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bgpd.h,v 1.51 2004/01/04 18:51:23 henning Exp $ */
+/* $OpenBSD: bgpd.h,v 1.52 2004/01/04 19:39:46 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -179,7 +179,8 @@ enum imsg_type {
IMSG_NEXTHOP_REMOVE,
IMSG_NEXTHOP_UPDATE,
IMSG_CTL_SHOW_NEIGHBOR,
- IMSG_CTL_END
+ IMSG_CTL_END,
+ IMSG_CTL_RELOAD
};
struct imsg_hdr {
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index 7eb6dda7f69..33c3472dab8 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.8 2004/01/04 18:51:23 henning Exp $ */
+/* $OpenBSD: control.c,v 1.9 2004/01/04 19:39:46 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -211,6 +211,9 @@ control_dispatch_msg(struct pollfd *pfd, int i)
0, p, sizeof(struct peer));
imsg_compose(&c->ibuf, IMSG_CTL_END, 0, NULL, 0);
break;
+ case IMSG_CTL_RELOAD:
+ imsg_compose_parent(IMSG_CTL_RELOAD, 0, NULL, 0);
+ break;
default:
break;
}
diff --git a/usr.sbin/bgpd/session.c b/usr.sbin/bgpd/session.c
index f7df8dfbc99..3294be71ab0 100644
--- a/usr.sbin/bgpd/session.c
+++ b/usr.sbin/bgpd/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.60 2004/01/04 18:51:23 henning Exp $ */
+/* $OpenBSD: session.c,v 1.61 2004/01/04 19:39:46 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -186,6 +186,8 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2],
pfd[PFD_LISTEN].events = POLLIN;
pfd[PFD_PIPE_MAIN].fd = ibuf_main.sock;
pfd[PFD_PIPE_MAIN].events = POLLIN;
+ if (ibuf_main.w.queued > 0)
+ pfd[PFD_PIPE_MAIN].events |= POLLOUT;
pfd[PFD_PIPE_ROUTE].fd = ibuf_rde.sock;
pfd[PFD_PIPE_ROUTE].events = POLLIN;
if (ibuf_rde.w.queued > 0)
@@ -281,6 +283,10 @@ session_main(struct bgpd_config *config, struct peer *cpeers, int pipe_m2s[2],
session_accept(sock);
}
+ if (nfds > 0 && pfd[PFD_PIPE_MAIN].revents & POLLOUT)
+ if (msgbuf_write(&ibuf_main.w) < 0)
+ fatal("pipe write error");
+
if (nfds > 0 && pfd[PFD_PIPE_MAIN].revents & POLLIN) {
nfds--;
session_dispatch_imsg(&ibuf_main, PFD_PIPE_MAIN);
@@ -1410,3 +1416,9 @@ session_up(struct peer *peer)
&peer->remote_bgpid, sizeof(peer->remote_bgpid)) == -1)
fatalx("imsg_compose error");
}
+
+int
+imsg_compose_parent(int type, u_int32_t peerid, void *data, u_int16_t datalen)
+{
+ return (imsg_compose(&ibuf_main, type, peerid, data, datalen));
+} \ No newline at end of file
diff --git a/usr.sbin/bgpd/session.h b/usr.sbin/bgpd/session.h
index 96be2a88899..c983e0a0b93 100644
--- a/usr.sbin/bgpd/session.h
+++ b/usr.sbin/bgpd/session.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.h,v 1.8 2004/01/04 18:51:23 henning Exp $ */
+/* $OpenBSD: session.h,v 1.9 2004/01/04 19:39:46 henning Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -148,7 +148,7 @@ void session_socket_blockmode(int, enum blockmodes);
int session_main(struct bgpd_config *, struct peer *, int[2],
int[2]);
struct peer *getpeerbyip(in_addr_t);
-
+int imsg_compose_parent(int, u_int32_t, void *, u_int16_t);
/* log.c */
void log_peer_err(const struct peer *, const char *, ...);