[asterisk-commits] simon.perreault: trunk r281688 - in /trunk: ./ channels/sip/ configs/ include...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 11 08:31:44 CDT 2010
Author: simon.perreault
Date: Wed Aug 11 08:31:39 2010
New Revision: 281688
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281688
Log:
Merged revisions 281687 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r281687 | simon.perreault | 2010-08-11 09:30:59 -0400 (Wed, 11 Aug 2010) | 9 lines
Fix parsing of IPv6 address literals in outboundproxy
(closes issue #17757)
Reported by: oej
Patches:
17757.diff uploaded by sperreault (license 252)
sip.conf.diff uploaded by sperreault (license 252)
Tested by: oej
........
Modified:
trunk/ (props changed)
trunk/channels/sip/config_parser.c
trunk/configs/sip.conf.sample
trunk/include/asterisk/netsock2.h
trunk/main/netsock2.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/channels/sip/config_parser.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sip/config_parser.c?view=diff&rev=281688&r1=281687&r2=281688
==============================================================================
--- trunk/channels/sip/config_parser.c (original)
+++ trunk/channels/sip/config_parser.c Wed Aug 11 08:31:39 2010
@@ -661,16 +661,18 @@
else
line = *hostname;
- if ((port = strrchr(line, ':'))) {
- *port++ = '\0';
-
+ if (ast_sockaddr_split_hostport(line, hostname, &port, 0) == 0) {
+ ast_log(LOG_WARNING, "Cannot parse host '%s' on line %d of sip.conf.\n",
+ line, lineno);
+ return -1;
+ }
+
+ if (port) {
if (!sscanf(port, "%5u", portnum)) {
ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno);
port = NULL;
}
- }
-
- if (!port) {
+ } else {
if (*transport & SIP_TRANSPORT_TLS) {
*portnum = STANDARD_TLS_PORT;
} else {
Modified: trunk/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/trunk/configs/sip.conf.sample?view=diff&rev=281688&r1=281687&r2=281688
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Wed Aug 11 08:31:39 2010
@@ -367,6 +367,10 @@
;outboundproxy=proxy.provider.domain:8080 ; send outbound signaling to this proxy, not directly to the devices
;outboundproxy=proxy.provider.domain,force ; Send ALL outbound signalling to proxy, ignoring route: headers
;outboundproxy=tls://proxy.provider.domain ; same as '=proxy.provider.domain' except we try to connect with tls
+;outboundproxy=192.0.2.1 ; IPv4 address literal (default port is 5060)
+;outboundproxy=2001:db8::1 ; IPv6 address literal (default port is 5060)
+;outboundproxy=192.168.0.2.1:5062 ; IPv4 address literal with explicit port
+;outboundproxy=[2001:db8::1]:5062 ; IPv6 address literal with explicit port
; ; (could also be tcp,udp) - defining transports on the proxy line only
; ; applies for the global proxy, otherwise use the transport= option
;matchexternaddrlocally = yes ; Only substitute the externaddr or externhost setting if it matches
Modified: trunk/include/asterisk/netsock2.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/netsock2.h?view=diff&rev=281688&r1=281687&r2=281688
==============================================================================
--- trunk/include/asterisk/netsock2.h (original)
+++ trunk/include/asterisk/netsock2.h Wed Aug 11 08:31:39 2010
@@ -233,6 +233,26 @@
* \since 1.8
*
* \brief
+ * Splits a string into its host and port components
+ *
+ * \param str[in] The string to parse. May be modified by writing a NUL at the end of
+ * the host part.
+ * \param host[out] Pointer to the host component within \a str.
+ * \param port[out] Pointer to the port component within \a str.
+ * \param flags If set to zero, a port MAY be present. If set to PARSE_PORT_IGNORE, a
+ * port MAY be present but will be ignored. If set to PARSE_PORT_REQUIRE,
+ * a port MUST be present. If set to PARSE_PORT_FORBID, a port MUST NOT
+ * be present.
+ *
+ * \retval 1 Success
+ * \retval 0 Failure
+ */
+int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags);
+
+/*!
+ * \since 1.8
+ *
+ * \brief
* Parse an IPv4 or IPv6 address string.
*
* \details
Modified: trunk/main/netsock2.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/netsock2.c?view=diff&rev=281688&r1=281687&r2=281688
==============================================================================
--- trunk/main/netsock2.c (original)
+++ trunk/main/netsock2.c Wed Aug 11 08:31:39 2010
@@ -118,7 +118,7 @@
return ast_str_buffer(str);
}
-int static _ast_sockaddr_parse(char *str, char **host, char **port, int flags)
+int ast_sockaddr_split_hostport(char *str, char **host, char **port, int flags)
{
char *s = str;
@@ -187,7 +187,7 @@
int e;
s = ast_strdupa(str);
- if (!_ast_sockaddr_parse(s, &host, &port, flags)) {
+ if (!ast_sockaddr_split_hostport(s, &host, &port, flags)) {
return 0;
}
@@ -233,7 +233,7 @@
int e, i, res_cnt;
s = ast_strdupa(str);
- if (!_ast_sockaddr_parse(s, &host, &port, flags)) {
+ if (!ast_sockaddr_split_hostport(s, &host, &port, flags)) {
return 0;
}
More information about the asterisk-commits
mailing list