summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2017-08-23 01:48:23 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2017-08-24 14:04:20 +0200
commit5ca6df7822a8cddd1a10b27760f6b6e274aced5d (patch)
tree1c34cec265e2e23e1b42d60e11cc0ae3ea317a0b
parenteigrpd: Remove union from FSM msg (diff)
downloadfrr-5ca6df7822a8cddd1a10b27760f6b6e274aced5d.tar.xz
frr-5ca6df7822a8cddd1a10b27760f6b6e274aced5d.zip
eigrpd: No need to create TLV type
There is no need to create a TLV type to pass in for the FSM message. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r--eigrpd/eigrp_packet.c20
-rw-r--r--eigrpd/eigrp_packet.h1
-rw-r--r--eigrpd/eigrp_topology.c27
-rw-r--r--eigrpd/eigrp_update.c38
4 files changed, 29 insertions, 57 deletions
diff --git a/eigrpd/eigrp_packet.c b/eigrpd/eigrp_packet.c
index 72aaef1b3..d4e8264f2 100644
--- a/eigrpd/eigrp_packet.c
+++ b/eigrpd/eigrp_packet.c
@@ -1101,6 +1101,16 @@ struct eigrp_packet *eigrp_packet_duplicate(struct eigrp_packet *old,
return new;
}
+static struct TLV_IPv4_Internal_type *eigrp_IPv4_InternalTLV_new()
+{
+ struct TLV_IPv4_Internal_type *new;
+
+ new = XCALLOC(MTYPE_EIGRP_IPV4_INT_TLV,
+ sizeof(struct TLV_IPv4_Internal_type));
+
+ return new;
+}
+
struct TLV_IPv4_Internal_type *eigrp_read_ipv4_tlv(struct stream *s)
{
struct TLV_IPv4_Internal_type *tlv;
@@ -1332,16 +1342,6 @@ void eigrp_authTLV_SHA256_free(struct TLV_SHA256_Authentication_Type *authTLV)
XFREE(MTYPE_EIGRP_AUTH_SHA256_TLV, authTLV);
}
-struct TLV_IPv4_Internal_type *eigrp_IPv4_InternalTLV_new()
-{
- struct TLV_IPv4_Internal_type *new;
-
- new = XCALLOC(MTYPE_EIGRP_IPV4_INT_TLV,
- sizeof(struct TLV_IPv4_Internal_type));
-
- return new;
-}
-
void eigrp_IPv4_InternalTLV_free(
struct TLV_IPv4_Internal_type *IPv4_InternalTLV)
{
diff --git a/eigrpd/eigrp_packet.h b/eigrpd/eigrp_packet.h
index e72048ecc..e52fd268f 100644
--- a/eigrpd/eigrp_packet.h
+++ b/eigrpd/eigrp_packet.h
@@ -152,7 +152,6 @@ extern int eigrp_check_sha256_digest(struct stream *,
struct eigrp_neighbor *, u_char);
-extern struct TLV_IPv4_Internal_type *eigrp_IPv4_InternalTLV_new(void);
extern void eigrp_IPv4_InternalTLV_free(struct TLV_IPv4_Internal_type *);
extern struct TLV_Sequence_Type *eigrp_SequenceTLV_new(void);
diff --git a/eigrpd/eigrp_topology.c b/eigrpd/eigrp_topology.c
index 4555ced47..3ba8c5b5f 100644
--- a/eigrpd/eigrp_topology.c
+++ b/eigrpd/eigrp_topology.c
@@ -497,20 +497,19 @@ void eigrp_topology_neighbor_down(struct eigrp *eigrp,
for (ALL_LIST_ELEMENTS(eigrp->topology_table, node1, node11, prefix)) {
for (ALL_LIST_ELEMENTS(prefix->entries, node2, node22, entry)) {
- if (entry->adv_router == nbr) {
- struct eigrp_fsm_action_message msg;
- struct TLV_IPv4_Internal_type *tlv =
- eigrp_IPv4_InternalTLV_new();
- tlv->metric.delay = EIGRP_MAX_METRIC;
- msg.packet_type = EIGRP_OPC_UPDATE;
- msg.eigrp = eigrp;
- msg.data_type = EIGRP_INT;
- msg.adv_router = nbr;
- msg.metrics = tlv->metric;
- msg.entry = entry;
- msg.prefix = prefix;
- eigrp_fsm_event(&msg);
- }
+ struct eigrp_fsm_action_message msg;
+
+ if (entry->adv_router != nbr)
+ continue;
+
+ msg.metrics.delay = EIGRP_MAX_METRIC;
+ msg.packet_type = EIGRP_OPC_UPDATE;
+ msg.eigrp = eigrp;
+ msg.data_type = EIGRP_INT;
+ msg.adv_router = nbr;
+ msg.entry = entry;
+ msg.prefix = prefix;
+ eigrp_fsm_event(&msg);
}
}
diff --git a/eigrpd/eigrp_update.c b/eigrpd/eigrp_update.c
index 98bfc95e4..e4b788374 100644
--- a/eigrpd/eigrp_update.c
+++ b/eigrpd/eigrp_update.c
@@ -112,7 +112,7 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp,
{
struct listnode *node1;
struct eigrp_prefix_entry *prefix;
- struct TLV_IPv4_Internal_type *tlv_max;
+ struct eigrp_fsm_action_message fsm_msg;
/* iterate over all prefixes which weren't advertised by neighbor */
for (ALL_LIST_ELEMENTS_RO(nbr_prefixes, node1, prefix)) {
@@ -120,19 +120,9 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp,
inet_ntoa(prefix->destination_ipv4->prefix),
prefix->destination_ipv4->prefixlen);
- /* create internal IPv4 TLV with infinite delay */
- tlv_max = eigrp_IPv4_InternalTLV_new();
- tlv_max->type = EIGRP_TLV_IPv4_INT;
- tlv_max->length = 28U;
- tlv_max->metric = prefix->reported_metric;
+ fsm_msg.metrics = prefix->reported_metric;
/* set delay to MAX */
- tlv_max->metric.delay = EIGRP_MAX_METRIC;
- tlv_max->destination = prefix->destination_ipv4->prefix;
- tlv_max->prefix_length = prefix->destination_ipv4->prefixlen;
-
-
- /* prepare message for FSM */
- struct eigrp_fsm_action_message fsm_msg;
+ fsm_msg.metrics.delay = EIGRP_MAX_METRIC;
struct eigrp_neighbor_entry *entry =
eigrp_prefix_entry_lookup(prefix->entries, nbr);
@@ -141,15 +131,11 @@ static void eigrp_update_receive_GR_ask(struct eigrp *eigrp,
fsm_msg.eigrp = eigrp;
fsm_msg.data_type = EIGRP_INT;
fsm_msg.adv_router = nbr;
- fsm_msg.metrics = tlv_max->metric;
fsm_msg.entry = entry;
fsm_msg.prefix = prefix;
/* send message to FSM */
eigrp_fsm_event(&fsm_msg);
-
- /* free memory used by TLV */
- eigrp_IPv4_InternalTLV_free(tlv_max);
}
}
@@ -845,7 +831,6 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
struct list *prefixes;
u_int32_t flags;
unsigned int send_prefixes;
- struct TLV_IPv4_Internal_type *tlv_max;
/* get prefixes to send to neighbor */
prefixes = nbr->nbr_gr_prefixes_send;
@@ -960,16 +945,6 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
zlog_info("Filtered prefix %s will be removed.",
inet_ntoa(dest_addr->prefix));
- tlv_max = eigrp_IPv4_InternalTLV_new();
- tlv_max->type = EIGRP_TLV_IPv4_INT;
- tlv_max->length = 28U;
- tlv_max->metric = pe->reported_metric;
- /* set delay to MAX */
- tlv_max->metric.delay = EIGRP_MAX_METRIC;
- tlv_max->destination = pe->destination_ipv4->prefix;
- tlv_max->prefix_length =
- pe->destination_ipv4->prefixlen;
-
/* prepare message for FSM */
struct eigrp_fsm_action_message fsm_msg;
@@ -980,15 +955,14 @@ static void eigrp_update_send_GR_part(struct eigrp_neighbor *nbr)
fsm_msg.eigrp = e;
fsm_msg.data_type = EIGRP_INT;
fsm_msg.adv_router = nbr;
- fsm_msg.metrics = tlv_max->metric;
+ fsm_msg.metrics = pe->reported_metric;
+ /* Set delay to MAX */
+ fsm_msg.metrics.delay = EIGRP_MAX_METRIC;
fsm_msg.entry = entry;
fsm_msg.prefix = pe;
/* send message to FSM */
eigrp_fsm_event(&fsm_msg);
-
- /* free memory used by TLV */
- eigrp_IPv4_InternalTLV_free(tlv_max);
}
/*
* End of filtering