mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 05:27:47 +00:00
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>
This commit is contained in:
parent
7c12afcf80
commit
af97a18b10
@ -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)
|
static void *bgp_address_hash_alloc(void *p)
|
||||||
{
|
{
|
||||||
const struct in_addr *val = (const struct in_addr *)p;
|
const struct in_addr *val = (const struct in_addr *)p;
|
||||||
|
@ -68,12 +68,6 @@ struct bgp_nexthop_cache {
|
|||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* BGP own address structure */
|
|
||||||
struct bgp_addr {
|
|
||||||
struct in_addr addr;
|
|
||||||
int refcnt;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Own tunnel-ip address structure */
|
/* Own tunnel-ip address structure */
|
||||||
struct tip_addr {
|
struct tip_addr {
|
||||||
struct in_addr addr;
|
struct in_addr addr;
|
||||||
@ -103,4 +97,5 @@ extern void bgp_tip_del(struct bgp *bgp, struct in_addr *tip);
|
|||||||
extern void bgp_tip_hash_init(struct bgp *bgp);
|
extern void bgp_tip_hash_init(struct bgp *bgp);
|
||||||
extern void bgp_tip_hash_destroy(struct bgp *bgp);
|
extern void bgp_tip_hash_destroy(struct bgp *bgp);
|
||||||
|
|
||||||
|
extern void bgp_nexthop_show_address_hash(struct vty *vty, struct bgp *bgp);
|
||||||
#endif /* _QUAGGA_BGP_NEXTHOP_H */
|
#endif /* _QUAGGA_BGP_NEXTHOP_H */
|
||||||
|
@ -7451,14 +7451,6 @@ DEFUN (show_bgp_vrfs,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void show_tip_entry(struct hash_backet *backet, void *args)
|
static void show_tip_entry(struct hash_backet *backet, void *args)
|
||||||
{
|
{
|
||||||
@ -7472,9 +7464,7 @@ static void show_tip_entry(struct hash_backet *backet, void *args)
|
|||||||
static void bgp_show_martian_nexthops(struct vty *vty, struct bgp *bgp)
|
static void bgp_show_martian_nexthops(struct vty *vty, struct bgp *bgp)
|
||||||
{
|
{
|
||||||
vty_out(vty, "self nexthop database:\n");
|
vty_out(vty, "self nexthop database:\n");
|
||||||
hash_iterate(bgp->address_hash,
|
bgp_nexthop_show_address_hash(vty, bgp);
|
||||||
(void (*)(struct hash_backet *, void *))show_address_entry,
|
|
||||||
vty);
|
|
||||||
|
|
||||||
vty_out(vty, "Tunnel-ip database:\n");
|
vty_out(vty, "Tunnel-ip database:\n");
|
||||||
hash_iterate(bgp->tip_hash,
|
hash_iterate(bgp->tip_hash,
|
||||||
|
Loading…
Reference in New Issue
Block a user