mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
Use char * for DU/CU IP address
The previously used net_ip_address_t type is limited to some bytes, but the CU name might be longer. Use char * to allow longer DNS names. Also, this type separates IPv4/v6, which is not necessary, as it is now handled by the same C API (getaddrinfo()), since !2635. Co-authored-by: Guido Casati <hello@guidocasati.com>
This commit is contained in:
committed by
Guido Casati
parent
deb63888d9
commit
bacf713299
@@ -83,11 +83,9 @@
|
||||
|
||||
#define F1AP_MAX_NO_OF_INDIVIDUAL_CONNECTIONS_TO_RESET 65536
|
||||
|
||||
typedef net_ip_address_t f1ap_net_ip_address_t;
|
||||
|
||||
typedef struct f1ap_net_config_t {
|
||||
f1ap_net_ip_address_t CU_f1_ip_address;
|
||||
f1ap_net_ip_address_t DU_f1c_ip_address;
|
||||
char *CU_f1_ip_address;
|
||||
char *DU_f1c_ip_address;
|
||||
char *DU_f1u_ip_address;
|
||||
uint16_t CUport;
|
||||
uint16_t DUport;
|
||||
|
||||
@@ -44,7 +44,7 @@ static instance_t du_create_gtpu_instance_to_cu(const f1ap_net_config_t *nc)
|
||||
{
|
||||
openAddr_t tmp = {0};
|
||||
strncpy(tmp.originHost, nc->DU_f1u_ip_address, sizeof(tmp.originHost) - 1);
|
||||
strncpy(tmp.destinationHost, nc->CU_f1_ip_address.ipv4_address, sizeof(tmp.destinationHost) - 1);
|
||||
strncpy(tmp.destinationHost, nc->CU_f1_ip_address, sizeof(tmp.destinationHost) - 1);
|
||||
sprintf(tmp.originService, "%d", nc->DUport);
|
||||
sprintf(tmp.destinationService, "%d", nc->CUport);
|
||||
return gtpv1Init(tmp);
|
||||
@@ -63,9 +63,20 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *n
|
||||
sctp_new_association_req_p->in_streams = 2; //du_inst->sctp_in_streams;
|
||||
sctp_new_association_req_p->out_streams = 2; //du_inst->sctp_out_streams;
|
||||
// remote
|
||||
memcpy(&sctp_new_association_req_p->remote_address, &nc->CU_f1_ip_address, sizeof(nc->CU_f1_ip_address));
|
||||
sctp_new_association_req_p->remote_address.ipv4 = 1;
|
||||
strncpy(sctp_new_association_req_p->remote_address.ipv4_address,
|
||||
nc->CU_f1_ip_address,
|
||||
sizeof(sctp_new_association_req_p->remote_address.ipv4_address) - 1);
|
||||
// local
|
||||
memcpy(&sctp_new_association_req_p->local_address, &nc->DU_f1c_ip_address, sizeof(nc->DU_f1c_ip_address));
|
||||
sctp_new_association_req_p->local_address.ipv4 = 1;
|
||||
strncpy(sctp_new_association_req_p->local_address.ipv4_address,
|
||||
nc->DU_f1c_ip_address,
|
||||
sizeof(sctp_new_association_req_p->local_address.ipv4_address) - 1);
|
||||
LOG_D(F1AP,
|
||||
"Local IPv4 Address: %s, Remote IPv4 Address: %s\n",
|
||||
sctp_new_association_req_p->local_address.ipv4_address,
|
||||
sctp_new_association_req_p->remote_address.ipv4_address);
|
||||
|
||||
// du_f1ap_register_to_sctp
|
||||
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
|
||||
}
|
||||
|
||||
@@ -33,20 +33,16 @@ static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params, const
|
||||
{
|
||||
f1ap_net_config_t nc = {0};
|
||||
|
||||
nc.CU_f1_ip_address.ipv6 = 0;
|
||||
nc.CU_f1_ip_address.ipv4 = 1;
|
||||
strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr);
|
||||
nc.CU_f1_ip_address= strdup(f1_params->remote_addr);
|
||||
nc.CUport = f1_params->remote_portd;
|
||||
|
||||
nc.DU_f1c_ip_address.ipv6 = 0;
|
||||
nc.DU_f1c_ip_address.ipv4 = 1;
|
||||
strcpy(nc.DU_f1c_ip_address.ipv4_address, f1_params->my_addr);
|
||||
nc.DU_f1c_ip_address = strdup(f1_params->my_addr);
|
||||
nc.DU_f1u_ip_address = strdup(f1u_ip_addr);
|
||||
nc.DUport = f1_params->my_portd;
|
||||
LOG_I(F1AP,
|
||||
"F1-C DU IPaddr %s, connect to F1-C CU %s, binding GTP to %s\n",
|
||||
nc.DU_f1c_ip_address.ipv4_address,
|
||||
nc.CU_f1_ip_address.ipv4_address,
|
||||
nc.DU_f1c_ip_address,
|
||||
nc.CU_f1_ip_address,
|
||||
nc.DU_f1u_ip_address);
|
||||
|
||||
// sctp_in_streams/sctp_out_streams are given by SCTP layer
|
||||
|
||||
@@ -394,7 +394,7 @@ static void sctp_handle_new_association_req(const instance_t instance,
|
||||
struct addrinfo *serv;
|
||||
|
||||
int status = getaddrinfo(local, NULL, &hints, &serv);
|
||||
AssertFatal(status == 0, "getaddrinfo() failed: %s\n", gai_strerror(status));
|
||||
AssertFatal(status == 0, "getaddrinfo(%s) failed: %s\n", local, gai_strerror(status));
|
||||
|
||||
int sd;
|
||||
struct addrinfo *p = NULL;
|
||||
|
||||
Reference in New Issue
Block a user