소스 검색

ims_auth: Add option to set destination host for MAR requests

Carsten Bock 10 년 전
부모
커밋
7aa9f30da3

+ 2 - 1
modules/ims_auth/authims_mod.c

@@ -95,12 +95,12 @@ static str registration_default_algorithm = str_init("AKAv1-MD5"); /**< default
 unsigned char registration_default_algorithm_type = 1; /**< fixed default algorithm for registration (if none present)	 */
 
 str cxdx_dest_realm = str_init("ims.smilecoms.com");
+str cxdx_dest_host = str_init("");
 
 //Only used if we want to force the Rx peer
 //Usually this is configured at a stack level and the first request uses realm routing
 str cxdx_forced_peer = str_init("");
 
-
 /* fixed parameter storage */
 str scscf_name_str = str_init("sip:scscf.ims.smilecoms.com:6060"); /**< fixed name of the S-CSCF 							*/
 
@@ -140,6 +140,7 @@ static param_export_t params[] = {
     {"av_check_only_impu", INT_PARAM, &av_check_only_impu},
     {"cxdx_forced_peer", PARAM_STR, &cxdx_forced_peer},
     {"cxdx_dest_realm", PARAM_STR, &cxdx_dest_realm},
+    {"cxdx_dest_host", PARAM_STR, &cxdx_dest_host},
     {0, 0, 0}
 };
 

+ 16 - 0
modules/ims_auth/cxdx_avp.c

@@ -160,6 +160,22 @@ inline int cxdx_add_destination_realm(AAAMessage *msg,str data)
 		__FUNCTION__);
 }
 
+/**
+ * Creates and adds a Destination-Host AVP.
+ * @param msg - the Diameter message to add to.
+ * @param data - the value for the AVP payload
+ * @returns 1 on success or 0 on error
+ */
+inline int cxdx_add_destination_host(AAAMessage *msg,str data)
+{
+	return 
+	cxdx_add_avp(msg,data.s,data.len,
+		AVP_Destination_Host,
+		AAA_AVP_FLAG_MANDATORY,
+		0,
+		AVP_DUPLICATE_DATA,
+		__FUNCTION__);
+}
 
 /**
  * Creates and adds a Vendor-Specifig-Application-ID AVP.

+ 8 - 0
modules/ims_auth/cxdx_avp.h

@@ -61,6 +61,14 @@ struct sip_msg;
  */
 inline int cxdx_add_destination_realm(AAAMessage *msg, str data);
 
+/**
+ * Creates and adds a Destination-Host AVP.
+ * @param msg - the Diameter message to add to.
+ * @param data - the value for the AVP payload
+ * @returns 1 on success or 0 on error
+ */
+inline int cxdx_add_destination_host(AAAMessage *msg,str data);
+
 /**
  * Creates and adds a Vendor-Specifig-Application-ID AVP.
  * @param msg - the Diameter message to add to.

+ 4 - 0
modules/ims_auth/cxdx_mar.c

@@ -503,6 +503,10 @@ int cxdx_send_mar(struct sip_msg *msg, str public_identity, str private_identity
     }
     if (!mar) goto error1;
 
+    if (cxdx_dest_host.len > 0) {
+       if (!cxdx_add_destination_host(mar, cxdx_dest_host)) goto error1;
+    }
+
     if (!cxdx_add_destination_realm(mar, cxdx_dest_realm)) goto error1;
 
     if (!cxdx_add_vendor_specific_appid(mar, IMS_vendor_id_3GPP, IMS_Cx, 0 /*IMS_Cx*/)) goto error1;

+ 1 - 0
modules/ims_auth/cxdx_mar.h

@@ -55,6 +55,7 @@ struct parsed_maa;
 extern struct cdp_binds cdpb;
 extern str cxdx_forced_peer; /**< FQDN of the Diameter peer to send requests to */
 extern str cxdx_dest_realm;
+extern str cxdx_dest_host;
 extern struct tm_binds tmb;
 
 typedef struct saved_transaction {

+ 6 - 0
modules/ims_auth/doc/ims_auth.xml

@@ -67,6 +67,12 @@
 
       <holder>Smile Communications</holder>
     </copyright>
+
+    <copyright>
+      <year>2015</year>
+
+      <holder>ng-voice GmbH</holder>
+    </copyright>
   </bookinfo>
 
   <toc/>

+ 19 - 1
modules/ims_auth/doc/ims_auth_admin.xml

@@ -244,7 +244,7 @@ modparam("ims_auth", "cxdx_forced_peer", "hss.ims.smilecoms.com")
     <section>
       <title><varname>cxdx_dest_realm</varname> (string)</title>
 
-      <para>Destination realm to be used in Diameter messags to HSS</para>
+      <para>Destination realm to be used in Diameter messages to HSS</para>
 
       <para>Default value is <quote>ims.smilecoms.com</quote>.</para>
 
@@ -259,6 +259,24 @@ modparam("ims_auth", "cxdx_dest_realm", "ims.smilecoms.com")
       </example>
     </section>
 
+    <section>
+      <title><varname>cxdx_dest_host</varname> (string)</title>
+
+      <para>Destination Host to be used in Diameter-MAR messages to HSS</para>
+
+      <para>Default value is <quote></quote> (not set).</para>
+
+      <example>
+        <title><varname>cxdx_dest_host</varname> parameter usage</title>
+
+        <programlisting format="linespecific">
+...
+modparam("ims_auth", "cxdx_dest_host", "hss.ims.ng-voice.com")
+...
+</programlisting>
+      </example>
+    </section>
+
     <section>
       <title><varname>max_nonce_reuse</varname> (integer)</title>