+// SPDX-License-Identifier: GPL-2.0-or-later
/* BGP nexthop scan
* Copyright (C) 2000 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra 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.
- *
- * GNU Zebra 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>
safi = table->safi;
bgp_path = table->bgp;
+
if (json) {
json_path = json_object_new_object();
json_object_string_add(json_path, "afi", afi2str(afi));
dest);
if (dest->pdest)
json_object_string_addf(
- json_path, "rd", "%pRD",
+ json_path, "rd",
+ BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
dest->pdest));
json_object_string_add(
json_object_array_add(paths, json_path);
continue;
}
- if (dest->pdest)
- vty_out(vty, " %d/%d %pBD RD %pRD %s flags 0x%x\n",
- afi, safi, dest,
+ if (dest->pdest) {
+ vty_out(vty, " %d/%d %pBD RD ", afi, safi, dest);
+ vty_out(vty, BGP_RD_AS_FORMAT(bgp->asnotation),
(struct prefix_rd *)bgp_dest_get_prefix(
- dest->pdest),
- bgp_path->name_pretty, path->flags);
- else
+ dest->pdest));
+ vty_out(vty, " %s flags 0x%x\n", bgp_path->name_pretty,
+ path->flags);
+ } else
vty_out(vty, " %d/%d %pBD %s flags 0x%x\n",
afi, safi, dest, bgp_path->name_pretty, path->flags);
}