Browse code

ipops: warning when too many dns containers are created

Daniel-Constantin Mierla authored on 06/05/2022 10:46:28
Showing 1 changed files
... ...
@@ -95,6 +95,7 @@ sr_dns_item_t *sr_dns_add_item(str *name)
95 95
 {
96 96
 	sr_dns_item_t *it = NULL;
97 97
 	unsigned int hashid = 0;
98
+	int n = 0;
98 99
 
99 100
 	hashid =  get_hash1_raw(name->s, name->len);
100 101
 
... ...
@@ -105,7 +106,13 @@ sr_dns_item_t *sr_dns_add_item(str *name)
105 106
 				&& strncmp(it->name.s, name->s, name->len)==0)
106 107
 			return it;
107 108
 		it = it->next;
109
+		n++;
108 110
 	}
111
+	if(n > 20) {
112
+		LM_WARN("too many dns containers - adding nunmber %d - can fill memory\n",
113
+				n);
114
+	}
115
+
109 116
 	/* add new */
110 117
 	it = (sr_dns_item_t*)pkg_malloc(sizeof(sr_dns_item_t));
111 118
 	if(it==NULL)