Module: kamailio
Branch: master
Commit: b7dcbc37aceaefecf9a0f7367526a331d42269ea
URL:
https://github.com/kamailio/kamailio/commit/b7dcbc37aceaefecf9a0f7367526a33…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-09-30T12:55:23+02:00
core: socket info - relocate check for index to get more debugging details
---
Modified: src/core/socket_info.c
---
Diff:
https://github.com/kamailio/kamailio/commit/b7dcbc37aceaefecf9a0f7367526a33…
Patch:
https://github.com/kamailio/kamailio/commit/b7dcbc37aceaefecf9a0f7367526a33…
---
diff --git a/src/core/socket_info.c b/src/core/socket_info.c
index 281defecffc..c8782bc0b3f 100644
--- a/src/core/socket_info.c
+++ b/src/core/socket_info.c
@@ -1555,12 +1555,6 @@ static int build_iface_list(void)
rtl = IFA_PAYLOAD(nlp);
index = ifi->ifa_index;
- num++;
- if(index >= MAX_IFACE_NO) {
- LM_ERR("Invalid interface index returned: %d (n: %d) - skip\n",
- index, num);
- continue;
- }
entry = (struct idx *)pkg_malloc(sizeof(struct idx));
if(entry == 0) {
@@ -1627,6 +1621,14 @@ static int build_iface_list(void)
}
}
+ if(index >= MAX_IFACE_NO) {
+ LM_ERR("Invalid interface index returned: %d (n: %d) - skip\n",
+ index, num);
+ pkg_free(entry);
+ continue;
+ }
+ num++;
+
if(strlen(ifaces[index].name) == 0 && strlen(name) > 0) {
memcpy(ifaces[index].name, name, MAX_IF_LEN - 1);
ifaces[index].name[MAX_IF_LEN - 1] = '\0';