mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 15:45:25 +00:00
sockaddr.c is now generic
This commit is contained in:
@@ -28,7 +28,7 @@ CDEFINES =
|
|||||||
CWARNINGS =
|
CWARNINGS =
|
||||||
|
|
||||||
UNIXOBJS = unix/app.@O@ unix/time.@O@ unix/stdtime.@O@ \
|
UNIXOBJS = unix/app.@O@ unix/time.@O@ unix/stdtime.@O@ \
|
||||||
unix/socket.@O@ unix/interfaceiter.@O@ unix/sockaddr.@O@
|
unix/socket.@O@ unix/interfaceiter.@O@
|
||||||
|
|
||||||
NLSOBJS = nls/msgcat.@O@
|
NLSOBJS = nls/msgcat.@O@
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ PTHREADOBJS = pthreads/condition.@O@
|
|||||||
OBJS = @ISC_EXTRA_OBJS@ \
|
OBJS = @ISC_EXTRA_OBJS@ \
|
||||||
assertions.@O@ base64.@O@ buffer.@O@ error.@O@ \
|
assertions.@O@ base64.@O@ buffer.@O@ error.@O@ \
|
||||||
heap.@O@ lex.@O@ lib.@O@ mem.@O@ result.@O@ \
|
heap.@O@ lex.@O@ lib.@O@ mem.@O@ result.@O@ \
|
||||||
rwlock.@O@ symtab.@O@ str.@O@ event.@O@ task.@O@ \
|
rwlock.@O@ sockaddr.@O@ symtab.@O@ str.@O@ event.@O@ \
|
||||||
timer.@O@ version.@O@ \
|
task.@O@ timer.@O@ version.@O@ \
|
||||||
${UNIXOBJS} ${NLSOBJS} ${PTHREADOBJS}
|
${UNIXOBJS} ${NLSOBJS} ${PTHREADOBJS}
|
||||||
|
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
|
@@ -25,7 +25,7 @@ CDEFINES =
|
|||||||
CWARNINGS =
|
CWARNINGS =
|
||||||
|
|
||||||
OBJS = app.@O@ time.@O@ stdtime.@O@ socket.@O@ \
|
OBJS = app.@O@ time.@O@ stdtime.@O@ socket.@O@ \
|
||||||
interfaceiter.@O@ sockaddr.@O@
|
interfaceiter.@O@
|
||||||
|
|
||||||
SUBDIRS = include
|
SUBDIRS = include
|
||||||
TARGETS = ${OBJS}
|
TARGETS = ${OBJS}
|
||||||
|
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 1999 Internet Software Consortium.
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
|
|
||||||
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
|
|
||||||
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
|
|
||||||
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
|
||||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
|
|
||||||
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
|
||||||
* SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
|
|
||||||
#include <isc/types.h>
|
|
||||||
#include <isc/assertions.h>
|
|
||||||
#include <isc/error.h>
|
|
||||||
#include <isc/sockaddr.h>
|
|
||||||
|
|
||||||
isc_boolean_t
|
|
||||||
isc_sockaddr_equal(isc_sockaddr_t *a, isc_sockaddr_t *b)
|
|
||||||
{
|
|
||||||
struct sockaddr *sa, *sb;
|
|
||||||
|
|
||||||
sa = (struct sockaddr *)&a->type;
|
|
||||||
sb = (struct sockaddr *)&b->type;
|
|
||||||
|
|
||||||
if (sa->sa_family != sb->sa_family)
|
|
||||||
return (ISC_FALSE);
|
|
||||||
|
|
||||||
#ifdef HAVE_SA_LEN
|
|
||||||
if (sa->sa_len != sb->sa_len)
|
|
||||||
return (ISC_FALSE);
|
|
||||||
if (memcmp(sa->sa_data, sb->sa_data, sa->sa_len) != 0)
|
|
||||||
return (ISC_FALSE);
|
|
||||||
#else
|
|
||||||
switch (sa->sa_family) {
|
|
||||||
case AF_INET: {
|
|
||||||
struct sockaddr_in *sina, *sinb;
|
|
||||||
|
|
||||||
sina = (struct sockaddr_in *)sa;
|
|
||||||
sinb = (struct sockaddr_in *)sb;
|
|
||||||
|
|
||||||
if (sina->sin_port != sinb->sin_port)
|
|
||||||
return (ISC_FALSE);
|
|
||||||
if (memcmp(&sina->sin_addr, &sinb->sin_addr, 4) != 0)
|
|
||||||
return (ISC_FALSE);
|
|
||||||
|
|
||||||
return (ISC_TRUE);
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
INSIST("Unknown socket protocol");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__, "Cannot happen");
|
|
||||||
return (ISC_FALSE);
|
|
||||||
}
|
|
Reference in New Issue
Block a user