mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-07 22:11:46 +00:00
Merge pull request #2837 from ppmathis/cidr-style
bgpd: Always show CIDR mask when displaying routes
This commit is contained in:
commit
24a04145c5
@ -6245,24 +6245,14 @@ static void route_vty_out_route(struct prefix *p, struct vty *vty,
|
|||||||
json_object *json)
|
json_object *json)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
uint32_t destination;
|
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
|
|
||||||
if (p->family == AF_INET) {
|
if (p->family == AF_INET) {
|
||||||
if (!json) {
|
if (!json) {
|
||||||
len = vty_out(vty, "%s",
|
len = vty_out(
|
||||||
inet_ntop(p->family, &p->u.prefix, buf,
|
vty, "%s/%d",
|
||||||
BUFSIZ));
|
inet_ntop(p->family, &p->u.prefix, buf, BUFSIZ),
|
||||||
destination = ntohl(p->u.prefix4.s_addr);
|
p->prefixlen);
|
||||||
|
|
||||||
if ((IN_CLASSC(destination) && p->prefixlen == 24)
|
|
||||||
|| (IN_CLASSB(destination) && p->prefixlen == 16)
|
|
||||||
|| (IN_CLASSA(destination) && p->prefixlen == 8)
|
|
||||||
|| p->u.prefix4.s_addr == 0) {
|
|
||||||
/* When mask is natural,
|
|
||||||
mask is not displayed. */
|
|
||||||
} else
|
|
||||||
len += vty_out(vty, "/%d", p->prefixlen);
|
|
||||||
} else {
|
} else {
|
||||||
json_object_string_add(json, "prefix",
|
json_object_string_add(json, "prefix",
|
||||||
inet_ntop(p->family,
|
inet_ntop(p->family,
|
||||||
|
Loading…
Reference in New Issue
Block a user