[sr-dev] git:master:274f1034: nathelper Via header for SIP ping over IPv6 needs square brackets

Olle E. Johansson oej at edvina.net
Wed Oct 7 13:44:41 CEST 2015


Module: kamailio
Branch: master
Commit: 274f1034bfb9ea0d52ef291d2f95021ca86f3081
URL: https://github.com/kamailio/kamailio/commit/274f1034bfb9ea0d52ef291d2f95021ca86f3081

Author: Olle E. Johansson <oej at edvina.net>
Committer: Olle E. Johansson <oej at edvina.net>
Date: 2015-10-07T13:44:03+02:00

nathelper Via header for SIP ping over IPv6 needs square brackets

---

Modified: modules/nathelper/sip_pinger.h

---

Diff:  https://github.com/kamailio/kamailio/commit/274f1034bfb9ea0d52ef291d2f95021ca86f3081.diff
Patch: https://github.com/kamailio/kamailio/commit/274f1034bfb9ea0d52ef291d2f95021ca86f3081.patch

---

diff --git a/modules/nathelper/sip_pinger.h b/modules/nathelper/sip_pinger.h
index 9db8144..0ff60b1 100644
--- a/modules/nathelper/sip_pinger.h
+++ b/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) {




More information about the sr-dev mailing list