diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-21 21:50:47 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-21 21:51:58 +0200 |
commit | af97a18b1015e05f9c5d220b3f64be875a2058e3 (patch) | |
tree | 9c5707c25946fa2b501022573b7c6fa488e52ee7 /bgpd/bgp_nexthop.c | |
parent | Merge pull request #3056 from pacovn/Coverity_1473285_Explicit_null_dereferenced (diff) | |
download | frr-af97a18b1015e05f9c5d220b3f64be875a2058e3.tar.xz frr-af97a18b1015e05f9c5d220b3f64be875a2058e3.zip |
bgpd: Make `struct bgp_addr` a private data structure
The `struct bgp_addr` is not needed for anything other than
the address hash. Isolate this data structure so that it
is not polluting up the name space.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r-- | bgpd/bgp_nexthop.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 76bfa73fe..bcada6c58 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -169,6 +169,28 @@ void bgp_tip_del(struct bgp *bgp, struct in_addr *tip) } } +/* BGP own address structure */ +struct bgp_addr { + struct in_addr addr; + int refcnt; +}; + +static void show_address_entry(struct hash_backet *backet, void *args) +{ + struct vty *vty = (struct vty *)args; + struct bgp_addr *addr = (struct bgp_addr *)backet->data; + + vty_out(vty, "addr: %s, count: %d\n", inet_ntoa(addr->addr), + addr->refcnt); +} + +void bgp_nexthop_show_address_hash(struct vty *vty, struct bgp *bgp) +{ + hash_iterate(bgp->address_hash, + (void (*)(struct hash_backet *, void *))show_address_entry, + vty); +} + static void *bgp_address_hash_alloc(void *p) { const struct in_addr *val = (const struct in_addr *)p; |