Module: kamailio
Branch: master
Commit: 2ce244825bf7bc38f145699209ef7125ae5480d0
URL:
https://github.com/kamailio/kamailio/commit/2ce244825bf7bc38f145699209ef712…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-02-23T11:32:21+01:00
ipops: use local ip struct for internal resolving
- static structure from core can be overwritten on subsequential use
- GH #2645
---
Modified: src/modules/ipops/ipops_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2ce244825bf7bc38f145699209ef712…
Patch:
https://github.com/kamailio/kamailio/commit/2ce244825bf7bc38f145699209ef712…
---
diff --git a/src/modules/ipops/ipops_mod.c b/src/modules/ipops/ipops_mod.c
index 13511e4422..cb7422b988 100644
--- a/src/modules/ipops/ipops_mod.c
+++ b/src/modules/ipops/ipops_mod.c
@@ -1098,15 +1098,22 @@ static int ki_is_ip_rfc1918(sip_msg_t* _msg, str* sval)
static inline ip_addr_t *strtoipX(str *ips)
{
+ static ip_addr_t ipb;
+
/* try to figure out INET class */
if(ips->s[0] == '[' || memchr(ips->s, ':', ips->len)!=NULL)
{
/* IPv6 */
- return str2ip6(ips);
+ if(str2ip6buf(ips, &ipb) < 0) {
+ return &ipb;
+ }
} else {
/* IPv4 */
- return str2ip(ips);
+ if (str2ipbuf(ips, &ipb)<0) {
+ return &ipb;
+ }
}
+ return NULL;
}
static int ki_dns_sys_match_ip(sip_msg_t *msg, str *vhn, str *vip)