dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9394


Change subject: GGSN_Tests: test what happens when PCO contains only one DNS 
entry
......................................................................

GGSN_Tests: test what happens when PCO contains only one DNS entry

When the protocol configuration options (PCO) contain a protocol
option that lists only one DNS server (normally there are two
included, a primary and a secondary). Than the parser in osmo-ggsn
runs into an endles loop. This testcase tries to provoke this behavior
by sending PDP CONTEXT ACTIVATE messages with PCO that contain only
a single DNS entry.

The problematic behavior of osmo-ggsn has been fixed recently
(see depends).

Change-Id: I71761e1f9db7ceac3c3df43d2e539f8c8d53c4fc
Depends: osmo-msc Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5
Related: OS#3288
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/expected-results.xml
M library/GTP_Templates.ttcn
3 files changed, 47 insertions(+), 0 deletions(-)



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

diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index d099681..28a1785 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -932,6 +932,24 @@
                T_default.stop;
        }

+       /* Test if the parser can cope with PCO that only contain either a 
single or a primary DNS.
+        * Note: an unpatched osmo-ggsn version will enter an endless-loop when 
the test is run
+        * see Change-Id Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 
*/
+       testcase TC_pdp4_act_deact_with_single_dns() runs on GT_CT {
+               f_init();
+               var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
'1234'O, c_ApnInternet, valueof(t_EuaIPv4Dyn)));
+               var ProtConfigOptions pco_pri_dns := 
valueof(ts_PCO_IPv4_PRI_DNS_IPCP);
+               var ProtConfigOptions pco_sec_dns := 
valueof(ts_PCO_IPv4_SEC_DNS_IPCP);
+
+               ctx.pco_req := pco_pri_dns;
+               f_pdp_ctx_act(ctx);
+               f_pdp_ctx_del(ctx, '1'B);
+
+               ctx.pco_req := pco_sec_dns;
+               f_pdp_ctx_act(ctx);
+               f_pdp_ctx_del(ctx, '1'B);
+       }
+
        control {
                execute(TC_pdp4_act_deact());
                execute(TC_pdp4_act_deact_ipcp());
@@ -947,5 +965,7 @@
                execute(TC_pdp6_clients_interact());

                execute(TC_echo_req_resp());
+
+               execute(TC_pdp4_act_deact_with_single_dns());
        }
 }
diff --git a/ggsn_tests/expected-results.xml b/ggsn_tests/expected-results.xml
index 1e5da38..f871657 100644
--- a/ggsn_tests/expected-results.xml
+++ b/ggsn_tests/expected-results.xml
@@ -11,4 +11,5 @@
   <testcase classname='GGSN_Tests' name='TC_pdp6_act_deact_gtpu_access' 
time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_pdp6_clients_interact' 
time='MASKED'/>
   <testcase classname='GGSN_Tests' name='TC_echo_req_resp' time='MASKED'/>
+  <testcase classname='GGSN_Tests' name='TC_pdp4_act_deact_with_single_dns' 
time='MASKED'/>
 </testsuite>
diff --git a/library/GTP_Templates.ttcn b/library/GTP_Templates.ttcn
index 44ec439..6c71765 100644
--- a/library/GTP_Templates.ttcn
+++ b/library/GTP_Templates.ttcn
@@ -400,6 +400,25 @@
                }
        }

+       template ProtConfigOptions ts_PCO_IPv4_PRI_DNS_IPCP modifies ts_PCO := {
+               protocols := {
+                       /* dummy PAP entry to check if our parser can cope with 
a single primary DNS entry
+                        * see Change-Id 
Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
+                       { protocolID := 'C023'O, lengthProtoID := 0, 
protoIDContents := ''O },
+                       { protocolID := '8021'O, lengthProtoID := 16, 
protoIDContents :=
+                                                               
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Primary)) }
+               }
+       }
+       template ProtConfigOptions ts_PCO_IPv4_SEC_DNS_IPCP modifies ts_PCO := {
+               protocols := {
+                       /* dummy PAP entry to check if our parser can cope with 
a single secondary DNS entry
+                        * see Change-Id 
Icffde89f9bc5d8fcadf6e2dd6c0b4de03440edd5 and OS#3288 */
+                       { protocolID := 'C023'O, lengthProtoID := 0, 
protoIDContents := ''O },
+                       { protocolID := '8021'O, lengthProtoID := 16, 
protoIDContents :=
+                                                               
enc_IpcpPacket(valueof(ts_IPCP_ReqDNS_Secondary)) }
+               }
+       }
+
        template ProtocolElement tr_PCO_Proto(OCT2 prot_id) := {
                protocolID := prot_id,
                lengthProtoID := ?,
@@ -468,6 +487,13 @@
                ts_IPCP(LCP_Configure_Request, identifier,
                        { tr_IPCP_PrimaryDns('00000000'O), 
tr_IPCP_SecondaryDns('00000000'O) });

+       template IpcpPacket ts_IPCP_ReqDNS_Primary(uint8_t identifier := 0) :=
+               ts_IPCP(LCP_Configure_Request, identifier,
+                       { tr_IPCP_PrimaryDns('00000000'O) });
+       template IpcpPacket ts_IPCP_ReqDNS_Secondary(uint8_t identifier := 0) :=
+               ts_IPCP(LCP_Configure_Request, identifier,
+                       { tr_IPCP_SecondaryDns('00000000'O) });
+
        function f_teardown_ind_IE(in template (omit) BIT1 ind) return template 
(omit) TearDownInd {
                if (istemplatekind(ind, "omit")) {
                        return omit;

--
To view, visit https://gerrit.osmocom.org/9394
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: I71761e1f9db7ceac3c3df43d2e539f8c8d53c4fc
Gerrit-Change-Number: 9394
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <[email protected]>

Reply via email to