mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 21:47:15 +02:00
ospf6d: remove redundant code when printing prefix options
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
This commit is contained in:
parent
66721aaee7
commit
8ae79ff269
|
@ -684,11 +684,9 @@ static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||||
int prefixnum;
|
int prefixnum;
|
||||||
char buf[128], options[32];
|
char buf[128], options[32];
|
||||||
struct ospf6_prefix *prefix;
|
struct ospf6_prefix *prefix;
|
||||||
const char *p, *mc, *la, *nu;
|
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
json_object *json_loop;
|
json_object *json_loop;
|
||||||
json_object *json_arr = NULL;
|
json_object *json_arr = NULL;
|
||||||
char str[15];
|
|
||||||
char prefix_string[133];
|
char prefix_string[133];
|
||||||
|
|
||||||
link_lsa = (struct ospf6_link_lsa *)((caddr_t)lsa->header
|
link_lsa = (struct ospf6_link_lsa *)((caddr_t)lsa->header
|
||||||
|
@ -720,26 +718,13 @@ static int ospf6_link_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||||
|| current + OSPF6_PREFIX_SIZE(prefix) > end)
|
|| current + OSPF6_PREFIX_SIZE(prefix) > end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
p = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_P)
|
ospf6_prefix_options_printbuf(prefix->prefix_options, buf,
|
||||||
? "P"
|
sizeof(buf));
|
||||||
: "--");
|
|
||||||
mc = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_MC)
|
|
||||||
? "MC"
|
|
||||||
: "--");
|
|
||||||
la = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_LA)
|
|
||||||
? "LA"
|
|
||||||
: "--");
|
|
||||||
nu = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_NU)
|
|
||||||
? "NU"
|
|
||||||
: "--");
|
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
json_loop = json_object_new_object();
|
json_loop = json_object_new_object();
|
||||||
snprintf(str, sizeof(str), "%s|%s|%s|%s", p, mc, la,
|
json_object_string_add(json_loop, "prefixOption", buf);
|
||||||
nu);
|
|
||||||
json_object_string_add(json_loop, "prefixOption", str);
|
|
||||||
} else
|
} else
|
||||||
vty_out(vty, " Prefix Options: %s|%s|%s|%s\n", p,
|
vty_out(vty, " Prefix Options: %s\n", buf);
|
||||||
mc, la, nu);
|
|
||||||
|
|
||||||
memset(&in6, 0, sizeof(in6));
|
memset(&in6, 0, sizeof(in6));
|
||||||
memcpy(&in6, OSPF6_PREFIX_BODY(prefix),
|
memcpy(&in6, OSPF6_PREFIX_BODY(prefix),
|
||||||
|
@ -916,11 +901,9 @@ static int ospf6_intra_prefix_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||||
char buf[128];
|
char buf[128];
|
||||||
struct ospf6_prefix *prefix;
|
struct ospf6_prefix *prefix;
|
||||||
char id[16], adv_router[16];
|
char id[16], adv_router[16];
|
||||||
const char *p, *mc, *la, *nu;
|
|
||||||
struct in6_addr in6;
|
struct in6_addr in6;
|
||||||
json_object *json_loop;
|
json_object *json_loop;
|
||||||
json_object *json_arr = NULL;
|
json_object *json_arr = NULL;
|
||||||
char str[15];
|
|
||||||
char prefix_string[133];
|
char prefix_string[133];
|
||||||
|
|
||||||
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa
|
intra_prefix_lsa = (struct ospf6_intra_prefix_lsa
|
||||||
|
@ -959,26 +942,13 @@ static int ospf6_intra_prefix_lsa_show(struct vty *vty, struct ospf6_lsa *lsa,
|
||||||
|| current + OSPF6_PREFIX_SIZE(prefix) > end)
|
|| current + OSPF6_PREFIX_SIZE(prefix) > end)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
p = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_P)
|
ospf6_prefix_options_printbuf(prefix->prefix_options, buf,
|
||||||
? "P"
|
sizeof(buf));
|
||||||
: "--");
|
|
||||||
mc = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_MC)
|
|
||||||
? "MC"
|
|
||||||
: "--");
|
|
||||||
la = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_LA)
|
|
||||||
? "LA"
|
|
||||||
: "--");
|
|
||||||
nu = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_NU)
|
|
||||||
? "NU"
|
|
||||||
: "--");
|
|
||||||
if (use_json) {
|
if (use_json) {
|
||||||
json_loop = json_object_new_object();
|
json_loop = json_object_new_object();
|
||||||
snprintf(str, sizeof(str), "%s|%s|%s|%s", p, mc, la,
|
json_object_string_add(json_loop, "prefixOption", buf);
|
||||||
nu);
|
|
||||||
json_object_string_add(json_loop, "prefixOption", str);
|
|
||||||
} else
|
} else
|
||||||
vty_out(vty, " Prefix Options: %s|%s|%s|%s\n", p,
|
vty_out(vty, " Prefix Options: %s\n", buf);
|
||||||
mc, la, nu);
|
|
||||||
|
|
||||||
memset(&in6, 0, sizeof(in6));
|
memset(&in6, 0, sizeof(in6));
|
||||||
memcpy(&in6, OSPF6_PREFIX_BODY(prefix),
|
memcpy(&in6, OSPF6_PREFIX_BODY(prefix),
|
||||||
|
|
Loading…
Reference in a new issue