diff options
author | David Lamparter <equinox@diac24.net> | 2019-06-12 20:06:23 +0200 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2019-06-13 13:35:28 +0200 |
commit | 899e4095d1b5d3a40114df1a8cd86c6d18dbc9d8 (patch) | |
tree | e19e01a0bd068c3aa3ca30760ca3ef94c8a46578 | |
parent | lib/clippy: ignore -Wstrict-aliasing (diff) | |
download | frr-899e4095d1b5d3a40114df1a8cd86c6d18dbc9d8.tar.xz frr-899e4095d1b5d3a40114df1a8cd86c6d18dbc9d8.zip |
bgpd: fix clang format warning
... by simplifying the code to use %pI6 instead.
Signed-off-by: David Lamparter <equinox@diac24.net>
-rw-r--r-- | bgpd/bgp_route.c | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4de73f124..a22d4d0a5 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7570,8 +7570,6 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p, && BGP_ATTR_NEXTHOP_AFI_IP6(attr)) || (BGP_ATTR_NEXTHOP_AFI_IP6(attr))) { char buf_a[512]; - char buf_b[512]; - char buf_c[BUFSIZ]; if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL) { if (json) @@ -7589,27 +7587,15 @@ void route_vty_out_tag(struct vty *vty, struct prefix *p, buf_a, sizeof(buf_a))); } else if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) { - if (json) { - inet_ntop(AF_INET6, - &attr->mp_nexthop_global, - buf_a, sizeof(buf_a)); - inet_ntop(AF_INET6, - &attr->mp_nexthop_local, - buf_b, sizeof(buf_b)); - sprintf(buf_c, "%s(%s)", buf_a, buf_b); + snprintfrr(buf_a, sizeof(buf_a), "%pI6(%pI6)", + &attr->mp_nexthop_global, + &attr->mp_nexthop_local); + if (json) json_object_string_add( json_out, - "mpNexthopGlobalLocal", buf_c); - } else - vty_out(vty, "%s(%s)", - inet_ntop( - AF_INET6, - &attr->mp_nexthop_global, - buf_a, sizeof(buf_a)), - inet_ntop( - AF_INET6, - &attr->mp_nexthop_local, - buf_b, sizeof(buf_b))); + "mpNexthopGlobalLocal", buf_a); + else + vty_out(vty, "%s", buf_a); } } } |