pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35629?usp=email )

Change subject: GSUP: Convert PDP-Type IE to PDP-Address IE
......................................................................

GSUP: Convert PDP-Type IE to PDP-Address IE

The previous PDP-Type IE should have been a PDP-Address from the
start, since having only PDP-Type with no address is only a specific
case (dynamic addressing).
This becomes clear by looking at other similar protocols like:
* MAP: APN-Configuration IE has servedPartyIP-IP{v4,v6}-Address IEs
* Diameter S6b, 3GPP TS 29.272 7.3.35 APN-Configuration contains
  Served-Party-IP-Address AVPs
* Diameter SWx, 3GPP TS 29.273 APN-Configuration.
* GTPv1C Ts 29.060 7.7.29 PDP Context containing PDP Address.

Since PDP-Type on its own really makes no sense, being it a special case
of PDP-Address, let's keep the IE by renaming it (keeping old name too
for API backward compat) and extend it to support lengths > 2 bytes.

Old implementation of libosmogsm gsup actually ignored lengths > 2
bytes, so we are safe acting against older implementations here, both
on the sending and receiving side on the wire.

Change-Id: I3e92368fff61694bcef6a48320595b59ae8f54ca
Related: OS#6091
Related: libosmocore.git Change-Id I775ff9c3be165d9f30d6ab55d03f99b6104eadd6
Related: osmo-gsm-manuals.git Change-Id 
I775ff9c3be165d9f30d6ab55d03f99b6104eadd6
---
M library/GSUP_Templates.ttcn
M library/GSUP_Types.ttcn
M sgsn/SGSN_Tests.ttcn
3 files changed, 91 insertions(+), 12 deletions(-)

Approvals:
  fixeria: Looks good to me, but someone else must approve
  Jenkins Builder: Verified
  laforge: Looks good to me, approved




diff --git a/library/GSUP_Templates.ttcn b/library/GSUP_Templates.ttcn
index 0e9a2e5..634cfc3 100644
--- a/library/GSUP_Templates.ttcn
+++ b/library/GSUP_Templates.ttcn
@@ -59,7 +59,15 @@
        digits := digits
 }

-
+template (value) GSUP_PDP_Address ts_GSUP_PDP_Address_IPv4(template (omit) 
OCT4 ip_addr) := {
+       ipv4 := {
+               pdp_typeorg := '0001'B,
+               spare := '1111'B,
+               pdp_typenum := '21'O,
+               ipv4_address := ip_addr
+       }
+}
+template (value) GSUP_PDP_Address ts_EuaIPv4Dyn := 
ts_GSUP_PDP_Address_IPv4(omit);

 template GSUP_IE ts_GSUP_IE_AuthTuple2G(octetstring rand, octetstring sres,
                                        octetstring kc) := {
@@ -151,13 +159,15 @@
        }
 }

-template GSUP_IE ts_GSUP_IE_PdpInfo(octetstring apn, octetstring pdp_type, 
octetstring pdp_qos) := {
+template GSUP_IE ts_GSUP_IE_PdpInfo(template (value) octetstring apn,
+                                   template (value) GSUP_PDP_Address 
pdp_address,
+                                   template (value) octetstring pdp_qos) := {
        tag := OSMO_GSUP_PDP_INFO_IE,
        len := 0, /* overwritten */
        val := {
                pdp_info := {
                        valueof(ts_GSUP_IE_APN(apn)),
-                       valueof(ts_GSUP_IE_PDP_TYPE(pdp_type)),
+                       valueof(ts_GSUP_IE_PDP_ADDRESS(pdp_address)),
                        valueof(ts_GSUP_IE_PDP_QOS(pdp_qos))
                }
        }
@@ -180,15 +190,15 @@
 }


-template (value) GSUP_IE ts_GSUP_IE_PDP_TYPE(OCT2 pdp_type) := {
-       tag := OSMO_GSUP_PDP_TYPE_IE,
+template (value) GSUP_IE ts_GSUP_IE_PDP_ADDRESS(template (value) 
GSUP_PDP_Address pdp_address) := {
+       tag := OSMO_GSUP_PDP_ADDRESS_IE,
        len := 0,
        val := {
-               pdp_type := pdp_type
+               pdp_address := pdp_address
        }
 }

-template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(octetstring pdp_qos) := {
+template (value) GSUP_IE ts_GSUP_IE_PDP_QOS(template (value) octetstring 
pdp_qos) := {
        tag := OSMO_GSUP_PDP_QOS_IE,
        len := 0,
        val := {
@@ -633,7 +643,7 @@
        }
 }

-template (value) GSUP_IE ts_GSUP_IE_APN(octetstring apn) := {
+template (value) GSUP_IE ts_GSUP_IE_APN(template (value) octetstring apn) := {
        tag := OSMO_GSUP_ACCESS_POINT_NAME_IE,
        len := 0, /* overwritten */
        val := {
diff --git a/library/GSUP_Types.ttcn b/library/GSUP_Types.ttcn
index f9faeb7..666d8d0 100644
--- a/library/GSUP_Types.ttcn
+++ b/library/GSUP_Types.ttcn
@@ -29,7 +29,7 @@
        OSMO_GSUP_MSISDN_IE             ('08'O),
        OSMO_GSUP_HLR_NUMBER_IE         ('09'O),
        OSMO_GSUP_PDP_CONTEXT_ID_IE     ('10'O),
-       OSMO_GSUP_PDP_TYPE_IE           ('11'O),
+       OSMO_GSUP_PDP_ADDRESS_IE        ('11'O),
        OSMO_GSUP_ACCESS_POINT_NAME_IE  ('12'O),
        OSMO_GSUP_PDP_QOS_IE            ('13'O),
        OSMO_GSUP_CHARG_CHAR_IE         ('14'O),
@@ -196,6 +196,45 @@
        octetstring pdu
 };

+type union GSUP_PDP_Address {
+       GSUP_PDP_Address_IPv4           ipv4,
+       GSUP_PDP_Address_IPv6           ipv6,
+       GSUP_PDP_Address_IPv4v6 ipv4v6,
+       GSUP_PDP_Address_unknown        other
+} with { variant "TAG(ipv4, pdp_typenum = '21'O;
+                     ipv6, pdp_typenum = '57'O;
+                     ipv4v6, pdp_typenum = '8D'O;
+                     other, OTHERWISE;)" };
+
+type record  GSUP_PDP_Address_IPv4 {
+       BIT4    pdp_typeorg,
+       BIT4    spare,
+       OCT1    pdp_typenum,
+       OCT4    ipv4_address optional
+};
+
+type record GSUP_PDP_Address_IPv6 {
+       BIT4    pdp_typeorg,
+       BIT4    spare,
+       OCT1    pdp_typenum,
+       OCT16   ipv6_address optional
+};
+
+type record GSUP_PDP_Address_IPv4v6 {
+       BIT4    pdp_typeorg,
+       BIT4    spare,
+       OCT1    pdp_typenum,
+       OCT4    ipv4_address optional,
+       OCT16   ipv6_address optional
+};
+
+type record  GSUP_PDP_Address_unknown {
+       BIT4    pdp_typeorg,
+       BIT4    spare,
+       OCT1    pdp_typenum,
+       octetstring addr optional
+};
+
 type record GSUP_IE {
        GSUP_IEI        tag,
        uint8_t         len,
@@ -219,7 +258,7 @@
                                 pdp_info, tag = OSMO_GSUP_PDP_INFO_IE;
                                 apn, tag = OSMO_GSUP_ACCESS_POINT_NAME_IE;
                                 pdp_qos, tag = OSMO_GSUP_PDP_QOS_IE;
-                                pdp_type, tag = OSMO_GSUP_PDP_TYPE_IE;
+                                pdp_address, tag = OSMO_GSUP_PDP_ADDRESS_IE;
                                 charg_char, tag = OSMO_GSUP_CHARG_CHAR_IE;
                                 pdp_ctx_id, tag = OSMO_GSUP_PDP_CONTEXT_ID_IE;
                                 session_state, tag = 
OSMO_GSUP_SESSION_STATE_IE;
@@ -281,7 +320,7 @@
        OCT1            pdp_ctx_id,
        octetstring     apn,
        octetstring     pdp_qos,
-       OCT2            pdp_type,
+       GSUP_PDP_Address        pdp_address,
        octetstring     charg_char,
        /* Session information */
        GSUP_SessionState       session_state,
diff --git a/sgsn/SGSN_Tests.ttcn b/sgsn/SGSN_Tests.ttcn
index 13c0be1..1fd20a5 100644
--- a/sgsn/SGSN_Tests.ttcn
+++ b/sgsn/SGSN_Tests.ttcn
@@ -876,7 +876,7 @@
 private altstep as_gmm_gsup_lu_isd() runs on BSSGP_ConnHdlr {
        [] GSUP.receive(tr_GSUP_UL_REQ(g_pars.imsi)) {
                var GSUP_PDU gsup := valueof(ts_GSUP_ISD_REQ(g_pars.imsi, 
g_pars.msisdn));
-               gsup.ies := gsup.ies & { 
valueof(ts_GSUP_IE_PdpInfo(char2oct("*"), '0121'O, ''O)) };
+               gsup.ies := gsup.ies & { 
valueof(ts_GSUP_IE_PdpInfo(char2oct("*"), ts_EuaIPv4Dyn, ''O)) };
                GSUP.send(gsup);
                GSUP.receive(tr_GSUP_ISD_RES(g_pars.imsi));
                GSUP.send(ts_GSUP_UL_RES(g_pars.imsi));

--
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/35629?usp=email
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: I3e92368fff61694bcef6a48320595b59ae8f54ca
Gerrit-Change-Number: 35629
Gerrit-PatchSet: 2
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: lynxis lazus <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to