/* BGP own address structure */
struct bgp_addr {
- struct prefix *p;
+ struct prefix p;
struct list *ifp_name_list;
};
struct listnode *node;
char str[INET6_ADDRSTRLEN] = {0};
- if (addr->p->family == AF_INET) {
+ if (addr->p.family == AF_INET) {
vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET,
- &(addr->p->u.prefix4),
+ &(addr->p.u.prefix4),
str, INET_ADDRSTRLEN),
addr->ifp_name_list->count);
- } else if (addr->p->family == AF_INET6) {
+ } else if (addr->p.family == AF_INET6) {
vty_out(vty, "addr: %s, count: %d : ", inet_ntop(AF_INET6,
- &(addr->p->u.prefix6),
+ &(addr->p.u.prefix6),
str, INET6_ADDRSTRLEN),
addr->ifp_name_list->count);
}
struct bgp_addr *addr = NULL;
addr = XMALLOC(MTYPE_BGP_ADDR, sizeof(struct bgp_addr));
- addr->p = prefix_new();
- prefix_copy(addr->p, copy_addr->p);
+ prefix_copy(&addr->p, ©_addr->p);
addr->ifp_name_list = list_new();
addr->ifp_name_list->del = bgp_address_hash_string_del;
{
struct bgp_addr *addr = data;
- prefix_free(&addr->p);
list_delete(&addr->ifp_name_list);
XFREE(MTYPE_BGP_ADDR, addr);
}
{
const struct bgp_addr *addr = p;
- return prefix_hash_key((const void *)(addr->p));
+ return prefix_hash_key(&addr->p);
}
static bool bgp_address_hash_cmp(const void *p1, const void *p2)
const struct bgp_addr *addr1 = p1;
const struct bgp_addr *addr2 = p2;
- return prefix_same(addr1->p, addr2->p);
+ return prefix_same(&addr1->p, &addr2->p);
}
void bgp_address_init(struct bgp *bgp)
struct listnode *node;
char *name;
- tmp.p = p;
+ tmp.p = *p;
- if (tmp.p->family == AF_INET)
- tmp.p->prefixlen = IPV4_MAX_BITLEN;
- else if (tmp.p->family == AF_INET6)
- tmp.p->prefixlen = IPV6_MAX_BITLEN;
+ if (tmp.p.family == AF_INET)
+ tmp.p.prefixlen = IPV4_MAX_BITLEN;
+ else if (tmp.p.family == AF_INET6)
+ tmp.p.prefixlen = IPV6_MAX_BITLEN;
addr = hash_get(bgp->address_hash, &tmp, bgp_address_hash_alloc);
struct listnode *node;
char *name;
- tmp.p = p;
+ tmp.p = *p;
- if (tmp.p->family == AF_INET)
- tmp.p->prefixlen = IPV4_MAX_BITLEN;
- else if (tmp.p->family == AF_INET6)
- tmp.p->prefixlen = IPV6_MAX_BITLEN;
+ if (tmp.p.family == AF_INET)
+ tmp.p.prefixlen = IPV4_MAX_BITLEN;
+ else if (tmp.p.family == AF_INET6)
+ tmp.p.prefixlen = IPV6_MAX_BITLEN;
addr = hash_lookup(bgp->address_hash, &tmp);
/* may have been deleted earlier by bgp_interface_down() */
{
struct prefix p = {0};
afi_t new_afi = afi;
- struct bgp_addr tmp_addr = {0}, *addr = NULL;
+ struct bgp_addr tmp_addr = {{0}}, *addr = NULL;
struct tip_addr tmp_tip, *tip = NULL;
bool is_bgp_static_route = ((type == ZEBRA_ROUTE_BGP)
break;
}
- tmp_addr.p = &p;
+ tmp_addr.p = p;
addr = hash_lookup(bgp->address_hash, &tmp_addr);
if (addr)
return 1;
if (attr->flag & ATTR_FLAG_BIT(BGP_ATTR_NEXT_HOP)) {
tmp_tip.addr = attr->nexthop;
} else if ((attr->mp_nexthop_len) &&
- ((attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4)
- || (attr->mp_nexthop_len ==
- BGP_ATTR_NHLEN_VPNV4))) {
+ ((attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV4)
+ || (attr->mp_nexthop_len == BGP_ATTR_NHLEN_VPNV4))) {
tmp_tip.addr = attr->mp_nexthop_global_in;
}