mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 12:47:16 +00:00
ospfd: inc. opaque data in show opaque info detail json output
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1794afe010)
This commit is contained in:
parent
a640b4a390
commit
7f8f9aaee6
@ -34,6 +34,7 @@
|
||||
#include "thread.h"
|
||||
#include "hash.h"
|
||||
#include "sockunion.h" /* for inet_aton() */
|
||||
#include "printfrr.h"
|
||||
|
||||
#include "ospfd/ospfd.h"
|
||||
#include "ospfd/ospf_interface.h"
|
||||
@ -1162,11 +1163,13 @@ void ospf_opaque_config_write_debug(struct vty *vty)
|
||||
void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa,
|
||||
json_object *json)
|
||||
{
|
||||
char buf[128], *bp;
|
||||
struct lsa_header *lsah = lsa->data;
|
||||
uint32_t lsid = ntohl(lsah->id.s_addr);
|
||||
uint8_t opaque_type = GET_OPAQUE_TYPE(lsid);
|
||||
uint32_t opaque_id = GET_OPAQUE_ID(lsid);
|
||||
struct ospf_opaque_functab *functab;
|
||||
int len, lenValid;
|
||||
|
||||
/* Switch output functionality by vty address. */
|
||||
if (vty != NULL) {
|
||||
@ -1185,11 +1188,19 @@ void show_opaque_info_detail(struct vty *vty, struct ospf_lsa *lsa,
|
||||
json, "opaqueType",
|
||||
ospf_opaque_type_name(opaque_type));
|
||||
json_object_int_add(json, "opaqueId", opaque_id);
|
||||
json_object_int_add(json, "opaqueDataLength",
|
||||
ntohs(lsah->length)
|
||||
- OSPF_LSA_HEADER_SIZE);
|
||||
len = ntohs(lsah->length) - OSPF_LSA_HEADER_SIZE;
|
||||
json_object_int_add(json, "opaqueDataLength", len);
|
||||
lenValid = VALID_OPAQUE_INFO_LEN(lsah);
|
||||
json_object_boolean_add(json, "opaqueDataLengthValid",
|
||||
VALID_OPAQUE_INFO_LEN(lsah));
|
||||
lenValid);
|
||||
if (lenValid) {
|
||||
bp = asnprintfrr(MTYPE_TMP, buf, sizeof(buf),
|
||||
"%*pHXn", (int)len,
|
||||
(lsah + 1));
|
||||
json_object_string_add(json, "opaqueData", buf);
|
||||
if (bp != buf)
|
||||
XFREE(MTYPE_TMP, bp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zlog_debug(" Opaque-Type %u (%s)", opaque_type,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user