It works
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5946 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -151,9 +151,9 @@ NwGtpv1uRcT gtpv1u_process_stack_req(
|
||||
*/
|
||||
if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg,
|
||||
buffer, (NwU32T *)&buffer_len)) {
|
||||
GTPU_ERROR("Error while retrieving T-PDU");
|
||||
GTPU_ERROR("Error while retrieving T-PDU\n");
|
||||
}
|
||||
GTPU_DEBUG("Received TPDU from gtpv1u stack %u with size %d", pUlpApi->apiInfo.recvMsgInfo.teid, buffer_len);
|
||||
GTPU_DEBUG("Received TPDU from gtpv1u stack %u with size %d\n", pUlpApi->apiInfo.recvMsgInfo.teid, buffer_len);
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_IND);
|
||||
if (message_p == NULL) {
|
||||
@@ -419,7 +419,8 @@ static void *gtpv1u_thread(void *args)
|
||||
GTPU_ERROR("nwGtpv1uProcessUlpReq failed: while getting teid %u in hashtable S1U_mapping\n", data_req_p->local_S1u_teid);
|
||||
} else {
|
||||
stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU;
|
||||
stack_req.apiInfo.sendtoInfo.teid = data_req_p->local_S1u_teid;
|
||||
//stack_req.apiInfo.sendtoInfo.teid = data_req_p->local_S1u_teid;
|
||||
stack_req.apiInfo.sendtoInfo.teid = gtpv1u_teid2enb_info->teid_enb;
|
||||
BUFFER_TO_NwU32T(gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address, stack_req.apiInfo.sendtoInfo.ipAddr);
|
||||
|
||||
/*nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
|
||||
|
||||
@@ -506,12 +506,12 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz,
|
||||
|
||||
if(NW_GTPV1U_OK == rc) {
|
||||
NwGtpv1uMsgT *pMsg = (NwGtpv1uMsgT *) hMsg;
|
||||
GTPU_DEBUG("Received T-PDU over tunnel end-point '%x' of size %u from "NW_IPV4_ADDR,
|
||||
GTPU_DEBUG("Received T-PDU over tunnel end-point '%x' of size %u from "NW_IPV4_ADDR"\n",
|
||||
ntohl(msgHdr->teid), pMsg->msgLen, NW_IPV4_ADDR_FORMAT((peerIp)));
|
||||
rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg);
|
||||
}
|
||||
} else {
|
||||
GTPU_ERROR("Received T-PDU over non-existent tunnel end-point '%x' from "NW_IPV4_ADDR,
|
||||
GTPU_ERROR("Received T-PDU over non-existent tunnel end-point '%x' from "NW_IPV4_ADDR"\n",
|
||||
ntohl(msgHdr->teid), NW_IPV4_ADDR_FORMAT((peerIp)));
|
||||
}
|
||||
NW_LEAVE(thiz);
|
||||
@@ -561,7 +561,7 @@ nwGtpv1uHandleEchoReq(NW_IN NwGtpv1uStackT *thiz,
|
||||
*/
|
||||
rc = nwGtpv1uMsgAddIeTV1(hMsg, NW_GTPV1U_IE_RECOVERY, 0x00);
|
||||
|
||||
GTPU_INFO("Sending NW_GTP_ECHO_RSP message to %x:%x with seq %u",
|
||||
GTPU_INFO("Sending NW_GTP_ECHO_RSP message to %x:%x with seq %u\n",
|
||||
peerIp,
|
||||
peerPort,
|
||||
seqNum);
|
||||
@@ -758,12 +758,12 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
|
||||
|
||||
switch(msgType) {
|
||||
case NW_GTP_ECHO_REQ:
|
||||
GTPU_DEBUG("NW_GTP_ECHO_REQ");
|
||||
GTPU_DEBUG("NW_GTP_ECHO_REQ\n");
|
||||
ret = nwGtpv1uHandleEchoReq( thiz, udpData, udpDataLen, peerPort, peerIp);
|
||||
break;
|
||||
|
||||
case NW_GTP_ERROR_INDICATION:
|
||||
GTPU_DEBUG("NW_GTP_ERROR_INDICATION");
|
||||
GTPU_DEBUG("NW_GTP_ERROR_INDICATION\n");
|
||||
ret = nwGtpv1uSendUlpMessageIndication( thiz,
|
||||
0,
|
||||
NW_GTPV1U_ULP_API_RECV_MSG,
|
||||
@@ -777,7 +777,7 @@ nwGtpv1uProcessUdpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
|
||||
break;
|
||||
|
||||
case NW_GTP_ECHO_RSP:
|
||||
GTPU_DEBUG("NW_GTP_ECHO_RSP");
|
||||
GTPU_DEBUG("NW_GTP_ECHO_RSP\n");
|
||||
ret = NW_GTPV1U_OK;
|
||||
break;
|
||||
|
||||
@@ -815,7 +815,7 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
|
||||
|
||||
switch(pUlpReq->apiType) {
|
||||
case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT: {
|
||||
GTPU_DEBUG("Received NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT from ulp");
|
||||
GTPU_DEBUG("Received NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT from ulp\n");
|
||||
rc = NwGtpv1uCreateTunnelEndPoint(thiz,
|
||||
pUlpReq->apiInfo.createTunnelEndPointInfo.teid,
|
||||
pUlpReq->apiInfo.createTunnelEndPointInfo.hUlpSession,
|
||||
@@ -824,25 +824,25 @@ nwGtpv1uProcessUlpReq( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle,
|
||||
break;
|
||||
|
||||
case NW_GTPV1U_ULP_API_DESTROY_TUNNEL_ENDPOINT: {
|
||||
GTPU_DEBUG("Received destroy session req from ulp");
|
||||
GTPU_DEBUG("Received destroy session req from ulp\n");
|
||||
rc = nwGtpv1uDestroyTunnelEndPoint(thiz, pUlpReq);
|
||||
}
|
||||
break;
|
||||
|
||||
case NW_GTPV1U_ULP_API_INITIAL_REQ: {
|
||||
GTPU_DEBUG("Received initial req from ulp");
|
||||
GTPU_DEBUG("Received initial req from ulp\n");
|
||||
rc = nwGtpv1uInitialReq(thiz, pUlpReq);
|
||||
}
|
||||
break;
|
||||
|
||||
case NW_GTPV1U_ULP_API_SEND_TPDU: {
|
||||
GTPU_DEBUG("Received send tpdu req from ulp");
|
||||
GTPU_DEBUG("Received send tpdu req from ulp\n");
|
||||
rc = nwGtpv1uSendto(thiz, pUlpReq);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
GTPU_DEBUG("Unsupported API received from ulp");
|
||||
GTPU_DEBUG("Unsupported API received from ulp\n");
|
||||
rc = NW_GTPV1U_FAILURE;
|
||||
break;
|
||||
}
|
||||
@@ -869,7 +869,7 @@ nwGtpv1uProcessTimeout(void *timeoutInfo)
|
||||
NW_ASSERT(thiz != NULL);
|
||||
|
||||
NW_ENTER(thiz);
|
||||
GTPU_DEBUG("Received timeout event from ULP with timeoutInfo %x!",
|
||||
GTPU_DEBUG("Received timeout event from ULP with timeoutInfo %x!\n",
|
||||
(unsigned int)timeoutInfo);
|
||||
|
||||
rc = (((NwGtpv1uTimeoutInfoT *) timeoutInfo)->timeoutCallbackFunc) (timeoutInfo);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
# -------- Local ---------
|
||||
|
||||
# Uncomment if the framework cannot resolv it.
|
||||
Identity = "hss.eur";
|
||||
Identity = "hss.pft";
|
||||
|
||||
#ListenOn = "192.168.13.177";
|
||||
|
||||
|
||||
# TLS configuration (see previous section)
|
||||
TLS_Cred = "/mnt/sshfs/trunk/openair-cn/OPENAIRHSS/conf/hss.cert.pem",
|
||||
"/mnt/sshfs/trunk/openair-cn/OPENAIRHSS/conf/hss.key.pem";
|
||||
TLS_CA = "/mnt/sshfs/trunk/openair-cn/OPENAIRHSS/conf/cacert.pem";
|
||||
TLS_Cred = "//usr/local/src/openair4G/trunk/openair-cn/OPENAIRHSS/conf/hss.cert.pem",
|
||||
"//usr/local/src/openair4G/trunk/openair-cn/OPENAIRHSS/conf/hss.key.pem";
|
||||
TLS_CA = "/usr/local/src/openair4G/trunk/openair-cn/OPENAIRHSS/conf/cacert.pem";
|
||||
|
||||
# Disable use of TCP protocol (only listen and connect in SCTP)
|
||||
# Default : TCP enabled
|
||||
|
||||
@@ -40,11 +40,16 @@ echo "Creating certificate for HSS"
|
||||
# openssl req -new -batch -out hss.csr.pem -key hss.key.pem -subj /CN=hss.test.fr/C=FR/ST=Biot/L=Aix/O=test.fr/OU=mobiles
|
||||
# openssl ca -cert cacert.pem -keyfile cakey.pem -in hss.csr.pem -out hss.cert.pem -outdir . -batch
|
||||
|
||||
# CA self certificate
|
||||
# Create a Root Certification Authority Certificate
|
||||
openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out cacert.pem -keyout cakey.pem -subj /CN=eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
|
||||
# Generate a Private Key
|
||||
openssl genrsa -out hss.key.pem 1024
|
||||
openssl req -new -batch -out hss.csr.pem -key hss.key.pem -subj /CN=hss.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
|
||||
# Generate a CSR (Certificate Signing Request) that will be self-signed
|
||||
openssl req -new -batch -out hss.csr.pem -key hss.key.pem -subj /CN=hss.pft/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
|
||||
# Certification authority
|
||||
openssl ca -cert cacert.pem -keyfile cakey.pem -in hss.csr.pem -out hss.cert.pem -outdir . -batch
|
||||
|
||||
# openssl genrsa -out $hss.key.pem 1024
|
||||
|
||||
@@ -536,7 +536,7 @@ int s1ap_mme_handle_initial_context_setup_response(
|
||||
MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.ipv4 = 1; // TO DO
|
||||
MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.ipv6 = 0; // TO DO
|
||||
MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.interface_type = S1_U_ENODEB_GTP_U;
|
||||
MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.teid = *((uint32_t *)eRABSetupItemCtxtSURes_p->gTP_TEID.buf);
|
||||
MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.teid = htonl(*((uint32_t *)eRABSetupItemCtxtSURes_p->gTP_TEID.buf));
|
||||
memcpy(&MME_APP_INITIAL_CONTEXT_SETUP_RSP(message_p).bearer_s1u_enb_fteid.ipv4_address,
|
||||
eRABSetupItemCtxtSURes_p->transportLayerAddress.buf,
|
||||
4);
|
||||
|
||||
@@ -39,10 +39,10 @@ HOSTNAME=$(hostname -f)
|
||||
echo "Creating certificate for user '$HOSTNAME'"
|
||||
|
||||
# CA self certificate
|
||||
openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out cacert.pem -keyout cakey.pem -subj /CN=eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
openssl req -new -batch -x509 -days 3650 -nodes -newkey rsa:1024 -out cacert.pem -keyout cakey.pem -subj /CN=pft/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
|
||||
openssl genrsa -out user.key.pem 1024
|
||||
openssl req -new -batch -out user.csr.pem -key user.key.pem -subj /CN=$HOSTNAME.eur/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
openssl req -new -batch -out user.csr.pem -key user.key.pem -subj /CN=$HOSTNAME.pft/C=FR/ST=PACA/L=Aix/O=Eurecom/OU=CM
|
||||
openssl ca -cert cacert.pem -keyfile cakey.pem -in user.csr.pem -out user.cert.pem -outdir . -batch
|
||||
|
||||
if [ ! -d /usr/local/etc/freeDiameter ]
|
||||
|
||||
@@ -58,6 +58,13 @@ void s6a_peer_connected_cb(struct peer_info *info, void *arg)
|
||||
message_p = itti_alloc_new_message(TASK_S6A, ACTIVATE_MESSAGE);
|
||||
|
||||
itti_send_msg_to_task(TASK_S1AP, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
|
||||
/* Inform SGI that connection to HSS is established */
|
||||
message_p = itti_alloc_new_message(TASK_S6A, ACTIVATE_MESSAGE);
|
||||
|
||||
itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p);
|
||||
|
||||
}
|
||||
|
||||
/* For test */
|
||||
|
||||
@@ -120,7 +120,7 @@ int s6a_init(const mme_config_t *mme_config_p)
|
||||
S6A_DEBUG("Initializing freeDiameter core...\n");
|
||||
ret = fd_core_initialize();
|
||||
if (ret != 0) {
|
||||
S6A_ERROR("An error occurred during freeDiameter core library initialization\n");
|
||||
S6A_ERROR("An error occurred during freeDiameter core library initialization: %d\n",ret);
|
||||
return ret;
|
||||
} else {
|
||||
S6A_DEBUG("Initializing freeDiameter core done\n");
|
||||
|
||||
@@ -193,6 +193,7 @@ typedef struct sgi_data_s {
|
||||
int hw_address_of_router_captured;
|
||||
uint32_t local_addr_v4_4_hw_address_router_capture;
|
||||
uint32_t ipv4_addr_of_router;
|
||||
char hss_associated;
|
||||
|
||||
|
||||
#ifdef ENABLE_USE_PCAP_FOR_SGI
|
||||
|
||||
@@ -66,12 +66,14 @@
|
||||
#include "intertask_interface.h"
|
||||
|
||||
#ifdef ENABLE_USE_NETFILTER_FOR_SGI
|
||||
#warning "ENABLE_USE_NETFILTER_FOR_SGI"
|
||||
#define SGI_SOCKET_RAW 1
|
||||
#define SGI_SOCKET_BIND_TO_IF 1
|
||||
#undef SGI_MARKING
|
||||
#undef SGI_PACKET_RX_RING
|
||||
#undef SGI_SOCKET_UDP
|
||||
#else
|
||||
#warning "DISABLE_USE_NETFILTER_FOR_SGI"
|
||||
#define SGI_SOCKET_RAW 1
|
||||
#define SGI_SOCKET_BIND_TO_IF 1
|
||||
#undef SGI_PACKET_RX_RING
|
||||
@@ -120,6 +122,37 @@ struct ipv6hdr {
|
||||
#define PKT_OFFSET (TPACKET_ALIGN(sizeof(struct tpacket_hdr)) + \
|
||||
TPACKET_ALIGN(sizeof(struct sockaddr_ll)))
|
||||
|
||||
int sgi_create_vlan_interface(char *interface_nameP, int vlan_idP) {
|
||||
char vlan_interface_name[IFNAMSIZ];
|
||||
char command_line[256];
|
||||
int ret = 0;
|
||||
|
||||
ret = sprintf(vlan_interface_name, "%s.%d", interface_nameP, vlan_idP);
|
||||
if (ret > 0) {
|
||||
ret = sprintf(command_line, "ifconfig %s down > /dev/null 2>&1", vlan_interface_name);
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
|
||||
ret = sprintf(command_line, "vconfig rem %s > /dev/null 2>&1", vlan_interface_name);
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
|
||||
ret = sprintf(command_line, "vconfig add %s %d", interface_nameP, vlan_idP);
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
|
||||
ret = sprintf(command_line, "ifconfig %s up", vlan_interface_name);
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
|
||||
ret = sprintf(command_line, "sync");
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
|
||||
ret = sprintf(command_line, "ip -4 addr add 10.0.%d.2/24 dev %s", vlan_idP+200, vlan_interface_name);
|
||||
if (ret > 0) ret = system(command_line); else return -1;
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int sgi_create_sockets(sgi_data_t *sgi_data_p)
|
||||
{
|
||||
#ifdef SGI_SOCKET_BIND_TO_IF
|
||||
@@ -154,6 +187,10 @@ int sgi_create_sockets(sgi_data_t *sgi_data_p)
|
||||
// work
|
||||
//#define SGI_SOCKET_RAW
|
||||
for (i = 0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
|
||||
|
||||
|
||||
sgi_create_vlan_interface(sgi_data_p->interface_name,i+SGI_MIN_EPS_BEARER_ID);
|
||||
|
||||
//sgi_data_p->sd[i] = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
|
||||
// works also
|
||||
sgi_data_p->sd[i] = socket(PF_PACKET, SOCK_RAW, htons(IPPROTO_RAW));
|
||||
@@ -218,7 +255,7 @@ int sgi_create_sockets(sgi_data_t *sgi_data_p)
|
||||
sprintf(if_name, "%s.%d",sgi_data_p->interface_name,i+SGI_MIN_EPS_BEARER_ID);
|
||||
|
||||
memset(&socket_address, 0, sizeof(struct sockaddr_ll));
|
||||
socket_address.sll_family = PF_PACKET;
|
||||
socket_address.sll_family = PF_PACKET; //always PF_PACKET
|
||||
|
||||
//socket_address.sll_addr = ;// Filled when we want to tx
|
||||
//socket_address.sll_halen = ;// Filled when we want to tx
|
||||
@@ -227,13 +264,16 @@ int sgi_create_sockets(sgi_data_t *sgi_data_p)
|
||||
//socket_address.sll_hatype = ;// Filled when packet received
|
||||
//socket_address.sll_pkttype = ;// Filled when packet received
|
||||
socket_address.sll_ifindex = if_nametoindex(if_name);
|
||||
socket_address.sll_protocol = htons(ETH_P_IP);
|
||||
socket_address.sll_protocol = htons(ETH_P_IP);/* Protocol phy level */
|
||||
//socket_address.sll_protocol = htons(ETH_P_ALL);
|
||||
|
||||
// Now we can bind the socket to send the IP traffic
|
||||
if (bind(sgi_data_p->sd[i], (struct sockaddr *)&socket_address, sizeof(struct sockaddr_ll)) < 0) {
|
||||
SGI_IF_ERROR("Bind socket to %s (%s:%d)\n", if_name, strerror(errno), errno);
|
||||
goto error;
|
||||
} else {
|
||||
SGI_IF_DEBUG("Bind EPS bearer ID %d socket %d to %s\n",
|
||||
i+SGI_MIN_EPS_BEARER_ID, sgi_data_p->sd[i], if_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -571,8 +611,8 @@ int sgi_send_data(uint8_t *buffer_pP, uint32_t length, sgi_data_t *sgi_data_pP,
|
||||
#endif
|
||||
//sgi_print_hex_octets(iov[0].iov_base, iov[0].iov_len);
|
||||
//sgi_print_hex_octets(iov[1].iov_base, iov[1].iov_len);
|
||||
if (writev(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID], (const struct iovec *)&iov, 2) < 0) {
|
||||
SGI_IF_ERROR("Error during send to socket %d bearer id %d : (%s:%d)\n",
|
||||
if (writev(sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID], (const struct iovec *)iov, 2) < 0) {
|
||||
SGI_IF_ERROR("Error during writev to socket %d bearer id %d : (%s:%d)\n",
|
||||
sgi_data_pP->sd[mapping_p->eps_bearer_id - SGI_MIN_EPS_BEARER_ID],
|
||||
mapping_p->eps_bearer_id,
|
||||
strerror(errno),
|
||||
|
||||
+71
-49
@@ -55,6 +55,7 @@
|
||||
static void* sgi_task_thread(void *args_p);
|
||||
static int sgi_create_endpoint_request(sgi_data_t *sgi_dataP, SGICreateEndpointReq *req_p);
|
||||
static int sgi_update_endpoint_request(sgi_data_t *sgi_dataP, SGIUpdateEndpointReq *req_p);
|
||||
static int sgi_init_phase2(sgi_data_t *sgi_data_pP);
|
||||
//-----------------------------------------------------------------------------
|
||||
static pthread_t fw_2_sgi_task_thread;
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -82,41 +83,54 @@ static void* sgi_task_thread(void *args_p)
|
||||
|
||||
DevAssert(received_message_p != NULL);
|
||||
|
||||
switch (ITTI_MSG_ID(received_message_p))
|
||||
{
|
||||
case GTPV1U_TUNNEL_DATA_IND: {
|
||||
/* We received data from GTPV1_U incoming from an UE.
|
||||
* Forward it host adapter.
|
||||
*/
|
||||
Gtpv1uTunnelDataInd *data_ind_p;
|
||||
data_ind_p = &received_message_p->ittiMsg.gtpv1uTunnelDataInd;
|
||||
sgi_send_data(data_ind_p->buffer, data_ind_p->length, sgi_data_p, data_ind_p->local_S1u_teid);
|
||||
/* Buffer is no longer needed, free it */
|
||||
free(data_ind_p->buffer);
|
||||
}
|
||||
break;
|
||||
case SGI_CREATE_ENDPOINT_REQUEST: {
|
||||
SGICreateEndpointReq *req_p;
|
||||
req_p = &received_message_p->ittiMsg.sgiCreateEndpointReq;
|
||||
sgi_create_endpoint_request(sgi_data_p, req_p);
|
||||
if (sgi_data_p->hss_associated) {
|
||||
switch (ITTI_MSG_ID(received_message_p))
|
||||
{
|
||||
case GTPV1U_TUNNEL_DATA_IND: {
|
||||
/* We received data from GTPV1_U incoming from an UE.
|
||||
* Forward it host adapter.
|
||||
*/
|
||||
Gtpv1uTunnelDataInd *data_ind_p;
|
||||
data_ind_p = &received_message_p->ittiMsg.gtpv1uTunnelDataInd;
|
||||
sgi_send_data(data_ind_p->buffer, data_ind_p->length, sgi_data_p, data_ind_p->local_S1u_teid);
|
||||
/* Buffer is no longer needed, free it */
|
||||
free(data_ind_p->buffer);
|
||||
}
|
||||
break;
|
||||
case SGI_CREATE_ENDPOINT_REQUEST: {
|
||||
SGICreateEndpointReq *req_p;
|
||||
req_p = &received_message_p->ittiMsg.sgiCreateEndpointReq;
|
||||
sgi_create_endpoint_request(sgi_data_p, req_p);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case SGI_UPDATE_ENDPOINT_REQUEST: {
|
||||
SGIUpdateEndpointReq *req_p;
|
||||
req_p = &received_message_p->ittiMsg.sgiUpdateEndpointReq;
|
||||
sgi_update_endpoint_request(sgi_data_p, req_p);
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
SGI_IF_ERROR("Unkwnon message ID %d:%s\n",
|
||||
case SGI_UPDATE_ENDPOINT_REQUEST: {
|
||||
SGIUpdateEndpointReq *req_p;
|
||||
req_p = &received_message_p->ittiMsg.sgiUpdateEndpointReq;
|
||||
sgi_update_endpoint_request(sgi_data_p, req_p);
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
SGI_IF_ERROR("Unkwnon message ID %d:%s\n",
|
||||
ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
switch (ITTI_MSG_ID(received_message_p))
|
||||
{
|
||||
case ACTIVATE_MESSAGE: {
|
||||
sgi_data_p->hss_associated = 1;
|
||||
SGI_IF_DEBUG("HSS ASSOCIATED, CAN START VLANS (bug in freediameter)");
|
||||
sgi_init_phase2(sgi_data_p);
|
||||
} break;
|
||||
|
||||
default: {
|
||||
SGI_IF_ERROR("Unkwnon or ignored message ID %d:%s\n",
|
||||
ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p);
|
||||
received_message_p = NULL;
|
||||
@@ -251,32 +265,40 @@ int sgi_init(const pgw_config_t *pgw_config_p)
|
||||
sgi_data_p->interface_name[len] = '\0';
|
||||
sgi_data_p->ipv4_addr = pgw_config_p->ipv4.pgw_ipv4_address_for_SGI;
|
||||
|
||||
if (strcmp(sgi_data_p->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
|
||||
sgi_data_p->interface_index = if_nametoindex(sgi_data_p->interface_name);
|
||||
|
||||
if (sgi_create_sockets(sgi_data_p) < 0) {
|
||||
SGI_IF_ERROR("Could not create socket, leaving thread %s\n", __FUNCTION__);
|
||||
free(sgi_data_p);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
SGI_IF_WARNING("SGI interface disabled by config file\n");
|
||||
}
|
||||
|
||||
if (pthread_create(&fw_2_sgi_task_thread, NULL, &sgi_task_thread, (void *)sgi_data_p) < 0) {
|
||||
SGI_IF_ERROR("sgi_task_thread pthread_create: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strcmp(sgi_data_p->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sgi_init_phase2(sgi_data_t *sgi_data_pP) {
|
||||
int i;
|
||||
|
||||
if (strcmp(sgi_data_pP->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
|
||||
sgi_data_pP->interface_index = if_nametoindex(sgi_data_pP->interface_name);
|
||||
|
||||
if (sgi_create_sockets(sgi_data_pP) < 0) {
|
||||
SGI_IF_ERROR("Could not create socket, leaving thread %s\n", __FUNCTION__);
|
||||
free(sgi_data_pP);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
SGI_IF_WARNING("SGI interface disabled by config file\n");
|
||||
}
|
||||
|
||||
|
||||
if (strcmp(sgi_data_pP->interface_name, PGW_CONFIG_STRING_INTERFACE_DISABLED) != 0) {
|
||||
#ifdef ENABLE_USE_PCAP_FOR_SGI
|
||||
if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_pcap_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
|
||||
if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_pcap_fw_2_gtpv1u_thread, (void *)sgi_data_pP) < 0) {
|
||||
SGI_IF_ERROR("sgi_pcap_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_USE_NETFILTER_FOR_SGI
|
||||
if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_nf_fw_2_gtpv1u_thread, (void *)sgi_data_p) < 0) {
|
||||
if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_nf_fw_2_gtpv1u_thread, (void *)sgi_data_pP) < 0) {
|
||||
SGI_IF_ERROR("sgi_nf_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@@ -285,9 +307,9 @@ int sgi_init(const pgw_config_t *pgw_config_p)
|
||||
#ifdef ENABLE_USE_RAW_SOCKET_FOR_SGI
|
||||
for (i=0; i < SGI_MAX_EPS_BEARERS_PER_USER; i++) {
|
||||
sgi_read_thread_args_t *args_p = malloc(sizeof(sgi_read_thread_args_t));
|
||||
args_p->sgi_data = sgi_data_p;
|
||||
args_p->sgi_data = sgi_data_pP;
|
||||
args_p->socket_index = i;
|
||||
if (pthread_create(&sgi_data_p->capture_on_sgi_if_thread, NULL, &sgi_sock_raw_fw_2_gtpv1u_thread, (void *)args_p) < 0) {
|
||||
if (pthread_create(&sgi_data_pP->capture_on_sgi_if_thread, NULL, &sgi_sock_raw_fw_2_gtpv1u_thread, (void *)args_p) < 0) {
|
||||
SGI_IF_ERROR("sgi_sock_raw_fw_2_gtpv1u_thread pthread_create: %s", strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
@@ -296,7 +318,7 @@ int sgi_init(const pgw_config_t *pgw_config_p)
|
||||
//#endif
|
||||
}
|
||||
|
||||
while (sgi_data_p->thread_started != SGI_MAX_EPS_BEARERS_PER_USER ) {
|
||||
while (sgi_data_pP->thread_started != SGI_MAX_EPS_BEARERS_PER_USER ) {
|
||||
usleep(1000);
|
||||
}
|
||||
/*SGI_IF_DEBUG("ARP RESOLVING ROUTER...\n");
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -------- Local ---------
|
||||
|
||||
# Uncomment if the framework cannot resolv it.
|
||||
Identity = "@HOSTNAME@.eur";
|
||||
Realm = "eur";
|
||||
Identity = "@HOSTNAME@.pft";
|
||||
Realm = "pft";
|
||||
|
||||
# TLS configuration (see previous section)
|
||||
TLS_Cred = "/usr/local/etc/freeDiameter/user.cert.pem",
|
||||
@@ -24,6 +24,8 @@ AppServThreads = 1;
|
||||
|
||||
#ListenOn = "192.168.57.100";
|
||||
|
||||
#Port = 3870;
|
||||
#SecPort = 3871;
|
||||
# -------- Extensions ---------
|
||||
|
||||
# Uncomment (and create rtd.conf) to specify routing table for this peer.
|
||||
@@ -61,4 +63,4 @@ LoadExtension = "dict_s6a.fdx";
|
||||
# For only accepting incoming connections, see the acl_wl.fx extension.
|
||||
|
||||
# ConnectPeer = "hss.test.fr" { ConnectTo = "192.168.56.101"; No_IPv6; No_TCP; Port = 3868; Realm = "test.fr"; };
|
||||
# ConnectPeer = "hss.eur" { ConnectTo = "192.168.12.190"; No_IPv6; Port = 3868; };
|
||||
#ConnectPeer = "hss.pft" { ConnectTo = "192.168.14.17"; No_IPv6; Port = 3868; };
|
||||
|
||||
@@ -428,7 +428,7 @@ static int config_parse_file(mme_config_t *mme_config_p)
|
||||
(const char **)&sgw_ip_address_for_S1u_S12_S4_up)
|
||||
&& config_setting_lookup_string( subsetting, SGW_CONFIG_STRING_SGW_IPV4_ADDRESS_FOR_S11,
|
||||
(const char **)&sgw_ip_address_for_S11)
|
||||
&& config_setting_lookup_int( setting, SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP, &alongint)
|
||||
&& config_setting_lookup_int( subsetting, SGW_CONFIG_STRING_SGW_PORT_FOR_S1U_S12_S4_UP, &alongint)
|
||||
)
|
||||
) {
|
||||
cidr = strdup(sgw_ip_address_for_S1u_S12_S4_up);
|
||||
@@ -483,9 +483,8 @@ static void config_display(mme_config_t *mme_config_p)
|
||||
fprintf(stdout, " port number ......: %d\n", mme_config_p->s1ap_config.port_number);
|
||||
fprintf(stdout, "- IP:\n");
|
||||
//fprintf(stdout, " s1-u iface .......: %s\n", mme_config_p->ipv4.sgw_interface_name_for_S1u_S12_S4_up);
|
||||
//fprintf(stdout, " s1-u ip ..........: %s/%d\n",
|
||||
// inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up)),
|
||||
// mme_config_p->ipv4.sgw_ip_netmask_for_S1u_S12_S4_up);
|
||||
fprintf(stdout, " s1-u ip ..........: %s\n",
|
||||
inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up)));
|
||||
//fprintf(stdout, " sgi iface ........: %s\n", mme_config_p->ipv4.pgw_interface_name_for_SGI);
|
||||
//fprintf(stdout, " sgi ip ...........: %s/%d\n",
|
||||
// inet_ntoa(*((struct in_addr *)&mme_config_p->ipv4.pgw_ip_addr_for_SGI)),
|
||||
|
||||
Reference in New Issue
Block a user