summaryrefslogtreecommitdiff
path: root/ospf6d
diff options
context:
space:
mode:
authorckishimo <carles.kishimoto@gmail.com>2021-02-23 15:45:32 +0100
committerckishimo <carles.kishimoto@gmail.com>2021-02-23 18:04:18 +0100
commit8ae79ff2692f1cfd615d7f64194cce23b740055c (patch)
treec24af0aef83cd34d036c22b7fb5aab7dad1b4478 /ospf6d
parent66721aaee7990e505db78bfe077c2df6312dc27a (diff)
ospf6d: remove redundant code when printing prefix options
Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
Diffstat (limited to 'ospf6d')
-rw-r--r--ospf6d/ospf6_intra.c46
1 files changed, 8 insertions, 38 deletions
diff --git a/ospf6d/ospf6_intra.c b/ospf6d/ospf6_intra.c
index 5394ba9786..f7f9863914 100644
--- a/ospf6d/ospf6_intra.c
+++ b/ospf6d/ospf6_intra.c
@@ -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),