vty_out(vty, "%-3c", (tn->state > 0) ? 'A' : 'P');
- vty_out(vty, "%pFX, ", tn->destination);
+ vty_out(vty, "%pFX, ", &tn->destination);
vty_out(vty, "%u successors, ", (successors) ? successors->count : 0);
vty_out(vty, "FD is %u, serno: %" PRIu64 " \n", tn->fdistance,
tn->serno);
{
enum eigrp_fsm_events event = eigrp_get_fsm_event(msg);
- zlog_info(
- "EIGRP AS: %d State: %s Event: %s Network: %pI4 Packet Type: %s Reply RIJ Count: %d change: %s",
- msg->eigrp->AS, prefix_state2str(msg->prefix->state),
- fsm_state2str(event), &msg->prefix->destination->u.prefix4,
- packet_type2str(msg->packet_type), msg->prefix->rij->count,
- change2str(msg->change));
+ zlog_info("EIGRP AS: %d State: %s Event: %s Network: %pFX Packet Type: %s Reply RIJ Count: %d change: %s",
+ msg->eigrp->AS, prefix_state2str(msg->prefix->state), fsm_state2str(event),
+ &msg->prefix->destination, packet_type2str(msg->packet_type),
+ msg->prefix->rij->count, change2str(msg->change));
(*(NSM[msg->prefix->state][event].func))(msg);
return 1;
if (pe == NULL) {
pe = eigrp_prefix_descriptor_new();
pe->serno = eigrp->serno;
- pe->destination = (struct prefix *)prefix_ipv4_new();
- prefix_copy(pe->destination, &dest_addr);
+ prefix_copy(&pe->destination, &dest_addr);
pe->af = AF_INET;
pe->nt = EIGRP_TOPOLOGY_TYPE_CONNECTED;
return 1;
}
+static void eigrp_network_delete_all(struct eigrp *eigrp, struct route_table *table)
+{
+ struct route_node *rn;
+
+ for (rn = route_top(table); rn; rn = route_next(rn)) {
+ prefix_free((struct prefix **)&rn->info);
+ }
+}
+
+void eigrp_network_free(struct eigrp *eigrp, struct route_table *table)
+{
+ eigrp_network_delete_all(eigrp, table);
+ route_table_finish(table);
+}
+
/* Check whether interface matches given network
* returns: 1, true. 0, false
*/
extern int eigrp_if_ipmulticast(struct eigrp *, struct prefix *, unsigned int);
extern int eigrp_network_set(struct eigrp *eigrp, struct prefix *p);
extern int eigrp_network_unset(struct eigrp *eigrp, struct prefix *p);
+extern void eigrp_network_free(struct eigrp *eigrp, struct route_table *table);
extern void eigrp_hello_timer(struct event *thread);
extern void eigrp_if_update(struct interface *);
uint16_t length;
stream_putw(s, EIGRP_TLV_IPv4_INT);
- switch (pe->destination->prefixlen) {
+ switch (pe->destination.prefixlen) {
case 0:
case 1:
case 2:
stream_putw(s, length);
break;
default:
- flog_err(EC_LIB_DEVELOPMENT, "%s: Unexpected prefix length: %d",
- __func__, pe->destination->prefixlen);
+ flog_err(EC_LIB_DEVELOPMENT, "%s: Unexpected prefix length: %d", __func__,
+ pe->destination.prefixlen);
return 0;
}
stream_putl(s, 0x00000000);
stream_putc(s, pe->reported_metric.tag);
stream_putc(s, pe->reported_metric.flags);
- stream_putc(s, pe->destination->prefixlen);
+ stream_putc(s, pe->destination.prefixlen);
- stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 24) & 0xFF);
- if (pe->destination->prefixlen > 8)
- stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 16) & 0xFF);
- if (pe->destination->prefixlen > 16)
- stream_putc(s, (ntohl(pe->destination->u.prefix4.s_addr) >> 8) & 0xFF);
- if (pe->destination->prefixlen > 24)
- stream_putc(s, ntohl(pe->destination->u.prefix4.s_addr) & 0xFF);
+ stream_putc(s, (ntohl(pe->destination.u.prefix4.s_addr) >> 24) & 0xFF);
+ if (pe->destination.prefixlen > 8)
+ stream_putc(s, (ntohl(pe->destination.u.prefix4.s_addr) >> 16) & 0xFF);
+ if (pe->destination.prefixlen > 16)
+ stream_putc(s, (ntohl(pe->destination.u.prefix4.s_addr) >> 8) & 0xFF);
+ if (pe->destination.prefixlen > 24)
+ stream_putc(s, ntohl(pe->destination.u.prefix4.s_addr) & 0xFF);
return length;
}
sizeof(struct eigrp_prefix_descriptor));
memcpy(pe2, pe, sizeof(struct eigrp_prefix_descriptor));
- if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_OUT,
- pe2->destination)) {
+ if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_OUT, &pe2->destination)) {
zlog_info("REPLY SEND: Setting Metric to max");
pe2->reported_metric.delay = EIGRP_MAX_METRIC;
}
uint8_t af; // address family
uint8_t req_action; // required action
- struct prefix *destination;
+ struct prefix destination;
// If network type is REMOTE_EXTERNAL, pointer will have reference to
// its external TLV
new->rij = list_new();
new->entries->cmp = (int (*)(void *, void *))eigrp_route_descriptor_cmp;
new->distance = new->fdistance = new->rdistance = EIGRP_MAX_METRIC;
- new->destination = NULL;
return new;
}
{
struct route_node *rn;
- rn = route_node_get(topology, pe->destination);
+ rn = route_node_get(topology, &pe->destination);
if (rn->info) {
if (IS_DEBUG_EIGRP_EVENT)
- zlog_debug(
- "%s: %pFX Should we have found this entry in the topo table?",
- __func__, pe->destination);
+ zlog_debug("%s: %pFX Should we have found this entry in the topo table?",
+ __func__, &pe->destination);
route_unlock_node(rn);
}
listnode_add_sort(node->entries, entry);
entry->prefix = node;
- eigrp_zebra_route_add(eigrp, node->destination,
- l, node->fdistance);
+ eigrp_zebra_route_add(eigrp, &node->destination, l, node->fdistance);
}
list_delete(&l);
if (!eigrp)
return;
- rn = route_node_lookup(table, pe->destination);
+ rn = route_node_lookup(table, &pe->destination);
if (!rn)
return;
eigrp_route_descriptor_delete(eigrp, pe, ne);
list_delete(&pe->entries);
list_delete(&pe->rij);
- eigrp_zebra_route_delete(eigrp, pe->destination);
- prefix_free(&pe->destination);
+ eigrp_zebra_route_delete(eigrp, &pe->destination);
rn->info = NULL;
route_unlock_node(rn); // Lookup above
{
if (listnode_lookup(node->entries, entry) != NULL) {
listnode_delete(node->entries, entry);
- eigrp_zebra_route_delete(eigrp, node->destination);
+ eigrp_zebra_route_delete(eigrp, &node->destination);
XFREE(MTYPE_EIGRP_ROUTE_DESCRIPTOR, entry);
}
}
successors = eigrp_topology_get_successor_max(prefix, eigrp->max_paths);
if (successors) {
- eigrp_zebra_route_add(eigrp, prefix->destination, successors,
- prefix->fdistance);
+ eigrp_zebra_route_add(eigrp, &prefix->destination, successors, prefix->fdistance);
for (ALL_LIST_ELEMENTS_RO(successors, node, entry))
entry->flags |= EIGRP_ROUTE_DESCRIPTOR_INTABLE_FLAG;
list_delete(&successors);
} else {
- eigrp_zebra_route_delete(eigrp, prefix->destination);
+ eigrp_zebra_route_delete(eigrp, &prefix->destination);
for (ALL_LIST_ELEMENTS_RO(prefix->entries, node, entry))
entry->flags &= ~EIGRP_ROUTE_DESCRIPTOR_INTABLE_FLAG;
}
/* iterate over all prefixes which weren't advertised by neighbor */
for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) {
- zlog_debug("GR receive: Neighbor not advertised %pFX",
- prefix->destination);
+ zlog_debug("GR receive: Neighbor not advertised %pFX", &prefix->destination);
fsm_msg.metrics = prefix->reported_metric;
/* set delay to MAX */
/*Here comes topology information save*/
pe = eigrp_prefix_descriptor_new();
pe->serno = eigrp->serno;
- pe->destination =
- (struct prefix *)prefix_ipv4_new();
- prefix_copy(pe->destination, &dest_addr);
+ prefix_copy(&pe->destination, &dest_addr);
pe->af = AF_INET;
pe->state = EIGRP_FSM_STATE_PASSIVE;
pe->nt = EIGRP_TOPOLOGY_TYPE_REMOTE;
}
}
/* Get destination address from prefix */
- dest_addr = pe->destination;
+ dest_addr = &pe->destination;
/* Check if any list fits */
if (eigrp_update_prefix_apply(
has_tlv = 0;
}
/* Get destination address from prefix */
- dest_addr = pe->destination;
+ dest_addr = &pe->destination;
if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_OUT,
dest_addr)) {
/*
* Filtering
*/
- dest_addr = pe->destination;
+ dest_addr = &pe->destination;
if (eigrp_update_prefix_apply(eigrp, ei, EIGRP_FILTER_OUT,
dest_addr)) {
zclient->zebra_connected = eigrp_zebra_connected;
}
+void eigrp_zebra_stop(void)
+{
+ zclient_stop(zclient);
+ zclient_free(zclient);
+}
/* Zebra route add and delete treatment. */
static int eigrp_zebra_read_route(ZAPI_CALLBACK_ARGS)
#include "vrf.h"
extern void eigrp_zebra_init(void);
+extern void eigrp_zebra_stop(void);
extern void eigrp_zebra_route_add(struct eigrp *eigrp, struct prefix *p,
struct list *successors, uint32_t distance);
SET_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN);
- frr_each (eigrp_master_hash, &eigrp_om->eigrp, eigrp)
+ while (eigrp_master_hash_count(&eigrp_om->eigrp)) {
+ eigrp = eigrp_master_hash_first(&eigrp_om->eigrp);
eigrp_finish(eigrp);
+ }
eigrp_master_hash_fini(&eigrp_om->eigrp);
+
+ eigrp_zebra_stop();
+
frr_fini();
}
{
eigrp_finish_final(eigrp);
- /* eigrp being shut-down? If so, was this the last eigrp instance? */
- if (CHECK_FLAG(eigrp_om->options, EIGRP_MASTER_SHUTDOWN) &&
- (eigrp_master_hash_count(&eigrp_om->eigrp) == 0)) {
- if (zclient) {
- zclient_stop(zclient);
- zclient_free(zclient);
- }
- exit(0);
- }
-
return;
}
list_delete(&eigrp->oi_write_q);
eigrp_topology_free(eigrp, eigrp->topology_table);
+ eigrp_network_free(eigrp, eigrp->networks);
eigrp_nbr_delete(eigrp->neighbor_self);
stream_free(eigrp->ibuf);
distribute_list_delete(&eigrp->distribute_ctx);
+
+ QOBJ_UNREG(eigrp);
+
XFREE(MTYPE_EIGRP_TOP, eigrp);
}