Change in osmo-ttcn3-hacks[master]: lib: GTP_Emulation: Allow receiving packets with TEID 0

2018-07-11 Thread Pau Espin Pedrol
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 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol 


Change in osmo-ttcn3-hacks[master]: lib: GTP_Emulation: Allow receiving packets with TEID 0

2018-07-11 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/9949 )

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


Patch Set 1: Code-Review+2


--
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: comment
Gerrit-Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
Gerrit-Change-Number: 9949
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Wed, 11 Jul 2018 20:08:58 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-ttcn3-hacks[master]: lib: GTP_Emulation: Allow receiving packets with TEID 0

2018-07-10 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/49/9949/1

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: newchange
Gerrit-Change-Id: Ic702b78028e850ed961ef805f35e10a42da34e56
Gerrit-Change-Number: 9949
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol