Merge pull request #9578 from donaldsharp/SLASH_ESCAPE

Slash escape
This commit is contained in:
Russ White 2021-09-08 20:11:07 -04:00 committed by GitHub
commit d79b88c5a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 23 deletions

View File

@ -396,8 +396,6 @@ static void display_l3vni(struct vty *vty, struct bgp *bgp_vrf,
originator_ip, sizeof(originator_ip))); originator_ip, sizeof(originator_ip)));
json_object_string_add(json, "advertiseGatewayMacip", "n/a"); json_object_string_add(json, "advertiseGatewayMacip", "n/a");
json_object_string_add(json, "advertiseSviMacIp", "n/a"); json_object_string_add(json, "advertiseSviMacIp", "n/a");
json_object_to_json_string_ext(json,
JSON_C_TO_STRING_NOSLASHESCAPE);
json_object_string_add(json, "advertisePip", json_object_string_add(json, "advertisePip",
bgp_vrf->evpn_info->advertise_pip ? bgp_vrf->evpn_info->advertise_pip ?
"Enabled" : "Disabled"); "Enabled" : "Disabled");
@ -967,8 +965,6 @@ static void show_l3vni_entry(struct vty *vty, struct bgp *bgp,
json_object_string_add(json_vni, "advertiseGatewayMacip", json_object_string_add(json_vni, "advertiseGatewayMacip",
"n/a"); "n/a");
json_object_string_add(json_vni, "advertiseSviMacIp", "n/a"); json_object_string_add(json_vni, "advertiseSviMacIp", "n/a");
json_object_to_json_string_ext(json_vni,
JSON_C_TO_STRING_NOSLASHESCAPE);
json_object_string_add( json_object_string_add(
json_vni, "advertisePip", json_vni, "advertisePip",
bgp->evpn_info->advertise_pip ? "Enabled" : "Disabled"); bgp->evpn_info->advertise_pip ? "Enabled" : "Disabled");
@ -4413,8 +4409,11 @@ DEFUN(show_bgp_l2vpn_evpn_vni,
} }
if (uj) { if (uj) {
vty_out(vty, "%s\n", json_object_to_json_string_ext( vty_out(vty, "%s\n",
json, JSON_C_TO_STRING_PRETTY)); json_object_to_json_string_ext(
json,
JSON_C_TO_STRING_PRETTY
| JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json); json_object_free(json);
} }

View File

@ -10607,11 +10607,9 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,
prefix2str(&rn->p, buf1, sizeof(buf1)); prefix2str(&rn->p, buf1, sizeof(buf1));
json_route = json_object_new_object();
if (json) { if (json) {
json_route = json_object_new_object();
json_object_object_add(json, buf1, json_route); json_object_object_add(json, buf1, json_route);
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_NOSLASHESCAPE);
} }
switch (or->path_type) { switch (or->path_type) {
@ -10733,8 +10731,6 @@ static void show_ip_ospf_route_network(struct vty *vty, struct ospf *ospf,
} }
} }
} }
if (!json)
json_object_free(json_route);
} }
if (!json) if (!json)
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -10762,8 +10758,8 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf,
continue; continue;
int flag = 0; int flag = 0;
json_route = json_object_new_object();
if (json) { if (json) {
json_route = json_object_new_object();
json_object_object_add( json_object_object_add(
json, inet_ntop(AF_INET, &rn->p.u.prefix4, json, inet_ntop(AF_INET, &rn->p.u.prefix4,
buf, sizeof(buf)), buf, sizeof(buf)),
@ -10878,8 +10874,6 @@ static void show_ip_ospf_route_router(struct vty *vty, struct ospf *ospf,
} }
} }
} }
if (!json)
json_object_free(json_route);
} }
if (!json) if (!json)
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -10908,11 +10902,9 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf,
char buf1[19]; char buf1[19];
snprintfrr(buf1, sizeof(buf1), "%pFX", &rn->p); snprintfrr(buf1, sizeof(buf1), "%pFX", &rn->p);
json_route = json_object_new_object();
if (json) { if (json) {
json_route = json_object_new_object();
json_object_object_add(json, buf1, json_route); json_object_object_add(json, buf1, json_route);
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_NOSLASHESCAPE);
} }
switch (er->path_type) { switch (er->path_type) {
@ -11010,8 +11002,6 @@ static void show_ip_ospf_route_external(struct vty *vty, struct ospf *ospf,
} }
} }
} }
if (!json)
json_object_free(json_route);
} }
if (!json) if (!json)
vty_out(vty, "\n"); vty_out(vty, "\n");
@ -11224,7 +11214,9 @@ DEFUN (show_ip_ospf_route,
if (uj) { if (uj) {
/* Keep Non-pretty format */ /* Keep Non-pretty format */
vty_out(vty, "%s\n", vty_out(vty, "%s\n",
json_object_to_json_string(json)); json_object_to_json_string_ext(
json,
JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json); json_object_free(json);
} else if (!ospf_output) } else if (!ospf_output)
vty_out(vty, "%% OSPF instance not found\n"); vty_out(vty, "%% OSPF instance not found\n");
@ -11236,7 +11228,9 @@ DEFUN (show_ip_ospf_route,
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n",
json_object_to_json_string_ext( json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json,
JSON_C_TO_STRING_PRETTY
| JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json); json_object_free(json);
} else } else
vty_out(vty, "%% OSPF instance not found\n"); vty_out(vty, "%% OSPF instance not found\n");
@ -11250,7 +11244,9 @@ DEFUN (show_ip_ospf_route,
if (uj) { if (uj) {
vty_out(vty, "%s\n", vty_out(vty, "%s\n",
json_object_to_json_string_ext( json_object_to_json_string_ext(
json, JSON_C_TO_STRING_PRETTY)); json,
JSON_C_TO_STRING_PRETTY
| JSON_C_TO_STRING_NOSLASHESCAPE));
json_object_free(json); json_object_free(json);
} else } else
vty_out(vty, "%% OSPF instance not found\n"); vty_out(vty, "%% OSPF instance not found\n");
@ -11263,7 +11259,9 @@ DEFUN (show_ip_ospf_route,
ret = show_ip_ospf_route_common(vty, ospf, json, use_vrf); ret = show_ip_ospf_route_common(vty, ospf, json, use_vrf);
/* Keep Non-pretty format */ /* Keep Non-pretty format */
if (uj) if (uj)
vty_out(vty, "%s\n", json_object_to_json_string(json)); vty_out(vty, "%s\n",
json_object_to_json_string_ext(
json, JSON_C_TO_STRING_NOSLASHESCAPE));
} }
if (uj) if (uj)