[sr-dev] git:master: ims_usrloc_pcscf: New hashing_type: "2" Hash over received IP, fallback to Host from contact (especially for NAT)
Carsten Bock
carsten at ng-voice.com
Wed Sep 10 10:42:32 CEST 2014
Module: sip-router
Branch: master
Commit: 6f79459b8aea611acce81468198e0b7e775a51d5
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=6f79459b8aea611acce81468198e0b7e775a51d5
Author: Carsten Bock <carsten at ng-voice.com>
Committer: Carsten Bock <carsten at ng-voice.com>
Date: Wed Sep 10 10:41:42 2014 +0200
ims_usrloc_pcscf: New hashing_type: "2" Hash over received IP, fallback to Host from contact (especially for NAT)
---
.../doc/ims_usrloc_pcscf_admin.xml | 7 +++++--
modules/ims_usrloc_pcscf/pcontact.c | 17 ++++++++++++-----
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/modules/ims_usrloc_pcscf/doc/ims_usrloc_pcscf_admin.xml b/modules/ims_usrloc_pcscf/doc/ims_usrloc_pcscf_admin.xml
index e2707ee..c904b53 100644
--- a/modules/ims_usrloc_pcscf/doc/ims_usrloc_pcscf_admin.xml
+++ b/modules/ims_usrloc_pcscf/doc/ims_usrloc_pcscf_admin.xml
@@ -188,9 +188,12 @@ modparam("ims_usrloc_pcscf", "db_mode", 1)
<para>0 - This uses the original hash over AOR method. By default we
are backwards compatible...</para>
</listitem>
-
<listitem>
- <para>1 - Use the newer hash over IP:PORT.</para>
+ <para>1 - Use the newer hash over the Host from Contact-Header.</para>
+ </listitem>
+ <listitem>
+ <para>2 - Use the newer hash over the source-IP from where the
+ request was received (useful for NAT-Scenarios)</para>
</listitem>
</itemizedlist>
diff --git a/modules/ims_usrloc_pcscf/pcontact.c b/modules/ims_usrloc_pcscf/pcontact.c
index 0a23c3d..907ac5f 100644
--- a/modules/ims_usrloc_pcscf/pcontact.c
+++ b/modules/ims_usrloc_pcscf/pcontact.c
@@ -155,11 +155,6 @@ int new_pcontact(struct udomain* _d, str* _contact, struct pcontact_info* _ci, s
(*_c)->contact_user.s = sip_uri.user.s;
(*_c)->contact_user.len = sip_uri.user.len;
- if (hashing_type==0) {
- (*_c)->aorhash = core_hash(_contact, 0, 0);
- } else {
- (*_c)->aorhash = core_hash(&(*_c)->contact_host, 0, 0);
- }
(*_c)->expires = _ci->expires;
(*_c)->reg_state = _ci->reg_state;
@@ -179,6 +174,18 @@ int new_pcontact(struct udomain* _d, str* _contact, struct pcontact_info* _ci, s
(*_c)->received_proto = _ci->received_proto;
}
+ if (hashing_type==0) {
+ (*_c)->aorhash = core_hash(_contact, 0, 0);
+ } else if (hashing_type==1) {
+ (*_c)->aorhash = core_hash(&(*_c)->contact_host, 0, 0);
+ } else {
+ if ((*_c)->received_host.len > 0) {
+ (*_c)->aorhash = core_hash(&(*_c)->received_host, 0, 0);
+ } else {
+ (*_c)->aorhash = core_hash(&(*_c)->contact_host, 0, 0);
+ }
+ }
+
//setup public ids
for (i=0; i<_ci->num_public_ids; i++) {
if (i>0) is_default = 0; //only the first one is default - P-Associated-uri (first one is default)
More information about the sr-dev
mailing list