diff --git a/openair-cn/GTPV1-U/gtpv1u_task.c b/openair-cn/GTPV1-U/gtpv1u_task.c index 053d09671d..dab243d294 100644 --- a/openair-cn/GTPV1-U/gtpv1u_task.c +++ b/openair-cn/GTPV1-U/gtpv1u_task.c @@ -49,6 +49,7 @@ #include "NwGtpv1uMsg.h" #include "NwLog.h" #include "gtpv1u_sgw_defs.h" +#include "NwGtpv1uPrivate.h" //static NwGtpv1uStackHandleT gtpv1u_stack = 0; static gtpv1u_data_t gtpv1u_sgw_data; diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h index fbfeb8279c..5f2e6ee0f9 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h +++ b/openair-cn/GTPV1-U/nw-gtpv1u/shared/NwGtpv1u.h @@ -314,6 +314,7 @@ typedef struct NwGtpv1uRcT (*udpDataReqCallback) ( NW_IN NwGtpv1uUdpHandleT udpHandle, NW_IN NwU8T* dataBuf, NW_IN NwU32T dataSize, + NW_IN NwU32T dataOffset, NW_IN NwU32T peerIP, NW_IN NwU16T peerPort); } NwGtpv1uUdpEntityT; diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c index 97ea58cb53..4cb0eb9dcd 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1u.c @@ -229,7 +229,7 @@ nwGtpv1uCreateAndSendMsg( NwGtpv1uStackT *thiz, NwU32T peerIp, NwU16T peerPort, rc = thiz->udp.udpDataReqCallback(thiz->udp.hUdp, pMsg->msgBuf, pMsg->msgLen, - pMsg->msgOffset, + pMsg->msgBufOffset, peerIp, peerPort); @@ -292,6 +292,7 @@ nwGtpv1uPeerRspTimeout(void *arg) rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp, thiz->pMsg->msgBuf, thiz->pMsg->msgLen, + thiz->pMsg->msgBufOffset, thiz->peerIp, thiz->peerPort); @@ -520,8 +521,8 @@ nwGtpv1uProcessGpdu( NwGtpv1uStackT *thiz, GTPU_DEBUG("Received T-PDU over tunnel end-point '%x' of size %u (decapsulated %u)from "NW_IPV4_ADDR"\n", ntohl(msgHdr->teid), gpduLen, pMsg->msgLen, NW_IPV4_ADDR_FORMAT((peerIp))); - AssertFatal(gpduLen == (pMsg->msgLen + pMsg->msgOffset), - "Mismatch gpduLen %d / buffer offset %d / msg len %d / buffer len", + AssertFatal(gpduLen == (pMsg->msgLen + pMsg->msgBufOffset), + "Mismatch gpduLen %u / buffer offset %u / msg len %u / buffer len %u", gpduLen, pMsg->msgBufOffset, pMsg->msgLen, pMsg->msgBufLen); rc = nwGtpSessionSendMsgApiToUlpEntity(pTunnelEndPoint, pMsg); diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c index 870dc35f49..0b416446e3 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uMsg.c @@ -42,6 +42,7 @@ #include "NwGtpv1u.h" #include "NwGtpv1uPrivate.h" #include "NwGtpv1uMsg.h" +#include "assertions.h" #include "gtpv1u.h" #if defined(ENB_MODE) @@ -132,11 +133,10 @@ nwGtpv1uGpduMsgNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, NW_GTPV1U_MALLOC(pStack, sizeof(NwGtpv1uMsgT), pMsg, NwGtpv1uMsgT *); } - if(pMsg) { msgExtraLen = (((seqNumFlag) || (NW_FALSE) || (NW_FALSE) ) ? (NW_GTPV1U_EPC_SPECIFIC_HEADER_SIZE - NW_GTPV1U_EPC_MIN_HEADER_SIZE) : 0); - AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset); + AssertFatal((msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE) <= tpduOffset, "Mismatch GTPU len"); pMsg->msgBuf = tpdu; pMsg->msgBufLen = tpduLength + msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE; pMsg->msgBufOffset = tpduOffset - (msgExtraLen + NW_GTPV1U_EPC_MIN_HEADER_SIZE); @@ -264,8 +264,8 @@ nwGtpv1uMsgFromBufferNew( NW_IN NwGtpv1uStackHandleT hGtpuStackHandle, pMsg->npduNum = *(pBuf++); pMsg->nextExtHdrType = *(pBuf++); } - pMsg->msgOffset = (NwU32T)(pBuf - pMsg->msgBuf); - pMsg->msgLen = bufLen - pMsg->msgOffset; + pMsg->msgBufOffset = (NwU32T)(pBuf - pMsg->msgBuf); + pMsg->msgLen = bufLen - pMsg->msgBufOffset; *phMsg = (NwGtpv1uMsgHandleT) pMsg; return NW_GTPV1U_OK; } diff --git a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c index 36f1d24c26..cc055a7c83 100644 --- a/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c +++ b/openair-cn/GTPV1-U/nw-gtpv1u/src/NwGtpv1uTrxn.c @@ -72,6 +72,7 @@ nwGtpv1uTrxnSendMsgRetransmission(NwGtpv1uTrxnT *thiz) rc = thiz->pStack->udp.udpDataReqCallback(thiz->pStack->udp.hUdp, thiz->pMsg->msgBuf, thiz->pMsg->msgLen, + thiz->pMsg->msgBufOffset, thiz->peerIp, thiz->peerPort); @@ -364,6 +365,7 @@ nwGtpv1uTrxnCreateAndSendMsg( NW_IN NwGtpv1uStackT *thiz, rc = thiz->udp.udpDataReqCallback(thiz->udp.hUdp, pMsg->msgBuf, pMsg->msgLen, + pMsg->msgBufOffset, peerIp, peerPort); diff --git a/openair-cn/SGI/Makefile.am b/openair-cn/SGI/Makefile.am index 90c4e21841..9a386ed1d5 100644 --- a/openair-cn/SGI/Makefile.am +++ b/openair-cn/SGI/Makefile.am @@ -36,7 +36,8 @@ AM_CFLAGS = @ADD_CFLAGS@ \ -I$(top_srcdir)/NAS/EURECOM-NAS/src/ies \ -I$(top_srcdir)/NAS/EURECOM-NAS/src/emm/msg \ -I$(top_srcdir)/NAS/EURECOM-NAS/src/esm/msg \ - -I$(top_srcdir)/NAS/EURECOM-NAS/src/util \ + -I$(top_srcdir)/NAS/EURECOM-NAS/src/util \ + -I$(top_srcdir)/GTPV1-U \ -I$(top_srcdir)/INTERTASK_INTERFACE noinst_LTLIBRARIES = libsgi.la diff --git a/openair-cn/SGI/sgi_egress.c b/openair-cn/SGI/sgi_egress.c index 04a998bc6b..00cf6ab5e8 100755 --- a/openair-cn/SGI/sgi_egress.c +++ b/openair-cn/SGI/sgi_egress.c @@ -39,6 +39,7 @@ #include "sgi.h" +#include "gtpv1u.h" #include "intertask_interface.h" #include "assertions.h"