When querying a non-existent table, do not reply "no such peer"

Index: bgpd/bgpd.h
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/bgpd.h,v
retrieving revision 1.352
diff -u -p -r1.352 bgpd.h
--- bgpd/bgpd.h 4 Nov 2018 14:34:00 -0000       1.352
+++ bgpd/bgpd.h 9 Nov 2018 18:55:28 -0000
@@ -509,7 +509,8 @@ enum ctl_results {
        CTL_RES_PENDING,
        CTL_RES_NOMEM,
        CTL_RES_BADPEER,
-       CTL_RES_BADSTATE
+       CTL_RES_BADSTATE,
+       CTL_RES_NOSUCHRIB
 };
 
 /* needed for session.h parse prototype */
@@ -1414,7 +1415,8 @@ static const char * const ctl_res_strerr
        "previous reload still running",
        "out of memory",
        "not a cloned peer",
-       "peer still active, down peer first"
+       "peer still active, down peer first",
+       "no such RIB"
 };
 
 static const char * const timernames[] = {
Index: bgpd/rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.448
diff -u -p -r1.448 rde.c
--- bgpd/rde.c  8 Nov 2018 09:59:45 -0000       1.448
+++ bgpd/rde.c  9 Nov 2018 18:55:28 -0000
@@ -2316,7 +2316,7 @@ rde_dump_ctx_new(struct ctl_show_rib_req
                rid = RIB_ADJ_OUT;
        } else if ((rid = rib_find(req->rib)) == RIB_NOTFOUND) {
                log_warnx("rde_dump_ctx_new: no such rib %s", req->rib);
-               error = CTL_RES_NOSUCHPEER;
+               error = CTL_RES_NOSUCHRIB;
                imsg_compose(ibuf_se_ctl, IMSG_CTL_RESULT, 0, pid, -1, &error,
                    sizeof(error));
                free(ctx);

Reply via email to