diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index 06c7f9f049..53200519fc 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.h,v 1.47 2000/08/01 01:30:40 tale Exp $ */ +/* $Id: result.h,v 1.48 2000/08/10 23:11:12 bwelling Exp $ */ #ifndef ISC_RESULT_H #define ISC_RESULT_H 1 @@ -70,11 +70,12 @@ #define ISC_R_NOTFILE 44 /* not a file */ #define ISC_R_NOTDIRECTORY 45 /* not a directory */ #define ISC_R_QUEUEFULL 46 /* queue is full */ +#define ISC_R_FAMILY 47 /* address family mismatch */ /* * Not an result code: the number of results. */ -#define ISC_R_NRESULTS 47 +#define ISC_R_NRESULTS 48 ISC_LANG_BEGINDECLS diff --git a/lib/isc/result.c b/lib/isc/result.c index a6d7c33bee..7eeb8b85a4 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: result.c,v 1.46 2000/08/01 01:29:43 tale Exp $ */ +/* $Id: result.c,v 1.47 2000/08/10 23:11:09 bwelling Exp $ */ #include @@ -84,7 +84,8 @@ static const char *text[ISC_R_NRESULTS] = { "invalid use of multicast address", /* 43 */ "not a file", /* 44 */ "not a directory", /* 45 */ - "queue is full" /* 46 */ + "queue is full", /* 46 */ + "address family mismatch" /* 47 */ }; #define ISC_RESULT_RESULTSET 2 diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index fd5e34a40c..c82b1550d2 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: socket.c,v 1.155 2000/08/10 21:47:46 bwelling Exp $ */ +/* $Id: socket.c,v 1.156 2000/08/10 23:11:11 bwelling Exp $ */ #include @@ -134,6 +134,7 @@ struct isc_socket { ISC_LINK(isc_socket_t) link; unsigned int references; int fd; + int pf; isc_result_t recv_result; isc_result_t send_result; @@ -1149,6 +1150,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, if (ret != ISC_R_SUCCESS) return (ret); + sock->pf = pf; switch (type) { case isc_sockettype_udp: sock->fd = socket(pf, SOCK_DGRAM, IPPROTO_UDP); @@ -2575,6 +2577,10 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr) { INSIST(!sock->bound); + if (sock->pf != sockaddr->type.sa.sa_family) { + UNLOCK(&sock->lock); + return(ISC_R_FAMILY); + } if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof on) < 0) { UNEXPECTED_ERROR(__FILE__, __LINE__, "setsockopt(%d) failed",