#define EIGRP_TOPOLOGY_TYPE_REMOTE_EXTERNAL 2 // Remote external network
/*EIGRP TT entry flags*/
-#define EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG 1
-#define EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG 2
-#define EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG 4
-#define EIGRP_NEIGHBOR_ENTRY_EXTERNAL_FLAG 8
+#define EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG (1 << 0)
+#define EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG (1 << 1)
+#define EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG (1 << 2)
+#define EIGRP_NEIGHBOR_ENTRY_EXTERNAL_FLAG (1 << 3)
/*EIGRP FSM state count, event count*/
#define EIGRP_FSM_STATE_MAX 5
new = XCALLOC(MTYPE_EIGRP_PREFIX_ENTRY, sizeof(struct eigrp_prefix_entry));
new->entries = list_new();
new->rij = list_new();
- new->entries->cmp = (int
- (*)(void *, void *)) eigrp_neighbor_entry_cmp;
+ new->entries->cmp = (int (*)(void *, void *))eigrp_neighbor_entry_cmp;
new->distance = new->fdistance = new->rdistance = EIGRP_MAX_METRIC;
new->destination_ipv4 = NULL;
new->destination_ipv6 = NULL;
return successors;
}
-/*extern struct eigrp_neighbor_entry *
- eigrp_topology_get_fsuccessor (struct eigrp_prefix_entry *table_node)
- {
- struct eigrp_neighbor_entry *data;
- struct listnode *node, *nnode;
- for (ALL_LIST_ELEMENTS (table_node->entries, node, nnode, data))
- {
- if ((data->flags & EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG) == 1)
- {
- return data;
- }
- }
-
- return NULL;
- }*/
-
struct eigrp_neighbor_entry *
eigrp_prefix_entry_lookup(struct list *entries, struct eigrp_neighbor *nbr)
{
if ((entry->distance <= (u_int64_t)(dest->distance*eigrp->variance)) && entry->distance != EIGRP_MAX_METRIC) // is successor
{
entry->flags |= EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
- entry->flags &= 0xfd; // 1111 1101 set fs flag to zero
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
}
else if (entry->reported_distance < dest->fdistance) // is feasible successor
{
entry->flags |= EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
- entry->flags &= 0xfe; // 1111 1110 set successor flag to zero
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG;
}
else
{
- entry->flags &= 0xfc; // 1111 1100 set successor and fs flag to zero
- }
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_FSUCCESSOR_FLAG;
+ 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;
+ 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;
+ entry->flags &= ~EIGRP_NEIGHBOR_ENTRY_INTABLE_FLAG;
}
}
}
eigrp_prefix_entry_delete(table,prefix);
}
}
-/*int
- eigrp_topology_get_successor_count (struct eigrp_prefix_entry *prefix)
- {
-
- struct listnode *node;
- struct eigrp_neighbor_entry *entry;
-
- int count = 0;
-
- for (ALL_LIST_ELEMENTS_RO (prefix->entries,node,entry))
- {
- if ((entry->flags & EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG) == EIGRP_NEIGHBOR_ENTRY_SUCCESSOR_FLAG)
- {
- count ++;
- }
- }
-
- return count;
- }
- */