Browse code

sipdump: make ipv6 addresses without square brackets

Daniel-Constantin Mierla authored on 16/09/2022 11:54:56
Showing 1 changed files
... ...
@@ -226,8 +226,9 @@ int ki_sipdump_send(sip_msg_t *msg, str *stag)
226 226
 	isd.tag = *stag;
227 227
 	isd.protoid = msg->rcv.proto;
228 228
 	isd.afid = msg->rcv.src_ip.af;
229
-	isd.src_ip.len = ip_addr2sbufz(&msg->rcv.src_ip, srcip_buf,
229
+	isd.src_ip.len = ip_addr2sbuf(&msg->rcv.src_ip, srcip_buf,
230 230
 			IP_ADDR_MAX_STRZ_SIZE);
231
+	srcip_buf[isd.src_ip.len] = 0;
231 232
 	isd.src_ip.s = srcip_buf;
232 233
 	isd.src_port = msg->rcv.src_port;
233 234
 	if(msg->rcv.bind_address==NULL
... ...
@@ -340,8 +341,9 @@ int sipdump_msg_received(sr_event_param_t *evp)
340 341
 	isd.protoid = evp->rcv->proto;
341 342
 	isd.afid = (evp->rcv->bind_address!=NULL
342 343
 				&& evp->rcv->bind_address->address.af==AF_INET6)?AF_INET6:AF_INET;
343
-	isd.src_ip.len = ip_addr2sbufz(&evp->rcv->src_ip, srcip_buf,
344
+	isd.src_ip.len = ip_addr2sbuf(&evp->rcv->src_ip, srcip_buf,
344 345
 					IP_ADDR_MAX_STRZ_SIZE);
346
+	srcip_buf[isd.src_ip.len] = '\0';
345 347
 	isd.src_ip.s = srcip_buf;
346 348
 	isd.src_port = evp->rcv->src_port;
347 349
 	if(evp->rcv->bind_address==NULL