eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2017-08-23 14:36:06 -04:00
parent 02b4599881
commit 836aad7ee8
3 changed files with 16 additions and 24 deletions

View file

@ -196,8 +196,7 @@ void eigrp_neighbor_entry_add(struct eigrp_prefix_entry *node,
listnode_add_sort(node->entries, entry);
entry->prefix = node;
eigrp_zebra_route_add((struct prefix_ipv4 *)
node->destination, l);
eigrp_zebra_route_add(node->destination, l);
}
list_delete(l);
@ -222,8 +221,7 @@ void eigrp_prefix_entry_delete(struct list *topology,
list_free(node->entries);
list_free(node->rij);
listnode_delete(topology, node);
eigrp_zebra_route_delete((struct prefix_ipv4 *)
node->destination);
eigrp_zebra_route_delete(node->destination);
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) {
listnode_delete(node->entries, entry);
eigrp_zebra_route_delete((struct prefix_ipv4 *)
node->destination);
eigrp_zebra_route_delete(node->destination);
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;
if (successors) {
eigrp_zebra_route_add((struct prefix_ipv4 *)
prefix->destination,
eigrp_zebra_route_add(prefix->destination,
successors);
for (ALL_LIST_ELEMENTS_RO(successors, node, entry))
entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
list_delete(successors);
} else {
eigrp_zebra_route_delete((struct prefix_ipv4 *)
prefix->destination);
eigrp_zebra_route_delete(prefix->destination);
for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry))
entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
}

View file

@ -361,7 +361,7 @@ static struct interface *zebra_interface_if_lookup(struct stream *s)
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_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)) {
char buf[2][INET_ADDRSTRLEN];
zlog_debug(
"Zebra: Route add %s/%d nexthop %s",
inet_ntop(AF_INET, &p->prefix, buf[0], sizeof(buf[0])),
p->prefixlen, inet_ntop(AF_INET, 0 /*&p->nexthop*/,
buf[1], sizeof(buf[1])));
char buf[2][PREFIX_STRLEN];
zlog_debug("Zebra: Route add %s nexthop %s",
prefix2str(p, buf[0], PREFIX_STRLEN),
inet_ntop(AF_INET, 0, buf[1], PREFIX_STRLEN));
}
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;
@ -421,10 +419,9 @@ void eigrp_zebra_route_delete(struct prefix_ipv4 *p)
zclient_route_send(ZEBRA_ROUTE_DELETE, zclient, &api);
if (IS_DEBUG_EIGRP(zebra, ZEBRA_REDISTRIBUTE)) {
char buf[INET_ADDRSTRLEN];
zlog_debug("Zebra: Route del %s/%d",
inet_ntop(AF_INET, &p->prefix, buf, sizeof(buf)),
p->prefixlen);
char buf[PREFIX_STRLEN];
zlog_debug("Zebra: Route del %s",
prefix2str(p, buf, PREFIX_STRLEN));
}
return;

View file

@ -33,8 +33,8 @@
extern void eigrp_zebra_init(void);
extern void eigrp_zebra_route_add(struct prefix_ipv4 *, struct list *);
extern void eigrp_zebra_route_delete(struct prefix_ipv4 *);
extern void eigrp_zebra_route_add(struct prefix *, struct list *);
extern void eigrp_zebra_route_delete(struct prefix *);
extern int eigrp_redistribute_set(struct eigrp *, int, struct eigrp_metrics);
extern int eigrp_redistribute_unset(struct eigrp *, int);
extern int eigrp_is_type_redistributed(int);