forked from Mirror/frr
isisd: fix erroneous srv6 information in database
The show isis database detail command dumps invalid srv6 information: > SRv6 Locator: fc00:0:6::/64 (Metric: 0) ipv6-unicast > Sub-TLVs: > SRv6 End SID Endpoint Behavior: unknown, SID value: fc00:0:6:0:1:: > > MT Reachability: 0123.6452.1973.03 (Metric: 10) ipv6-unicast > Local Interface IPv6 Address(es): 192::4:3 > SRv6 Lan End.X SID: fc00:0:3:0:43::, Algorithm: SPF, Weight: 0, Endpoint Behavior: End.DX6, Flags: B:0, S:0, P:0 Neighbor-ID: 0123.6452.1975 > SRv6 SID Structure Locator Block length: 40, Locator Node length: 24, Function length: 16, Argument length: 0, The behavior codepoint should use the IANA definitions to display the correct value. Fix this by calling the appropriate convert function. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
ed63f849ef
commit
4150f9bbb1
|
@ -1053,9 +1053,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
||||||
adj->algorithm));
|
adj->algorithm));
|
||||||
json_object_int_add(srv6_endx_sid_json,
|
json_object_int_add(srv6_endx_sid_json,
|
||||||
"weight", adj->weight);
|
"weight", adj->weight);
|
||||||
json_object_string_add(srv6_endx_sid_json,
|
json_object_string_add(srv6_endx_sid_json, "behavior",
|
||||||
"behavior",
|
srv6_endpoint_behavior_codepoint2str(
|
||||||
seg6local_action2str(
|
|
||||||
adj->behavior));
|
adj->behavior));
|
||||||
json_object_boolean_add(
|
json_object_boolean_add(
|
||||||
srv6_endx_sid_json, "flagB",
|
srv6_endx_sid_json, "flagB",
|
||||||
|
@ -1081,22 +1080,17 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
||||||
for (adj = (struct isis_srv6_endx_sid_subtlv *)
|
for (adj = (struct isis_srv6_endx_sid_subtlv *)
|
||||||
exts->srv6_endx_sid.head;
|
exts->srv6_endx_sid.head;
|
||||||
adj; adj = adj->next) {
|
adj; adj = adj->next) {
|
||||||
sbuf_push(
|
sbuf_push(buf, indent,
|
||||||
buf, indent,
|
"SRv6 End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c\n",
|
||||||
"SRv6 End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c\n",
|
&adj->sid, sr_algorithm_string(adj->algorithm),
|
||||||
&adj->sid,
|
adj->weight,
|
||||||
sr_algorithm_string(adj->algorithm),
|
srv6_endpoint_behavior_codepoint2str(adj->behavior),
|
||||||
adj->weight,
|
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG ? '1'
|
||||||
seg6local_action2str(adj->behavior),
|
: '0',
|
||||||
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
|
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG ? '1'
|
||||||
? '1'
|
: '0',
|
||||||
: '0',
|
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG ? '1'
|
||||||
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
|
: '0');
|
||||||
? '1'
|
|
||||||
: '0',
|
|
||||||
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
|
|
||||||
? '1'
|
|
||||||
: '0');
|
|
||||||
if (adj->subsubtlvs)
|
if (adj->subsubtlvs)
|
||||||
isis_format_subsubtlvs(adj->subsubtlvs,
|
isis_format_subsubtlvs(adj->subsubtlvs,
|
||||||
buf, NULL,
|
buf, NULL,
|
||||||
|
@ -1131,9 +1125,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
||||||
lan->algorithm));
|
lan->algorithm));
|
||||||
json_object_int_add(srv6_lan_endx_sid_json,
|
json_object_int_add(srv6_lan_endx_sid_json,
|
||||||
"weight", lan->weight);
|
"weight", lan->weight);
|
||||||
json_object_string_add(srv6_lan_endx_sid_json,
|
json_object_string_add(srv6_lan_endx_sid_json, "behavior",
|
||||||
"behavior",
|
srv6_endpoint_behavior_codepoint2str(
|
||||||
seg6local_action2str(
|
|
||||||
lan->behavior));
|
lan->behavior));
|
||||||
json_object_boolean_add(
|
json_object_boolean_add(
|
||||||
srv6_lan_endx_sid_json, "flagB",
|
srv6_lan_endx_sid_json, "flagB",
|
||||||
|
@ -1162,24 +1155,19 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
|
||||||
for (lan = (struct isis_srv6_lan_endx_sid_subtlv *)
|
for (lan = (struct isis_srv6_lan_endx_sid_subtlv *)
|
||||||
exts->srv6_lan_endx_sid.head;
|
exts->srv6_lan_endx_sid.head;
|
||||||
lan; lan = lan->next) {
|
lan; lan = lan->next) {
|
||||||
sbuf_push(
|
sbuf_push(buf, indent,
|
||||||
buf, indent,
|
"SRv6 Lan End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c "
|
||||||
"SRv6 Lan End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c "
|
"Neighbor-ID: %pSY\n",
|
||||||
"Neighbor-ID: %pSY\n",
|
&lan->sid, sr_algorithm_string(lan->algorithm),
|
||||||
&lan->sid,
|
lan->weight,
|
||||||
sr_algorithm_string(lan->algorithm),
|
srv6_endpoint_behavior_codepoint2str(lan->behavior),
|
||||||
lan->weight,
|
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG ? '1'
|
||||||
seg6local_action2str(lan->behavior),
|
: '0',
|
||||||
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
|
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG ? '1'
|
||||||
? '1'
|
: '0',
|
||||||
: '0',
|
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG ? '1'
|
||||||
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
|
: '0',
|
||||||
? '1'
|
lan->neighbor_id);
|
||||||
: '0',
|
|
||||||
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
|
|
||||||
? '1'
|
|
||||||
: '0',
|
|
||||||
lan->neighbor_id);
|
|
||||||
if (lan->subsubtlvs)
|
if (lan->subsubtlvs)
|
||||||
isis_format_subsubtlvs(lan->subsubtlvs,
|
isis_format_subsubtlvs(lan->subsubtlvs,
|
||||||
buf, NULL,
|
buf, NULL,
|
||||||
|
@ -2823,7 +2811,7 @@ static void format_item_srv6_end_sid(uint16_t mtid, struct isis_item *i,
|
||||||
sid_json = json_object_new_object();
|
sid_json = json_object_new_object();
|
||||||
json_object_object_add(json, "srv6EndSid", sid_json);
|
json_object_object_add(json, "srv6EndSid", sid_json);
|
||||||
json_object_string_add(sid_json, "endpointBehavior",
|
json_object_string_add(sid_json, "endpointBehavior",
|
||||||
seg6local_action2str(sid->behavior));
|
srv6_endpoint_behavior_codepoint2str(sid->behavior));
|
||||||
json_object_string_addf(sid_json, "sidValue", "%pI6", &sid->sid);
|
json_object_string_addf(sid_json, "sidValue", "%pI6", &sid->sid);
|
||||||
if (sid->subsubtlvs) {
|
if (sid->subsubtlvs) {
|
||||||
struct json_object *subtlvs_json;
|
struct json_object *subtlvs_json;
|
||||||
|
@ -2836,7 +2824,7 @@ static void format_item_srv6_end_sid(uint16_t mtid, struct isis_item *i,
|
||||||
} else {
|
} else {
|
||||||
sbuf_push(buf, indent, "SRv6 End SID ");
|
sbuf_push(buf, indent, "SRv6 End SID ");
|
||||||
sbuf_push(buf, 0, "Endpoint Behavior: %s, ",
|
sbuf_push(buf, 0, "Endpoint Behavior: %s, ",
|
||||||
seg6local_action2str(sid->behavior));
|
srv6_endpoint_behavior_codepoint2str(sid->behavior));
|
||||||
sbuf_push(buf, 0, "SID value: %pI6\n", &sid->sid);
|
sbuf_push(buf, 0, "SID value: %pI6\n", &sid->sid);
|
||||||
|
|
||||||
if (sid->subsubtlvs) {
|
if (sid->subsubtlvs) {
|
||||||
|
|
Loading…
Reference in a new issue