Browse code

nathelper Via header for SIP ping over IPv6 needs square brackets

(cherry picked from commit 274f1034bfb9ea0d52ef291d2f95021ca86f3081)
(cherry picked from commit 74042e3c00edd441e30d7aba25807f99617be375)
(cherry picked from commit c8ef96a8a939b2e3536217d40cfcee9d008611cb)

Olle E. Johansson authored on 07/10/2015 11:44:03 • Daniel-Constantin Mierla committed on 18/12/2015 11:08:03
Showing 1 changed files
... ...
@@ -146,7 +146,13 @@ static inline char* build_sipping(str *curi, struct socket_info* s, str *path,
146 146
 	*(p++) = ' ';
147 147
 	append_str( p, curi->s, curi->len);
148 148
 	append_fix( p, " SIP/2.0"CRLF"Via: SIP/2.0/UDP ");
149
+	if (s->address.af == AF_INET6) {	/* Via header IP is a IPv6 reference */
150
+		append_fix( p, "[");
151
+	}
149 152
 	append_str( p, s->address_str.s, s->address_str.len);
153
+	if (s->address.af == AF_INET6) {
154
+		append_fix( p, "]");
155
+	}
150 156
 	*(p++) = ':';
151 157
 	append_str( p, s->port_no_str.s, s->port_no_str.len);
152 158
 	if (path->len) {