+// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP FlowSpec VTY
* Copyright (C) 2018 6WIND
- *
- * FRRouting is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * FRRouting is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
if (path->attr)
ipv6_ecomm = bgp_attr_get_ipv6_ecommunity(path->attr);
- if (path->attr && (path->attr->ecommunity || ipv6_ecomm)) {
+ if (path->attr && (bgp_attr_get_ecommunity(path->attr) || ipv6_ecomm)) {
/* Print attribute */
attr = path->attr;
- if (attr->ecommunity)
- s1 = ecommunity_ecom2str(attr->ecommunity,
- ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
+ if (bgp_attr_get_ecommunity(attr))
+ s1 = ecommunity_ecom2str(bgp_attr_get_ecommunity(attr),
+ ECOMMUNITY_FORMAT_ROUTE_MAP,
+ 0);
if (ipv6_ecomm)
s2 = ecommunity_ecom2str(
ipv6_ecomm, ECOMMUNITY_FORMAT_ROUTE_MAP, 0);
local_buff[0] = '\0';
if (p->u.prefix_flowspec.family == AF_INET
&& attr->nexthop.s_addr != INADDR_ANY)
- inet_ntop(AF_INET,
- &attr->nexthop.s_addr,
- local_buff,
- INET6_ADDRSTRLEN);
+ inet_ntop(AF_INET, &attr->nexthop.s_addr,
+ local_buff, sizeof(local_buff));
else if (p->u.prefix_flowspec.family == AF_INET6 &&
attr->mp_nexthop_len != 0 &&
attr->mp_nexthop_len != BGP_ATTR_NHLEN_IPV4 &&
attr->mp_nexthop_len != BGP_ATTR_NHLEN_VPNV4)
- inet_ntop(AF_INET6,
- &attr->mp_nexthop_global,
- local_buff,
- INET6_ADDRSTRLEN);
+ inet_ntop(AF_INET6, &attr->mp_nexthop_global,
+ local_buff, sizeof(local_buff));
if (local_buff[0] != '\0')
vty_out(vty, "\tNLRI NH %s\n",
local_buff);
pi, display, json_paths);
}
if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json_paths,
- JSON_C_TO_STRING_PRETTY));
- json_object_free(json_paths);
+ vty_json(vty, json_paths);
json_paths = NULL;
}
}