epdg: Transmit MIP6-Agent-Info AVP in S6b SAR

Inform the AAA-server about the selected PDN-GW.
Change-Id: Ia0f00a00b6474e19bb4cdc77724c75a55ef5c1f9
diff --git a/library/DIAMETER_rfc4004_Templates.ttcn b/library/DIAMETER_rfc4004_Templates.ttcn
new file mode 100644
index 0000000..2df5573
--- /dev/null
+++ b/library/DIAMETER_rfc4004_Templates.ttcn
@@ -0,0 +1,34 @@
+module DIAMETER_rfc4004_Templates {
+
+/* (C) 2023 by sysmocom s.f.m.c. GmbH <info@sysmocom.de
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+import from General_Types all;
+import from DIAMETER_Types all;
+import from DIAMETER_Templates all;
+import from Osmocom_Types all;
+import from Misc_Helpers all;
+
+/* 4.2.1. MIP6-Agent-Info AVP */
+template (value) MIPv4_NONE_MIP_Home_Agent_Address ts_AVP_Home_Agent_Address(template (value) AddressType addr_type,
+									     template (value) octetstring addr_data) := {
+	address_type := addr_type,
+	address_data := addr_data
+}
+
+template (value) GenericAVP ts_AVP_MIPHomeAgentAddress(template (value) MIPv4_NONE_MIP_Home_Agent_Address addr) := {
+	avp := {
+		avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv4_NONE_MIP_Home_Agent_Address),
+		avp_data := {
+			avp_MIPv4_NONE_MIP_Home_Agent_Address := addr
+		}
+	}
+}
+
+}
\ No newline at end of file
diff --git a/library/DIAMETER_rfc5447_Templates.ttcn b/library/DIAMETER_rfc5447_Templates.ttcn
index 4c119c7..f62c96d 100644
--- a/library/DIAMETER_rfc5447_Templates.ttcn
+++ b/library/DIAMETER_rfc5447_Templates.ttcn
@@ -14,6 +14,19 @@
 import from DIAMETER_Templates all;
 import from Osmocom_Types all;
 import from Misc_Helpers all;
+import from DIAMETER_rfc4004_Templates all;
+
+/* 4.2.1. MIP6-Agent-Info AVP */
+template (value) GenericAVP ts_AVP_MIP6AgentInfo(template (value) MIPv4_NONE_MIP_Home_Agent_Address addr) := {
+	avp := {
+		avp_header := ts_DIA_Hdr(c_AVP_Code_MIPv6_NONE_MIP6_Agent_Info),
+		avp_data := {
+			avp_MIPv6_NONE_MIP6_Agent_Info := {
+				ts_AVP_MIPHomeAgentAddress(addr)
+			}
+		}
+	}
+}
 
 /* 4.2.5. MIP6-Feature-Vector AVP */
 const uint64_t DIA_RFC5447_MIP6_Feature_Vector_MIP6_INTEGRATED := hex2int('0000000000000001'H);
diff --git a/library/DIAMETER_ts29_273_Templates.ttcn b/library/DIAMETER_ts29_273_Templates.ttcn
index e116cfd..899dfb4 100644
--- a/library/DIAMETER_ts29_273_Templates.ttcn
+++ b/library/DIAMETER_ts29_273_Templates.ttcn
@@ -283,6 +283,7 @@
 ts_DIA_S6b_AAR(template (value) charstring username_nai,
 	       template (value) MIPv6_NONE_MIP6_Feature_Vector mip6_feat_vec,
 	       template (value) charstring apn,
+	       template (value) MIPv4_NONE_MIP_Home_Agent_Address pgw_addr,
 	       template (value) octetstring sess_id := c_def_sess_id,
 	       template (value) charstring orig_host := "pgw.localdomain",
 	       template (value) charstring orig_realm := "localdomain",
@@ -303,6 +304,7 @@
 			ts_AVP_DestinationRealm(dest_realm),
 			ts_AVP_AuthRequestType(AUTHORIZE_ONLY),
 			ts_AVP_UserName(char2oct(valueof(username_nai))),
+			ts_AVP_MIP6AgentInfo(pgw_addr),
 			ts_AVP_MIP6FeatureVector(mip6_feat_vec),
 			ts_AVP_ServiceSelection(valueof(apn))
 			/* TODO: Lots other optional */