Module: kamailio
Branch: master
Commit: bd40f0d08f5d0f14b301cb492d1082c71be91c50
URL:
https://github.com/kamailio/kamailio/commit/bd40f0d08f5d0f14b301cb492d1082c…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2022-08-02T08:47:52Z
usrloc: fix sending keepalive messages for IPv6, it was missing the brackets
---
Modified: src/modules/usrloc/ul_keepalive.c
---
Diff:
https://github.com/kamailio/kamailio/commit/bd40f0d08f5d0f14b301cb492d1082c…
Patch:
https://github.com/kamailio/kamailio/commit/bd40f0d08f5d0f14b301cb492d1082c…
---
diff --git a/src/modules/usrloc/ul_keepalive.c b/src/modules/usrloc/ul_keepalive.c
index a69a76d8b9..5b1572483b 100644
--- a/src/modules/usrloc/ul_keepalive.c
+++ b/src/modules/usrloc/ul_keepalive.c
@@ -61,7 +61,7 @@ Content-Length: 0\r\n\r\n"
#define ULKA_CALLID_PREFIX_LEN (sizeof(ULKA_CALLID_PREFIX) - 1)
#define ULKA_MSG "%.*s %.*s SIP/2.0\r\n" \
- "Via: SIP/2.0/%.*s %.*s:%.*s;branch=z9hG4bKx.%u.%u.0\r\n" \
+ "Via: SIP/2.0/%.*s %s%.*s%s:%.*s;branch=z9hG4bKx.%u.%u.0\r\n" \
"%s%.*s%.*s" \
"From: <%.*s>;tag=%.*s-%x-%lx-%lx-%x.%x\r\n" \
"To: <sip:%.*s%s%.*s>\r\n" \
@@ -101,6 +101,7 @@ int ul_ka_urecord(urecord_t *ur)
socket_info_t *ssock;
dest_info_t idst;
unsigned int bcnt = 0;
+ unsigned int via_ipv6 = 0;
int aortype = 0;
int i;
struct timeval tv;
@@ -195,8 +196,14 @@ int ul_ka_urecord(urecord_t *ur)
idst.send_sock = ssock;
if(ssock->useinfo.name.len > 0) {
+ if (ssock->useinfo.address.af == AF_INET6) {
+ via_ipv6 = 1;
+ }
vaddr = ssock->useinfo.name;
} else {
+ if (ssock->address.af == AF_INET6) {
+ via_ipv6 = 1;
+ }
vaddr = ssock->address_str;
}
if(ssock->useinfo.port_no > 0) {
@@ -212,7 +219,9 @@ int ul_ka_urecord(urecord_t *ur)
ul_ka_method.len, ul_ka_method.s,
uc->c.len, uc->c.s,
sproto.len, sproto.s,
+ (via_ipv6==1)?"[":"",
vaddr.len, vaddr.s,
+ (via_ipv6==1)?"]":"",
vport.len, vport.s,
_ul_ka_counter, bcnt,
(uc->path.len>0)?"Route: ":"",