2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 06:25:31 +00:00

1681. [bug] Only set SO_REUSEADDR when a port is specified in

isc_socket_bind(). [RT #11742]
This commit is contained in:
Mark Andrews
2004-06-30 23:35:17 +00:00
parent 85609ef4d7
commit 9aa7706900
3 changed files with 15 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
1682. [placeholder] rt5066a
1681. [placeholder] rt11742
1681. [bug] Only set SO_REUSEADDR when a port is specified in
isc_socket_bind(). [RT #11742]
1680. [placeholder] rt11697

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.239 2004/04/19 02:53:05 marka Exp $ */
/* $Id: socket.c,v 1.240 2004/06/30 23:35:16 marka Exp $ */
#include <config.h>
@@ -2859,8 +2859,12 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
UNLOCK(&sock->lock);
return (ISC_R_FAMILYMISMATCH);
}
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on)) < 0) {
/*
* Only set SO_REUSEADDR when we want a specific port.
*/
if (isc_sockaddr_getport(sockaddr) != (in_port_t)0 &&
setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on)) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d) %s", sock->fd,
isc_msgcat_get(isc_msgcat, ISC_MSGSET_GENERAL,

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.33 2004/06/18 01:14:59 marka Exp $ */
/* $Id: socket.c,v 1.34 2004/06/30 23:35:17 marka Exp $ */
/* This code has been rewritten to take advantage of Windows Sockets
* I/O Completion Ports and Events. I/O Completion Ports is ONLY
@@ -3225,7 +3225,11 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) {
UNLOCK(&sock->lock);
return (ISC_R_FAMILYMISMATCH);
}
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
/*
* Only set SO_REUSEADDR when we want a specific port.
*/
if (isc_sockaddr_getport(sockaddr) != (in_port_t)0 &&
setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on,
sizeof(on)) < 0) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"setsockopt(%d) %s", sock->fd,