Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/9949 )

Change subject: lib: GTP_Emulation: Allow receiving packets with TEID 0
......................................................................

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
---
M library/GTP_Emulation.ttcn
1 file changed, 11 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/library/GTP_Emulation.ttcn b/library/GTP_Emulation.ttcn
index 534fdef..615309a 100644
--- a/library/GTP_Emulation.ttcn
+++ b/library/GTP_Emulation.ttcn
@@ -185,10 +185,19 @@
                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);

--
To view, visit https://gerrit.osmocom.org/9949
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
Gerrit-Change-Number: 9949
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to