Commit 6be158b6 authored by Laurent THOMAS's avatar Laurent THOMAS

add gtp-u echo reply implementation, and ci trace improvement

parent 5ead416c
...@@ -474,7 +474,7 @@ class RANManagement(): ...@@ -474,7 +474,7 @@ class RANManagement():
mySSH.command('echo ' + lPassWord + ' | echo "ulimit -c unlimited && sudo UHD_RFNOC_DIR=/usr/local/share/uhd/rfnoc ./ran_build/build/' + self.air_interface[self.eNB_instance] + ' -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('echo ' + lPassWord + ' | echo "ulimit -c unlimited && sudo UHD_RFNOC_DIR=/usr/local/share/uhd/rfnoc ./ran_build/build/' + self.air_interface[self.eNB_instance] + ' -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
#otherwise the regular command is ok #otherwise the regular command is ok
else: else:
mySSH.command('echo "ulimit -c unlimited && ./ran_build/build/' + self.air_interface[self.eNB_instance] + ' -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('echo "ulimit -c unlimited && catchsegv ./ran_build/build/' + self.air_interface[self.eNB_instance] + ' -O ' + lSourcePath + '/' + ci_full_config_file + extra_options + '" > ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
mySSH.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5) mySSH.command('chmod 775 ./my-lte-softmodem-run' + str(self.eNB_instance) + '.sh', '\$', 5)
mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5) mySSH.command('echo ' + lPassWord + ' | sudo -S rm -Rf enb_' + self.testCase_id + '.log', '\$', 5)
......
...@@ -919,7 +919,7 @@ static void log_output_memory(log_component_t *c, const char *file, const char * ...@@ -919,7 +919,7 @@ static void log_output_memory(log_component_t *c, const char *file, const char *
} }
} }
}else{ }else{
fwrite(log_buffer, len, 1, c->stream); if (write(fileno(c->stream), log_buffer, len)) {};
} }
} }
......
...@@ -108,7 +108,7 @@ instance_t legacyInstanceMapping=0; ...@@ -108,7 +108,7 @@ instance_t legacyInstanceMapping=0;
#define GTPV1U_HEADER_SIZE (8) #define GTPV1U_HEADER_SIZE (8)
static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, teid_t teid, uint8_t *Msg,int msgLen, static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, int msgType, teid_t teid, uint8_t *Msg,int msgLen,
bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) { bool seqNumFlag, bool npduNumFlag, bool extHdrFlag, int seqNum, int npduNum, int extHdrType) {
AssertFatal(extHdrFlag==false,"Not developped"); AssertFatal(extHdrFlag==false,"Not developped");
int headerAdditional=0; int headerAdditional=0;
...@@ -116,9 +116,8 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te ...@@ -116,9 +116,8 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te
if ( seqNumFlag || npduNumFlag || extHdrFlag) if ( seqNumFlag || npduNumFlag || extHdrFlag)
headerAdditional=4; headerAdditional=4;
uint8_t *buffer;
int fullSize=GTPV1U_HEADER_SIZE+headerAdditional+msgLen; int fullSize=GTPV1U_HEADER_SIZE+headerAdditional+msgLen;
AssertFatal((buffer=(uint8_t *) malloc(fullSize)) != NULL, ""); uint8_t buffer[fullSize];
Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *)buffer ; Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *)buffer ;
// N should be 0 for us (it was used only in 2G and 3G) // N should be 0 for us (it was used only in 2G and 3G)
msgHdr->PN=npduNumFlag; msgHdr->PN=npduNumFlag;
...@@ -128,7 +127,7 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te ...@@ -128,7 +127,7 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te
//PT=0 is for GTP' TS 32.295 (charging) //PT=0 is for GTP' TS 32.295 (charging)
msgHdr->PT=1; msgHdr->PT=1;
msgHdr->version=1; msgHdr->version=1;
msgHdr->msgType=GTP_GPDU; msgHdr->msgType=msgType;
msgHdr->msgLength=htons(msgLen); msgHdr->msgLength=htons(msgLen);
if ( seqNumFlag || extHdrFlag || npduNumFlag) if ( seqNumFlag || extHdrFlag || npduNumFlag)
...@@ -153,11 +152,9 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te ...@@ -153,11 +152,9 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te
if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) {
LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n",
h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno);
free(buffer);
return GTPNOK; return GTPNOK;
} }
free(buffer);
return !GTPNOK; return !GTPNOK;
} }
...@@ -199,6 +196,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b ...@@ -199,6 +196,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b
gtpv1uCreateAndSendMsg(compatInst(instance), gtpv1uCreateAndSendMsg(compatInst(instance),
tmp.outgoing_ip_addr, tmp.outgoing_ip_addr,
tmp.outgoing_port, tmp.outgoing_port,
GTP_GPDU,
tmp.teid_outgoing, tmp.teid_outgoing,
buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ;
} }
...@@ -241,6 +239,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, ...@@ -241,6 +239,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req,
gtpv1uCreateAndSendMsg(compatInst(instance), gtpv1uCreateAndSendMsg(compatInst(instance),
tmp.outgoing_ip_addr, tmp.outgoing_ip_addr,
tmp.outgoing_port, tmp.outgoing_port,
GTP_GPDU,
tmp.teid_outgoing, tmp.teid_outgoing,
buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ; buffer, length, seqNumFlag, npduNumFlag, false, tmp.seqNum, tmp.npduNum, 0) ;
} }
...@@ -647,9 +646,26 @@ static int Gtpv1uHandleEchoReq(int h, ...@@ -647,9 +646,26 @@ static int Gtpv1uHandleEchoReq(int h,
uint32_t msgBufLen, uint32_t msgBufLen,
uint16_t peerPort, uint16_t peerPort,
uint32_t peerIp) { uint32_t peerIp) {
LOG_E(GTPU,"EchoReq reply to be dev\n"); Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf;
int rc = GTPNOK;
return rc; if ( msgHdr->version != 1 || msgHdr->PT != 1 ) {
LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h);
return GTPNOK;
}
if ( msgHdr->S != 1 ) {
LOG_E(GTPU, "[%d] Received a echo request packet with no sequence number \n", h);
return GTPNOK;
}
uint16_t seq=ntohs(*(uint16_t*)(msgHdr+1));
LOG_D(GTPU, "[%d] Received a echo request, TEID: %d, seq: %hu\n", h, msgHdr->teid, seq);
uint8_t recovery[2]={14,0};
return gtpv1uCreateAndSendMsg(h, peerIp, peerPort, GTP_ECHO_RSP, ntohl(msgHdr->teid),
recovery, sizeof recovery,
1, 0, 0, seq, 0, 0);
} }
static int Gtpv1uHandleError(int h, static int Gtpv1uHandleError(int h,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment