Change in osmo-ttcn3-hacks[master]: WIP: mncc: Support IPv6 addresses (new version mncc 7)

2020-09-10 Thread pespin
Hello fixeria, laforge, Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056

to look at the new patch set (#2).

Change subject: WIP: mncc: Support IPv6 addresses (new version mncc 7)
..

WIP: mncc: Support IPv6 addresses (new version mncc 7)

Apparently commit 06b859ca314f53a902329ed95848dbafef1d4f87 forgot to
bump the MNCC_SOCK_VERSION field from 5 to 6.

Change-Id: I5448ff931ec33f24f4837a51376f1703fe97683b
---
M library/MNCC_Emulation.ttcn
M library/MNCC_EncDec.cc
M library/MNCC_Types.ttcn
M library/mncc.h
M msc/BSC_ConnectionHandler.ttcn
M msc/MSC_Tests.ttcn
M sip/SIP_Tests.default
7 files changed, 85 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks 
refs/changes/56/20056/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5448ff931ec33f24f4837a51376f1703fe97683b
Gerrit-Change-Number: 20056
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: newpatchset


Change in osmo-ttcn3-hacks[master]: WIP: mncc: Support IPv6 addresses (new version mncc 7)

2020-09-09 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056 )

Change subject: WIP: mncc: Support IPv6 addresses (new version mncc 7)
..


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056/1/library/MNCC_EncDec.cc
File library/MNCC_EncDec.cc:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056/1/library/MNCC_EncDec.cc@195
PS1, Line 195:  memcpy(((struct 
sockaddr_in6*))->sin6_addr, in.u().rtp().ip().data(),
I still need to figure out how to get a memory buffer point out of an 
octetstring here, from ip().


https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056/1/library/MNCC_Types.ttcn
File library/MNCC_Types.ttcn:

https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056/1/library/MNCC_Types.ttcn@377
PS1, Line 377:  octetstring ip, //TODO: define size of octetstring based on 
is_ipv6 using CROSSTAGS?
something like: if is_ipv6 LERNGTHOF(ip = 16), if not is_ipv6 LENGTHOF(ip = 4).



--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I5448ff931ec33f24f4837a51376f1703fe97683b
Gerrit-Change-Number: 20056
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Wed, 09 Sep 2020 19:00:27 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in osmo-ttcn3-hacks[master]: WIP: mncc: Support IPv6 addresses (new version mncc 7)

2020-09-09 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/20056 )


Change subject: WIP: mncc: Support IPv6 addresses (new version mncc 7)
..

WIP: mncc: Support IPv6 addresses (new version mncc 7)

Apparently commit 06b859ca314f53a902329ed95848dbafef1d4f87 forgot to
bump the MNCC_SOCK_VERSION field from 5  to 6 in

TODO: check what about MNCC_Emulation.mp_mncc_version

TODO: Add IPv6 tests for sip/SIP_Tests

Change-Id: I5448ff931ec33f24f4837a51376f1703fe97683b
---
M library/MNCC_Emulation.ttcn
M library/MNCC_EncDec.cc
M library/MNCC_Types.ttcn
M library/mncc.h
4 files changed, 47 insertions(+), 14 deletions(-)



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

diff --git a/library/MNCC_Emulation.ttcn b/library/MNCC_Emulation.ttcn
index be087ec..13a842b 100644
--- a/library/MNCC_Emulation.ttcn
+++ b/library/MNCC_Emulation.ttcn
@@ -38,7 +38,7 @@
 import from UD_Types all;

 modulepar {
-   int mp_mncc_version := 6;
+   int mp_mncc_version := 7;
 }

 /* General "base class" component definition, of which specific implementations
diff --git a/library/MNCC_EncDec.cc b/library/MNCC_EncDec.cc
index f2692d7..d9529ee 100644
--- a/library/MNCC_EncDec.cc
+++ b/library/MNCC_EncDec.cc
@@ -188,8 +188,20 @@
memset(, 0, sizeof(rtp));
rtp.msg_type = in.msg__type();
rtp.callref = in.u().rtp().callref();
-   rtp.ip = in.u().rtp().ip();
-   rtp.port = in.u().rtp().rtp__port();
+   if (in.u().rtp().is__ipv6()) {
+   rtp.addr.ss_family = AF_INET6;
+   ((struct sockaddr_in6*))->sin6_port = 
in.u().rtp().rtp__port();
+   //TODO: verify octetstring len
+   memcpy(((struct sockaddr_in6*))->sin6_addr, 
in.u().rtp().ip().data(),
+  sizeof(struct in6_addr));
+   } else {
+   rtp.addr.ss_family = AF_INET;
+   ((struct sockaddr_in*))->sin_port = 
in.u().rtp().rtp__port();
+   //TODO: verify octetstring len
+   memcpy(((struct sockaddr_in*))->sin_addr, 
in.u().rtp().ip().data(),
+  sizeof(struct in_addr));
+   //rtp.ip = in.u().rtp().ip();
+   }
rtp.payload_type = in.u().rtp().payload__type();
rtp.payload_msg_type = in.u().rtp().payload__msg__type();
ret_val = OCTETSTRING(sizeof(rtp), (uint8_t *) );
@@ -224,6 +236,9 @@
const struct gsm_mncc_rtp *in_rtp;
MNCC__PDU__Rtp rtp;
MNCC__MsgUnion u;
+   bool is_ipv6;
+   OCTETSTRING ip;
+   uint16_t port;

in_mncc = (struct gsm_mncc *) ttcn_buffer.get_read_data();

@@ -258,7 +273,20 @@
case MNCC_RTP_CONNECT:
case MNCC_RTP_FREE:
in_rtp = (const struct gsm_mncc_rtp *) in_mncc;
-   rtp = MNCC__PDU__Rtp(in_rtp->callref, in_rtp->ip, in_rtp->port, 
in_rtp->payload_type,
+   switch (in_rtp->addr.ss_family) {
+   case AF_INET:
+   is_ipv6 = false;
+   port = ((struct sockaddr_in*)_rtp->addr)->sin_port;
+   ip = OCTETSTRING(sizeof(struct in_addr), &(struct 
sockaddr_in*)_rtp->addr)->sin_addr);
+   break;
+   case AF_INET6:
+   is_ipv6 = true;
+   port = ((struct sockaddr_in6*)_rtp->addr)->sin6_port;
+   ip = OCTETSTRING(sizeof(struct in6_addr), &(struct 
sockaddr_in6*)_rtp->addr)->sin6_addr);
+
+   break;
+   }
+   rtp = MNCC__PDU__Rtp(in_rtp->callref, is_ipv6, ip, port, 
in_rtp->payload_type,
 in_rtp->payload_msg_type, in_rtp->sdp);
u.rtp() = rtp;
break;
diff --git a/library/MNCC_Types.ttcn b/library/MNCC_Types.ttcn
index 0a8e7d9..fa4fc3e 100644
--- a/library/MNCC_Types.ttcn
+++ b/library/MNCC_Types.ttcn
@@ -373,7 +373,8 @@

 type record MNCC_PDU_Rtp {
uint32_tcallref,
-   uint32_tip,
+   boolean is_ipv6,
+   octetstring ip, //TODO: define size of octetstring based on is_ipv6 
using CROSSTAGS?
uint16_trtp_port,
uint32_tpayload_type,
uint32_tpayload_msg_type,
@@ -1921,7 +1922,8 @@
u := {
rtp := {
callref := call_id,
-   ip := 0,
+   is_ipv6 := false,
+   ip := ''O,
rtp_port := 0,
payload_type := 0,
payload_msg_type := 0,
@@ -1935,13 +1937,14 @@

 /* MSC -> MNCC: RTP_CREATE.rsp; acknowledge creation of RTP (stating MSC side 
IP/Port) */