forked from Mirror/frr
eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
02b4599881
commit
836aad7ee8
|
@ -196,8 +196,7 @@ void eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
|
||||||
listnode_add_sort(node->entries, entry);
|
listnode_add_sort(node->entries, entry);
|
||||||
entry->prefix = node;
|
entry->prefix = node;
|
||||||
|
|
||||||
eigrp_zebra_route_add((struct prefix_ipv4 *)
|
eigrp_zebra_route_add(node->destination, l);
|
||||||
node->destination, l);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
list_delete(l);
|
list_delete(l);
|
||||||
|
@ -222,8 +221,7 @@ void eigrp_prefix_entry_delete(struct list *topology,
|
||||||
list_free(node->entries);
|
list_free(node->entries);
|
||||||
list_free(node->rij);
|
list_free(node->rij);
|
||||||
listnode_delete(topology, node);
|
listnode_delete(topology, node);
|
||||||
eigrp_zebra_route_delete((struct prefix_ipv4 *)
|
eigrp_zebra_route_delete(node->destination);
|
||||||
node->destination);
|
|
||||||
XFREE(MTYPE_EIGRP_PREFIX_ENTRY, node);
|
XFREE(MTYPE_EIGRP_PREFIX_ENTRY, node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -236,8 +234,7 @@ void eigrp_neighbor_entry_delete(struct eigrp_prefix_entry *node,
|
||||||
{
|
{
|
||||||
if (listnode_lookup(node->entries, entry) != NULL) {
|
if (listnode_lookup(node->entries, entry) != NULL) {
|
||||||
listnode_delete(node->entries, entry);
|
listnode_delete(node->entries, entry);
|
||||||
eigrp_zebra_route_delete((struct prefix_ipv4 *)
|
eigrp_zebra_route_delete(node->destination);
|
||||||
node->destination);
|
|
||||||
XFREE(MTYPE_EIGRP_NEIGHBOR_ENTRY, entry);
|
XFREE(MTYPE_EIGRP_NEIGHBOR_ENTRY, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -467,16 +464,14 @@ void eigrp_update_routing_table(struct eigrp_prefix_entry *prefix)
|
||||||
struct eigrp_neighbor_entry *entry;
|
struct eigrp_neighbor_entry *entry;
|
||||||
|
|
||||||
if (successors) {
|
if (successors) {
|
||||||
eigrp_zebra_route_add((struct prefix_ipv4 *)
|
eigrp_zebra_route_add(prefix->destination,
|
||||||
prefix->destination,
|
|
||||||
successors);
|
successors);
|
||||||
for (ALL_LIST_ELEMENTS_RO(successors, node, entry))
|
for (ALL_LIST_ELEMENTS_RO(successors, node, entry))
|
||||||
entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
|
entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
|
||||||
|
|
||||||
list_delete(successors);
|
list_delete(successors);
|
||||||
} else {
|
} else {
|
||||||
eigrp_zebra_route_delete((struct prefix_ipv4 *)
|
eigrp_zebra_route_delete(prefix->destination);
|
||||||
prefix->destination);
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry))
|
for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry))
|
||||||
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
|
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
|
||||||
}
|
}
|
||||||
|
|
|
@ -361,7 +361,7 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
|
||||||
ifname_tmp, strnlen(ifname_tmp, INTERFACE_NAMSIZ), VRF_DEFAULT);
|
ifname_tmp, strnlen(ifname_tmp, INTERFACE_NAMSIZ), VRF_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eigrp_zebra_route_add(struct prefix_ipv4 *p, struct list *successors)
|
void eigrp_zebra_route_add(struct prefix *p, struct list *successors)
|
||||||
{
|
{
|
||||||
struct zapi_route api;
|
struct zapi_route api;
|
||||||
struct zapi_nexthop *api_nh;
|
struct zapi_nexthop *api_nh;
|
||||||
|
@ -395,18 +395,16 @@ void eigrp_zebra_route_add(struct prefix_ipv4 *p, struct list *successors)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
|
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
|
||||||
char buf[2][INET_ADDRSTRLEN];
|
char buf[2][PREFIX_STRLEN];
|
||||||
zlog_debug(
|
zlog_debug("Zebra: Route add %s nexthop %s",
|
||||||
"Zebra: Route add %s/%d nexthop %s",
|
prefix2str(p, buf[0], PREFIX_STRLEN),
|
||||||
inet_ntop(AF_INET, &p->prefix, buf[0], sizeof(buf[0])),
|
inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN));
|
||||||
p->prefixlen, inet_ntop(AF_INET, 0 /*&p->nexthop*/,
|
|
||||||
buf[1], sizeof(buf[1])));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
|
||||||
}
|
}
|
||||||
|
|
||||||
void eigrp_zebra_route_delete(struct prefix_ipv4 *p)
|
void eigrp_zebra_route_delete(struct prefix *p)
|
||||||
{
|
{
|
||||||
struct zapi_route api;
|
struct zapi_route api;
|
||||||
|
|
||||||
|
@ -421,10 +419,9 @@ void eigrp_zebra_route_delete(struct prefix_ipv4 *p)
|
||||||
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
|
||||||
|
|
||||||
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
|
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
|
||||||
char buf[INET_ADDRSTRLEN];
|
char buf[PREFIX_STRLEN];
|
||||||
zlog_debug("Zebra: Route del %s/%d",
|
zlog_debug("Zebra: Route del %s",
|
||||||
inet_ntop(AF_INET, &p->prefix, buf, sizeof(buf)),
|
prefix2str(p, buf, PREFIX_STRLEN));
|
||||||
p->prefixlen);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
extern void eigrp_zebra_init(void);
|
extern void eigrp_zebra_init(void);
|
||||||
|
|
||||||
extern void eigrp_zebra_route_add(struct prefix_ipv4 *, struct list *);
|
extern void eigrp_zebra_route_add(struct prefix *, struct list *);
|
||||||
extern void eigrp_zebra_route_delete(struct prefix_ipv4 *);
|
extern void eigrp_zebra_route_delete(struct prefix *);
|
||||||
extern int eigrp_redistribute_set(struct eigrp *, int, struct eigrp_metrics);
|
extern int eigrp_redistribute_set(struct eigrp *, int, struct eigrp_metrics);
|
||||||
extern int eigrp_redistribute_unset(struct eigrp *, int);
|
extern int eigrp_redistribute_unset(struct eigrp *, int);
|
||||||
extern int eigrp_is_type_redistributed(int);
|
extern int eigrp_is_type_redistributed(int);
|
||||||
|
|
Loading…
Reference in a new issue