From 33c734718e1ee31efa6293a9b23624363b5cb59e Mon Sep 17 00:00:00 2001 From: claudio Date: Thu, 11 Jan 2024 13:08:39 +0000 Subject: [PATCH] Export the rtr session state as string. OK tb@ --- usr.sbin/bgpd/bgpd.h | 3 ++- usr.sbin/bgpd/rtr_proto.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bgpd/bgpd.h b/usr.sbin/bgpd/bgpd.h index 0c05c831032..a9792097894 100644 --- a/usr.sbin/bgpd/bgpd.h +++ b/usr.sbin/bgpd/bgpd.h @@ -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 @@ -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; diff --git a/usr.sbin/bgpd/rtr_proto.c b/usr.sbin/bgpd/rtr_proto.c index 2d9e9465d21..de813fb0bd0 100644 --- a/usr.sbin/bgpd/rtr_proto.c +++ b/usr.sbin/bgpd/rtr_proto.c @@ -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 @@ -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, -- 2.20.1