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:
@@ -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,
|
||||
|
Reference in New Issue
Block a user