diff options
Diffstat (limited to 'usr.sbin/bgpd/control.c')
-rw-r--r-- | usr.sbin/bgpd/control.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index cbf55ae23f8..9bbd6be1ecd 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.56 2007/12/20 17:08:48 henning Exp $ */ +/* $OpenBSD: control.c,v 1.57 2007/12/23 18:26:13 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -256,16 +256,41 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) p = getpeerbyaddr(&neighbor->addr); if (p == NULL) p = getpeerbydesc(neighbor->descr); - if (p != NULL) + if (p != NULL && !neighbor->show_timers) { imsg_compose_rde(imsg.hdr.type, imsg.hdr.pid, p, sizeof(struct peer)); - } else + imsg_compose_rde(IMSG_CTL_END, + imsg.hdr.pid, NULL, 0); + } + if (p != NULL && neighbor->show_timers) { + u_int i; + time_t d; + struct ctl_timer ct; + + imsg_compose(&c->ibuf, + IMSG_CTL_SHOW_NEIGHBOR, + 0, 0, -1, p, sizeof(*p)); + for (i = 1; i < Timer_Max; i++) { + if (!timer_running(p, i, &d)) + continue; + ct.type = i; + ct.val = d; + imsg_compose(&c->ibuf, + IMSG_CTL_SHOW_TIMER, + 0, 0, -1, &ct, sizeof(ct)); + } + imsg_compose(&c->ibuf, IMSG_CTL_END, + 0, 0, -1, NULL, 0); + } + } else { for (p = peers; p != NULL; p = p->next) imsg_compose_rde(imsg.hdr.type, imsg.hdr.pid, p, sizeof(struct peer)); - imsg_compose_rde(IMSG_CTL_END, imsg.hdr.pid, NULL, 0); + imsg_compose_rde(IMSG_CTL_END, imsg.hdr.pid, + NULL, 0); + } break; case IMSG_CTL_SHOW_TERSE: for (p = peers; p != NULL; p = p->next) |