return NULL;
}
+/*
+ * For a future optimization, put the successor list into it's
+ * own separate list from the full list?
+ *
+ * That way we can clean up all the list_new and list_delete's
+ * that we are doing. DBS
+ */
struct list *
eigrp_topology_get_successor(struct eigrp_prefix_entry *table_node)
{
void
eigrp_update_routing_table(struct eigrp_prefix_entry * prefix)
{
+ struct list *successors = eigrp_topology_get_successor(prefix);
struct listnode *node;
struct eigrp_neighbor_entry *entry;
- for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry))
+ if (successors)
{
- if (entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)
- {
- if (!(entry->flags & EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG))
- {
- eigrp_zebra_route_add(prefix->destination_ipv4, entry);
- entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
- }
- }
- else if (entry->flags & EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG)
- {
- eigrp_zebra_route_delete(prefix->destination_ipv4, entry);
- entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
- }
+ eigrp_zebra_route_add(prefix->destination_ipv4, successors);
+ for (ALL_LIST_ELEMENTS_RO (successors, node, entry))
+ entry->flags |= EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
+
+ list_delete(successors);
+ }
+ else
+ {
+ eigrp_zebra_route_delete(prefix->destination_ipv4);
+ for (ALL_LIST_ELEMENTS_RO (prefix->entries, node, entry))
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
}
}
}
void
-eigrp_zebra_route_add (struct prefix_ipv4 *p, struct eigrp_neighbor_entry *te)
+eigrp_zebra_route_add (struct prefix_ipv4 *p, struct list *successors)
{
+ struct eigrp_neighbor_entry *te;
+ struct listnode *node;
u_char message;
u_char flags;
int psize;
/* EIGRP pass nexthop and metric */
SET_FLAG (message, ZAPI_MESSAGE_NEXTHOP);
- /* Distance value. */
-// distance = eigrp_distance_apply (p, er);
-// if (distance)
-// SET_FLAG (message, ZAPI_MESSAGE_DISTANCE);
-
/* Make packet. */
s = zclient->obuf;
stream_reset (s);
stream_write (s, (u_char *) & p->prefix, psize);
/* Nexthop count. */
- stream_putc (s, 1);
+ stream_putc (s, successors->count);
/* Nexthop, ifindex, distance and metric information. */
- stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
- stream_put_in_addr (s, &te->adv_router->src);
- stream_putl (s, te->ei->ifp->ifindex);
+ for (ALL_LIST_ELEMENTS_RO (successors, node, te))
+ {
+ stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
+ stream_put_in_addr (s, &te->adv_router->src);
+ stream_putl (s, te->ei->ifp->ifindex);
+ }
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
{
inet_ntop(AF_INET, 0 /*&p->nexthop*/, buf[1], sizeof (buf[1])));
}
- //stream_putl (s, te->distance);
stream_putw_at (s, 0, stream_get_endp (s));
zclient_send_message (zclient);
}
void
-eigrp_zebra_route_delete (struct prefix_ipv4 *p, struct eigrp_neighbor_entry *te)
+eigrp_zebra_route_delete (struct prefix_ipv4 *p)
{
- u_char message;
- u_char flags;
- int psize;
- struct stream *s;
+ struct zapi_ipv4 api;
if (zclient->redist[AFI_IP][ZEBRA_ROUTE_EIGRP])
{
- message = 0;
- flags = 0;
- /* Make packet. */
- s = zclient->obuf;
- stream_reset (s);
-
- /* Put command, type, flags, message. */
- zclient_create_header (s, ZEBRA_IPV4_ROUTE_DELETE, VRF_DEFAULT);
- stream_putc (s, ZEBRA_ROUTE_EIGRP);
- stream_putw (s, 0); // Instance
- stream_putl (s, flags);
- stream_putc (s, message);
- stream_putw (s, SAFI_UNICAST);
-
- /* Put prefix information. */
- psize = PSIZE (p->prefixlen);
- stream_putc (s, p->prefixlen);
- stream_write (s, (u_char *) & p->prefix, psize);
-
- /* Nexthop count. */
- stream_putc (s, 1);
-
- /* Nexthop, ifindex, distance and metric information. */
- stream_putc (s, NEXTHOP_TYPE_IPV4_IFINDEX);
- stream_put_in_addr (s, &te->adv_router->src);
- stream_putl (s, te->ei->ifp->ifindex);
+ api.vrf_id = VRF_DEFAULT;
+ api.type = ZEBRA_ROUTE_EIGRP;
+ api.instance = 0;
+ api.flags = 0;
+ api.message = 0;
+ api.safi = SAFI_UNICAST;
+ zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient, p, &api);
if (IS_DEBUG_EIGRP (zebra, ZEBRA_REDISTRIBUTE))
- {
+ {
char buf[2][INET_ADDRSTRLEN];
zlog_debug ("Zebra: Route del %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])));
}
-
-
- if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
- {
- stream_putl (s, te->distance);
- }
-
- stream_putw_at (s, 0, stream_get_endp (s));
-
- zclient_send_message (zclient);
}
+
+ return;
}
vrf_bitmap_t