Author: sf Date: Sat Oct 15 21:11:41 2011 New Revision: 1183717 URL: http://svn.apache.org/viewvc?rev=1183717&view=rev Log: Backport r1183693: Add support for APR_SO_BROADCAST PR: 46389 Submitted by: Armin Müller Modified: apr/apr/branches/1.5.x/ (props changed) apr/apr/branches/1.5.x/CHANGES apr/apr/branches/1.5.x/include/apr_network_io.h apr/apr/branches/1.5.x/network_io/os2/sockopt.c apr/apr/branches/1.5.x/network_io/unix/sockopt.c apr/apr/branches/1.5.x/network_io/win32/sockopt.c Propchange: apr/apr/branches/1.5.x/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Oct 15 21:11:41 2011 @@ -1,2 +1,2 @@ /apr/apr/branches/1.4.x:1101301 -/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838,983618,990435,1055657,1072165,1078845,1183683,1183685-1183686,1183688 +/apr/apr/trunk:733052,747990,748361,748371,748565,748888,748902,748988,749810,760443,782838,783398,783958,784633,784773,788588,793192-793193,794118,794485,795267,799497,800627,809745,809854,810472,811455,813063,821306,829490,831641,835607,908427,910419,917819,917837-917838,983618,990435,1055657,1072165,1078845,1183683,1183685-1183686,1183688,1183693 Modified: apr/apr/branches/1.5.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/CHANGES?rev=1183717&r1=1183716&r2=1183717&view=diff ============================================================================== --- apr/apr/branches/1.5.x/CHANGES [utf-8] (original) +++ apr/apr/branches/1.5.x/CHANGES [utf-8] Sat Oct 15 21:11:41 2011 @@ -1,6 +1,8 @@ -*- coding: utf-8 -*- Changes for APR 1.5.0 + *) apr_socket_opt_set: Add support for APR_SO_BROADCAST. PR 46389. + [Armin Müller ] Changes for APR 1.4.x and later: Modified: apr/apr/branches/1.5.x/include/apr_network_io.h URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/include/apr_network_io.h?rev=1183717&r1=1183716&r2=1183717&view=diff ============================================================================== --- apr/apr/branches/1.5.x/include/apr_network_io.h (original) +++ apr/apr/branches/1.5.x/include/apr_network_io.h Sat Oct 15 21:11:41 2011 @@ -99,6 +99,8 @@ extern "C" { * until data is available. * @see apr_socket_accept_filter */ +#define APR_SO_BROADCAST 65536 /**< Allow broadcast + */ /** @} */ Modified: apr/apr/branches/1.5.x/network_io/os2/sockopt.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/os2/sockopt.c?rev=1183717&r1=1183716&r2=1183717&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/os2/sockopt.c (original) +++ apr/apr/branches/1.5.x/network_io/os2/sockopt.c Sat Oct 15 21:11:41 2011 @@ -58,6 +58,11 @@ APR_DECLARE(apr_status_t) apr_socket_opt return APR_OS2_STATUS(sock_errno()); } } + if (opt & APR_SO_BROADCAST) { + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int)) == -1) { + return APR_FROM_OS_ERROR(sock_errno()); + } + } if (opt & APR_SO_REUSEADDR) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { return APR_OS2_STATUS(sock_errno()); Modified: apr/apr/branches/1.5.x/network_io/unix/sockopt.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/unix/sockopt.c?rev=1183717&r1=1183716&r2=1183717&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/unix/sockopt.c (original) +++ apr/apr/branches/1.5.x/network_io/unix/sockopt.c Sat Oct 15 21:11:41 2011 @@ -141,6 +141,18 @@ apr_status_t apr_socket_opt_set(apr_sock apr_set_option(sock, APR_SO_DEBUG, on); } break; + case APR_SO_BROADCAST: +#ifdef SO_BROADCAST + if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) { + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, (void *)&one, sizeof(int)) == -1) { + return errno; + } + apr_set_option(sock, APR_SO_BROADCAST, on); + } +#else + return APR_ENOTIMPL; +#endif + break; case APR_SO_REUSEADDR: if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { Modified: apr/apr/branches/1.5.x/network_io/win32/sockopt.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/network_io/win32/sockopt.c?rev=1183717&r1=1183716&r2=1183717&view=diff ============================================================================== --- apr/apr/branches/1.5.x/network_io/win32/sockopt.c (original) +++ apr/apr/branches/1.5.x/network_io/win32/sockopt.c Sat Oct 15 21:11:41 2011 @@ -134,6 +134,15 @@ APR_DECLARE(apr_status_t) apr_socket_opt return apr_get_netos_error(); } break; + case APR_SO_BROADCAST: + if (on != apr_is_option_set(sock, APR_SO_BROADCAST)) { + if (setsockopt(sock->socketdes, SOL_SOCKET, SO_BROADCAST, + (void *)&one, sizeof(int)) == -1) { + return apr_get_netos_error(); + } + apr_set_option(sock, APR_SO_BROADCAST, on); + } + break; case APR_SO_REUSEADDR: if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR,