Skip to content

Commit

Permalink
Merge pull request #17956 from pguibert6WIND/isis_srv6_codepoint_erro…
Browse files Browse the repository at this point in the history
…neous

isisd: fix erroneous srv6 information in database
  • Loading branch information
ton31337 authored Jan 31, 2025
2 parents de8f52b + 4150f9b commit ce20b8c
Showing 1 changed file with 30 additions and 42 deletions.
72 changes: 30 additions & 42 deletions isisd/isis_tlvs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
adj->algorithm));
json_object_int_add(srv6_endx_sid_json,
"weight", adj->weight);
json_object_string_add(srv6_endx_sid_json,
"behavior",
seg6local_action2str(
json_object_string_add(srv6_endx_sid_json, "behavior",
srv6_endpoint_behavior_codepoint2str(
adj->behavior));
json_object_boolean_add(
srv6_endx_sid_json, "flagB",
Expand All @@ -1081,22 +1080,17 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
for (adj = (struct isis_srv6_endx_sid_subtlv *)
exts->srv6_endx_sid.head;
adj; adj = adj->next) {
sbuf_push(
buf, indent,
"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->weight,
seg6local_action2str(adj->behavior),
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
? '1'
: '0',
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
? '1'
: '0',
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
? '1'
: '0');
sbuf_push(buf, indent,
"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->weight,
srv6_endpoint_behavior_codepoint2str(adj->behavior),
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG ? '1'
: '0',
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG ? '1'
: '0',
adj->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG ? '1'
: '0');
if (adj->subsubtlvs)
isis_format_subsubtlvs(adj->subsubtlvs,
buf, NULL,
Expand Down Expand Up @@ -1131,9 +1125,8 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
lan->algorithm));
json_object_int_add(srv6_lan_endx_sid_json,
"weight", lan->weight);
json_object_string_add(srv6_lan_endx_sid_json,
"behavior",
seg6local_action2str(
json_object_string_add(srv6_lan_endx_sid_json, "behavior",
srv6_endpoint_behavior_codepoint2str(
lan->behavior));
json_object_boolean_add(
srv6_lan_endx_sid_json, "flagB",
Expand Down Expand Up @@ -1162,24 +1155,19 @@ static void format_item_ext_subtlvs(struct isis_ext_subtlvs *exts,
for (lan = (struct isis_srv6_lan_endx_sid_subtlv *)
exts->srv6_lan_endx_sid.head;
lan; lan = lan->next) {
sbuf_push(
buf, indent,
"SRv6 Lan End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c "
"Neighbor-ID: %pSY\n",
&lan->sid,
sr_algorithm_string(lan->algorithm),
lan->weight,
seg6local_action2str(lan->behavior),
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG
? '1'
: '0',
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG
? '1'
: '0',
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG
? '1'
: '0',
lan->neighbor_id);
sbuf_push(buf, indent,
"SRv6 Lan End.X SID: %pI6, Algorithm: %s, Weight: %hhu, Endpoint Behavior: %s, Flags: B:%c, S:%c, P:%c "
"Neighbor-ID: %pSY\n",
&lan->sid, sr_algorithm_string(lan->algorithm),
lan->weight,
srv6_endpoint_behavior_codepoint2str(lan->behavior),
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_BFLG ? '1'
: '0',
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_SFLG ? '1'
: '0',
lan->flags & EXT_SUBTLV_LINK_SRV6_ENDX_SID_PFLG ? '1'
: '0',
lan->neighbor_id);
if (lan->subsubtlvs)
isis_format_subsubtlvs(lan->subsubtlvs,
buf, NULL,
Expand Down Expand Up @@ -2823,7 +2811,7 @@ static void format_item_srv6_end_sid(uint16_t mtid, struct isis_item *i,
sid_json = json_object_new_object();
json_object_object_add(json, "srv6EndSid", sid_json);
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);
if (sid->subsubtlvs) {
struct json_object *subtlvs_json;
Expand All @@ -2836,7 +2824,7 @@ static void format_item_srv6_end_sid(uint16_t mtid, struct isis_item *i,
} else {
sbuf_push(buf, indent, "SRv6 End SID ");
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);

if (sid->subsubtlvs) {
Expand Down

0 comments on commit ce20b8c

Please sign in to comment.