aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-07-10 18:38:17 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-07-11 20:16:34 +0000
commit20e16c1983e55dccae2bd07c7e11ebab5f2ed065 (patch)
treeae96f758503cf1ba555dc4d0ca01ac8dead8105d
parent3e2af5d4d7648b68ad122cf714a0b32b948dcf54 (diff)
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
-rw-r--r--library/GTP_Emulation.ttcn13
1 files changed, 11 insertions, 2 deletions
diff --git a/library/GTP_Emulation.ttcn b/library/GTP_Emulation.ttcn
index 534fdef8..615309a8 100644
--- a/library/GTP_Emulation.ttcn
+++ b/library/GTP_Emulation.ttcn
@@ -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);