Module: kamailio
Branch: 5.4
Commit: 47b45b60a037808a675f7d52dd5b2ee80bfe0868
URL:
https://github.com/kamailio/kamailio/commit/47b45b60a037808a675f7d52dd5b2ee…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2021-03-01T18:31:19+01:00
ipops: use local ip struct for internal resolving
- static structure from core can be overwritten on subsequential use
- GH #2645
(cherry picked from commit 2ce244825bf7bc38f145699209ef7125ae5480d0)
---
Modified: src/modules/ipops/ipops_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/47b45b60a037808a675f7d52dd5b2ee…
Patch:
https://github.com/kamailio/kamailio/commit/47b45b60a037808a675f7d52dd5b2ee…
---
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)