[sr-dev] git:4.3:74042e3c: nathelper Via header for SIP ping over IPv6 needs square brackets

Olle E. Johansson oej at edvina.net
Wed Oct 7 14:04:53 CEST 2015


Module: kamailio
Branch: 4.3
Commit: 74042e3c00edd441e30d7aba25807f99617be375
URL: https://github.com/kamailio/kamailio/commit/74042e3c00edd441e30d7aba25807f99617be375

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2015-10-07T14:04:27+02:00

nathelper Via header for SIP ping over IPv6 needs square brackets

(cherry picked from commit 274f1034bfb9ea0d52ef291d2f95021ca86f3081)

---

Modified: modules/nathelper/sip_pinger.h

---

Diff:  https://github.com/kamailio/kamailio/commit/74042e3c00edd441e30d7aba25807f99617be375.diff
Patch: https://github.com/kamailio/kamailio/commit/74042e3c00edd441e30d7aba25807f99617be375.patch

---

diff --git a/modules/nathelper/sip_pinger.h b/modules/nathelper/sip_pinger.h
index fc18f96..295fb68 100644
--- a/modules/nathelper/sip_pinger.h
+++ b/modules/nathelper/sip_pinger.h
@@ -146,7 +146,13 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path,
 	*(p++) = ' ';
 	append_str( p, curi->s, curi->len);
 	append_fix( p, " SIP/2.0"CRLF"Via: SIP/2.0/UDP ");
+	if (s->address.af == AF_INET6) {	/* Via header IP is a IPv6 reference */
+		append_fix( p, "[");
+	}
 	append_str( p, s->address_str.s, s->address_str.len);
+	if (s->address.af == AF_INET6) {
+		append_fix( p, "]");
+	}
 	*(p++) = ':';
 	append_str( p, s->port_no_str.s, s->port_no_str.len);
 	if (path->len) {




More information about the sr-dev mailing list