]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd: Refactor to use 'struct prefix' for eigrp_zebra.h
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 23 Aug 2017 18:36:06 +0000 (14:36 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 Aug 2017 12:09:02 +0000 (08:09 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_topology.c
eigrpd/eigrp_zebra.c
eigrpd/eigrp_zebra.h

index e2f47ced31f6559079efa0efe5c41a7ae1b3f809..0ae4788fd03e7b39c47abc2632a94b25e46e0b6e 100644 (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;
        }
index 5aa7821e18d97af06f97a5f183763c5b408a4c6c..47871dfd3e381484c8ca611e41cf85d31b4dc065 100644 (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;
index 3281c470180f76169d437f2350dcf54923fa4799..1c418dddef61c2f38833c32ef78c7117e58a7a61 100644 (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);