diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-23 20:36:06 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-08-24 14:09:02 +0200 |
commit | 836aad7ee82af11cc4c014d0b2de687d43c46f46 (patch) | |
tree | a46f04e33d6b0bab277779342356b265657b6364 /eigrpd | |
parent | eigrpd: Convert pe->destination_ipv4 to pe->destination (diff) | |
download | frr-836aad7ee82af11cc4c014d0b2de687d43c46f46.tar.xz frr-836aad7ee82af11cc4c014d0b2de687d43c46f46.zip |
eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'eigrpd')
-rw-r--r-- | eigrpd/eigrp_topology.c | 15 | ||||
-rw-r--r-- | eigrpd/eigrp_zebra.c | 21 | ||||
-rw-r--r-- | eigrpd/eigrp_zebra.h | 4 |
3 files changed, 16 insertions, 24 deletions
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c index e2f47ced3..0ae4788fd 100644 --- a/eigrpd/eigrp_topology.c +++ b/eigrpd/eigrp_topology.c @@ -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; } diff --git a/eigrpd/eigrp_zebra.c b/eigrpd/eigrp_zebra.c index 5aa7821e1..47871dfd3 100644 --- a/eigrpd/eigrp_zebra.c +++ b/eigrpd/eigrp_zebra.c @@ -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; diff --git a/eigrpd/eigrp_zebra.h b/eigrpd/eigrp_zebra.h index 3281c4701..1c418ddde 100644 --- a/eigrpd/eigrp_zebra.h +++ b/eigrpd/eigrp_zebra.h @@ -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); |