### Description
As per my thread on sr-users: **Active/active keepalived - Kamailio includes non-local virtual IP in "myself" which breaks DMQ call routing**, I am seeing issues due to the behavior of `check_self` and more specifically `grep_sock_info`. I have attached a patch with a proposed new feature that would allow changing this behaviour slightly, although I've avoided changing any default behaviour.
I have a setup with keepalived in active/active mode, with two virtual IPs. The goal …
[View More]is that each VIP is active only one one node at a time, but in the event of a failure, both VIPs would become active on one node.
The issue I am facing is that in order for this to work, I need to have both nodes listen on both virtual IPs at all times, but this means that both nodes always consider traffic to those IPs local to themselves, even when that is not the case. This breaks many things, basically anything with `uri == myself`. But even internally in Kamailio itself, this is causing problems.
For example: PATH support is broken and this is not easily fixed in the config because `lookup()` is actually using `check_self()` internally. I am sure there are many other features which will not work right in the above scenario, and this is why I'm proposing a change in the code itself, instead of just trying to solve it in the config.
I've attached a patch file with my proposed change and would appreciate any feedback as to my overall approach. If this seems OK then I will put together a pull request for your review.
Thanks!
### Expected behavior
Kamailio should detect what IP addresses are currently active locally on it's system before considering the socket a match. If the IP is not currently there, it should ignore the match as if it is not currently listening on this IP (because it really is not!)
#### Actual observed behavior
Right now, Kamailio looks blindly at all "listen" sockets and looks for a match, regardless of if that IP is currently active locally or not, and this causes the false results of `check_self`
### Possible Solutions
As mentioned, I'm attaching a patch showing my overall approach. Basically:
* I am using pre-existing functions as much as possible for best compatibility e.g. IPv6 and IPv4.
* I use `dns_resolvehost()` which seems to have a caching function built-in and so I am hoping the performance impact of my change would be negligible.
* My code only makes a change _if_ the virtual flag is set, and if not, existing behaviour is kept so as to avoid any breaking changes.
[RT59671-kamailio-add-listen-virtual-check2.patch.txt](https://github.com/ka…
--
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2984
You are receiving this because you are subscribed to this thread.
Message ID: <kamailio/kamailio/issues/2984(a)github.com>
[View Less]
Hi,
we are using kamailio with more than 4GB of shared memory. When using 'core.shmem' we are expierencing an integer overflow in the output.
The issue can be found here:
https://github.com/kamailio/kamailio/blob/1ddc27f199061025a6a43da3e8a1388fc…
I currently don't have the time to setup a build environment so I can't fix it myself.
cheers.
--
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/2824
Module: kamailio
Branch: master
Commit: 7162dc0a7368f61e3b32231a2ad00e72ee29d82e
URL: https://github.com/kamailio/kamailio/commit/7162dc0a7368f61e3b32231a2ad00e7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-01-12T17:02:11+01:00
ctl: float/double values are stored over a long long int instead of int
- cope with larger values than MAX_INT/1000, supporint now
up to MAX_LLONG/1000
---
Modified: src/…
[View More]modules/ctl/binrpc.h
---
Diff: https://github.com/kamailio/kamailio/commit/7162dc0a7368f61e3b32231a2ad00e7…
Patch: https://github.com/kamailio/kamailio/commit/7162dc0a7368f61e3b32231a2ad00e7…
---
diff --git a/src/modules/ctl/binrpc.h b/src/modules/ctl/binrpc.h
index cb7204fffd..bb34cd3be5 100644
--- a/src/modules/ctl/binrpc.h
+++ b/src/modules/ctl/binrpc.h
@@ -205,6 +205,31 @@ inline static int binrpc_add_tag(struct binrpc_pkt* pkt, int type, int end)
+/* writes a minimal long long, returns the new offset and sets
+ * len to the number of bytes written (<=8)
+ * to check for oveflow use: returned_value-p != *len
+ * (Note: if *len==0 using the test above succeeds even if p>=end)
+ */
+inline static unsigned char* binrpc_write_llong( unsigned char* p,
+ unsigned char* end,
+ long long i, int *len)
+{
+ int size;
+ unsigned long long u;
+
+ u = (unsigned long long)i;
+
+ for (size=8; size && ((u & (0xffull<<56))==0); u<<=8, size--);
+ *len=size;
+ for(; (p<end) && (size); p++, size--){
+ *p=(unsigned char)(u>>56);
+ u<<=8;
+ }
+ return p;
+}
+
+
+
/* writes a minimal int, returns the new offset and sets
* len to the number of bytes written (<=4)
* to check for oveflow use: returned_value-p != *len
@@ -330,6 +355,23 @@ inline static int binrpc_hdr_change_len(unsigned char* hdr, int hdr_len,
}
+/* int format: size TYPE <val> */
+inline static int binrpc_add_llong_type(struct binrpc_pkt* pkt, long long i, int type)
+{
+
+ unsigned char* p;
+ int size;
+
+ p=binrpc_write_llong(pkt->crt+1, pkt->end, i, &size);
+ if ((pkt->crt>=pkt->end) || ((int)(p-pkt->crt-1)!=size))
+ goto error_len;
+ *(pkt->crt)=(size<<4) | type;
+ pkt->crt=p;
+ return 0;
+error_len:
+ return E_BINRPC_OVERFLOW;
+}
+
/* int format: size BINRPC_T_INT <val> */
inline static int binrpc_add_int_type(struct binrpc_pkt* pkt, int i, int type)
@@ -351,9 +393,9 @@ inline static int binrpc_add_int_type(struct binrpc_pkt* pkt, int i, int type)
/* double format: FIXME: for now a hack: fixed point represented in
- * an int (=> max 3 decimals, < MAX_INT/1000) */
+ * a long long (=> max 3 decimals, < MAX_LLONG/1000) */
#define binrpc_add_double_type(pkt, f, type)\
- binrpc_add_int_type((pkt), (int)((f)*1000), (type))
+ binrpc_add_llong_type((pkt), (long long)((f)*1000), (type))
@@ -516,6 +558,35 @@ static inline int binrpc_addfault( struct binrpc_pkt* pkt,
/* parsing incoming messages */
+static inline unsigned char* binrpc_read_llong( long long* i,
+ int len,
+ unsigned char* s,
+ unsigned char* end,
+ int *err
+ )
+{
+ unsigned char* start;
+ unsigned long long u;
+
+ start=s;
+ *i=0;
+ u = 0;
+ *err=0;
+ for(;len>0; len--, s++){
+ if (s>=end){
+ *err=E_BINRPC_MORE_DATA;
+ *i = (long long)u;
+ return start;
+ }
+ u<<=8;
+ u|=*s;
+ };
+ *i = (long long)u;
+ return s;
+}
+
+
+
static inline unsigned char* binrpc_read_int( int* i,
int len,
unsigned char* s,
@@ -638,8 +709,8 @@ inline static unsigned char* binrpc_read_record(struct binrpc_parse_ctx* ctx,
int end_tag;
int tmp;
unsigned char* p;
- int i;
-
+ long long ll;
+
p=buf;
end_tag=0;
*err=0;
@@ -758,10 +829,10 @@ inline static unsigned char* binrpc_read_record(struct binrpc_parse_ctx* ctx,
}
break;
case BINRPC_T_DOUBLE: /* FIXME: hack: represented as fixed point
- inside an int */
+ inside an long long */
if (ctx->in_struct && smode==0) goto error_record;
- p=binrpc_read_int(&i, len, p, end, err);
- v->u.fval=((double)i)/1000;
+ p=binrpc_read_llong(&ll, len, p, end, err);
+ v->u.fval=((double)ll)/1000;
break;
default:
if (ctx->in_struct){
[View Less]
<!-- 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 …
[View More]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 -->
- [x] 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 -->
- It is allowed to use '@' within a username and/or a password for MySQL.
Database as a Service providers like e.g. Microsoft Azure use
these in usernames by default.
The existing URI parser always treated the '@' as a separator between
username:password and host:port/db parts of the URI.
The parser now checks how many '@' characters are present in the URI
and only treats the last occurence as separator for the host:port/db
part.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1346
-- Commit Summary --
* module_db_mysql: Allow '@' in username/password for db_url URIs
-- File Changes --
M src/modules/db_mysql/my_uri.c (35)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1346.patchhttps://github.com/kamailio/kamailio/pull/1346.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/1346
[View Less]
Hi All,
I’m trying to update the cookbook to document PR #2985, but it looks like I need edit access on the wiki? My username is “rhys”. Can someone give me access?
Thanks!
Rhys Hanrahan | Chief Information Officer
e: rhys(a)nexusone.com.au<mailto:rhys@nexusone.com.au>
[www.nexusone.com.au]<http://www.nexusone.com.au/> [signature_214001646] <http://www.fusiontech.com.au/>
NEXUS ONE | FUSION TECHNOLOGY SOLUTIONS
p: 1800 NEXUS1 (1800 639 871) or 1800 565 845 | a: Suite 12.…
[View More]03 Level 12, 227 Elizabeth Street, Sydney NSW 2000
www.nexusone.com.au<http://www.nexusone.com.au/> | www.fusiontech.com.au<http://www.fusiontech.com.au/>
The information in this email and any accompanying attachments may contain; a. Confidential information of Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or third parties; b. Legally privileged information of Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or third parties; and or c. Copyright material Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd or third parties. If you have received this email in error, please notify the sender immediately and delete this message. Fusion Technology Solutions Pty Ltd, Nexus One Pty Ltd does not accept any responsibility for loss or damage arising from the use or distribution of this email.
Please consider the environment before printing this email.
[View Less]