[sr-dev] git:master:b81000ca: evrexec: log src ip and port

Daniel-Constantin Mierla miconda at gmail.com
Wed Mar 30 13:01:27 CEST 2022


Module: kamailio
Branch: master
Commit: b81000ca0f3332a00831ce9d6e774027beb4a605
URL: https://github.com/kamailio/kamailio/commit/b81000ca0f3332a00831ce9d6e774027beb4a605

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at 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/b81000ca0f3332a00831ce9d6e774027beb4a605.diff
Patch: https://github.com/kamailio/kamailio/commit/b81000ca0f3332a00831ce9d6e774027beb4a605.patch

---

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;




More information about the sr-dev mailing list