mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +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;
|
||||
char buf[128], options[32];
|
||||
struct ospf6_prefix *prefix;
|
||||
const char *p, *mc, *la, *nu;
|
||||
struct in6_addr in6;
|
||||
json_object *json_loop;
|
||||
json_object *json_arr = NULL;
|
||||
char str[15];
|
||||
char prefix_string[133];
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
p = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_P)
|
||||
? "P"
|
||||
: "--");
|
||||
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"
|
||||
: "--");
|
||||
ospf6_prefix_options_printbuf(prefix->prefix_options, buf,
|
||||
sizeof(buf));
|
||||
if (use_json) {
|
||||
json_loop = json_object_new_object();
|
||||
snprintf(str, sizeof(str), "%s|%s|%s|%s", p, mc, la,
|
||||
nu);
|
||||
json_object_string_add(json_loop, "prefixOption", str);
|
||||
json_object_string_add(json_loop, "prefixOption", buf);
|
||||
} else
|
||||
vty_out(vty, " Prefix Options: %s|%s|%s|%s\n", p,
|
||||
mc, la, nu);
|
||||
vty_out(vty, " Prefix Options: %s\n", buf);
|
||||
|
||||
memset(&in6, 0, sizeof(in6));
|
||||
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];
|
||||
struct ospf6_prefix *prefix;
|
||||
char id[16], adv_router[16];
|
||||
const char *p, *mc, *la, *nu;
|
||||
struct in6_addr in6;
|
||||
json_object *json_loop;
|
||||
json_object *json_arr = NULL;
|
||||
char str[15];
|
||||
char prefix_string[133];
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
p = (CHECK_FLAG(prefix->prefix_options, OSPF6_PREFIX_OPTION_P)
|
||||
? "P"
|
||||
: "--");
|
||||
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"
|
||||
: "--");
|
||||
ospf6_prefix_options_printbuf(prefix->prefix_options, buf,
|
||||
sizeof(buf));
|
||||
if (use_json) {
|
||||
json_loop = json_object_new_object();
|
||||
snprintf(str, sizeof(str), "%s|%s|%s|%s", p, mc, la,
|
||||
nu);
|
||||
json_object_string_add(json_loop, "prefixOption", str);
|
||||
json_object_string_add(json_loop, "prefixOption", buf);
|
||||
} else
|
||||
vty_out(vty, " Prefix Options: %s|%s|%s|%s\n", p,
|
||||
mc, la, nu);
|
||||
vty_out(vty, " Prefix Options: %s\n", buf);
|
||||
|
||||
memset(&in6, 0, sizeof(in6));
|
||||
memcpy(&in6, OSPF6_PREFIX_BODY(prefix),
|
||||
|
|
Loading…
Reference in a new issue