[sr-dev] git:master:e6a551a9: core: added define to set max length for advertised socket info

Daniel-Constantin Mierla miconda at gmail.com
Sun Mar 24 14:11:04 CET 2019


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-03-23T21:54:17+01:00

core: added define to set max length for advertised socket info

- allow different value than the length for socket address
- value set to 255
- GH #1902

---

Modified: src/core/socket_info.c
Modified: src/core/socket_info.h

---

Diff:  https://github.com/kamailio/kamailio/commit/e6a551a913023421af6f5a4dacb87c989f4e95df.diff
Patch: https://github.com/kamailio/kamailio/commit/e6a551a913023421af6f5a4dacb87c989f4e95df.patch

---

diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 0ba1be5fe3..1f2850a67b 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -431,7 +431,7 @@ static int fix_sock_str(struct socket_info* si)
 	si->sock_str.len = len;
 	if(si->useinfo.name.s!=NULL)
 	{
-		len = MAX_SOCKET_STR;
+		len = MAX_SOCKET_ADVERTISE_STR;
 
 		if (si->useinfo.sock_str.s) pkg_free(si->useinfo.sock_str.s);
 
diff --git a/src/core/socket_info.h b/src/core/socket_info.h
index 641d8a2760..d8e23828d9 100644
--- a/src/core/socket_info.h
+++ b/src/core/socket_info.h
@@ -41,6 +41,9 @@
 #define MAX_SOCKET_STR (sizeof("unknown") - 1 + IP_ADDR_MAX_STR_SIZE + \
 	INT2STR_MAX_LEN + 2 + 2)
 
+/* Maximum lenght for advertise string of listen socket */
+#define MAX_SOCKET_ADVERTISE_STR	511
+
 int socket2str(char* s, int* len, struct socket_info* si);
 int socketinfo2str(char* s, int* len, struct socket_info* si, int mode);
 




More information about the sr-dev mailing list