diff --git a/openair3/TEST/EPC_TEST/play_scenario.c b/openair3/TEST/EPC_TEST/play_scenario.c index e7cb8ef84801e711906587e2c402af9530f94dd4..c633cedfa772101144c1a9be47c4f320c8ebe6c5 100644 --- a/openair3/TEST/EPC_TEST/play_scenario.c +++ b/openair3/TEST/EPC_TEST/play_scenario.c @@ -921,58 +921,56 @@ int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s shift = shift->next; } // now recompute time_relative_to_last_received_packet, time_relative_to_last_sent_packet - if (shifts) { - packet = scenario->list_packet; - while (packet) { - if (first_packet > 0) { - initial_time = packet->time_relative_to_first_packet; - packet->time_relative_to_first_packet.tv_sec = 0; - packet->time_relative_to_first_packet.tv_usec = 0; - first_packet = 0; + packet = scenario->list_packet; + while (packet) { + if (first_packet > 0) { + initial_time = packet->time_relative_to_first_packet; + packet->time_relative_to_first_packet.tv_sec = 0; + packet->time_relative_to_first_packet.tv_usec = 0; + first_packet = 0; + } else { + timersub(&packet->time_relative_to_first_packet, &initial_time, + &packet->time_relative_to_first_packet); + } + if (packet->action == ET_PACKET_ACTION_S1C_SEND) { + if (first_sent_packet > 0) { + relative_last_sent_packet = packet->time_relative_to_first_packet; + packet->time_relative_to_last_sent_packet.tv_sec = 0; + packet->time_relative_to_last_sent_packet.tv_usec = 0; + first_sent_packet = 0; } else { - timersub(&packet->time_relative_to_first_packet, &initial_time, - &packet->time_relative_to_first_packet); + timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, + &packet->time_relative_to_last_sent_packet); + relative_last_sent_packet = packet->time_relative_to_first_packet; } - if (packet->action == ET_PACKET_ACTION_S1C_SEND) { - if (first_sent_packet > 0) { - relative_last_sent_packet = packet->time_relative_to_first_packet; - packet->time_relative_to_last_sent_packet.tv_sec = 0; - packet->time_relative_to_last_sent_packet.tv_usec = 0; - first_sent_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, - &packet->time_relative_to_last_sent_packet); - relative_last_sent_packet = packet->time_relative_to_first_packet; - } - if (first_received_packet > 0) { - packet->time_relative_to_last_received_packet.tv_sec = 0; - packet->time_relative_to_last_received_packet.tv_usec = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, - &packet->time_relative_to_last_received_packet); - } - } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { - if (first_received_packet > 0) { - relative_last_received_packet.tv_sec = packet->time_relative_to_first_packet.tv_sec; - relative_last_received_packet.tv_usec = packet->time_relative_to_first_packet.tv_usec; - packet->time_relative_to_last_received_packet.tv_sec = 0; - packet->time_relative_to_last_received_packet.tv_usec = 0; - first_received_packet = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, - &packet->time_relative_to_last_received_packet); - relative_last_received_packet = packet->time_relative_to_first_packet; - } - if (first_sent_packet > 0) { - packet->time_relative_to_last_sent_packet.tv_sec = 0; - packet->time_relative_to_last_sent_packet.tv_usec = 0; - } else { - timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, - &packet->time_relative_to_last_sent_packet); - } + if (first_received_packet > 0) { + packet->time_relative_to_last_received_packet.tv_sec = 0; + packet->time_relative_to_last_received_packet.tv_usec = 0; + } else { + timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, + &packet->time_relative_to_last_received_packet); + } + } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { + if (first_received_packet > 0) { + relative_last_received_packet.tv_sec = packet->time_relative_to_first_packet.tv_sec; + relative_last_received_packet.tv_usec = packet->time_relative_to_first_packet.tv_usec; + packet->time_relative_to_last_received_packet.tv_sec = 0; + packet->time_relative_to_last_received_packet.tv_usec = 0; + first_received_packet = 0; + } else { + timersub(&packet->time_relative_to_first_packet, &relative_last_received_packet, + &packet->time_relative_to_last_received_packet); + relative_last_received_packet = packet->time_relative_to_first_packet; + } + if (first_sent_packet > 0) { + packet->time_relative_to_last_sent_packet.tv_sec = 0; + packet->time_relative_to_last_sent_packet.tv_usec = 0; + } else { + timersub(&packet->time_relative_to_first_packet, &relative_last_sent_packet, + &packet->time_relative_to_last_sent_packet); } - packet = packet->next; } + packet = packet->next; } et_display_scenario(scenario); diff --git a/openair3/TEST/EPC_TEST/play_scenario_fsm.c b/openair3/TEST/EPC_TEST/play_scenario_fsm.c index 5dee83afc9339e4d43cdbc44788e8bff7677cd86..d253e5cd5fe2c066356a3ea21f8214d7d285b254 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_fsm.c +++ b/openair3/TEST/EPC_TEST/play_scenario_fsm.c @@ -135,7 +135,7 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) } else { LOG_D(ENB_APP, "last_packet_was_tx\n"); we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet); - LOG_D(ENB_APP, "we_are_too_early=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec); + LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec); } if ((0 == we_are_too_late) && (0 == g_max_speed)){ // set timer diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c index ad720ab7dc2e6272da79067f6fa92c30c4fdbcdd..2242a63bd6c3316ae7f8f791368c470e0105e1ea 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c @@ -494,10 +494,11 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con const xmlChar value_d[32]; const xmlChar value_h[20]; const xmlChar showname[64]; - int ret = 0; - int pos2 = 0; - char val = NULL; - char hex[3] = {0,0,0};; + int ret = 0; + int pos2 = 0; + unsigned long int uli = 0; + char hex[3] = {0,0,0}; + char *end_ptr = NULL; size = strtoul((const char *)xml_char, NULL, 0); xmlFree(xml_char); @@ -518,10 +519,11 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con do { hex[0] = value_h[pos2++]; hex[1] = value_h[pos2++]; - hex[2] = 0; - val = (unsigned char)strtoul(hex, NULL, 16); - AssertFatal(errno != 0, "Conversion of hexstring %s failed", hex); - s1ap->binary_stream[pos++] = val; + hex[2] = '\0'; + end_ptr = hex; + uli = strtoul(hex, &end_ptr, 16); + AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno); + s1ap->binary_stream[pos++] = (unsigned char)uli; } while (pos2 < (2*5)); // update ASN1 et_decode_s1ap(s1ap);