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");
 			}
diff --git a/library/GTP_Templates.ttcn b/library/GTP_Templates.ttcn
index 3788725..30346d4 100644
--- a/library/GTP_Templates.ttcn
+++ b/library/GTP_Templates.ttcn
@@ -973,13 +973,13 @@
 		}
 	}
 
-	template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP modifies ts_PCO := {
+	template (value) ProtConfigOptions ts_PCO_IPv4_DNS_IPCP(uint8_t ipcp_req_id := 0) modifies ts_PCO := {
 		protocols := {
 			/* dummy PAP entry to check if our parser in the GGSN can properly iterate over
 			 * the list of protocols, see Change-Id Icc2e6716c33d78d3c3e000f529806228d8aa155e */
 			{ protocolID := 'C023'O, lengthProtoID := 0, protoIDContents := ''O },
 			{ protocolID := '8021'O, lengthProtoID := 16, protoIDContents :=
-								enc_IpcpPacket(valueof(ts_IPCP_ReqDNS)) }
+								enc_IpcpPacket(valueof(ts_IPCP_ReqDNS(ipcp_req_id))) }
 		}
 	}