lib: GTP_Emulation: Allow receiving packets with TEID 0

Some GTP messages like Echo Request, Echo Reply and Ind Error don't use
the TEID value. According to 3GPP TS 29.060 sec 9.3.1 in those cases the TEID is
set to 0:

"""
- TEID: Contains the Tunnel Endpoint Identifier for the tunnel to which this T-PDU belongs. The TEID shall be
used by the receiving entity to find the PDP context, except for the following cases:
- The Echo Request/Response and Supported Extension Headers notification messages, where the Tunnel
Endpoint Identifier shall be set to all zeroes.
- The Error Indication message where the Tunnel Endpoint Identifier shall be set to all zeros.
"""

Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
This commit is contained in:
Pau Espin 2018-07-10 18:38:17 +02:00
parent 3e2af5d4d7
commit 20e16c1983
1 changed files with 11 additions and 2 deletions

View File

@ -185,10 +185,19 @@ function main(GtpEmulationCfg cfg) runs on GTP_Emulation_CT {
var template hexstring imsi_t := f_gtpc_extract_imsi(g1c_ud.gtpc);
if (isvalue(imsi_t)) {
vc_conn := f_comp_by_imsi(valueof(imsi_t));
} else {
CLIENT.send(g1c_ud) to vc_conn;
} else if(g1c_ud.gtpc.teid != int2oct(0, 4)) {
vc_conn := f_comp_by_teid(g1c_ud.gtpc.teid);
CLIENT.send(g1c_ud) to vc_conn;
} else {
/* Send to all clients */
var integer i;
for (i := 0; i < sizeof(TidTable); i := i+1) {
if (isbound(TidTable[i].teid) and TidTable[i].teid == teid) {
CLIENT.send(g1c_ud) to TidTable[i].vc_conn;
}
}
}
CLIENT.send(g1c_ud) to vc_conn;
}
[] GTPU.receive(Gtp1uUnitdata:?) -> value g1u_ud {
vc_conn := f_comp_by_teid(g1u_ud.gtpu.teid);