summaryrefslogtreecommitdiff
path: root/lib/isc/sockaddr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/isc/sockaddr.c')
-rw-r--r--lib/isc/sockaddr.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c
index 06233757..e9cdc5e4 100644
--- a/lib/isc/sockaddr.c
+++ b/lib/isc/sockaddr.c
@@ -1,21 +1,21 @@
/*
* Copyright (C) 1999, 2000 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.
+ *
+ * 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.
*/
-/* $Id: sockaddr.c,v 1.42.2.1 2000/09/21 22:14:59 gson Exp $ */
+/* $Id: sockaddr.c,v 1.46 2000/08/09 19:09:08 gson Exp $ */
#include <config.h>
@@ -65,9 +65,6 @@ isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
return (ISC_TRUE);
}
-/*
- * Compare just the addresses (ignore ports)
- */
isc_boolean_t
isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
REQUIRE(a != NULL && b != NULL);
@@ -95,11 +92,6 @@ isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
return (ISC_TRUE);
}
-/*
- * Compare just a prefix of the addresses (ignore ports and
- * low address bits)
- */
-
isc_boolean_t
isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
unsigned int prefixlen)
@@ -122,7 +114,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
/*
* Do the port first, giving us the opportunity to check for
- * unsupported address families before calling
+ * unsupported address families before calling
* isc_netaddr_fromsockaddr().
*/
switch (sockaddr->type.sa.sa_family) {
@@ -135,18 +127,18 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
default:
return (ISC_R_FAILURE);
}
-
+
plen = strlen(pbuf);
INSIST(plen < sizeof(pbuf));
-
+
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
result = isc_netaddr_totext(&netaddr, target);
if (result != ISC_R_SUCCESS)
return (result);
-
+
if (1 + plen + 1 > isc_buffer_availablelength(target))
return (ISC_R_NOSPACE);
-
+
isc_buffer_putmem(target, (const unsigned char *)"#", 1);
isc_buffer_putmem(target, (const unsigned char *)pbuf, plen);
@@ -181,10 +173,6 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
const unsigned char *s;
unsigned int h = 0;
unsigned int g;
-
- /*
- * Provide a hash value for 'sockaddr'.
- */
REQUIRE(sockaddr != NULL);
@@ -350,7 +338,7 @@ isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
sockaddr->type.sin.sin_port = htons(port);
break;
case AF_INET6:
- sockaddr->length = sizeof sockaddr->type.sin6;
+ sockaddr->length = sizeof sockaddr->type.sin6;
#ifdef ISC_PLATFORM_HAVESALEN
sockaddr->type.sin6.sin6_len = sizeof sockaddr->type.sin6;
#endif