Export the rtr session state as string.
authorclaudio <claudio@openbsd.org>
Thu, 11 Jan 2024 13:08:39 +0000 (13:08 +0000)
committerclaudio <claudio@openbsd.org>
Thu, 11 Jan 2024 13:08:39 +0000 (13:08 +0000)
OK tb@

usr.sbin/bgpd/bgpd.h
usr.sbin/bgpd/rtr_proto.c

index 0c05c83..a979209 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: bgpd.h,v 1.480 2024/01/10 13:31:09 claudio Exp $ */
+/*     $OpenBSD: bgpd.h,v 1.481 2024/01/11 13:08:39 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -562,6 +562,7 @@ struct rtr_config {
 
 struct ctl_show_rtr {
        char                    descr[PEER_DESCR_LEN];
+       char                    state[PEER_DESCR_LEN];
        struct bgpd_addr        remote_addr;
        struct bgpd_addr        local_addr;
        uint32_t                serial;
index 2d9e946..de813fb 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rtr_proto.c,v 1.29 2024/01/11 11:43:07 claudio Exp $ */
+/*     $OpenBSD: rtr_proto.c,v 1.30 2024/01/11 13:08:39 claudio Exp $ */
 
 /*
  * Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
@@ -1509,6 +1509,7 @@ rtr_show(struct rtr_session *rs, pid_t pid)
        msg.session_id = rs->session_id;
        msg.last_sent_error = rs->last_sent_error;
        msg.last_recv_error = rs->last_recv_error;
+       strlcpy(msg.state, rtr_statenames[rs->state], sizeof(msg.state));
        strlcpy(msg.last_sent_msg, rs->last_sent_msg,
            sizeof(msg.last_sent_msg));
        strlcpy(msg.last_recv_msg, rs->last_recv_msg,