pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/38475?usp=email )


Change subject: ggsn: Validate MTU sent during ICMPv6 RA
......................................................................

ggsn: Validate MTU sent during ICMPv6 RA

Related: OS#6298
Related: SYS#7122
Change-Id: Ia5bbc5f9e42b02d1b9bd6c4190a2bd439663deeb
---
M ggsn_tests/GGSN_Tests.ttcn
M library/ICMPv6_Templates.ttcn
2 files changed, 48 insertions(+), 9 deletions(-)



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

diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index 5983703..8b1a6e7 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -957,9 +957,14 @@
                                        repeat;
                                }
                                /* We are waiting for RA, update ctx */
-                               if (match(icmp6, tr_ICMPv6_RA(?, 64))) {
-                                       ctx.ip6_prefix := 
icmp6.routerAdvertisement.options[0].prefixInformation.prefix;
-                                       log("RA with /64 prefix ", 
ctx.ip6_prefix);
+                               if (match(icmp6, tr_ICMPv6_RA(?))) {
+                                       for (var integer i := 0; i < 
lengthof(icmp6.routerAdvertisement.options); i := i + 1) {
+                                               var OptionField opt := 
icmp6.routerAdvertisement.options[i];
+                                               if 
(ischosen(opt.prefixInformation)) {
+                                                       ctx.ip6_prefix := 
opt.prefixInformation.prefix;
+                                                       log("RA with /64 prefix 
", ctx.ip6_prefix);
+                                               }
+                                       }
                                }
                        }
                        [] GTPU.receive(tr_GTPU_GPDU(?, ?)) { repeat; }
@@ -976,8 +981,15 @@
        }

        /* wait for GGSN to send us an ICMPv6 router advertisement */
-       function f_wait_rtr_adv(PdpContext ctx) runs on GT_CT {
-               f_wait_icmp6(ctx, tr_ICMPv6_RA(?, 64));
+       function f_wait_rtr_adv(PdpContext ctx, template integer mtu := *) runs 
on GT_CT {
+               var template (present) OptionField opt_prefix := 
tr_ICMP6_OptPrefix(?, 64);
+               var template (present) Options opts;
+               if (istemplatekind(mtu, "*")) {
+                       opts := ( { opt_prefix }, { opt_prefix, 
tr_ICMP6_OptMTU(?) } );
+               } else {
+                       opts := { opt_prefix, tr_ICMP6_OptMTU(mtu) };
+               }
+               f_wait_icmp6(ctx, tr_ICMPv6_RA(opts));
        }

        /* Wait for ICMPv6 echo request from GTP */
@@ -1094,6 +1106,30 @@
                f_shutdown_helper();
        }

+       /* Test PDP context activation for dynamic IPv6 EUA with MTU in router 
solicitation/advertisement */
+       testcase TC_pdp6_act_deact_mtu() runs on GT_CT {
+               f_init();
+               if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) {
+                       f_vty_set_mtu(m_configured_mtu);
+               } else {
+                       /* In GGSN_IMPL_OPEN5GS we expect open5gs-smfd to be
+                        * configured with mtu value m_configured_mtu */
+               }
+
+               var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), 
"1234", c_ApnInet6, valueof(t_EuaIPv6Dyn)));
+               f_pdp_ctx_act(ctx);
+
+               f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
+               f_wait_rtr_adv(ctx, m_configured_mtu);
+               f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
+
+               f_pdp_ctx_del(ctx, '1'B);
+               if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) {
+                       f_vty_set_mtu(-1);
+               }
+               f_shutdown_helper();
+       }
+
        /* Test PDP context activation for dynamic IPv6 EUA with IPv6 DNS in 
PCO and router solicitation/advertisement.
           Test we can send ICMPv6 ping over GTPU to DNS server. */
        testcase TC_pdp6_act_deact_gtpu_access() runs on GT_CT {
@@ -1752,6 +1788,10 @@
                                                                " vs exp ", 
tr_PCO_P_UV_U16(m_configured_mtu)));
                }

+               f_send_gtpu(ctx, f_icmpv6_rs_for_pdp(ctx));
+               f_wait_rtr_adv(ctx, m_configured_mtu);
+               f_send_gtpu(ctx, f_gen_icmpv6_neigh_solicit_for_pdp(ctx));
+
                f_pdp_ctx_del(ctx, '1'B);
                if (m_ggsn_impl == GGSN_IMPL_OSMOCOM) {
                        f_vty_set_mtu(-1);
@@ -2387,6 +2427,7 @@
                        execute(TC_pdp6_act_deact());
                        execute(TC_pdp6_act_deact_pcodns());
                        execute(TC_pdp6_act_deact_icmp6());
+                       execute(TC_pdp6_act_deact_mtu());
                        execute(TC_pdp6_act_deact_gtpu_access());
                        execute(TC_pdp6_act_deact_gtpu_access_ll_saddr());
                        execute(TC_pdp6_act_deact_gtpu_access_wrong_ll_saddr());
diff --git a/library/ICMPv6_Templates.ttcn b/library/ICMPv6_Templates.ttcn
index 687aad4..a77fb62 100644
--- a/library/ICMPv6_Templates.ttcn
+++ b/library/ICMPv6_Templates.ttcn
@@ -114,7 +114,7 @@
        }

        /* template for receiving/matching an ICMPv6 router advertisement */
-       template (present) PDU_ICMPv6 tr_ICMPv6_RA(template (present) OCT16 
prefix, template (present) INT1 prefix_len) := {
+       template (present) PDU_ICMPv6 tr_ICMPv6_RA(template (present) Options 
options := ?) := {
                routerAdvertisement := {
                        typeField := 134,
                        code := 0,
@@ -126,9 +126,7 @@
                        routerLifetime := ?,
                        reachableTime := ?,
                        retransTimer := ?,
-                       options := ({ tr_ICMP6_OptPrefix(prefix, prefix_len) },
-                                   { tr_ICMP6_OptPrefix(prefix, prefix_len), 
tr_ICMP6_OptMTU }
-                                  )
+                       options := options
                }
        }


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

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: Ia5bbc5f9e42b02d1b9bd6c4190a2bd439663deeb
Gerrit-Change-Number: 38475
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to