Module: kamailio
Branch: master
Commit: 66b3c04a9653425b1602c82dd2456a7eb7cf59d1
URL:
https://github.com/kamailio/kamailio/commit/66b3c04a9653425b1602c82dd2456a7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-04-23T11:19:30+02:00
core: fmsg - parse loopback ip when initializing faked msg structure
- GH #3817
---
Modified: src/core/fmsg.c
---
Diff:
https://github.com/kamailio/kamailio/commit/66b3c04a9653425b1602c82dd2456a7…
Patch:
https://github.com/kamailio/kamailio/commit/66b3c04a9653425b1602c82dd2456a7…
---
diff --git a/src/core/fmsg.c b/src/core/fmsg.c
index 7a4f9ba87e5..b30ca9f69cf 100644
--- a/src/core/fmsg.c
+++ b/src/core/fmsg.c
@@ -25,6 +25,7 @@
#include "dprint.h"
#include "globals.h"
#include "dset.h"
+#include "resolve.h"
#include "fmsg.h"
@@ -57,6 +58,8 @@ static void faked_msg_buf_init(void)
static int faked_msg_init_new(sip_msg_t *fmsg)
{
+ str loip = str_init("127.0.0.1");
+
faked_msg_buf_init();
/* init faked sip msg */
@@ -75,13 +78,9 @@ static int faked_msg_init_new(sip_msg_t *fmsg)
fmsg->rcv.proto = PROTO_UDP;
fmsg->rcv.src_port = 5060;
- fmsg->rcv.src_ip.u.addr32[0] = 0x7f000001;
- fmsg->rcv.src_ip.af = AF_INET;
- fmsg->rcv.src_ip.len = 4;
+ str2ipbuf(&loip, &fmsg->rcv.src_ip);
fmsg->rcv.dst_port = 5060;
- fmsg->rcv.dst_ip.u.addr32[0] = 0x7f000001;
- fmsg->rcv.dst_ip.af = AF_INET;
- fmsg->rcv.dst_ip.len = 4;
+ str2ipbuf(&loip, &fmsg->rcv.dst_ip);
return 0;
}