]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd: Remove union from FSM msg
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 22 Aug 2017 23:19:10 +0000 (19:19 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 24 Aug 2017 12:04:20 +0000 (08:04 -0400)
Remove the union of passing the TLV and just pass the metric in.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_query.c
eigrpd/eigrp_reply.c
eigrpd/eigrp_siaquery.c
eigrpd/eigrp_siareply.c
eigrpd/eigrp_structs.h
eigrpd/eigrp_topology.c
eigrpd/eigrp_update.c

index 92aa7f985565fca187c9658fc9e6179409e684ed..4757097315961b93db158be327e66e4e128c4ef5 100644 (file)
@@ -133,7 +133,7 @@ void eigrp_query_receive(struct eigrp *eigrp, struct ip *iph,
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
                                msg.adv_router = nbr;
-                               msg.data.ipv4_int_type = tlv;
+                               msg.metrics = tlv->metric;
                                msg.entry = entry;
                                msg.prefix = dest;
                                eigrp_fsm_event(&msg);
index 92cea77305a8962e7ef69466fad51745aa46a175..304a1a52423e122759a98e86687870dbc57efc02 100644 (file)
@@ -239,7 +239,7 @@ void eigrp_reply_receive(struct eigrp *eigrp, struct ip *iph,
                        msg.eigrp = eigrp;
                        msg.data_type = EIGRP_INT;
                        msg.adv_router = nbr;
-                       msg.data.ipv4_int_type = tlv;
+                       msg.metrics = tlv->metric;
                        msg.entry = entry;
                        msg.prefix = dest;
                        eigrp_fsm_event(&msg);
index 60decc5bef2d327dafab5edd8a18f122e0608fe2..cd04f8859508ce2340b8edcb42b9d93262aff433 100644 (file)
@@ -102,7 +102,7 @@ void eigrp_siaquery_receive(struct eigrp *eigrp, struct ip *iph,
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
                                msg.adv_router = nbr;
-                               msg.data.ipv4_int_type = tlv;
+                               msg.metrics = tlv->metric;
                                msg.entry = entry;
                                msg.prefix = dest;
                                eigrp_fsm_event(&msg);
index e9609402002b3ce18984e1e43877af38cbc98ac0..5e835494885a92e905eed0f118230ae038a0529f 100644 (file)
@@ -101,7 +101,7 @@ void eigrp_siareply_receive(struct eigrp *eigrp, struct ip *iph,
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
                                msg.adv_router = nbr;
-                               msg.data.ipv4_int_type = tlv;
+                               msg.metrics = tlv->metric;
                                msg.entry = entry;
                                msg.prefix = dest;
                                eigrp_fsm_event(&msg);
index c81dfebb468c6a4ae0a1fd9198cb3e2b84eedea4..6bb0c5cc2b07df1256f5fc07246e0cf83647b1c0 100644 (file)
@@ -514,10 +514,7 @@ struct eigrp_fsm_action_message {
        struct eigrp_neighbor_entry *entry;
        struct eigrp_prefix_entry *prefix;
        msg_data_t data_type; // internal or external tlv type
-       union {
-               struct TLV_IPv4_External_type *ipv4_ext_data;
-               struct TLV_IPv4_Internal_type *ipv4_int_type;
-       } data;
+       struct eigrp_metrics metrics;
 };
 
 #endif /* _ZEBRA_EIGRP_STRUCTURES_H_ */
index 9f62e5e899ae8ad25669ebe5aba0cf499ddecca9..4555ced477d0300df33fdb804b14dc6cfe71dbae 100644 (file)
@@ -380,50 +380,45 @@ enum metric_change eigrp_topology_update_distance(struct eigrp_fsm_action_messag
        struct eigrp_prefix_entry *prefix = msg->prefix;
        struct eigrp_neighbor_entry *entry = msg->entry;
        enum metric_change change = METRIC_SAME;
+       u_int32_t new_reported_distance;
+
        assert(entry);
 
-       struct TLV_IPv4_External_type *ext_data = NULL;
-       struct TLV_IPv4_Internal_type *int_data = NULL;
        switch(msg->data_type) {
        case EIGRP_CONNECTED:
+               if (prefix->nt == EIGRP_TOPOLOGY_TYPE_CONNECTED)
+                       return change;
+
+               change = METRIC_DECREASE;
                break;
        case EIGRP_INT:
-               {
-                       u_int32_t new_reported_distance;
-
-                       int_data = msg->data.ipv4_int_type;
-                       if (eigrp_metrics_is_same(int_data->metric,
-                                                 entry->reported_metric)) {
-                               return change; // No change
-                       }
+               if (eigrp_metrics_is_same(msg->metrics,
+                                         entry->reported_metric)) {
+                       return change; // No change
+               }
 
-                       new_reported_distance = eigrp_calculate_metrics(eigrp,
-                                                                       int_data->metric);
+               new_reported_distance = eigrp_calculate_metrics(eigrp,
+                                                               msg->metrics);
 
-                       if (entry->reported_distance  < new_reported_distance)
-                               change = METRIC_INCREASE;
-                       else
-                               change = METRIC_DECREASE;
+               if (entry->reported_distance  < new_reported_distance)
+                       change = METRIC_INCREASE;
+               else
+                       change = METRIC_DECREASE;
 
-                       entry->reported_metric = int_data->metric;
-                       entry->reported_distance = new_reported_distance;
-                       eigrp_calculate_metrics(eigrp, int_data->metric);
-                       entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
-                       break;
-               }
+               entry->reported_metric = msg->metrics;
+               entry->reported_distance = new_reported_distance;
+               eigrp_calculate_metrics(eigrp, msg->metrics);
+               entry->distance = eigrp_calculate_total_metrics(eigrp, entry);
+               break;
        case EIGRP_EXT:
-               {
-                       ext_data = msg->data.ipv4_ext_data;
-
-                       if (prefix->nt == EIGRP_TOPOLOGY_TYPE_REMOTE_EXTERNAL) {
-                               if (eigrp_metrics_is_same(ext_data->metric,
-                                                         entry->reported_metric))
-                                       return change;
-                       } else
-                               change = METRIC_INCREASE;
+               if (prefix->nt == EIGRP_TOPOLOGY_TYPE_REMOTE_EXTERNAL) {
+                       if (eigrp_metrics_is_same(msg->metrics,
+                                                 entry->reported_metric))
+                               return change;
+               } else
+                       change = METRIC_INCREASE;
 
                        break;
-               }
        default:
                zlog_err("%s: Please implement handler", __PRETTY_FUNCTION__);
                break;
@@ -511,7 +506,7 @@ void eigrp_topology_neighbor_down(struct eigrp *eigrp,
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
                                msg.adv_router = nbr;
-                               msg.data.ipv4_int_type = tlv;
+                               msg.metrics = tlv->metric;
                                msg.entry = entry;
                                msg.prefix = prefix;
                                eigrp_fsm_event(&msg);
index ba54fa5727cc10c6540c49ca29874009e62d5332..98bfc95e4d63ba832221d4c94065524931b1c697 100644 (file)
@@ -141,7 +141,7 @@ 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.data.ipv4_int_type = tlv_max;
+               fsm_msg.metrics = tlv_max->metric;
                fsm_msg.entry = entry;
                fsm_msg.prefix = prefix;
 
@@ -317,7 +317,7 @@ void eigrp_update_receive(struct eigrp *eigrp, struct ip *iph,
                                msg.eigrp = eigrp;
                                msg.data_type = EIGRP_INT;
                                msg.adv_router = nbr;
-                               msg.data.ipv4_int_type = tlv;
+                               msg.metrics = tlv->metric;
                                msg.entry = entry;
                                msg.prefix = dest;
                                eigrp_fsm_event(&msg);
@@ -980,7 +980,7 @@ 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.data.ipv4_int_type = tlv_max;
+                       fsm_msg.metrics = tlv_max->metric;
                        fsm_msg.entry = entry;
                        fsm_msg.prefix = pe;