瀏覽代碼

nathelper Via header for SIP ping over IPv6 needs square brackets

Olle E. Johansson 10 年之前
父節點
當前提交
274f1034bf
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      modules/nathelper/sip_pinger.h

+ 6 - 0
modules/nathelper/sip_pinger.h

@@ -158,7 +158,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, vaddr.s, vaddr.len);
+	if (s->address.af == AF_INET6) {
+		append_fix( p, "]");
+	}
 	*(p++) = ':';
 	append_str( p, vport.s, vport.len);
 	if (path->len) {