Skip to content

Commit

Permalink
Key changes:
Browse files Browse the repository at this point in the history
- The aspath and community structures now have a json_object where we
  store the json representation.  This is updated at the same time
  the "str" for aspath/community are updated.  We do this so that we
  do not have to compute the json rep
- Added a small wrappper to libjson0, the wrapper lives in quagga's lib/json.[ch].
- Added more structure to the json output.  Sample output:

show ip bgp summary json
------------------------
BGP router identifier 10.0.0.1, local AS number 10
BGP table version 2400
RIB entries 4799, using 562 KiB of memory
Peers 17, using 284 KiB of memory
Peer groups 4, using 224 bytes of memory

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1         4    10       0       0        0    0    0 never    Active
10.0.0.2        4    10     104       7        0    0    0 00:02:29      600
10.0.0.3        4    10     104       7        0    0    0 00:02:29      600
10.0.0.4        4    10     204       7        0    0    0 00:02:29     1200
20.1.1.6        4    20     406     210        0    0    0 00:02:44      600
20.1.1.7        4    20     406     210        0    0    0 00:02:44      600
40.1.1.2        4    40     406     210        0    0    0 00:02:44      600
40.1.1.6        4    40     406     210        0    0    0 00:02:44      600
40.1.1.10       4    40     406     210        0    0    0 00:02:44      600

Total number of neighbors 9

{
    "as": 10,
    "dynamic-peers": 0,
    "peer-count": 17,
    "peer-group-count": 4,
    "peer-group-memory": 224,
    "peer-memory": 291312,
    "peers": {
        "1.1.1.1": {
            "inq": 0,
            "msgrcvd": 0,
            "msgsent": 0,
            "outq": 0,
            "prefix-advertised-count": 0,
            "prefix-received-count": 0,
            "remote-as": 10,
            "state": "Active",
            "table-version": 0,
            "uptime": "never",
            "version": 4
        },
        "10.0.0.2": {
            "hostname": "r2",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.3": {
            "hostname": "r3",
            "inq": 0,
            "msgrcvd": 104,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 600,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "10.0.0.4": {
            "hostname": "r4",
            "inq": 0,
            "msgrcvd": 204,
            "msgsent": 7,
            "outq": 0,
            "prefix-advertised-count": 1200,
            "prefix-received-count": 1200,
            "remote-as": 10,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:21",
            "version": 4
        },
        "20.1.1.6": {
            "hostname": "r6",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "20.1.1.7": {
            "hostname": "r7",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 20,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.10": {
            "hostname": "r10",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.2": {
            "hostname": "r8",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        },
        "40.1.1.6": {
            "hostname": "r9",
            "inq": 0,
            "msgrcvd": 406,
            "msgsent": 210,
            "outq": 0,
            "prefix-advertised-count": 2400,
            "prefix-received-count": 600,
            "remote-as": 40,
            "state": "Established",
            "table-version": 0,
            "uptime": "00:02:36",
            "version": 4
        }
    },
    "rib-count": 4799,
    "rib-memory": 575880,
    "router-id": "10.0.0.1",
    "table-version": 2400,
    "total-peers": 9
}

show ip bgp json
----------------
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.88.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i
*  40.3.89.0/24     40.1.1.6                 0             0 100 200 300 400 500 40 i
*                   40.1.1.10                0             0 100 200 300 400 500 40 i
*>                  40.1.1.2                 0             0 100 200 300 400 500 40 i

        "40.3.88.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],
        "40.3.89.0/24": [
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.6",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.10",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            },
            {
                "aspath": "100 200 300 400 500 40",
                "bestpath": true,
                "med": 0,
                "nexthops": [
                    {
                        "afi": "ipv4",
                        "ip": "40.1.1.2",
                        "used": true
                    }
                ],
                "origin": "IGP",
                "path-from": "external",
                "valid": true,
                "weight": 0
            }
        ],


show ip bgp x.x.x.x json
------------------------
BGP routing table entry for 40.3.86.0/24
Paths: (3 available, best FRRouting#3, table Default-IP-Routing-Table)
  Advertised to non peer-group peers:
  10.0.0.2 10.0.0.3 10.0.0.4 20.1.1.6 20.1.1.7 40.1.1.2 40.1.1.6 40.1.1.10
  100 200 300 400 500 40
    40.1.1.6 from 40.1.1.6 (40.0.0.9)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.10 from 40.1.1.10 (40.0.0.10)
      Origin IGP, metric 0, localpref 100, valid, external
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

  100 200 300 400 500 40
    40.1.1.2 from 40.1.1.2 (40.0.0.8)
      Origin IGP, metric 0, localpref 100, valid, external, best
      Community: 1:1 2:2 3:3 4:4 10:10 20:20
      Extended Community: RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66
      Last update: Fri May  8 21:23:41 2015

{
    "advertised-to": {
        "10.0.0.2": {
            "hostname": "r2"
        },
        "10.0.0.3": {
            "hostname": "r3"
        },
        "10.0.0.4": {
            "hostname": "r4"
        },
        "20.1.1.6": {
            "hostname": "r6"
        },
        "20.1.1.7": {
            "hostname": "r7"
        },
        "40.1.1.10": {
            "hostname": "r10"
        },
        "40.1.1.2": {
            "hostname": "r8"
        },
        "40.1.1.6": {
            "hostname": "r9"
        }
    },
    "paths": [
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.6",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r9",
                "peer-id": "40.1.1.6",
                "router-id": "40.0.0.9",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.10",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r10",
                "peer-id": "40.1.1.10",
                "router-id": "40.0.0.10",
                "type": "external"
            },
            "valid": true
        },
        {
            "aspath": {
                "length": 6,
                "segments": [
                    {
                        "list": [
                            100,
                            200,
                            300,
                            400,
                            500,
                            40
                        ],
                        "type": "as-sequence"
                    }
                ],
                "string": "100 200 300 400 500 40"
            },
            "bestpath": {
                "overall": true
            },
            "community": {
                "list": [
                    "1:1",
                    "2:2",
                    "3:3",
                    "4:4",
                    "10:10",
                    "20:20"
                ],
                "string": "1:1 2:2 3:3 4:4 10:10 20:20"
            },
            "extended-community": {
                "string": "RT:100:100 RT:200:200 RT:300:300 RT:400:400 SoO:44:44 SoO:55:55 SoO:66:66"
            },
            "last-update": {
                "epoch": 1431120222,
                "string": "Fri May  8 21:23:42 2015\n"
            },
            "localpref": 100,
            "med": 0,
            "nexthops": [
                {
                    "accessible": true,
                    "afi": "ipv4",
                    "ip": "40.1.1.2",
                    "metric": 0,
                    "used": true
                }
            ],
            "origin": "IGP",
            "peer": {
                "hostname": "r8",
                "peer-id": "40.1.1.2",
                "router-id": "40.0.0.8",
                "type": "external"
            },
            "valid": true
        }
    ],
    "prefix": "40.3.86.0",
    "prefixlen": 24
}
  • Loading branch information
donaldsharp committed Jun 12, 2015
1 parent 31a4638 commit f1aa5d8
Show file tree
Hide file tree
Showing 14 changed files with 578 additions and 476 deletions.
54 changes: 53 additions & 1 deletion bgpd/bgp_aspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ assegment_data_new (int num)
return (XMALLOC (MTYPE_AS_SEG_DATA, ASSEGMENT_DATA_SIZE (num, 1)));
}

const char *aspath_segment_type_str[] = {
"as-invalid",
"as-set",
"as-sequence",
"as-confed-sequence",
"as-confed-set"
};

/* Get a new segment. Note that 0 is an allowed length,
* and will result in a segment with no allocated data segment.
* the caller should immediately assign data to the segment, as the segment
Expand Down Expand Up @@ -326,6 +334,13 @@ aspath_free (struct aspath *aspath)
assegment_free_all (aspath->segments);
if (aspath->str)
XFREE (MTYPE_AS_STR, aspath->str);

if (aspath->json)
{
json_object_free(aspath->json);
aspath->json = NULL;
}

XFREE (MTYPE_AS_PATH, aspath);
}

Expand Down Expand Up @@ -500,10 +515,19 @@ aspath_make_str_count (struct aspath *as)
int str_size;
int len = 0;
char *str_buf;
json_object *jaspath_segments = NULL;
json_object *jseg = NULL;
json_object *jseg_list = NULL;

as->json = json_object_new_object();
jaspath_segments = json_object_new_array();

/* Empty aspath. */
if (!as->segments)
{
json_object_string_add(as->json, "string", "Local");
json_object_object_add(as->json, "segments", jaspath_segments);
json_object_int_add(as->json, "length", 0);
as->str = XMALLOC (MTYPE_AS_STR, 1);
as->str[0] = '\0';
as->str_len = 0;
Expand Down Expand Up @@ -546,6 +570,8 @@ aspath_make_str_count (struct aspath *as)
XFREE (MTYPE_AS_STR, str_buf);
as->str = NULL;
as->str_len = 0;
json_object_free(as->json);
as->json = NULL;
return;
}

Expand All @@ -571,15 +597,24 @@ aspath_make_str_count (struct aspath *as)
len += snprintf (str_buf + len, str_size - len,
"%c",
aspath_delimiter_char (seg->type, AS_SEG_START));

jseg_list = json_object_new_array();

/* write out the ASNs, with their seperators, bar the last one*/
for (i = 0; i < seg->length; i++)
{
json_object_array_add(jseg_list, json_object_new_int(seg->as[i]));

len += snprintf (str_buf + len, str_size - len, "%u", seg->as[i]);

if (i < (seg->length - 1))
len += snprintf (str_buf + len, str_size - len, "%c", seperator);
}

jseg = json_object_new_object();
json_object_string_add(jseg, "type", aspath_segment_type_str[seg->type]);
json_object_object_add(jseg, "list", jseg_list);
json_object_array_add(jaspath_segments, jseg);

if (seg->type != AS_SEQUENCE)
len += snprintf (str_buf + len, str_size - len, "%c",
Expand All @@ -596,6 +631,9 @@ aspath_make_str_count (struct aspath *as)
as->str = str_buf;
as->str_len = len;

json_object_string_add(as->json, "string", str_buf);
json_object_object_add(as->json, "segments", jaspath_segments);
json_object_int_add(as->json, "length", aspath_count_hops (as));
return;
}

Expand All @@ -604,6 +642,13 @@ aspath_str_update (struct aspath *as)
{
if (as->str)
XFREE (MTYPE_AS_STR, as->str);

if (as->json)
{
json_object_free(as->json);
as->json = NULL;
}

aspath_make_str_count (as);
}

Expand Down Expand Up @@ -637,6 +682,7 @@ aspath_dup (struct aspath *aspath)
struct aspath *new;

new = XCALLOC (MTYPE_AS_PATH, sizeof (struct aspath));
new->json = NULL;

if (aspath->segments)
new->segments = assegment_dup_all (aspath->segments);
Expand Down Expand Up @@ -675,6 +721,7 @@ aspath_hash_alloc (void *arg)
new->segments = aspath->segments;
new->str = aspath->str;
new->str_len = aspath->str_len;
new->json = aspath->json;

return new;
}
Expand Down Expand Up @@ -1239,6 +1286,7 @@ aspath_remove_private_asns (struct aspath *aspath)

new = XCALLOC (MTYPE_AS_PATH, sizeof (struct aspath));

new->json = NULL;
new_seg = NULL;
last_new_seg = NULL;
seg = aspath->segments;
Expand Down Expand Up @@ -1628,7 +1676,11 @@ aspath_reconcile_as4 ( struct aspath *aspath, struct aspath *as4path)
}

if (!hops)
return aspath_dup (as4path);
{
newpath = aspath_dup (as4path);
aspath_str_update(newpath);
return newpath;
}

if ( BGP_DEBUG(as4, AS4))
zlog_debug("[AS4] got AS_PATH %s and AS4_PATH %s synthesizing now",
Expand Down
5 changes: 5 additions & 0 deletions bgpd/bgp_aspath.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_ASPATH_H
#define _QUAGGA_BGP_ASPATH_H

#include "lib/json.h"

/* AS path segment type. */
#define AS_SET 1
#define AS_SEQUENCE 2
Expand Down Expand Up @@ -63,6 +65,9 @@ struct aspath
/* segment data */
struct assegment *segments;

/* AS path as a json object */
json_object *json;

/* String expression of AS path. This string is used by vty output
and AS path regular expression match. */
char *str;
Expand Down
48 changes: 40 additions & 8 deletions bgpd/bgp_community.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ community_free (struct community *com)
XFREE (MTYPE_COMMUNITY_VAL, com->val);
if (com->str)
XFREE (MTYPE_COMMUNITY_STR, com->str);

if (com->json)
{
json_object_free(com->json);
com->json = NULL;
}

XFREE (MTYPE_COMMUNITY, com);
}

Expand Down Expand Up @@ -170,6 +177,7 @@ community_uniq_sort (struct community *com)
return NULL;

new = community_new ();;
new->json = NULL;

for (i = 0; i < com->size; i++)
{
Expand All @@ -194,8 +202,8 @@ community_uniq_sort (struct community *com)
0xFFFFFF03 "local-AS"
For other values, "AS:VAL" format is used. */
static char *
community_com2str (struct community *com)
static void
set_community_string (struct community *com)
{
int i;
char *str;
Expand All @@ -205,16 +213,25 @@ community_com2str (struct community *com)
u_int32_t comval;
u_int16_t as;
u_int16_t val;
json_object *json_community_list = NULL;
json_object *json_string = NULL;

if (!com)
return NULL;

com->json = json_object_new_object();
json_community_list = json_object_new_array();

/* When communities attribute is empty. */
if (com->size == 0)
{
str = XMALLOC (MTYPE_COMMUNITY_STR, 1);
str[0] = '\0';
return str;

json_object_string_add(com->json, "string", "");
json_object_object_add(com->json, "list", json_community_list);
com->str = str;
return;
}

/* Memory allocation is time consuming work. So we calculate
Expand Down Expand Up @@ -266,30 +283,42 @@ community_com2str (struct community *com)
case COMMUNITY_INTERNET:
strcpy (pnt, "internet");
pnt += strlen ("internet");
json_string = json_object_new_string("internet");
json_object_array_add(json_community_list, json_string);
break;
case COMMUNITY_NO_EXPORT:
strcpy (pnt, "no-export");
pnt += strlen ("no-export");
json_string = json_object_new_string("no-export");
json_object_array_add(json_community_list, json_string);
break;
case COMMUNITY_NO_ADVERTISE:
strcpy (pnt, "no-advertise");
pnt += strlen ("no-advertise");
json_string = json_object_new_string("no-advertise");
json_object_array_add(json_community_list, json_string);
break;
case COMMUNITY_LOCAL_AS:
strcpy (pnt, "local-AS");
pnt += strlen ("local-AS");
json_string = json_object_new_string("local-AS");
json_object_array_add(json_community_list, json_string);
break;
default:
as = (comval >> 16) & 0xFFFF;
val = comval & 0xFFFF;
sprintf (pnt, "%u:%d", as, val);
json_string = json_object_new_string(pnt);
json_object_array_add(json_community_list, json_string);
pnt += strlen (pnt);
break;
}
}
*pnt = '\0';

return str;
json_object_string_add(com->json, "string", str);
json_object_object_add(com->json, "list", json_community_list);
com->str = str;
}

/* Intern communities attribute. */
Expand All @@ -314,7 +343,7 @@ community_intern (struct community *com)

/* Make string. */
if (! find->str)
find->str = community_com2str (find);
set_community_string (find);

return find;
}
Expand Down Expand Up @@ -383,9 +412,9 @@ community_str (struct community *com)
{
if (!com)
return NULL;

if (! com->str)
com->str = community_com2str (com);
set_community_string (com);
return com->str;
}

Expand Down Expand Up @@ -599,7 +628,10 @@ community_str2com (const char *str)
case community_token_no_advertise:
case community_token_local_as:
if (com == NULL)
com = community_new();
{
com = community_new();
com->json = NULL;
}
community_add_val (com, val);
break;
case community_token_unknown:
Expand Down
5 changes: 5 additions & 0 deletions bgpd/bgp_community.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_COMMUNITY_H
#define _QUAGGA_BGP_COMMUNITY_H

#include "lib/json.h"

/* Communities attribute. */
struct community
{
Expand All @@ -33,6 +35,9 @@ struct community
/* Communities value. */
u_int32_t *val;

/* Communities as a json object */
json_object *json;

/* String of community attribute. This sring is used by vty output
and expanded community-list for regular expression match. */
char *str;
Expand Down
19 changes: 6 additions & 13 deletions bgpd/bgp_damp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA

#include <zebra.h>
#include <math.h>
#include <json/json.h>

#include "prefix.h"
#include "memory.h"
Expand Down Expand Up @@ -587,8 +586,6 @@ bgp_damp_info_vty (struct vty *vty, struct bgp_info *binfo,
time_t t_now, t_diff;
char timebuf[BGP_UPTIME_LEN];
int penalty;
json_object *json_int;
json_object *json_string;

if (!binfo->extra)
return;
Expand All @@ -608,20 +605,16 @@ bgp_damp_info_vty (struct vty *vty, struct bgp_info *binfo,

if (json_path)
{
json_int = json_object_new_int(penalty);
json_object_object_add(json_path, "dampening-penalty", json_int);

json_int = json_object_new_int(bdi->flap);
json_object_object_add(json_path, "dampening-flap-count", json_int);

json_string = json_object_new_string(peer_uptime (bdi->start_time, timebuf, BGP_UPTIME_LEN));
json_object_object_add(json_path, "dampening-flap-period", json_string);
json_object_int_add(json_path, "dampening-penalty", penalty);
json_object_int_add(json_path, "dampening-flap-count", bdi->flap);
json_object_string_add(json_path, "dampening-flap-period",
peer_uptime (bdi->start_time, timebuf, BGP_UPTIME_LEN));

if (CHECK_FLAG (binfo->flags, BGP_INFO_DAMPED)
&& ! CHECK_FLAG (binfo->flags, BGP_INFO_HISTORY))
{
json_string = json_object_new_string(bgp_get_reuse_time (penalty, timebuf, BGP_UPTIME_LEN));
json_object_object_add(json_path, "dampening-reuse-in", json_string);
json_object_string_add(json_path, "dampening-reuse-in",
bgp_get_reuse_time (penalty, timebuf, BGP_UPTIME_LEN));
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion bgpd/bgp_damp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_DAMP_H
#define _QUAGGA_BGP_DAMP_H

#include <json/json.h>
#include "lib/json.h"

/* Structure maintained on a per-route basis. */
struct bgp_damp_info
Expand Down
2 changes: 0 additions & 2 deletions bgpd/bgp_open.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_OPEN_H
#define _QUAGGA_BGP_OPEN_H

#include <json/json.h>

/* Standard header for capability TLV */
struct capability_header
{
Expand Down
Loading

0 comments on commit f1aa5d8

Please sign in to comment.