ggsn: Validate IPCP identifier in answer matches the one in the request
Related: https://github.com/open5gs/open5gs/pull/2920
Related: SYS#6582
Change-Id: I0e0cefaeb303b4e284173011231170554e225561
diff --git a/ggsn_tests/GGSN_Tests.ttcn b/ggsn_tests/GGSN_Tests.ttcn
index d7de443..c949dc9 100644
--- a/ggsn_tests/GGSN_Tests.ttcn
+++ b/ggsn_tests/GGSN_Tests.ttcn
@@ -1489,8 +1489,9 @@
f_init();
var OCT4 ggsn_ip4_dns1 := f_inet_addr(m_ggsn_ip4_dns1);
var OCT4 ggsn_ip4_dns2 := f_inet_addr(m_ggsn_ip4_dns2);
+ var uint8_t ipcp_req_id := oct2int(f_rnd_octstring(1));
var PdpContext ctx := valueof(t_DefinePDP(f_rnd_imsi('26242'H), "1234", c_ApnInternet, valueof(t_EuaIPv4Dyn)));
- ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP);
+ ctx.pco_req := valueof(ts_PCO_IPv4_DNS_IPCP(ipcp_req_id));
f_pdp_ctx_act(ctx);
f_PCO_ensure_no_duplicates(ctx.pco_neg);
/* verify IPCP is at all contained */
@@ -1499,9 +1500,13 @@
}
/* verify IPCP contains both primary and secondary DNS */
var IpcpPacket ipcp := dec_IpcpPacket(f_PCO_extract_proto(ctx.pco_neg, '8021'O));
- if (not match(ipcp, tr_IPCP_Ack_DNS(0, ggsn_ip4_dns1, ggsn_ip4_dns2))) {
- if (not match(ipcp, tr_IPCP_Ack_DNS(0))) {
- setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found");
+ if (not match(ipcp, tr_IPCP_Ack_DNS(ipcp_req_id, ggsn_ip4_dns1, ggsn_ip4_dns2))) {
+ if (not match(ipcp, tr_IPCP_Ack_DNS(ipcp_req_id))) {
+ if (not match(ipcp, tr_IPCP_Ack_DNS(?))) {
+ setverdict(fail, "Primary/Secondary DNS PCO IPCP option not found");
+ } else {
+ setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected identifier");
+ }
} else {
setverdict(fail, "Primary/Secondary DNS PCO IPCP option found but not matching expected values");
}