Module: kamailio
Branch: master
Commit: b81000ca0f3332a00831ce9d6e774027beb4a605
URL:
https://github.com/kamailio/kamailio/commit/b81000ca0f3332a00831ce9d6e77402…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2022-03-30T13:01:03+02:00
evrexec: log src ip and port
---
Modified: src/modules/evrexec/evrexec_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b81000ca0f3332a00831ce9d6e77402…
Patch:
https://github.com/kamailio/kamailio/commit/b81000ca0f3332a00831ce9d6e77402…
---
diff --git a/src/modules/evrexec/evrexec_mod.c b/src/modules/evrexec/evrexec_mod.c
index 71e7c94921..89a189c9c8 100644
--- a/src/modules/evrexec/evrexec_mod.c
+++ b/src/modules/evrexec/evrexec_mod.c
@@ -223,6 +223,8 @@ void evrexec_process_socket(evrexec_task_t *it, int idx)
socklen_t src_addr_len;
ssize_t count;
str evr_data = STR_NULL;
+ char srchostval[NI_MAXHOST];
+ char srcportval[NI_MAXSERV];
if(parse_protohostport(&it->sockaddr, &phostp)<0 || phostp.port==0
|| phostp.host.len>62 || phostp.sport.len>5) {
@@ -273,6 +275,13 @@ void evrexec_process_socket(evrexec_task_t *it, int idx)
}
rcvbuf[count] = '\0';
+ ret = getnameinfo((struct sockaddr *)&src_addr, src_addr_len, srchostval,
+ sizeof(srchostval), srcportval, sizeof(srcportval),
+ NI_NUMERICHOST | NI_NUMERICSERV);
+ if(ret == 0) {
+ LM_DBG("received data from %s port %s\n", srchostval, srcportval);
+ }
+
evr_data.s = rcvbuf;
evr_data.len = (int)count;
pv_evr_data = &evr_data;