Module: kamailio
Branch: master
Commit: 26d25b1c9e3654642f9f85c02492297ec1c03e75
URL: https://github.com/kamailio/kamailio/commit/26d25b1c9e3654642f9f85c02492297…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-09-04T00:19:38+02:00
nathelper: docs - added missing xml tags for the new nat test option
---
Modified: src/modules/nathelper/doc/nathelper_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/26d25b1c9e3654642f9f85c02492297…
Patch: https://github.com/kamailio/kamailio/commit/26d25b1c9e3654642f9f85c02492297…
---
diff --git a/src/modules/nathelper/doc/nathelper_admin.xml b/src/modules/nathelper/doc/nathelper_admin.xml
index 71b8e92479..b5a5b08167 100644
--- a/src/modules/nathelper/doc/nathelper_admin.xml
+++ b/src/modules/nathelper/doc/nathelper_admin.xml
@@ -666,6 +666,7 @@ fix_nated_register();
URI port differs from the source port of the request (Warning: this is
might be legal or even intended combination in non NATted scenarios)
</para></listitem>
+ <listitem><para>
<emphasis>256</emphasis> - Test if the SDP connection address is different
from source IP address. It will work also with multiple connection address
lines.
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [x] Commit message has the format required by CONTRIBUTING guide
- [x] Commits are split per component (core, individual modules, libs, utils, ...)
- [x] Each component has a single commit (if not, squash them into one commit)
- [x] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [x] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
test sdp c line and sip source ip address is matched.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2045
-- Commit Summary --
* nathelper: test sdp c line and sip source ip address is matched
* nathelper : flag 256 is added to nathelper documentation
-- File Changes --
M src/modules/nathelper/doc/nathelper_admin.xml (72)
M src/modules/nathelper/nathelper.c (47)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2045.patchhttps://github.com/kamailio/kamailio/pull/2045.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2045
Module: kamailio
Branch: master
Commit: ce3bfaa843f0efabe49bd7087e89506f3f211669
URL: https://github.com/kamailio/kamailio/commit/ce3bfaa843f0efabe49bd7087e89506…
Author: Yasin Caner <caner_yaso(a)hotmail.com>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2019-09-03T23:14:16+02:00
nathelper: extend nat_uac_test() to test for mismatch between connection and source IP (GH #2045)
- extend nat_uac_test function to test for mismatch between connection and source IP
- add documentation for this new flag 256 to module docs as well
- based on pull request GH #2045 with smaller adaptions
---
Modified: src/modules/nathelper/doc/nathelper_admin.xml
Modified: src/modules/nathelper/nathelper.c
---
Diff: https://github.com/kamailio/kamailio/commit/ce3bfaa843f0efabe49bd7087e89506…
Patch: https://github.com/kamailio/kamailio/commit/ce3bfaa843f0efabe49bd7087e89506…
---
diff --git a/src/modules/nathelper/doc/nathelper_admin.xml b/src/modules/nathelper/doc/nathelper_admin.xml
index e3c47e2d70..71b8e92479 100644
--- a/src/modules/nathelper/doc/nathelper_admin.xml
+++ b/src/modules/nathelper/doc/nathelper_admin.xml
@@ -666,6 +666,10 @@ fix_nated_register();
URI port differs from the source port of the request (Warning: this is
might be legal or even intended combination in non NATted scenarios)
</para></listitem>
+ <emphasis>256</emphasis> - Test if the SDP connection address is different
+ from source IP address. It will work also with multiple connection address
+ lines.
+ </para></listitem>
</itemizedlist>
<para>
All flags can be bitwise combined, the test returns true if any of
diff --git a/src/modules/nathelper/nathelper.c b/src/modules/nathelper/nathelper.c
index 27015b7bd8..6baaa64528 100644
--- a/src/modules/nathelper/nathelper.c
+++ b/src/modules/nathelper/nathelper.c
@@ -100,7 +100,7 @@ MODULE_VERSION
#define NAT_UAC_TEST_O_1918 0x20
#define NAT_UAC_TEST_WS 0x40
#define NAT_UAC_TEST_C_PORT 0x80
-
+#define NAT_UAC_TEST_SDP_CLINE 0x100
#define DEFAULT_NATPING_STATE 1
@@ -123,6 +123,7 @@ static int fixup_fix_sdp(void **param, int param_no);
static int fixup_add_contact_alias(void **param, int param_no);
static int add_rcv_param_f(struct sip_msg *, char *, char *);
static int nh_sip_reply_received(sip_msg_t *msg);
+static int test_sdp_cline(struct sip_msg *msg);
static void nh_timer(unsigned int, void *);
static int mod_init(void);
@@ -1332,6 +1333,54 @@ static int contact_rport(struct sip_msg *msg)
}
}
+/**
+* test SDP C line ip address and source IP address match
+* if all ip address matches, return 0
+* returns unmatched ip address count
+* on parse error, returns -1
+*/
+static int test_sdp_cline(struct sip_msg *msg){
+ sdp_session_cell_t* session;
+ struct ip_addr cline_addr;
+ int sdp_session_num = 0;
+ int result = 0;
+
+ if(parse_sdp(msg) < 0) {
+ LM_ERR("Unable to parse sdp body\n");
+ return -1;
+ }
+
+ for(;;){
+ session = get_sdp_session(msg, sdp_session_num);
+ if(!session)
+ break;
+
+ if(!(session->ip_addr.len > 0 && session->ip_addr.s))
+ break;
+
+ if(session->pf==AF_INET){
+ if(str2ipbuf(&session->ip_addr,&cline_addr)<0){
+ LM_ERR("Couldn't get sdp c line IP address\n");
+ return -1;
+ }
+ }else if(session->pf==AF_INET6){
+ if(str2ip6buf(&session->ip_addr, &cline_addr)<0){
+ LM_ERR("Couldn't get sdp c line IP address\n");
+ return -1;
+ }
+ }else{
+ LM_ERR("Couldn't get sdp address type\n");
+ return -1;
+ }
+
+ if(ip_addr_cmp(&msg->rcv.src_ip,&cline_addr)){
+ result++;
+ }
+ sdp_session_num++;
+ }
+
+ return sdp_session_num - result;
+}
/*
* test for occurrence of RFC1918 IP address in SDP
*/
@@ -1441,6 +1490,12 @@ static int nat_uac_test(struct sip_msg *msg, int tests)
if((tests & NAT_UAC_TEST_C_PORT) && (contact_rport(msg) > 0))
return 1;
+ /**
+ * test if sdp c line ip address matches with sip source address
+ */
+ if((tests & NAT_UAC_TEST_SDP_CLINE) && (test_sdp_cline(msg) > 0))
+ return 1;
+
/* no test succeeded */
return -1;
}
<!-- Kamailio Pull Request Template -->
<!--
IMPORTANT:
- for detailed contributing guidelines, read:
https://github.com/kamailio/kamailio/blob/master/.github/CONTRIBUTING.md
- pull requests must be done to master branch, unless they are backports
of fixes from master branch to a stable branch
- backports to stable branches must be done with 'git cherry-pick -x ...'
- code is contributed under BSD for core and main components (tm, sl, auth, tls)
- code is contributed GPLv2 or a compatible license for the other components
- GPL code is contributed with OpenSSL licensing exception
-->
#### Pre-Submission Checklist
<!-- Go over all points below, and after creating the PR, tick all the checkboxes that apply -->
<!-- All points should be verified, otherwise, read the CONTRIBUTING guidelines from above-->
<!-- If you're unsure about any of these, don't hesitate to ask on sr-dev mailing list -->
- [ ] Commit message has the format required by CONTRIBUTING guide
- [ ] Commits are split per component (core, individual modules, libs, utils, ...)
- [ ] Each component has a single commit (if not, squash them into one commit)
- [ ] No commits to README files for modules (changes must be done to docbook files
in `doc/` subfolder, the README file is autogenerated)
#### Type Of Change
- [ ] Small bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds new functionality)
- [ ] Breaking change (fix or feature that would change existing functionality)
#### Checklist:
<!-- Go over all points below, and after creating the PR, tick the checkboxes that apply -->
- [ ] PR should be backported to stable branches
- [ ] Tested changes locally
- [ ] Related to issue #XXXX (replace XXXX with an open issue number)
#### Description
<!-- Describe your changes in detail -->
Issue in fetching resid param fixed for phonenum module
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/2054
-- Commit Summary --
* phonenum_fix
-- File Changes --
M src/modules/phonenum/phonenum_mod.c (2)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/2054.patchhttps://github.com/kamailio/kamailio/pull/2054.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/2054
Related to #2043.
When using the database for dialogs, the `caller_contact` and `callee_contact` columns are too short.
The following seems to help.
```
ALTER TABLE kamailio.dialog ALTER COLUMN caller_contact TYPE varchar(255);
ALTER TABLE kamailio.dialog ALTER COLUMN callee_contact TYPE varchar(255);
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2053