summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2008-05-08 04:05:37 +0000
committerhenning <henning@openbsd.org>2008-05-08 04:05:37 +0000
commit5641005adb94ed99dfcd5f49a8a13bd6d1b64418 (patch)
treed8400e1f35a10d181d1dd9ad48323769fa15b392
parentStart at making mpe tap to bpf. While there move if_start() call inside (diff)
downloadwireguard-openbsd-5641005adb94ed99dfcd5f49a8a13bd6d1b64418.tar.xz
wireguard-openbsd-5641005adb94ed99dfcd5f49a8a13bd6d1b64418.zip
make sure we always send back something on IMSG_CTL_SHOW_NEIGHBOR
namely, the "no such neighbor" case was missing. problem spotted by martin,ok claudio
-rw-r--r--usr.sbin/bgpd/control.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c
index 522564e175e..9dbbe18ecb7 100644
--- a/usr.sbin/bgpd/control.c
+++ b/usr.sbin/bgpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.58 2008/01/31 12:17:35 henning Exp $ */
+/* $OpenBSD: control.c,v 1.59 2008/05/08 04:05:37 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -257,14 +257,17 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt)
p = getpeerbyaddr(&neighbor->addr);
if (p == NULL)
p = getpeerbydesc(neighbor->descr);
- if (p != NULL && !neighbor->show_timers) {
+ if (p == NULL) {
+ control_result(c, CTL_RES_NOSUCHPEER);
+ break;
+ }
+ if (!neighbor->show_timers) {
imsg_compose_rde(imsg.hdr.type,
imsg.hdr.pid,
p, sizeof(struct peer));
imsg_compose_rde(IMSG_CTL_END,
imsg.hdr.pid, NULL, 0);
- }
- if (p != NULL && neighbor->show_timers) {
+ } else {
u_int i;
time_t d;
struct ctl_timer ct;