Browse code

sipdump: make ipv6 addresses without square brackets

(cherry picked from commit ac711cffea91c44f4e13b5d75d6ae01ee4599099)
(cherry picked from commit d3bdffa4f032c250a7834aeb79e5f8629acad777)

Daniel-Constantin Mierla authored on 16/09/2022 11:54:56
Showing 1 changed files
... ...
@@ -212,8 +212,9 @@ int ki_sipdump_send(sip_msg_t *msg, str *stag)
212 212
 	isd.tag = *stag;
213 213
 	isd.protoid = msg->rcv.proto;
214 214
 	isd.afid = msg->rcv.src_ip.af;
215
-	isd.src_ip.len = ip_addr2sbufz(&msg->rcv.src_ip, srcip_buf,
215
+	isd.src_ip.len = ip_addr2sbuf(&msg->rcv.src_ip, srcip_buf,
216 216
 			IP_ADDR_MAX_STRZ_SIZE);
217
+	srcip_buf[isd.src_ip.len] = 0;
217 218
 	isd.src_ip.s = srcip_buf;
218 219
 	isd.src_port = msg->rcv.src_port;
219 220
 	if(msg->rcv.bind_address==NULL
... ...
@@ -326,8 +327,9 @@ int sipdump_msg_received(sr_event_param_t *evp)
326 327
 	isd.protoid = evp->rcv->proto;
327 328
 	isd.afid = (evp->rcv->bind_address!=NULL
328 329
 				&& evp->rcv->bind_address->address.af==AF_INET6)?AF_INET6:AF_INET;
329
-	isd.src_ip.len = ip_addr2sbufz(&evp->rcv->src_ip, srcip_buf,
330
+	isd.src_ip.len = ip_addr2sbuf(&evp->rcv->src_ip, srcip_buf,
330 331
 					IP_ADDR_MAX_STRZ_SIZE);
332
+	srcip_buf[isd.src_ip.len] = '\0';
331 333
 	isd.src_ip.s = srcip_buf;
332 334
 	isd.src_port = evp->rcv->src_port;
333 335
 	if(evp->rcv->bind_address==NULL