For testing I was running bgpd with no neighbors defined.
In that case the peers pointer is NULL and so bgpctl is reporting suddenly
'no such neighbor' which is confusing for something like 'bgpctl show rib'.
This is kind of a regression from adding group support in bgpctl.

# bgpctl show rib
flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
       S = Stale, E = Error
origin validation state: N = not-found, V = valid, ! = invalid
origin: i = IGP, e = EGP, ? = Incomplete

flags ovs destination          gateway          lpref   med aspath origin
no such neighbor

With this diff the more expected behaviour is back:
bgpctl show rib
flags: * = Valid, > = Selected, I = via IBGP, A = Announced,
       S = Stale, E = Error
origin validation state: N = not-found, V = valid, ! = invalid
origin: i = IGP, e = EGP, ? = Incomplete

flags ovs destination          gateway          lpref   med aspath origin
AI*>    N 1.0.1.0/24           0.0.0.0            100     0 i
AI*>    N 1.0.2.0/24           0.0.0.0            100     0 i

Anyone cares enough for such an edge case?
-- 
:wq Claudio

Index: control.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/control.c,v
retrieving revision 1.94
diff -u -p -r1.94 control.c
--- control.c   20 Jan 2019 23:27:48 -0000      1.94
+++ control.c   12 Feb 2019 11:00:19 -0000
@@ -337,7 +337,7 @@ control_dispatch_msg(struct pollfd *pfd,
                                        }
                                }
                        }
-                       if (!matched) {
+                       if (!matched && peers != NULL) {
                                control_result(c, CTL_RES_NOSUCHPEER);
                        } else if (!neighbor || !neighbor->show_timers) {
                                imsg_ctl_rde(IMSG_CTL_END, imsg.hdr.pid,
@@ -461,7 +461,7 @@ control_dispatch_msg(struct pollfd *pfd,
                        for (p = peers; p != NULL; p = p->next)
                                if (peer_matched(p, neighbor))
                                        break;
-                       if (p == NULL) {
+                       if (p == NULL && peers != NULL) {
                                control_result(c, CTL_RES_NOSUCHPEER);
                                break;
                        }

Reply via email to