-/* $OpenBSD: bgpctl.c,v 1.305 2024/02/01 11:37:10 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.306 2024/05/22 08:42:34 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
static void
show_mrt_open(struct ibuf *b)
{
+ struct in_addr ina;
+ uint32_t bgpid;
uint16_t short_as, holdtime;
uint8_t version, optparamlen;
- struct in_addr bgpid;
/* length check up to optparamlen already happened */
if (ibuf_get_n8(b, &version) == -1 ||
ibuf_get_n16(b, &short_as) == -1 ||
ibuf_get_n16(b, &holdtime) == -1 ||
- ibuf_get(b, &bgpid, sizeof(bgpid)) == -1 ||
+ ibuf_get_n32(b, &bgpid) == -1 ||
ibuf_get_n8(b, &optparamlen) == -1) {
trunc:
printf("truncated message");
}
printf("\n ");
+ ina.s_addr = htonl(bgpid);
printf("Version: %d AS: %u Holdtime: %u BGP Id: %s Paramlen: %u",
- version, short_as, holdtime, inet_ntoa(bgpid), optparamlen);
+ version, short_as, holdtime, inet_ntoa(ina), optparamlen);
if (optparamlen != ibuf_size(b)) {
/* XXX missing support for RFC9072 */
printf("optional parameter length mismatch");
-/* $OpenBSD: output.c,v 1.50 2024/01/31 11:23:20 claudio Exp $ */
+/* $OpenBSD: output.c,v 1.51 2024/05/22 08:42:34 claudio Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
printf("\n");
if (p->state == STATE_ESTABLISHED) {
- ina.s_addr = p->remote_bgpid;
+ ina.s_addr = htonl(p->remote_bgpid);
printf(" BGP version 4, remote router-id %s",
inet_ntoa(ina));
printf("%s\n", fmt_auth_method(p->auth.method));
-/* $OpenBSD: output_json.c,v 1.43 2024/04/24 10:42:09 claudio Exp $ */
+/* $OpenBSD: output_json.c,v 1.44 2024/05/22 08:42:34 claudio Exp $ */
/*
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
log_addr(&p->conf.remote_addr), p->conf.remote_masklen);
if (p->state == STATE_ESTABLISHED) {
struct in_addr ina;
- ina.s_addr = p->remote_bgpid;
+ ina.s_addr = htonl(p->remote_bgpid);
json_do_string("bgpid", inet_ntoa(ina));
}
json_do_string("state", statenames[p->state]);