Function le_mdc_GetDataBearerTechnology seems to be unsafe (Legato version 18.6.4)

If I call le_mdc_GetDataBearerTechnology() function and the data session state is Disconnected, the function does not return LE_FAULT. The program crashes instead.

Can we know how did you the test + logs please?

When I had the results, I Will post them. I can not do it this week, sorry.

HI @Luis,
do you have new information to share with us?
BR

Sorry, but I hadn´t have time to dive into this topic.

I commented the piece of code that was problematic, becasuse I had to focus on other things.

The thing was that I had a Timer that is fired every minute and checks the Data Session State, if is connected, Checks the bearer technology.

The problem, I THINK, it happened whe I have called this function: le_mdc_StopSessionAsync(perfilgprs, EventosDesconexionBearer, NULL); and then the CicloWatchdogHandler was fired, the function le_mdc_GetSessionState returned a LE_MDC_CONNECTED value althoug session was closing. Then when le_mdc_GetDataBearerTechnology was called, the program crashed.

Here is the Timer Callback:

//-----------------------------------------------------------------------------------------
/**

  • Callback del Timer que controla el Watchdog para el GPRS
  • @params
  •  -tr[IN]		:referencia al timer que lanza el Callback
    

*/
//------------------------------------------------------------------------------------------
static void CicloWatchdogHandler(le_timer_Ref_t tr)
{
le_mdc_ConState_t constate;
le_mdc_DataBearerTechnology_t dbt_dwn, dbt_up;

LE_INFO("Estado de los HOSTs: h1=%d; h2=%d; htec=%d", h1_estado, h2_estado, htec_estado);

LE_INFO("GPRS CICLOWATCHDOGHANDLER");

if(gprs)
{
	if(le_mdc_GetSessionState(perfilgprs,&constate)==LE_OK)
	{
		if(constate==LE_MDC_DISCONNECTED)
		{
			estado_conexiongprs=0;

			LE_INFO("GPRS DESCONECTADO");
			//Recojer la razón de desconexión

			TratarRazonDesconexion(le_mdc_GetDisconnectionReason(perfilgprs));

			conectaBearer();
		}
		else if(constate==LE_MDC_CONNECTED)
		{

			LE_INFO("SE VA A RECOGER LA TECNOLOGIA");
			if(le_mdc_GetDataBearerTechnology(perfilgprs, &dbt_dwn, &dbt_up)==LE_OK)
			{
				if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_UNKNOWN)
				{
					LE_INFO("TECNOLOGIA DESCONOCIDA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_GSM)
				{
					LE_INFO("TECNOLOGIA GSM");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_GPRS)
				{
					LE_INFO("TECNOLOGIA GPRS");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_EGPRS)
				{
					LE_INFO("TECNOLOGIA EGPRS");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_WCDMA) //UMTS
				{
					LE_INFO("TECNOLOGIA 3G/WCDMA/UMTS");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HSPA)
				{
					LE_INFO("TECNOLOGIA HSPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HSPA_PLUS) //HSPA+
				{
					LE_INFO("TECNOLOGIA HSPA+");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_DC_HSPA_PLUS) // Dual Cell HSPA+
				{
					LE_INFO("TECNOLOGIA DUAL CELL HSPA+");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HSDPA) //HSDPA
				{
					LE_INFO("TECNOLOGIA 3.5G/HSDPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HSUPA) //HSUPA
				{
					LE_INFO("TECNOLOGIA 3.5G+/HSUPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_DC_HSUPA) //Dual Cell HSUPA
				{
					LE_INFO("TECNOLOGIA DUAL CELL 3.5G+/HSUPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_DC_HSPA) //Dual Cell HSPA
				{
					LE_INFO("TECNOLOGIA DUAL CELL HSPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_LTE) //LTE
				{
					LE_INFO("TECNOLOGIA LTE");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_LTE_FDD) //LTE FDD
				{
					LE_INFO("TECNOLOGIA LTE FDD");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_LTE_TDD) //LTE TDD
				{
					LE_INFO("TECNOLOGIA LTE TDD");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_LTE_CA_DL) //LTE CA DL
				{
					LE_INFO("TECNOLOGIA LTE CA DL");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_LTE_CA_UL) //LTE CA UL
				{
					LE_INFO("TECNOLOGIA LTE CA UL");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_TD_SCDMA) //TD-SCDMA
				{
					LE_INFO("TECNOLOGIA TD-SCDMA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_CDMA2000_1X) //CDMA200 1X
				{
					LE_INFO("TECNOLOGIA CDMA2000 1X");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_CDMA2000_EVDO) //CDMA200 HRPD (1xEV-DO)
				{
					LE_INFO("TECNOLOGIA CDMA200 HRPD (1xEV-DO)");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_CDMA2000_EVDO_REVA) //CDMA2000 HRPD (1xEV-DO RevA)
				{
					LE_INFO("TECNOLOGIA CDMA2000 HRPD (1xEV-DO RevA)");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_CDMA2000_EHRPD) //CDMA200 EHRPD
				{
					LE_INFO("TECNOLOGIA CDMA200 EHRPD");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_IS95_1X)
				{
					LE_INFO("TECNOLOGIA IS95 1X");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REV0_DPA)
				{
					LE_INFO("TECNOLOGIA HDR REV0 DPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVA_DPA)
				{
					LE_INFO("TECNOLOGIA HDR REVA DPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVB_DPA)
				{
					LE_INFO("TECNOLOGIA HDR REVB DPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVA_MPA)
				{
					LE_INFO("TECNOLOGIA HDR REVA MPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVB_MPA)
				{
					LE_INFO("TECNOLOGIA HDR REVB MPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVA_EMPA)
				{
					LE_INFO("TECNOLOGIA HDR REVA EMPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVB_EMPA)
				{
					LE_INFO("TECNOLOGIA HDR REVB EMPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_REVB_MMPA)
				{
					LE_INFO("TECNOLOGIA HDR REVB MMPA");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_HDR_EVDO_FMC)
				{
					LE_INFO("TECNOLOGIA HDR EVDO FMC");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_64_QAM)
				{
					LE_INFO("TECNOLOGIA 64 QAM");
				}
				else if(dbt_dwn==LE_MDC_DATA_BEARER_TECHNOLOGY_S2B)
				{
					LE_INFO("TECNOLOGIA S2B");
				}
			}
		}
	}
}

Testle_mrc_GetStateAndQual();
Testle_mrc_GetSignalMetrics();
Testle_mrc_GetCurrentNetworkName();

}

Thank you

@Luis, you have tried to exécute your app without the le_mdc_StopSessionAsync function? to see if the issue persists or not?
We need also the logs, to know what was happened before the crash.

Regards