pespin submitted this change.
ggsn: Validate MTU sent during ICMPv6 RA
Related: OS#6298
Related: SYS#7122
Change-Id: Ia5bbc5f9e42b02d1b9bd6c4190a2bd439663deeb
---
M ggsn_tests/GGSN_Tests.ttcn
M ggsn_tests/expected-results.xml
M library/ICMPv6_Templates.ttcn
3 files changed, 49 insertions(+), 9 deletions(-)
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/ggsn_tests/expected-results.xml b/ggsn_tests/expected-results.xml
index 4e37ecd..1b072ad 100644
--- a/ggsn_tests/expected-results.xml
+++ b/ggsn_tests/expected-results.xml
@@ -13,6 +13,7 @@
<testcase classname='GGSN_Tests' name='TC_pdp6_act_deact' time='MASKED'/>
<testcase classname='GGSN_Tests' name='TC_pdp6_act_deact_pcodns' time='MASKED'/>
<testcase classname='GGSN_Tests' name='TC_pdp6_act_deact_icmp6' time='MASKED'/>
+ <testcase classname='GGSN_Tests' name='TC_pdp6_act_deact_mtu' time='MASKED'/>
<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_pdp46_act_deact' time='MASKED'/>
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 change 38475. To unsubscribe, or for help writing mail filters, visit settings.