From 2b5ebfec75e0cb218373316d5a34ea45c4b22d81 Mon Sep 17 00:00:00 2001 From: benno Date: Sat, 24 Oct 2015 15:15:55 +0000 Subject: [PATCH] "bgpctl sh rib in" and "bgpctl sh rib out" require a neighbor argument to work. send an error if none is given. ok claudio@ --- usr.sbin/bgpd/control.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bgpd/control.c b/usr.sbin/bgpd/control.c index 34b4a358ff9..b46c5a3f50d 100644 --- a/usr.sbin/bgpd/control.c +++ b/usr.sbin/bgpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.78 2015/10/17 13:07:07 reyk Exp $ */ +/* $OpenBSD: control.c,v 1.79 2015/10/24 15:15:55 benno Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -427,11 +427,21 @@ control_dispatch_msg(struct pollfd *pfd, u_int *ctl_cnt) } ribreq->peerid = p->conf.id; } + if ((ribreq->flags & + (F_CTL_ADJ_OUT | F_CTL_ADJ_IN)) && !p) { + /* + * both in and out tables are only + * meaningful if used on a single + * peer. + */ + control_result(c, CTL_RES_NOSUCHPEER); + break; + } if ((ribreq->flags & F_CTL_ADJ_IN) && p && !p->conf.softreconfig_in) { /* - * if no neighbor was specified we - * try our best. + * without softreconfig_in we do not + * have an Adj-RIB-In table */ control_result(c, CTL_RES_NOCAP); break; -- 2.20.1