Remove unused MAC.eth_params_s

This field is used as an intermediate "storage facility", but is never
really used. Besides, in the MAC, we store IP information, not Ethernet
information, so it's wrong anyway.

Also remove memory leaks through strdup(), the pointer lifetime is
smaller than that of MacRLC_ParamList.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
This commit is contained in:
Robert Schmidt
2026-06-29 11:40:10 +02:00
parent c4125d1c74
commit 6d437cffcf
3 changed files with 15 additions and 22 deletions

View File

@@ -457,12 +457,12 @@ int e1apCUCP_handle_BEARER_CONTEXT_RELEASE_COMPLETE(sctp_assoc_t assoc_id, e1ap_
return 0;
}
static instance_t cuup_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs)
static instance_t cuup_task_create_gtpu_instance_to_du(const e1ap_net_config_t *c)
{
openAddr_t tmp = {0};
strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost) - 1);
sprintf(tmp.originService, "%d", IPaddrs->my_portd);
sprintf(tmp.destinationService, "%d", IPaddrs->remote_portd);
strncpy(tmp.originHost, c->localAddressF1U, sizeof(tmp.originHost) - 1);
sprintf(tmp.originService, "%d", c->localPortF1U);
sprintf(tmp.destinationService, "%d", c->remotePortF1U);
return gtpv1Init(tmp);
}
@@ -531,13 +531,8 @@ static void e1_task_handle_sctp_association_resp(E1_t type,
e1ap_upcp_inst_t *inst = getCxtE1(instance);
inst->cuup.assoc_id = sctp_new_association_resp->assoc_id;
e1ap_net_config_t *nc = &inst->net_config;
eth_params_t IPaddr = {0};
IPaddr.my_addr = nc->localAddressF1U;
IPaddr.my_portd = nc->localPortF1U;
IPaddr.remote_portd = nc->remotePortF1U;
if (getCxtE1(instance)->gtpInstF1U < 0)
getCxtE1(instance)->gtpInstF1U = cuup_task_create_gtpu_instance_to_du(&IPaddr);
getCxtE1(instance)->gtpInstF1U = cuup_task_create_gtpu_instance_to_du(&inst->net_config);
if (getCxtE1(instance)->gtpInstF1U < 0)
LOG_E(E1AP, "Failed to create CUUP F1-U UDP listener\n");
cuup_init_n3(instance);

View File

@@ -175,16 +175,16 @@ void RCconfig_macrlc(void)
if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_L1") == 0) {
} else if (strcmp(*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr), "nfapi") == 0) {
RC.mac[j]->eth_params_s.my_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr));
RC.mac[j]->eth_params_s.remote_addr = strdup(*(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr));
RC.mac[j]->eth_params_s.my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
RC.mac[j]->eth_params_s.remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
RC.mac[j]->eth_params_s.my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
RC.mac[j]->eth_params_s.remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
RC.mac[j]->eth_params_s.transp_preference = ETH_UDP_MODE;
LOG_I(ENB_APP,"**************** vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
configure_nfapi_vnf(RC.mac[j]->eth_params_s.my_addr, RC.mac[j]->eth_params_s.my_portc,RC.mac[j]->eth_params_s.remote_addr,RC.mac[j]->eth_params_s.remote_portd,RC.mac[j]->eth_params_s.my_portd);
LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", RC.mac[j]->eth_params_s.my_portc);
char *my_addr = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_ADDRESS_IDX].strptr);
char *remote_addr = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_ADDRESS_IDX].strptr);
int my_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTC_IDX].iptr);
// remote_portc not used
//int remote_portc = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTC_IDX].iptr);
int my_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_LOCAL_S_PORTD_IDX].iptr);
int remote_portd = *(MacRLC_ParamList.paramarray[j][MACRLC_REMOTE_S_PORTD_IDX].iptr);
LOG_I(ENB_APP,"**************** vnf_port:%d\n", my_portc);
configure_nfapi_vnf(my_addr, my_portc, remote_addr, remote_portd, my_portd);
LOG_I(ENB_APP,"**************** RETURNED FROM configure_nfapi_vnf() vnf_port:%d\n", my_portc);
} else { // other midhaul
AssertFatal(1==0,"MACRLC %d: %s unknown southbound midhaul\n",j,*(MacRLC_ParamList.paramarray[j][MACRLC_TRANSPORT_S_PREFERENCE_IDX].strptr));
}

View File

@@ -1269,8 +1269,6 @@ typedef struct {
/*! \brief top level eNB MAC structure */
typedef struct eNB_MAC_INST_s {
/// Ethernet parameters for fronthaul interface
eth_params_t eth_params_s;
///
module_id_t Mod_id;
/// frame counter