### Description
When receiving packets from an ipv6 full length, $si is empty When trying to listen to an ipv6 full length, kamailio refuses to start, trying to resolve the ipv6 instead of parsing it as an IPv6
There's no problem if the ipv6 in question is not maximum length.
### Troubleshooting
It seems like ip_addr2a() fails to properly parse a 39b length ipv6.
#### Reproduction
reproduced easily by placing calls from an ipv6 containing no 0 or trying to listen to an ipv6 full length.
#### Log Messages
Example packet and log associated:
Aug 13 01:06:42 test-1 /usr/sbin/kamailio[25890]: DEBUG: tls [tls_server.c:477]: tls_accept(): tls_accept: new connection from :52524 using TLSv1.0 ECDHE-RSA-AES256-SHA 256
=> The empty string before the port in that log should be a 39chr long ipv6
Aug 13 01:06:42 test-1 /usr/sbin/kamailio[25890]: WARNING: [INVITE|FROM|TO|/[]:57677=>2600:aaaa:aaaa:aaaa:aa:aa:aa:146:443/tls/22] 610:Empty source ip ?!
=> That is a log generated from the config, which should be $si/$siz before the port 57677 and is empty. There's a test before that log line if ($si == "") { log }
#### SIP Traffic ( Anonymized )
INVITE sip:+TO@DOMAIN;transport=tls SIP/2.0 Via: SIP/2.0/TLS [2607:bbbb:bbbb:bbbb:bbbb:bbbb:bbbb:d5c1]:57677;branch=z9hG4bK.5SSv~9uQw;rport From: "FROM" sip:FROM@DOMAIN;tag=8sei4EB40 To: "TO" sip:+TO@DOMAIN#015#012CSeq: 20 INVITE Call-ID: mA5D5fcZdt#015#012Max-Forwards: 70 Route: sip:DOMAIN:443;lr Supported: replaces, outbound Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO, UPDATE Content-Type: application/sdp Content-Length: 529 Contact: sip:ua@[2607:bbbb:bbbb:bbbb:bbbb:bbbb:bbbb:d5c1]:57677;transport=tls;+sip.instance="urn:uuid:2a1a2139-8ed6-40bd-9352-d804d331a098" User-Agent: UA
v=0 o=#191026873 3487 1810 IN IP6 2607:bbbb:bbbb:bbbb:bbbb:bbbb:bbbb:d5c1 s=Talk c=IN IP6 2607:bbbb:bbbb:bbbb:bbbb:bbbb:bbbb:d5c1 b=AS:380 t=0 0 a=rtcp-xr:rcvr-rtt=all:10000 stat-summary=loss,dup,jitt,TTL voip-metrics m=audio 10712 RTP/AVP 124 117 115 0 101 96 97 a=rtpmap:124 opus/48000/2 a=fmtp:124 useinbandfec=1 a=rtpmap:117 SILK/16000 a=rtpmap:115 SILK/8000 a=rtpmap:101 telephone-event/48000 a=rtpmap:96 telephone-event/16000 a=rtpmap:97 telephone-event/8000 a=rtcp-fb:* trr-int 1000 a=rtcp-fb:* ccm tmmbr#015
### Possible Solutions
Patching src/core/ip_addr.h to change IP6_MAX_STR_SIZE from 39 to 40 fix the issue.
### Additional Information
version: kamailio 5.5.1 (x86_64/linux) ( commit 5ecf17bc2d308141534bdaf3a312704daf0db850 )
* **Operating System**: * Debian 10.10
Can you try with the patch reference above? The issue seems to be the use of inet_ntop() for default IPv6 representation.
Another solution in existing release may be setting `ipv6_hex_style` global parameter to `a` or `A`.
Thank you @miconda , the patch above works perfectly fine.
I backported to the 5.5 branch for the test and no more issues.
Closed #2823.
OK, thanks for testing and feedback. Closing this one, it will be backported.