[ntp:bk-ntp-dev-send] BitKeeper patch

Harlan Stenn stenn at whimsy.udel.edu
Mon Jan 10 19:30:01 UTC 2005


This BitKeeper patch contains the following changesets:
mayer at tecotoo.|ChangeSet|20050102232821|41368
mayer at tecotoo.|ChangeSet|20041224232109|43047
mayer at tecotoo.|ChangeSet|20050105023858|41369
mayer at tecotoo.|ChangeSet|20041224035914|44406
mayer at tecotoo.|ChangeSet|20041204032934|25812
mayer at tecotoo.|ChangeSet|20041224231616|43506
mayer at tecotoo.|ChangeSet|20041203015835|26295
mayer at pogo.udel.edu|ChangeSet|20050106032952|41589
mayer at tecotoo.|ChangeSet|20050101231009|41391
mayer at tecotoo.|ChangeSet|20050101230535|42107
mayer at tecotoo.|ChangeSet|20041208013152|25809
mayer at tecotoo.|ChangeSet|20041231035208|41650
mayer at pogo.udel.edu|ChangeSet|20041223202448|34249
mayer at tecotoo.|ChangeSet|20041208004454|25799
mayer at pogo.udel.edu|ChangeSet|20050101054942|43960
mayer at pogo.udel.edu|ChangeSet|20041223051758|33315
mayer at tecotoo.|ChangeSet|20050102031434|41373
mayer at tecotoo.|ChangeSet|20041224232512|43030
mayer at tecotoo.|ChangeSet|20041204033637|25807
mayer at tecotoo.|ChangeSet|20041231035342|41656
mayer at pogo.udel.edu|ChangeSet|20050110043419|38950
mayer at tecotoo.|ChangeSet|20050105051251|41368
mayer at tecotoo.|ChangeSet|20050103021348|41347
mayer at pogo.udel.edu|ChangeSet|20041227163153|43036
mayer at tecotoo.|ChangeSet|20041223051606|33315
mayer at pogo.udel.edu|ChangeSet|20050101054850|43501
mayer at tecotoo.|ChangeSet|20041224231050|43493
mayer at pogo.udel.edu|ChangeSet|20041221133819|42938
mayer at tecotoo.|ChangeSet|20041224034122|32917
mayer at tecotoo.|ChangeSet|20041208004034|25800

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# ID:	stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
# User:	stenn
# Host:	whimsy.udel.edu
# Root:	/deacon/backroom/ntp-dev

#
#--- 1.4/include/isc/ipv6.h	2003-11-08 16:48:51 -05:00
#+++ 1.6/include/isc/ipv6.h	2004-12-24 18:15:54 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: ipv6.h,v 1.19 2002/04/03 06:38:33 marka Exp $ */
#+/* $Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp $ */
# 
# #ifndef ISC_IPV6_H
# #define ISC_IPV6_H 1
#@@ -59,7 +59,7 @@
# /*
#  * We probably don't need this on NTP
#  */
#-#ifdef ISC_ONLY_IPV6
#+#ifdef ISC_ONLY_IPV6 
# /***
#  *** Types.
#  ***/
#
#--- 1.2/include/isc/msgs.h	2003-07-26 15:36:11 -04:00
#+++ 1.3/include/isc/msgs.h	2005-01-01 18:09:48 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 2000, 2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 2000-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: msgs.h,v 1.7 2002/05/27 00:40:18 marka Exp $ */
#+/* $Id: msgs.h,v 1.5.2.2.8.3 2004/03/06 08:14:44 marka Exp $ */
# 
# #ifndef ISC_MSGS_H
# #define ISC_MSGS_H 1
#@@ -48,6 +48,7 @@
# #define ISC_MSGSET_TASK		18
# #define ISC_MSGSET_TIMER	19
# #define ISC_MSGSET_UTIL		20
#+#define ISC_MSGSET_IFITERGETIFADDRS 21
# 
# /*
#  * Message numbers.  They are only required to be unique per message set,
#@@ -176,6 +177,7 @@
# #define ISC_MSG_UTILWAIT       1710 /* "WAIT" */
# #define ISC_MSG_WAITED	       1711 /* "WAITED" */
# 
#+#define ISC_MSG_GETIFADDRS     1801 /* "getting interface addresses: ..." */
# 
# 
# #endif /* ISC_MSGS_H */
#
#--- 1.4/include/isc/net.h	2003-07-26 15:36:12 -04:00
#+++ 1.6/include/isc/net.h	2004-12-23 15:23:28 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: net.h,v 1.34 2002/04/03 06:38:38 marka Exp $ */
#+/* $Id: net.h,v 1.31.2.2.10.8 2004/04/29 01:31:23 marka Exp $ */
# 
# #ifndef ISC_NET_H
# #define ISC_NET_H 1
#@@ -75,6 +75,8 @@
# #include <sys/types.h>
# #include <sys/socket.h>		/* Contractual promise. */
# 
#+#include <net/if.h>
#+
# #include <netinet/in.h>		/* Contractual promise. */
# #include <arpa/inet.h>		/* Contractual promise. */
# #ifdef ISC_PLATFORM_NEEDNETINETIN6H
#@@ -230,6 +232,10 @@
# 		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
# 		 == ISC__IPADDR(0xe0000000))
# 
#+#define ISC_IPADDR_ISEXPERIMENTAL(i) \
#+		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
#+		 == ISC__IPADDR(0xf0000000))
#+
# /***
#  *** Functions.
#  ***/
#@@ -245,6 +251,7 @@
#  *
#  *	ISC_R_SUCCESS		IPv4 is supported.
#  *	ISC_R_NOTFOUND		IPv4 is not supported.
#+ *	ISC_R_DISABLED		IPv4 is disabled.
#  *	ISC_R_UNEXPECTED
#  */
# 
#@@ -257,25 +264,63 @@
#  *
#  *	ISC_R_SUCCESS		IPv6 is supported.
#  *	ISC_R_NOTFOUND		IPv6 is not supported.
#+ *	ISC_R_DISABLED		IPv6 is disabled.
#  *	ISC_R_UNEXPECTED
#  */
# 
#+isc_result_t
#+isc_net_probe_ipv6only(void);
#+/*
#+ * Check if the system's kernel supports the IPV6_V6ONLY socket option.
#+ *
#+ * Returns:
#+ *
#+ *	ISC_R_SUCCESS		the option is supported for both TCP and UDP.
#+ *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
#+ *	ISC_R_UNEXPECTED
#+ */
#+
#+isc_result_t
#+isc_net_probe_ipv6pktinfo(void);
#+/*
#+ * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option
#+ * for UDP sockets.
#+ *
#+ * Returns:
#+ *
#+ *	ISC_R_SUCCESS		the option is supported.
#+ *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
#+ *	ISC_R_UNEXPECTED
#+ */
#+
#+void
#+isc_net_disableipv4(void);
#+
#+void
#+isc_net_disableipv6(void);
#+
#+void
#+isc_net_enableipv4(void);
#+
#+void
#+isc_net_enableipv6(void);
#+
#+#ifdef ISC_PLATFORM_NEEDNTOP
# const char *
# isc_net_ntop(int af, const void *src, char *dst, size_t size);
#-#ifdef ISC_PLATFORM_NEEDNTOP
# #define inet_ntop isc_net_ntop
# #endif
# 
#+#ifdef ISC_PLATFORM_NEEDPTON
# int
# isc_net_pton(int af, const char *src, void *dst);
#-#ifdef ISC_PLATFORM_NEEDPTON
# #undef inet_pton
# #define inet_pton isc_net_pton
# #endif
# 
#+#ifdef ISC_PLATFORM_NEEDATON
# int
# isc_net_aton(const char *cp, struct in_addr *addr);
#-#ifdef ISC_PLATFORM_NEEDATON
# #define inet_aton isc_net_aton
# #endif
# 
#
#--- 1.3/include/isc/netaddr.h	2003-07-26 15:36:12 -04:00
#+++ 1.4/include/isc/netaddr.h	2004-12-23 00:15:11 -05:00
#@@ -1,21 +1,21 @@
# /*
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#  * Copyright (C) 1998-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: netaddr.h,v 1.21 2002/04/03 06:38:35 marka Exp $ */
#+/* $Id: netaddr.h,v 1.18.12.7 2004/03/08 09:04:52 marka Exp $ */
# 
# #ifndef ISC_NETADDR_H
# #define ISC_NETADDR_H 1
#@@ -23,9 +23,6 @@
# #include <isc/lang.h>
# #include <isc/net.h>
# #include <isc/types.h>
#-#include "ntp_rfc2553.h"
#-
#-
# 
# ISC_LANG_BEGINDECLS
# 
#@@ -35,6 +32,7 @@
#     		struct in_addr in;
# 		struct in6_addr in6;
# 	} type;
#+	isc_uint32_t zone;
# };
# 
# isc_boolean_t
#@@ -98,6 +96,12 @@
# isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6);
# 
# void
#+isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone);
#+
#+isc_uint32_t
#+isc_netaddr_getzone(const isc_netaddr_t *netaddr);
#+
#+void
# isc_netaddr_any(isc_netaddr_t *netaddr);
# /*
#  * Return the IPv4 wildcard address.
#@@ -113,6 +117,12 @@
# isc_netaddr_ismulticast(isc_netaddr_t *na);
# /*
#  * Returns ISC_TRUE if the address is a multicast address.
#+ */
#+
#+isc_boolean_t
#+isc_netaddr_isexperimental(isc_netaddr_t *na);
#+/*
#+ * Returns ISC_TRUE if the address is a experimental (CLASS E) address.
#  */
# 
# isc_boolean_t
#
#--- 1.2/include/isc/result.h	2003-07-26 15:36:14 -04:00
#+++ 1.3/include/isc/result.h	2004-12-23 00:15:12 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1998-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1998-2001, 2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: result.h,v 1.59 2001/11/30 01:02:17 gson Exp $ */
#+/* $Id: result.h,v 1.57.2.2.8.5 2004/05/15 03:46:13 jinmei Exp $ */
# 
# #ifndef ISC_RESULT_H
# #define ISC_RESULT_H 1
#@@ -80,11 +80,14 @@
# #define ISC_R_CONNECTIONRESET		54	/* connection reset */
# #define ISC_R_SOFTQUOTA			55	/* soft quota reached */
# #define ISC_R_BADNUMBER			56	/* not a valid number */
#+#define ISC_R_DISABLED			57	/* disabled */
#+#define ISC_R_MAXSIZE			58	/* max size */
#+#define ISC_R_BADADDRESSFORM		59	/* invalid address format */
# 
# /*
#  * Not a result code: the number of results.
#  */
#-#define ISC_R_NRESULTS 			57
#+#define ISC_R_NRESULTS 			60
# 
# ISC_LANG_BEGINDECLS
# 
#
#--- 1.2/include/isc/sockaddr.h	2003-07-26 15:36:14 -04:00
#+++ 1.3/include/isc/sockaddr.h	2004-12-23 00:15:12 -05:00
#@@ -174,6 +174,12 @@
#  */
# 
# isc_boolean_t
#+isc_sockaddr_isexperimental(isc_sockaddr_t *sa);
#+/*
#+ * Returns ISC_TRUE if the address is a experimental (CLASS E) address.
#+ */
#+
#+isc_boolean_t
# isc_sockaddr_islinklocal(isc_sockaddr_t *sa);
# /*
#  * Returns ISC_TRUE if the address is a link local addresss.
#
#--- 1.18/libisc/ifiter_ioctl.c	2004-01-08 18:20:39 -05:00
#+++ 1.21/libisc/ifiter_ioctl.c	2005-01-01 22:14:04 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: ifiter_ioctl.c,v 1.34 2002/08/16 00:05:57 marka Exp $ */
#+/* $Id: ifiter_ioctl.c,v 1.19.2.5.2.14 2004/06/22 04:40:23 marka Exp $ */
# 
# /*
#  * Obtain the list of network interfaces using the SIOCGLIFCONF ioctl.
#@@ -51,22 +51,40 @@
# #define IFITER_MAGIC		ISC_MAGIC('I', 'F', 'I', 'T')
# #define VALID_IFITER(t)		ISC_MAGIC_VALID(t, IFITER_MAGIC)
# 
#+#define ISC_IF_INET6_SZ \
#+    sizeof("00000000000000000000000000000001 01 80 10 80 XXXXXXloXXXXXXXX\n")
#+
# struct isc_interfaceiter {
# 	unsigned int		magic;		/* Magic number. */
# 	isc_mem_t		*mctx;
#-	int			socket;
# 	int			mode;
#+	int			socket;
# 	struct ifconf 		ifc;
#+	void			*buf;		/* Buffer for sysctl data. */
#+	unsigned int		bufsize;	/* Bytes allocated. */
#+	unsigned int		pos;		/* Current offset in
#+						   SIOCGIFCONF data */
# #if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	int			socket6;
# 	struct LIFCONF 		lifc;
#+	void			*buf6;		/* Buffer for sysctl data. */
#+	unsigned int		bufsize6;	/* Bytes allocated. */
#+	unsigned int		pos6;		/* Current offset in
#+						   SIOCGLIFCONF data */
#+	isc_result_t		result6;	/* Last result code. */
#+	isc_boolean_t		first6;
# #endif
#-	void			*buf;		/* Buffer for sysctl data. */
#-	unsigned int		bufsize;	/* Bytes allocated. */
# #ifdef HAVE_TRUCLUSTER
# 	int			clua_context;	/* Cluster alias context */
#+	isc_boolean_t		clua_done;
#+	struct sockaddr		clua_sa;
#+#endif
#+#ifdef	__linux
#+	FILE *			proc;
#+	char			entry[ISC_IF_INET6_SZ];
#+	isc_result_t		valid;
#+	isc_boolean_t		first;
# #endif
#-	unsigned int		pos;		/* Current offset in
#-						   SIOCGLIFCONF data */
# 	isc_interface_t		current;	/* Current interface data. */
# 	isc_result_t		result;		/* Last result code. */
# };
#@@ -84,6 +102,16 @@
# #define IFCONF_BUFSIZE_INITIAL	4096
# #define IFCONF_BUFSIZE_MAX	1048576
# 
#+#ifdef __linux
#+#ifndef IF_NAMESIZE
#+# ifdef IFNAMSIZ
#+#  define IF_NAMESIZE  IFNAMSIZ  
#+# else
#+#  define IF_NAMESIZE 16
#+# endif
#+#endif
#+#endif
#+
# static isc_result_t
# getbuf4(isc_interfaceiter_t *iter) {
# 	char strbuf[ISC_STRERRORSIZE];
#@@ -148,7 +176,6 @@
# 
# 		iter->bufsize *= 2;
# 	}
#-	iter->mode = 4;
# 	return (ISC_R_SUCCESS);
# 
#  unexpected:
#@@ -157,37 +184,34 @@
# 	return (ISC_R_UNEXPECTED);
# }
# 
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
# static isc_result_t
# getbuf6(isc_interfaceiter_t *iter) {
#-#if !defined(SIOCGLIFCONF) || !defined(SIOCGLIFADDR)
#-	UNUSED(iter);
#-	return (ISC_R_NOTIMPLEMENTED);
#-#else
# 	char strbuf[ISC_STRERRORSIZE];
# 	isc_result_t result;
# 
#-	iter->bufsize = IFCONF_BUFSIZE_INITIAL;
#+	iter->bufsize6 = IFCONF_BUFSIZE_INITIAL;
# 
# 	for (;;) {
#-		iter->buf = isc_mem_get(iter->mctx, iter->bufsize);
#-		if (iter->buf == NULL)
#+		iter->buf6 = isc_mem_get(iter->mctx, iter->bufsize6);
#+		if (iter->buf6 == NULL)
# 			return (ISC_R_NOMEMORY);
# 
#-		memset(&iter->lifc.lifc_len, 0, sizeof(iter->lifc.lifc_len));
#+		memset(&iter->lifc, 0, sizeof(iter->lifc));
# #ifdef ISC_HAVE_LIFC_FAMILY
#-		iter->lifc.lifc_family = AF_UNSPEC;
#+		iter->lifc.lifc_family = AF_INET6;
# #endif
# #ifdef ISC_HAVE_LIFC_FLAGS
# 		iter->lifc.lifc_flags = 0;
# #endif
#-		iter->lifc.lifc_len = iter->bufsize;
#-		iter->lifc.lifc_buf = iter->buf;
#+		iter->lifc.lifc_len = iter->bufsize6;
#+		iter->lifc.lifc_buf = iter->buf6;
# 		/*
# 		 * Ignore the HP/UX warning about "integer overflow during
# 		 * conversion".  It comes from its own macro definition,
# 		 * and is really hard to shut up.
# 		 */
#-		if (ioctl(iter->socket, SIOCGLIFCONF, (char *)&iter->lifc)
#+		if (ioctl(iter->socket6, SIOCGLIFCONF, (char *)&iter->lifc)
# 		    == -1) {
# #ifdef __hpux
# 			/*
#@@ -233,10 +257,10 @@
# 			 * retry.
# 			 */
# 			if (iter->lifc.lifc_len + 2 * sizeof(struct LIFREQ)
#-			    < iter->bufsize)
#+			    < iter->bufsize6)
# 				break;
# 		}
#-		if (iter->bufsize >= IFCONF_BUFSIZE_MAX) {
#+		if (iter->bufsize6 >= IFCONF_BUFSIZE_MAX) {
# 			UNEXPECTED_ERROR(__FILE__, __LINE__,
# 					 isc_msgcat_get(isc_msgcat,
# 							ISC_MSGSET_IFITERIOCTL,
#@@ -248,20 +272,21 @@
# 			result = ISC_R_UNEXPECTED;
# 			goto cleanup;
# 		}
#-		isc_mem_put(iter->mctx, iter->buf, iter->bufsize);
#+		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
# 
#-		iter->bufsize *= 2;
#+		iter->bufsize6 *= 2;
# 	}
# 
#-	iter->mode = 6;
#+	if (iter->lifc.lifc_len != 0)
#+		iter->mode = 6;
# 	return (ISC_R_SUCCESS);
# 
#  cleanup:
#-	isc_mem_put(iter->mctx, iter->buf, iter->bufsize);
#-	iter->buf = NULL;
#+	isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
#+	iter->buf6 = NULL;
# 	return (result);
#-#endif
# }
#+#endif
# 
# isc_result_t
# isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
#@@ -277,12 +302,48 @@
# 		return (ISC_R_NOMEMORY);
# 
# 	iter->mctx = mctx;
#+	iter->mode = 4;
# 	iter->buf = NULL;
#-	iter->mode = 0;
#+	iter->pos = (unsigned int) -1;
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	iter->buf6 = NULL;
#+	iter->pos6 = (unsigned int) -1;
#+	iter->result6 = ISC_R_NOMORE;
#+	iter->socket6 = -1;
#+	iter->first6 = ISC_FALSE;
#+#endif
# 
# 	/*
#-	 * Create an unbound datagram socket to do the SIOCGLIFADDR ioctl on.
#+	 * Get the interface configuration, allocating more memory if
#+	 * necessary.
# 	 */
#+
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	result = isc_net_probeipv6();
#+	if (result == ISC_R_SUCCESS) {
#+		/*
#+		 * Create an unbound datagram socket to do the SIOCGLIFCONF
#+		 * ioctl on.  HP/UX requires an AF_INET6 socket for
#+		 * SIOCGLIFCONF to get IPv6 addresses.
#+		 */
#+		if ((iter->socket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
#+			isc__strerror(errno, strbuf, sizeof(strbuf));
#+			UNEXPECTED_ERROR(__FILE__, __LINE__,
#+					 isc_msgcat_get(isc_msgcat,
#+							ISC_MSGSET_IFITERIOCTL,
#+							ISC_MSG_MAKESCANSOCKET,
#+							"making interface "
#+							"scan socket: %s"),
#+					 strbuf);
#+			result = ISC_R_UNEXPECTED;
#+			goto socket6_failure;
#+		}
#+		iter->result6 = getbuf6(iter);
#+		if (iter->result6 != ISC_R_NOTIMPLEMENTED &&
#+		    iter->result6 != ISC_R_SUCCESS)
#+			goto ioctl6_failure;
#+	}
#+#endif
# 	if ((iter->socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
# 		isc__strerror(errno, strbuf, sizeof(strbuf));
# 		UNEXPECTED_ERROR(__FILE__, __LINE__,
#@@ -295,17 +356,7 @@
# 		result = ISC_R_UNEXPECTED;
# 		goto socket_failure;
# 	}
#-
#-	/*
#-	 * Get the interface configuration, allocating more memory if
#-	 * necessary.
#-	 */
#-
#-	result = isc_net_probeipv6();
#-	if (result == ISC_R_SUCCESS)
#-		result = getbuf6(iter);
#-	if (result != ISC_R_SUCCESS)
#-		result = getbuf4(iter);
#+	result = getbuf4(iter);
# 	if (result != ISC_R_SUCCESS)
# 		goto ioctl_failure;
# 
#@@ -315,8 +366,13 @@
# 	 */
# #ifdef HAVE_TRUCLUSTER
# 	iter->clua_context = -1;
#+	iter->clua_done = ISC_TRUE;
#+#endif
#+#ifdef __linux
#+	iter->proc = fopen("/proc/net/if_inet6", "r");
#+	iter->valid = ISC_R_FAILURE;
#+	iter->first = ISC_FALSE;
# #endif
#-	iter->pos = (unsigned int) -1;
# 	iter->result = ISC_R_FAILURE;
# 
# 	iter->magic = IFITER_MAGIC;
#@@ -329,6 +385,15 @@
# 	(void) close(iter->socket);
# 
#  socket_failure:
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	if (iter->buf6 != NULL)
#+		isc_mem_put(mctx, iter->buf6, iter->bufsize6);
#+  ioctl6_failure:
#+	if (iter->socket6 != -1)
#+		(void) close(iter->socket6);
#+  socket6_failure:
#+#endif
#+ 
# 	isc_mem_put(mctx, iter, sizeof(*iter));
# 	return (result);
# }
#@@ -342,21 +407,97 @@
# 
# static isc_result_t
# internal_current_clusteralias(isc_interfaceiter_t *iter) {
#-	struct sockaddr sa;
# 	struct clua_info ci;
#-	while (clua_getaliasaddress(&sa, &iter->clua_context) == CLUA_SUCCESS) {
#-		if (clua_getaliasinfo(&sa, &ci) != CLUA_SUCCESS)
#-			continue;
#-		memset(&iter->current, 0, sizeof(iter->current));
#-		iter->current.af = sa.sa_family;
#-		memset(iter->current.name, 0, sizeof(iter->current.name));
#-		sprintf(iter->current.name, "clua%d", ci.aliasid);
#-		iter->current.flags = INTERFACE_F_UP;
#-		get_inaddr(&iter->current.address, &ci.addr);
#-		get_inaddr(&iter->current.netmask, &ci.netmask);
#-		return (ISC_R_SUCCESS);
#+	if (clua_getaliasinfo(&iter->clua_sa, &ci) != CLUA_SUCCESS)
#+		return (ISC_R_IGNORE);
#+	memset(&iter->current, 0, sizeof(iter->current));
#+	iter->current.af = iter->clua_sa.sa_family;
#+	memset(iter->current.name, 0, sizeof(iter->current.name));
#+	sprintf(iter->current.name, "clua%d", ci.aliasid);
#+	iter->current.flags = INTERFACE_F_UP;
#+	get_inaddr(&iter->current.address, &ci.addr);
#+	get_inaddr(&iter->current.netmask, &ci.netmask);
#+	return (ISC_R_SUCCESS);
#+}
#+#endif
#+
#+#ifdef __linux
#+static isc_result_t
#+linux_if_inet6_next(isc_interfaceiter_t *iter) {
#+	if (iter->proc != NULL &&
#+	    fgets(iter->entry, sizeof(iter->entry), iter->proc) != NULL)
#+		iter->valid = ISC_R_SUCCESS;
#+	else
#+		iter->valid = ISC_R_NOMORE;
#+	return (iter->valid);
#+}
#+
#+static void
#+linux_if_inet6_first(isc_interfaceiter_t *iter) {
#+	if (iter->proc != NULL) {
#+		rewind(iter->proc);
#+		(void)linux_if_inet6_next(iter);
#+	} else
#+		iter->valid = ISC_R_NOMORE;
#+	iter->first = ISC_FALSE;
#+}
#+
#+static isc_result_t
#+linux_if_inet6_current(isc_interfaceiter_t *iter) {
#+	char address[33];
#+	char name[IF_NAMESIZE+1];
#+	struct in6_addr addr6;
#+	int ifindex, prefix, flag3, flag4;
#+	int res;
#+	unsigned int i;
#+
#+	if (iter->valid != ISC_R_SUCCESS)
#+		return (iter->valid);
#+	if (iter->proc == NULL) {
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+			      "/proc/net/if_inet6:iter->proc == NULL");
#+		return (ISC_R_FAILURE);
#+	}
#+
#+	res = sscanf(iter->entry, "%32[a-f0-9] %x %x %x %x %16s\n",
#+		     address, &ifindex, &prefix, &flag3, &flag4, name);
#+	if (res != 6) {
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+			      "/proc/net/if_inet6:sscanf() -> %d (expected 6)",
#+			      res);
#+		return (ISC_R_FAILURE);
# 	}
#-	return (ISC_R_NOMORE);
#+	if (strlen(address) != 32) {
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+			      "/proc/net/if_inet6:strlen(%s) != 32", address);
#+		return (ISC_R_FAILURE);
#+	}
#+	for (i = 0; i < 16; i++) {
#+		unsigned char byte;
#+		static const char hex[] = "0123456789abcdef";
#+		byte = ((index(hex, address[i * 2]) - hex) << 4) |
#+		       (index(hex, address[i * 2 + 1]) - hex);
#+		addr6.s6_addr[i] = byte;
#+	}
#+	iter->current.af = AF_INET6;
#+	iter->current.flags = INTERFACE_F_UP;
#+	isc_netaddr_fromin6(&iter->current.address, &addr6);
#+	if (isc_netaddr_islinklocal(&iter->current.address)) {
#+		isc_netaddr_setzone(&iter->current.address,
#+				    (isc_uint32_t)ifindex);
#+	}
#+	for (i = 0; i < 16; i++) {
#+		if (prefix > 8) {
#+			addr6.s6_addr[i] = 0xff;
#+			prefix -= 8;
#+		} else {
#+			addr6.s6_addr[i] = (0xff << (8 - prefix)) & 0xff;
#+			prefix = 0;
#+		}
#+	}
#+	isc_netaddr_fromin6(&iter->current.netmask, &addr6);
#+	strncpy(iter->current.name, name, sizeof(iter->current.name));
#+	return (ISC_R_SUCCESS);
# }
# #endif
# 
#@@ -374,22 +515,33 @@
# 	struct ifreq ifreq;
# 	int family;
# 	char strbuf[ISC_STRERRORSIZE];
#-#if !defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#-	struct if_laddrreq if_laddrreq;
#-	int i, bits;
#+#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
#+	struct lifreq lifreq;
#+#else
#+	char sabuf[256];
#+#endif
#+	int i, bits, prefixlen;
#+#ifdef __linux
#+	isc_result_t result;
# #endif
# 
# 	REQUIRE(VALID_IFITER(iter));
# 	REQUIRE (iter->pos < (unsigned int) iter->ifc.ifc_len);
# 
#+#ifdef __linux
#+	result = linux_if_inet6_current(iter);
#+	if (result != ISC_R_NOMORE)
#+		return (result);
#+	iter->first = ISC_TRUE;
#+#endif
#+
# 	ifrp = (struct ifreq *)((char *) iter->ifc.ifc_req + iter->pos);
# 
# 	memset(&ifreq, 0, sizeof(ifreq));
# 	memcpy(&ifreq, ifrp, sizeof(ifreq));
# 
# 	family = ifreq.ifr_addr.sa_family;
#-#if !defined (SIOCGLIFCONF) && defined(SIOCGLIFADDR) && \
#-    defined(ISC_PLATFORM_HAVEIPV6)
#+#if defined(ISC_PLATFORM_HAVEIPV6)
# 	if (family != AF_INET && family != AF_INET6)
# #else
# 	if (family != AF_INET)
#@@ -403,18 +555,8 @@
# 	memset(iter->current.name, 0, sizeof(iter->current.name));
# 	memcpy(iter->current.name, ifreq.ifr_name, sizeof(ifreq.ifr_name));
# 
#-	/* Some older O/S's don't have the interface index. Since ifr_index is
#-	 * usually a macro definition into the actual structure we
#-	 * use that to determine if we should get it.
#-	 */
#-#ifdef ifr_index
#-	iter->current.ifindex = ifreq.ifr_index;	/* Save the if index */
#-#else
#-	iter->current.ifindex = 0;
#-#endif
#-
# 	get_addr(family, &iter->current.address,
#-		 (struct sockaddr *)&ifrp->ifr_addr);
#+		 (struct sockaddr *)&ifrp->ifr_addr, ifreq.ifr_name);
# 
# 	/*
# 	 * If the interface does not have a address ignore it.
#@@ -453,8 +595,10 @@
# 	if ((ifreq.ifr_flags & IFF_UP) != 0)
# 		iter->current.flags |= INTERFACE_F_UP;
# 
#+#ifdef IFF_POINTOPOINT
# 	if ((ifreq.ifr_flags & IFF_POINTOPOINT) != 0)
# 		iter->current.flags |= INTERFACE_F_POINTTOPOINT;
#+#endif
# 
# 	if ((ifreq.ifr_flags & IFF_LOOPBACK) != 0)
# 		iter->current.flags |= INTERFACE_F_LOOPBACK;
#@@ -469,44 +613,54 @@
# 	}
# #endif
# 
#-#if !defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#-	if (family == AF_INET) 
#+	if (family == AF_INET)
# 		goto inet;
# 
#-	memset(&if_laddrreq, 0, sizeof(if_laddrreq));
#-	memcpy(if_laddrreq.iflr_name, iter->current.name,
#-	       sizeof(if_laddrreq.iflr_name));
#-	memcpy(&if_laddrreq.addr, &iter->current.address.type.in6,
#+#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
#+	memset(&lifreq, 0, sizeof(lifreq));
#+	memcpy(lifreq.lifr_name, iter->current.name, sizeof(lifreq.lifr_name));
#+	memcpy(&lifreq.lifr_addr, &iter->current.address.type.in6,
# 	       sizeof(iter->current.address.type.in6));
# 
#-	if (ioctl(iter->socket, SIOCGLIFADDR, &if_laddrreq) < 0) {
#+	if (ioctl(iter->socket, SIOCGLIFADDR, &lifreq) < 0) {
# 		isc__strerror(errno, strbuf, sizeof(strbuf));
# 		UNEXPECTED_ERROR(__FILE__, __LINE__,
# 				 "%s: getting interface address: %s",
# 				 ifreq.ifr_name, strbuf);
# 		return (ISC_R_IGNORE);
# 	}
#+	prefixlen = lifreq.lifr_addrlen;
#+#else
#+	isc_netaddr_format(&iter->current.address, sabuf, sizeof(sabuf));
#+	UNEXPECTED_ERROR(__FILE__, __LINE__,
#+		      isc_msgcat_get(isc_msgcat,
#+				     ISC_MSGSET_IFITERIOCTL,
#+				     ISC_MSG_GETIFCONFIG,
#+				     "prefix length for %s is unknown "
#+				     "(assume 128)"), sabuf);
#+	prefixlen = 128;
#+#endif
# 
# 	/*
# 	 * Netmask already zeroed.
# 	 */
# 	iter->current.netmask.family = family;
# 	for (i = 0; i < 16; i++) {
#-		if (if_laddrreq.prefixlen > 8) {
#+		if (prefixlen > 8) {
# 			bits = 0;
#-			if_laddrreq.prefixlen -= 8;
#+			prefixlen -= 8;
# 		} else {
#-			bits = 8 - if_laddrreq.prefixlen;
#-			if_laddrreq.prefixlen = 0;
#+			bits = 8 - prefixlen;
#+			prefixlen = 0;
# 		}
# 		iter->current.netmask.type.in6.s6_addr[i] = (~0 << bits) & 0xff;
# 	}
# 	return (ISC_R_SUCCESS);
# 
#  inet:
#-#endif
# 	if (family != AF_INET)
# 		return (ISC_R_IGNORE);
#+#ifdef IFF_POINTOPOINT
# 	/*
# 	 * If the interface is point-to-point, get the destination address.
# 	 */
#@@ -529,9 +683,9 @@
# 			return (ISC_R_IGNORE);
# 		}
# 		get_addr(family, &iter->current.dstaddress,
#-			 (struct sockaddr *)&ifreq.ifr_dstaddr);
#+			 (struct sockaddr *)&ifreq.ifr_dstaddr, ifreq.ifr_name);
# 	}
#-
#+#endif
# 	if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0) {
# 		/*
# 		 * Ignore the HP/UX warning about "integer overflow during
#@@ -551,8 +705,9 @@
# 			return (ISC_R_IGNORE);
# 		}
# 		get_addr(family, &iter->current.broadcast,
#-			 (struct sockaddr *)&ifreq.ifr_broadaddr);
#+			 (struct sockaddr *)&ifreq.ifr_broadaddr, ifreq.ifr_name);
# 	}
#+
# 	/*
# 	 * Get the network mask.
# 	 */
#@@ -563,8 +718,7 @@
# 	 * conversion.  It comes from its own macro definition,
# 	 * and is really hard to shut up.
# 	 */
#-	if (ioctl(iter->socket, SIOCGIFNETMASK, (char *)&ifreq)
#-	    < 0) {
#+	if (ioctl(iter->socket, SIOCGIFNETMASK, (char *)&ifreq) < 0) {
# 		isc__strerror(errno, strbuf, sizeof(strbuf));
# 		UNEXPECTED_ERROR(__FILE__, __LINE__,
# 			isc_msgcat_get(isc_msgcat,
#@@ -575,25 +729,25 @@
# 		return (ISC_R_IGNORE);
# 	}
# 	get_addr(family, &iter->current.netmask,
#-		 (struct sockaddr *)&ifreq.ifr_addr);
#+		 (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name);
# 	return (ISC_R_SUCCESS);
# }
# 
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
# static isc_result_t
# internal_current6(isc_interfaceiter_t *iter) {
#-#if !defined(SIOCGLIFCONF) || !defined(SIOCGLIFADDR)
#-	UNUSED(iter);
#-	return (ISC_R_NOTIMPLEMENTED);
#-#else
# 	struct LIFREQ *ifrp;
# 	struct LIFREQ lifreq;
# 	int family;
# 	char strbuf[ISC_STRERRORSIZE];
#+	int fd;
# 
# 	REQUIRE(VALID_IFITER(iter));
#-	REQUIRE (iter->pos < (unsigned int) iter->lifc.lifc_len);
#+	if (iter->result6 != ISC_R_SUCCESS)
#+		return (iter->result6);
#+	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
# 
#-	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos);
#+	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
# 
# 	memset(&lifreq, 0, sizeof(lifreq));
# 	memcpy(&lifreq, ifrp, sizeof(lifreq));
#@@ -612,14 +766,10 @@
# 	INSIST(sizeof(lifreq.lifr_name) <= sizeof(iter->current.name));
# 	memset(iter->current.name, 0, sizeof(iter->current.name));
# 	memcpy(iter->current.name, lifreq.lifr_name, sizeof(lifreq.lifr_name));
#-	iter->current.ifindex = lifreq.lifr_index;	/* Save the if index */
# 
# 	get_addr(family, &iter->current.address,
#-		 (struct sockaddr *)&lifreq.lifr_addr);
#+		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
# 
#-#ifdef ISC_PLATFORM_HAVEIPV6
#-	iter->current.scopeid = get_scopeid(family, (struct sockaddr *)&lifreq.lifr_addr);
#-#endif
# 	/*
# 	 * If the interface does not have a address ignore it.
# 	 */
#@@ -641,32 +791,31 @@
# 
# 	iter->current.flags = 0;
# 
#+	if (family == AF_INET6)
#+		fd = iter->socket6;
#+	else
#+		fd = iter->socket;
#+
# 	/*
# 	 * Ignore the HP/UX warning about "integer overflow during
# 	 * conversion.  It comes from its own macro definition,
# 	 * and is really hard to shut up.
# 	 */
#-	if (ioctl(iter->socket, SIOCGLIFFLAGS, (char *) &lifreq) < 0) {
#-
#-		/*
#-		 * XXX This should be looked at further since it looks strange.
#-		 * If we get an ENXIO then we ignore the error and not worry
#-		 * about the flags.
#-		 */
#-		if (errno != ENXIO) {
#-			isc__strerror(errno, strbuf, sizeof(strbuf));
#-			UNEXPECTED_ERROR(__FILE__, __LINE__,
#+	if (ioctl(fd, SIOCGLIFFLAGS, (char *) &lifreq) < 0) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
# 				 "%s: getting interface flags: %s",
# 				 lifreq.lifr_name, strbuf);
#-			return (ISC_R_IGNORE);
#-		}
#+		return (ISC_R_IGNORE);
# 	}
# 
# 	if ((lifreq.lifr_flags & IFF_UP) != 0)
# 		iter->current.flags |= INTERFACE_F_UP;
# 
#+#ifdef IFF_POINTOPOINT
# 	if ((lifreq.lifr_flags & IFF_POINTOPOINT) != 0)
# 		iter->current.flags |= INTERFACE_F_POINTTOPOINT;
#+#endif
# 
# 	if ((lifreq.lifr_flags & IFF_LOOPBACK) != 0)
# 		iter->current.flags |= INTERFACE_F_LOOPBACK;
#@@ -681,6 +830,7 @@
# 	}
# #endif
# 
#+#ifdef IFF_POINTOPOINT
# 	/*
# 	 * If the interface is point-to-point, get the destination address.
# 	 */
#@@ -690,7 +840,7 @@
# 		 * conversion.  It comes from its own macro definition,
# 		 * and is really hard to shut up.
# 		 */
#-		if (ioctl(iter->socket, SIOCGLIFDSTADDR, (char *)&lifreq)
#+		if (ioctl(fd, SIOCGLIFDSTADDR, (char *)&lifreq)
# 		    < 0) {
# 			isc__strerror(errno, strbuf, sizeof(strbuf));
# 			UNEXPECTED_ERROR(__FILE__, __LINE__,
#@@ -703,8 +853,11 @@
# 			return (ISC_R_IGNORE);
# 		}
# 		get_addr(family, &iter->current.dstaddress,
#-			 (struct sockaddr *)&lifreq.lifr_dstaddr);
#+			 (struct sockaddr *)&lifreq.lifr_dstaddr,
#+			 lifreq.lifr_name);
# 	}
#+#endif
#+
# #ifdef SIOCGLIFBRDADDR
# 	if ((iter->current.flags & INTERFACE_F_BROADCAST) != 0) {
# 		/*
#@@ -725,43 +878,26 @@
# 			return (ISC_R_IGNORE);
# 		}
# 		get_addr(family, &iter->current.broadcast,
#-			 (struct sockaddr *)&lifreq.lifr_broadaddr);
#+			 (struct sockaddr *)&lifreq.lifr_broadaddr,
#+			 lifreq.lifr_name);
# 	}
# #endif	/* SIOCGLIFBRDADDR */
# 
# 	/*
#-	 * Get the network mask.
#+	 * Get the network mask.  Netmask already zeroed.
# 	 */
# 	memset(&lifreq, 0, sizeof(lifreq));
# 	memcpy(&lifreq, ifrp, sizeof(lifreq));
#-	switch (family) {
#-	case AF_INET:
#-		/*
#-		 * Ignore the HP/UX warning about "integer overflow during
#-		 * conversion.  It comes from its own macro definition,
#-		 * and is really hard to shut up.
#-		 */
#-		if (ioctl(iter->socket, SIOCGLIFNETMASK, (char *)&lifreq)
#-		    < 0) {
#-			isc__strerror(errno, strbuf, sizeof(strbuf));
#-			UNEXPECTED_ERROR(__FILE__, __LINE__,
#-				isc_msgcat_get(isc_msgcat,
#-					       ISC_MSGSET_IFITERIOCTL,
#-					       ISC_MSG_GETNETMASK,
#-					       "%s: getting netmask: %s"),
#-					 lifreq.lifr_name, strbuf);
#-			return (ISC_R_IGNORE);
#-		}
#-		get_addr(family, &iter->current.netmask,
#-			 (struct sockaddr *)&lifreq.lifr_addr);
#-		break;
#-	case AF_INET6: {
#+
# #ifdef lifr_addrlen
#+	/*
#+	 * Special case: if the system provides lifr_addrlen member, the
#+	 * netmask of an IPv6 address can be derived from the length, since
#+	 * an IPv6 address always has a contiguous mask.
#+	 */
#+	if (family == AF_INET6) {
# 		int i, bits;
# 
#-		/*
#-		 * Netmask already zeroed.
#-		 */
# 		iter->current.netmask.family = family;
# 		for (i = 0; i < lifreq.lifr_addrlen; i += 8) {
# 			bits = lifreq.lifr_addrlen - i;
#@@ -769,19 +905,46 @@
# 			iter->current.netmask.type.in6.s6_addr[i / 8] =
# 				(~0 << bits) & 0xff;
# 		}
#-#endif
#-		break;
#+
#+		return (ISC_R_SUCCESS);
# 	}
#+#endif
#+
#+	/*
#+	 * Ignore the HP/UX warning about "integer overflow during
#+	 * conversion.  It comes from its own macro definition,
#+	 * and is really hard to shut up.
#+	 */
#+	if (ioctl(fd, SIOCGLIFNETMASK, (char *)&lifreq) < 0) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 isc_msgcat_get(isc_msgcat,
#+						ISC_MSGSET_IFITERIOCTL,
#+						ISC_MSG_GETNETMASK,
#+						"%s: getting netmask: %s"),
#+				 lifreq.lifr_name, strbuf);
#+		return (ISC_R_IGNORE);
# 	}
#+	get_addr(family, &iter->current.netmask,
#+		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
# 
# 	return (ISC_R_SUCCESS);
#-#endif
# }
#+#endif
# 
# static isc_result_t
# internal_current(isc_interfaceiter_t *iter) {
#-	if (iter->mode == 6)
#-		return (internal_current6(iter));
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	if (iter->mode == 6) {
#+		iter->result6 = internal_current6(iter);
#+		if (iter->result6 != ISC_R_NOMORE)
#+			return (iter->result6);
#+	}
#+#endif
#+#ifdef HAVE_TRUCLUSTER
#+	if (!iter->clua_done)
#+		return(internal_current_clusteralias(iter));
#+#endif
# 	return (internal_current4(iter));
# }
# 
#@@ -798,8 +961,10 @@
# 
# 	REQUIRE (iter->pos < (unsigned int) iter->ifc.ifc_len);
# 
#-#ifdef HAVE_TRUCLUSTER
#-	if (internal_current_clusteralias(iter) == ISC_R_SUCCESS)
#+#ifdef __linux
#+	if (linux_if_inet6_next(iter) == ISC_R_SUCCESS)
#+		return (ISC_R_SUCCESS);
#+	if (!iter->first)
# 		return (ISC_R_SUCCESS);
# #endif
# 	ifrp = (struct ifreq *)((char *) iter->ifc.ifc_req + iter->pos);
#@@ -817,40 +982,95 @@
# 	return (ISC_R_SUCCESS);
# }
# 
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
# static isc_result_t
# internal_next6(isc_interfaceiter_t *iter) {
#-#if !defined(SIOCGLIFCONF) || !defined(SIOCGLIFADDR)
#-	UNUSED(iter);
#-	return (ISC_R_NOTIMPLEMENTED);
#-#else
# 	struct LIFREQ *ifrp;
#+	
#+	if (iter->result6 != ISC_R_SUCCESS && iter->result6 != ISC_R_IGNORE)
#+		return (iter->result6);
# 
#-	REQUIRE (iter->pos < (unsigned int) iter->lifc.lifc_len);
#+	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
# 
#-	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos);
#+	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
# 
# #ifdef ISC_PLATFORM_HAVESALEN
# 	if (ifrp->lifr_addr.sa_len > sizeof(struct sockaddr))
#-		iter->pos += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len;
#+		iter->pos6 += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len;
# 	else
# #endif
#-		iter->pos += sizeof(*ifrp);
#+		iter->pos6 += sizeof(*ifrp);
# 
#-	if (iter->pos >= (unsigned int) iter->lifc.lifc_len)
#+	if (iter->pos6 >= (unsigned int) iter->lifc.lifc_len)
# 		return (ISC_R_NOMORE);
# 
# 	return (ISC_R_SUCCESS);
#-#endif
# }
#+#endif
# 
# static isc_result_t
# internal_next(isc_interfaceiter_t *iter) {
#-	if (iter->mode == 6)
#-		return (internal_next6(iter));
#+#ifdef HAVE_TRUCLUSTER
#+	int clua_result;
#+#endif
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	if (iter->mode == 6) {
#+		iter->result6 = internal_next6(iter);
#+		if (iter->result6 != ISC_R_NOMORE)
#+			return (iter->result6);
#+		if (iter->first6) {
#+			iter->first6 = ISC_FALSE;
#+			return (ISC_R_SUCCESS);
#+		}
#+	}
#+#endif
#+#ifdef HAVE_TRUCLUSTER
#+	if (!iter->clua_done) {
#+		clua_result = clua_getaliasaddress(&iter->clua_sa,
#+						   &iter->clua_context);
#+		if (clua_result != CLUA_SUCCESS)
#+			iter->clua_done = ISC_TRUE;
#+		return (ISC_R_SUCCESS);
#+	}
#+#endif
# 	return (internal_next4(iter));
# }
# 
# static void
# internal_destroy(isc_interfaceiter_t *iter) {
# 	(void) close(iter->socket);
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	if (iter->socket6 != -1)
#+		(void) close(iter->socket6);
#+	if (iter->buf6 != NULL) {
#+		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
#+	}
#+#endif
#+#ifdef __linux
#+	if (iter->proc != NULL)
#+		fclose(iter->proc);
#+#endif
#+}
#+
#+static
#+void internal_first(isc_interfaceiter_t *iter) {
#+#ifdef HAVE_TRUCLUSTER
#+	int clua_result;
#+#endif
#+	iter->pos = 0;
#+#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
#+	iter->pos6 = 0;
#+	if (iter->result6 == ISC_R_NOMORE)
#+		iter->result6 = ISC_R_SUCCESS;
#+	iter->first6 = ISC_TRUE;
#+#endif
#+#ifdef HAVE_TRUCLUSTER
#+	iter->clua_context = 0;
#+	clua_result = clua_getaliasaddress(&iter->clua_sa,
#+					   &iter->clua_context);
#+	iter->clua_done = ISC_TF(clua_result != CLUA_SUCCESS);
#+#endif
#+#ifdef __linux
#+	linux_if_inet6_first(iter);
#+#endif
# }
#
#--- 1.8/libisc/ifiter_sysctl.c	2003-12-02 23:45:32 -05:00
#+++ 1.11/libisc/ifiter_sysctl.c	2005-01-01 22:14:03 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: ifiter_sysctl.c,v 1.17 2002/05/30 01:24:12 marka Exp $ */
#+/* $Id: ifiter_sysctl.c,v 1.14.12.7 2004/03/08 09:04:56 marka Exp $ */
# 
# /*
#  * Obtain the list of network interfaces using sysctl.
#@@ -170,7 +170,6 @@
# 
# 		memset(iter->current.name, 0, sizeof(iter->current.name));
# 		memcpy(iter->current.name, sdl->sdl_data, namelen);
#-		iter->current.ifindex = sdl->sdl_index;	/* Save the if index */
# 
# 		iter->current.flags = 0;
# 
#@@ -252,19 +251,23 @@
# 
# 		iter->current.af = family;
# 
#-		get_addr(family, &iter->current.address, addr_sa);
#-
#-		iter->current.scopeid = get_scopeid(family, addr_sa);
#+		get_addr(family, &iter->current.address, addr_sa,
#+			 iter->current.name);
# 
# 		if (mask_sa != NULL)
#-			get_addr(family, &iter->current.netmask, mask_sa);
#+			get_addr(family, &iter->current.netmask, mask_sa,
#+				 iter->current.name);
# 
# 		if (dst_sa != NULL &&
# 		    (iter->current.flags & INTERFACE_F_POINTTOPOINT) != 0)
#-			get_addr(family, &iter->current.dstaddress, dst_sa);
#+			get_addr(family, &iter->current.dstaddress, dst_sa,
#+				 iter->current.name);
#+
# 		if (dst_sa != NULL &&
# 		    (iter->current.flags & INTERFACE_F_BROADCAST) != 0)
#-			get_addr(family, &iter->current.broadcast, dst_sa);
#+			get_addr(family, &iter->current.dstaddress, dst_sa,
#+				 iter->current.name);
#+
# 
# 		return (ISC_R_SUCCESS);
# 	} else {
#@@ -306,3 +309,7 @@
# 	 */
# }
# 
#+static
#+void internal_first(isc_interfaceiter_t *iter) {
#+	iter->pos = 0;
#+}
#
#--- 1.11/libisc/interfaceiter.c	2004-08-04 18:09:36 -04:00
#+++ 1.15/libisc/interfaceiter.c	2005-01-02 18:27:51 -05:00
#@@ -1,24 +1,26 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: interfaceiter.c,v 1.27 2002/07/02 05:51:43 marka Exp $ */
#+/* $Id: interfaceiter.c,v 1.22.2.1.10.14 2004/08/28 06:25:22 marka Exp $ */
# 
# #include <config.h>
# 
#+#define ISC_ONLY_IPV6
#+
# #include <sys/types.h>
# #include <sys/ioctl.h>
# #ifdef HAVE_SYS_SOCKIO_H
#@@ -35,6 +37,7 @@
# #include <isc/mem.h>
# #include <isc/msgs.h>
# #include <isc/net.h>
#+#include <isc/print.h>
# #include <isc/result.h>
# #include <isc/strerror.h>
# #include <isc/string.h>
#@@ -45,21 +48,32 @@
# #ifdef HAVE_NET_IF6_H
# #include <net/if6.h>
# #endif
#-#include <net/if.h>
# 
# /* Common utility functions */
# 
# /*
#  * Extract the network address part from a "struct sockaddr".
#  *
#- * The address family is given explicity
#+ * The address family is given explicitly
#  * instead of using src->sa_family, because the latter does not work
#  * for copying a network mask obtained by SIOCGIFNETMASK (it does
#  * not have a valid address family).
#  */
# 
# static void
#-get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src) {
#+get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
#+	 char *ifname)
#+{
#+	struct sockaddr_in6 *sa6;
#+
#+#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) || \
#+    !defined(ISC_PLATFORM_HAVESCOPEID)
#+	UNUSED(ifname);
#+#endif
#+
#+	/* clear any remaining value for safety */
#+	memset(dst, 0, sizeof(*dst));
#+
# 	dst->family = family;
# 	switch (family) {
# 	case AF_INET:
#@@ -67,21 +81,56 @@
# 		       &((struct sockaddr_in *) src)->sin_addr,
# 		       sizeof(struct in_addr));
# 		break;
#-	case	AF_INET6:
#-		memcpy(&dst->type.in6,
#-		       &((struct sockaddr_in6 *) src)->sin6_addr,
#+	case AF_INET6:
#+		sa6 = (struct sockaddr_in6 *)src;
#+		memcpy(&dst->type.in6, &sa6->sin6_addr,
# 		       sizeof(struct in6_addr));
#-
#-		/*
#-		 * For KAME addresses we need to fix up the address
#-		 * for public consumption if it is a multicast address
#-		 */
#-#ifdef __KAME__
#-		if (IN6_IS_ADDR_MC_LINKLOCAL( &((struct sockaddr_in6 *)src)->sin6_addr)) {
#-			dst->type.in6.s6_addr[2] = 0;
#-			dst->type.in6.s6_addr[3] = 0;
#+#ifdef ISC_PLATFORM_HAVESCOPEID
#+		if (sa6->sin6_scope_id != 0)
#+			isc_netaddr_setzone(dst, sa6->sin6_scope_id);
#+		else {
#+			/*
#+			 * BSD variants embed scope zone IDs in the 128bit
#+			 * address as a kernel internal form.  Unfortunately,
#+			 * the embedded IDs are not hidden from applications
#+			 * when getting access to them by sysctl or ioctl.
#+			 * We convert the internal format to the pure address
#+			 * part and the zone ID part.
#+			 * Since multicast addresses should not appear here
#+			 * and they cannot be distinguished from netmasks,
#+			 * we only consider unicast link-local addresses.
#+			 */
#+			if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) {
#+				isc_uint16_t zone16;
#+
#+				memcpy(&zone16, &sa6->sin6_addr.s6_addr[2],
#+				       sizeof(zone16));
#+				zone16 = ntohs(zone16);
#+				if (zone16 != 0) {
#+					/* the zone ID is embedded */
#+					isc_netaddr_setzone(dst,
#+							    (isc_uint32_t)zone16);
#+					dst->type.in6.s6_addr[2] = 0;
#+					dst->type.in6.s6_addr[3] = 0;
#+#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
#+				} else if (ifname != NULL) {
#+					unsigned int zone;
#+
#+					/*
#+					 * sin6_scope_id is still not provided,
#+					 * but the corresponding interface name
#+					 * is know.  Use the interface ID as
#+					 * the link ID.
#+					 */
#+					zone = if_nametoindex(ifname);
#+					if (zone != 0) {
#+						isc_netaddr_setzone(dst,
#+								    (isc_uint32_t)zone);
#+					}
#+#endif
#+				}
#+			}
# 		}
#-
# #endif
# 		break;
# 	default:
#@@ -90,53 +139,13 @@
# 	}
# }
# 
#-#ifdef ISC_PLATFORM_HAVEIPV6
#-/*
#- * Get the scope id here for multicasting purposes
#- * For the KAME stack we need to play games to get the scope.
#- */
#-static unsigned int
#-get_scopeid(unsigned int family, struct sockaddr *src) {
#-
#-	unsigned int scopeid;
#-
#-	switch (family) {
#-	case AF_INET:
#-		return (0);
#-		break;
#-	case AF_INET6:
#-#ifdef __KAME__
#-	if (IN6_IS_ADDR_LINKLOCAL( &((struct sockaddr_in6 *)src)->sin6_addr)
#-		&& ((struct sockaddr_in6 *)src)->sin6_scope_id == 0) {
#-		u_int8_t *p;
#-		p = &((struct sockaddr_in6 *)src)->sin6_addr.s6_addr[0];
#-		scopeid = ((u_int16_t)p[2] << 8) | p[3];
#-	} else
#-#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
#-		scopeid = ((struct sockaddr_in6 *)src)->sin6_scope_id;
#-#else
#-		scopeid = 0;
#-#endif
#-#else
#-#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID
#-	scopeid = ((struct sockaddr_in6 *)src)->sin6_scope_id;
#-#else
#-	scopeid = 0;
#-#endif
#-#endif
#-	       return (scopeid);
#-	default:
#-		INSIST(0);
#-		break;
#-	}
#-	return (0);
#-}
#-#endif
# /*
#  * Include system-dependent code.
#  */
# 
#-#if HAVE_IFLIST_SYSCTL
#+#if HAVE_GETIFADDRS
#+#include "ifiter_getifaddrs.c"
#+#elif HAVE_IFLIST_SYSCTL
# #include "ifiter_sysctl.c"
# #else
# #include "ifiter_ioctl.c"
#@@ -161,10 +170,7 @@
# 
# 	REQUIRE(VALID_IFITER(iter));
# 
#-	iter->pos = 0;
#-#ifdef HAVE_TRUCLUSTER
#-	iter->clua_context = 0;
#-#endif
#+	internal_first(iter);
# 	for (;;) {
# 		result = internal_current(iter);
# 		if (result != ISC_R_IGNORE)
#@@ -205,7 +211,8 @@
# 	REQUIRE(VALID_IFITER(iter));
# 
# 	internal_destroy(iter);
#-	isc_mem_put(iter->mctx, iter->buf, iter->bufsize);
#+	if (iter->buf != NULL)
#+		isc_mem_put(iter->mctx, iter->buf, iter->bufsize);
# 
# 	iter->magic = 0;
# 	isc_mem_put(iter->mctx, iter, sizeof(*iter));
#
#--- 1.3/libisc/net.c	2003-07-26 15:36:24 -04:00
#+++ 1.5/libisc/net.c	2004-12-23 15:24:12 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: net.c,v 1.25 2001/11/30 01:59:45 gson Exp $ */
#+/* $Id: net.c,v 1.22.2.2.10.7 2004/04/29 01:31:22 marka Exp $ */
# 
# #include <config.h>
# 
#@@ -23,6 +23,7 @@
# #include <unistd.h>
# 
# #include <isc/net.h>
#+#include <isc/once.h>
# #include <isc/strerror.h>
# #include <isc/string.h>
# #include <isc/util.h>
#@@ -31,9 +32,17 @@
# const struct in6_addr isc_net_in6addrany = IN6ADDR_ANY_INIT;
# #endif
# 
#+#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
#+const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT;
#+#endif
#+
# static isc_boolean_t 	once = ISC_FALSE;
#+static isc_once_t 	once_ipv6only = ISC_ONCE_INIT;
#+static isc_once_t 	once_ipv6pktinfo = ISC_ONCE_INIT;
# static isc_result_t	ipv4_result = ISC_R_NOTFOUND;
# static isc_result_t	ipv6_result = ISC_R_NOTFOUND;
#+static isc_result_t	ipv6only_result = ISC_R_NOTFOUND;
#+static isc_result_t	ipv6pktinfo_result = ISC_R_NOTFOUND;
# 
# static isc_result_t
# try_proto(int domain) {
#@@ -57,13 +66,14 @@
# 		default:
# 			isc__strerror(errno, strbuf, sizeof(strbuf));
# 			UNEXPECTED_ERROR(__FILE__, __LINE__,
#-					 "socket() %s failed",
#+					 "socket() failed: %s",
# 					 strbuf);
# 			return (ISC_R_UNEXPECTED);
# 		}
# 	}
# 
# #ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
# #ifdef ISC_PLATFORM_HAVEIN6PKTINFO
# 	if (domain == PF_INET6) {
# 		struct sockaddr_in6 sin6;
#@@ -86,6 +96,7 @@
# 	}
# #endif
# #endif
#+#endif
# 
# 	(void)close(s);
# 
#@@ -96,10 +107,12 @@
# initialize_action(void) {
# 	ipv4_result = try_proto(PF_INET);
# #ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
# #ifdef ISC_PLATFORM_HAVEIN6PKTINFO
# 	ipv6_result = try_proto(PF_INET6);
# #endif
# #endif
#+#endif
# }
# 
# static void
#@@ -120,4 +133,179 @@
# isc_net_probeipv6(void) {
# 	initialize();
# 	return (ipv6_result);
#+}
#+
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+static void
#+try_ipv6only(void) {
#+#ifdef IPV6_V6ONLY
#+	int s, on;
#+	char strbuf[ISC_STRERRORSIZE];
#+#endif
#+	isc_result_t result;
#+
#+	result = isc_net_probeipv6();
#+	if (result != ISC_R_SUCCESS) {
#+		ipv6only_result = result;
#+		return;
#+	}
#+
#+#ifndef IPV6_V6ONLY
#+	ipv6only_result = ISC_R_NOTFOUND;
#+	return;
#+#else
#+	/* check for TCP sockets */
#+	s = socket(PF_INET6, SOCK_STREAM, 0);
#+	if (s == -1) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() failed: %s",
#+				 strbuf);
#+		ipv6only_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
#+		ipv6only_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+
#+	/* check for UDP sockets */
#+	s = socket(PF_INET6, SOCK_DGRAM, 0);
#+	if (s == -1) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() failed: %s",
#+				 strbuf);
#+		ipv6only_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
#+		ipv6only_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+
#+	ipv6only_result = ISC_R_SUCCESS;
#+
#+close:
#+	close(s);
#+	return;
#+#endif /* IPV6_V6ONLY */
#+}
#+
#+static void
#+initialize_ipv6only(void) {
#+	RUNTIME_CHECK(isc_once_do(&once_ipv6only,
#+				  try_ipv6only) == ISC_R_SUCCESS);
#+}
#+#endif /* IPV6_V6ONLY */
#+
#+static void
#+try_ipv6pktinfo(void) {
#+	int s, on;
#+	char strbuf[ISC_STRERRORSIZE];
#+	isc_result_t result;
#+	int optname;
#+
#+	result = isc_net_probeipv6();
#+	if (result != ISC_R_SUCCESS) {
#+		ipv6pktinfo_result = result;
#+		return;
#+	}
#+
#+	/* we only use this for UDP sockets */
#+	s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
#+	if (s == -1) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() failed: %s",
#+				 strbuf);
#+		ipv6pktinfo_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+#ifdef IPV6_RECVPKTINFO
#+	optname = IPV6_RECVPKTINFO;
#+#else
#+	optname = IPV6_PKTINFO;
#+#endif
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, optname, &on, sizeof(on)) < 0) {
#+		ipv6pktinfo_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+	ipv6pktinfo_result = ISC_R_SUCCESS;
#+
#+close:
#+	close(s);
#+	return;
#+}
#+
#+static void
#+initialize_ipv6pktinfo(void) {
#+	RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo,
#+				  try_ipv6pktinfo) == ISC_R_SUCCESS);
#+}
#+#endif /* WANT_IPV6 */
#+
#+isc_result_t
#+isc_net_probe_ipv6only(void) {
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+	initialize_ipv6only();
#+#else
#+	ipv6only_result = ISC_R_NOTFOUND;
#+#endif
#+#endif
#+	return (ipv6only_result);
#+}
#+
#+isc_result_t
#+isc_net_probe_ipv6pktinfo(void) {
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+	initialize_ipv6pktinfo();
#+#else
#+	ipv6pktinfo_result = ISC_R_NOTFOUND;
#+#endif
#+#endif
#+	return (ipv6pktinfo_result);
#+}
#+
#+void
#+isc_net_disableipv4(void) {
#+	initialize();
#+	if (ipv4_result == ISC_R_SUCCESS)
#+		ipv4_result = ISC_R_DISABLED;
#+}
#+
#+void
#+isc_net_disableipv6(void) {
#+	initialize();
#+	if (ipv6_result == ISC_R_SUCCESS)
#+		ipv6_result = ISC_R_DISABLED;
#+}
#+
#+void
#+isc_net_enableipv4(void) {
#+	initialize();
#+	if (ipv4_result == ISC_R_DISABLED)
#+		ipv4_result = ISC_R_SUCCESS;
#+}
#+
#+void
#+isc_net_enableipv6(void) {
#+	initialize();
#+	if (ipv6_result == ISC_R_DISABLED)
#+		ipv6_result = ISC_R_SUCCESS;
# }
#
#--- 1.4/ports/winnt/include/isc/ipv6.h	2004-11-02 23:22:24 -05:00
#+++ 1.5/ports/winnt/include/isc/ipv6.h	2004-12-23 00:15:13 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 2000, 2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 2000-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: ipv6.h,v 1.10 2002/08/01 03:56:08 mayer Exp $ */
#+/* $Id: ipv6.h,v 1.9.2.2.2.5 2004/04/19 06:39:55 marka Exp $ */
# 
# #ifndef ISC_IPV6_H
# #define ISC_IPV6_H 1
#@@ -43,8 +43,9 @@
#  *	RFC 2553.
#  */
# 
#-#define s6_addr8	s6_addr
#+#if _MSC_VER < 1300
# #define in6_addr in_addr6
#+#endif
# 
# #ifndef IN6ADDR_ANY_INIT
# #define IN6ADDR_ANY_INIT 	{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }}
#@@ -53,6 +54,9 @@
# #define IN6ADDR_LOOPBACK_INIT 	{{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 }}
# #endif
# 
#+extern const struct in6_addr isc_in6addr_any;
#+extern const struct in6_addr isc_in6addr_loopback;
#+
# /*
#  * Unspecified
#  */
#@@ -105,7 +109,7 @@
#  */
# #ifndef IN6_IS_ADDR_MULTICAST
# #define IN6_IS_ADDR_MULTICAST(a)	\
#-	((a)->s6_addr8[0] == 0xffU)
#+	((a)->s6_addr[0] == 0xffU)
# #endif
# /*
#  * Unicast link / site local.
#
#--- 1.4/ports/winnt/include/isc/net.h	2004-11-02 23:18:10 -05:00
#+++ 1.5/ports/winnt/include/isc/net.h	2004-12-23 00:15:14 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: net.h,v 1.17 2002/08/01 03:56:08 mayer Exp $ */
#+/* $Id: net.h,v 1.15.12.10 2004/04/29 01:31:23 marka Exp $ */
# 
# #ifndef ISC_NET_H
# #define ISC_NET_H 1
#@@ -97,8 +97,8 @@
# #include <isc/lang.h>
# #include <isc/types.h>
# 
#-//#include <ws2tcpip.h>
#-//#include <isc/ipv6.h>
#+#include <ws2tcpip.h>
#+#include <isc/ipv6.h>
# 
# /*
#  * This is here because named client, interfacemgr.c, etc. use the name as
#@@ -119,6 +119,11 @@
# #endif
# #endif
# 
#+#if _MSC_VER < 1300
#+#define in6addr_any isc_in6addr_any
#+#define in6addr_loopback isc_in6addr_loopback
#+#endif
#+
# /*
#  * Ensure type in_port_t is defined.
#  */
#@@ -141,6 +146,10 @@
# 		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
# 		 == ISC__IPADDR(0xe0000000))
# 
#+#define ISC_IPADDR_ISEXPERIMENTAL(i) \
#+		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
#+		 == ISC__IPADDR(0xf0000000))
#+
# /*
#  * Fix the FD_SET and FD_CLR Macros to properly cast
#  */
#@@ -234,6 +243,7 @@
#  *
#  *	ISC_R_SUCCESS		IPv4 is supported.
#  *	ISC_R_NOTFOUND		IPv4 is not supported.
#+ *	ISC_R_DISABLED		IPv4 is disabled.
#  *	ISC_R_UNEXPECTED
#  */
# 
#@@ -246,8 +256,46 @@
#  *
#  *	ISC_R_SUCCESS		IPv6 is supported.
#  *	ISC_R_NOTFOUND		IPv6 is not supported.
#+ *	ISC_R_DISABLED		IPv6 is disabled.
#+ *	ISC_R_UNEXPECTED
#+ */
#+
#+isc_result_t
#+isc_net_probe_ipv6only(void);
#+/*
#+ * Check if the system's kernel supports the IPV6_V6ONLY socket option.
#+ *
#+ * Returns:
#+ *
#+ *	ISC_R_SUCCESS		the option is supported for both TCP and UDP.
#+ *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
#  *	ISC_R_UNEXPECTED
#  */
#+
#+isc_result_t
#+isc_net_probe_ipv6pktinfo(void);
#+/*
#+ * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option
#+ * for UDP sockets.
#+ *
#+ * Returns:
#+ *
#+ *	ISC_R_SUCCESS		the option is supported.
#+ *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
#+ *	ISC_R_UNEXPECTED
#+ */
#+
#+void
#+isc_net_disableipv4(void);
#+
#+void
#+isc_net_disableipv6(void);
#+
#+void
#+isc_net_enableipv4(void);
#+
#+void
#+isc_net_enableipv6(void);
# 
# #ifdef ISC_PLATFORM_NEEDNTOP
# const char *
#
#--- 1.5/ports/winnt/libisc/net.c	2004-11-02 23:18:10 -05:00
#+++ 1.6/ports/winnt/libisc/net.c	2004-12-23 00:15:14 -05:00
#@@ -1,21 +1,21 @@
# /*
#- * Copyright (C) 1999-2001  Internet Software Consortium.
#+ * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
#+ * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
#+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
#+ * AND FITNESS.  IN NO EVENT SHALL ISC 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: net.c,v 1.4 2001/11/21 05:07:25 mayer Exp $ */
#+/* $Id: net.c,v 1.3.2.2.4.7 2004/04/29 01:31:23 marka Exp $ */
# 
# #include <config.h>
# 
#@@ -25,6 +25,7 @@
# #include <ws2tcpip.h>
# #include <isc/ipv6.h>
# #include <isc/net.h>
#+#include <isc/once.h>
# #include <isc/strerror.h>
# #include <isc/string.h>
# #include <isc/util.h>
#@@ -34,8 +35,12 @@
# #endif
# 
# static isc_boolean_t 	once = ISC_FALSE;
#+static isc_once_t 	once_ipv6only = ISC_ONCE_INIT;
#+static isc_once_t 	once_ipv6pktinfo = ISC_ONCE_INIT;
# static isc_result_t	ipv4_result = ISC_R_NOTFOUND;
# static isc_result_t	ipv6_result = ISC_R_NOTFOUND;
#+static isc_result_t	ipv6only_result = ISC_R_NOTFOUND;
#+static isc_result_t	ipv6pktinfo_result = ISC_R_NOTFOUND;
# 
# static isc_result_t
# try_proto(int domain) {
#@@ -62,6 +67,7 @@
# 	}
# 
# #ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
# #ifdef ISC_PLATFORM_HAVEIN6PKTINFO
# 	if (domain == PF_INET6) {
# 		struct sockaddr_in6 sin6;
#@@ -84,6 +90,7 @@
# 	}
# #endif
# #endif
#+#endif
# 
# 	closesocket(s);
# 
#@@ -94,10 +101,12 @@
# initialize_action(void) {
# 	ipv4_result = try_proto(PF_INET);
# #ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
# #ifdef ISC_PLATFORM_HAVEIN6PKTINFO
# 	ipv6_result = try_proto(PF_INET6);
# #endif
# #endif
#+#endif
# }
# 
# static void
#@@ -118,6 +127,193 @@
# isc_net_probeipv6(void) {
# 	initialize();
# 	return (ipv6_result);
#+}
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+static void
#+try_ipv6only(void) {
#+#ifdef IPV6_V6ONLY
#+	SOCKET s;
#+	int on;
#+	char strbuf[ISC_STRERRORSIZE];
#+#endif
#+	isc_result_t result;
#+
#+	result = isc_net_probeipv6();
#+	if (result != ISC_R_SUCCESS) {
#+		ipv6only_result = result;
#+		return;
#+	}
#+
#+#ifndef IPV6_V6ONLY
#+	ipv6only_result = ISC_R_NOTFOUND;
#+	return;
#+#else
#+	/* check for TCP sockets */
#+	s = socket(PF_INET6, SOCK_STREAM, 0);
#+	if (s == INVALID_SOCKET) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() %s: %s",
#+				 isc_msgcat_get(isc_msgcat,
#+						ISC_MSGSET_GENERAL,
#+						ISC_MSG_FAILED,
#+						"failed"),
#+				 strbuf);
#+		ipv6only_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
#+		ipv6only_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+
#+	/* check for UDP sockets */
#+	s = socket(PF_INET6, SOCK_DGRAM, 0);
#+	if (s == INVALID_SOCKET) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() %s: %s",
#+				 isc_msgcat_get(isc_msgcat,
#+						ISC_MSGSET_GENERAL,
#+						ISC_MSG_FAILED,
#+						"failed"),
#+				 strbuf);
#+		ipv6only_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
#+		ipv6only_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+
#+	ipv6only_result = ISC_R_SUCCESS;
#+
#+close:
#+	close(s);
#+	return;
#+#endif /* IPV6_V6ONLY */
#+}
#+
#+static void
#+initialize_ipv6only(void) {
#+	RUNTIME_CHECK(isc_once_do(&once_ipv6only,
#+				  try_ipv6only) == ISC_R_SUCCESS);
#+}
#+
#+static void
#+try_ipv6pktinfo(void) {
#+	int s, on;
#+	char strbuf[ISC_STRERRORSIZE];
#+	isc_result_t result;
#+	int optname;
#+
#+	result = isc_net_probeipv6();
#+	if (result != ISC_R_SUCCESS) {
#+		ipv6pktinfo_result = result;
#+		return;
#+	}
#+
#+	/* we only use this for UDP sockets */
#+	s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
#+	if (s == -1) {
#+		isc__strerror(errno, strbuf, sizeof(strbuf));
#+		UNEXPECTED_ERROR(__FILE__, __LINE__,
#+				 "socket() %s: %s",
#+				 isc_msgcat_get(isc_msgcat,
#+						ISC_MSGSET_GENERAL,
#+						ISC_MSG_FAILED,
#+						"failed"),
#+				 strbuf);
#+		ipv6pktinfo_result = ISC_R_UNEXPECTED;
#+		return;
#+	}
#+
#+#ifdef IPV6_RECVPKTINFO
#+	optname = IPV6_RECVPKTINFO;
#+#else
#+	optname = IPV6_PKTINFO;
#+#endif
#+	on = 1;
#+	if (setsockopt(s, IPPROTO_IPV6, optname, &on, sizeof(on)) < 0) {
#+		ipv6pktinfo_result = ISC_R_NOTFOUND;
#+		goto close;
#+	}
#+
#+	close(s);
#+	ipv6pktinfo_result = ISC_R_SUCCESS;
#+
#+close:
#+	close(s);
#+	return;
#+}
#+
#+static void
#+initialize_ipv6pktinfo(void) {
#+	RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo,
#+				  try_ipv6pktinfo) == ISC_R_SUCCESS);
#+}
#+#endif /* WANT_IPV6 */
#+#endif /* ISC_PLATFORM_HAVEIPV6 */
#+
#+isc_result_t
#+isc_net_probe_ipv6only(void) {
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+	initialize_ipv6only();
#+#else
#+	ipv6only_result = ISC_R_NOTFOUND;
#+#endif
#+#endif
#+	return (ipv6only_result);
#+}
#+
#+isc_result_t
#+isc_net_probe_ipv6pktinfo(void) {
#+#ifdef ISC_PLATFORM_HAVEIPV6
#+#ifdef WANT_IPV6
#+	initialize_ipv6pktinfo();
#+#else
#+	ipv6pktinfo_result = ISC_R_NOTFOUND;
#+#endif
#+#endif
#+	return (ipv6pktinfo_result);
#+}
#+
#+void
#+isc_net_disableipv4(void) {
#+	initialize();
#+	if (ipv4_result == ISC_R_SUCCESS)
#+		ipv4_result = ISC_R_DISABLED;
#+}
#+
#+void
#+isc_net_disableipv6(void) {
#+	initialize();
#+	if (ipv6_result == ISC_R_SUCCESS)
#+		ipv6_result = ISC_R_DISABLED;
#+}
#+
#+void
#+isc_net_enableipv4(void) {
#+	initialize();
#+	if (ipv4_result == ISC_R_DISABLED)
#+		ipv4_result = ISC_R_SUCCESS;
#+}
#+
#+void
#+isc_net_enableipv6(void) {
#+	initialize();
#+	if (ipv6_result == ISC_R_DISABLED)
#+		ipv6_result = ISC_R_SUCCESS;
# }
# /*
#  * Initialize socket services
#--- New file ---
#+++ include/isc/buffer.h	04/12/22 23:55:44
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 1998-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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: buffer.h,v 1.39.12.2 2004/03/08 09:04:51 marka Exp $ */
#
##ifndef ISC_BUFFER_H
##define ISC_BUFFER_H 1
#
#/*****
# ***** Module Info
# *****/
#
#/*
# * Buffers
# *
# * A buffer is a region of memory, together with a set of related subregions.
# * Buffers are used for parsing and I/O operations.
# *
# * The 'used region' and the 'available' region are disjoint, and their
# * union is the buffer's region.  The used region extends from the beginning
# * of the buffer region to the last used byte.  The available region
# * extends from one byte greater than the last used byte to the end of the
# * buffer's region.  The size of the used region can be changed using various
# * buffer commands.  Initially, the used region is empty.
# *
# * The used region is further subdivided into two disjoint regions: the
# * 'consumed region' and the 'remaining region'.  The union of these two
# * regions is the used region.  The consumed region extends from the beginning
# * of the used region to the byte before the 'current' offset (if any).  The
# * 'remaining' region the current pointer to the end of the used
# * region.  The size of the consumed region can be changed using various
# * buffer commands.  Initially, the consumed region is empty.
# *
# * The 'active region' is an (optional) subregion of the remaining region.
# * It extends from the current offset to an offset in the remaining region
# * that is selected with isc_buffer_setactive().  Initially, the active region
# * is empty.  If the current offset advances beyond the chosen offset, the
# * active region will also be empty.
# *
# *  /------------entire length---------------\
# *  /----- used region -----\/-- available --\
# *  +----------------------------------------+
# *  | consumed  | remaining |                |
# *  +----------------------------------------+
# *  a           b     c     d                e
# *
# * a == base of buffer.
# * b == current pointer.  Can be anywhere between a and d.
# * c == active pointer.  Meaningful between b and d.
# * d == used pointer.
# * e == length of buffer.
# *
# * a-e == entire length of buffer.
# * a-d == used region.
# * a-b == consumed region.
# * b-d == remaining region.
# * b-c == optional active region.
# *
# * The following invariants are maintained by all routines:
# *
# *	length > 0
# *
# *	base is a valid pointer to length bytes of memory
# *
# *	0 <= used <= length
# *
# *	0 <= current <= used
# *
# *	0 <= active <= used
# *	(although active < current implies empty active region)
# *
# * MP:
# *	Buffers have no synchronization.  Clients must ensure exclusive
# *	access.
# *
# * Reliability:
# *	No anticipated impact.
# *
# * Resources:
# *	Memory: 1 pointer + 6 unsigned integers per buffer.
# *
# * Security:
# *	No anticipated impact.
# *
# * Standards:
# *	None.
# */
#
#/***
# *** Imports
# ***/
#
##include <isc/lang.h>
##include <isc/magic.h>
##include <isc/types.h>
#
#/*
# * To make many functions be inline macros (via #define) define this.
# * If it is undefined, a function will be used.
# */
##define ISC_BUFFER_USEINLINE 
#
#ISC_LANG_BEGINDECLS
#
#/***
# *** Magic numbers
# ***/
##define ISC_BUFFER_MAGIC		0x42756621U	/* Buf!. */
##define ISC_BUFFER_VALID(b)		ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC)
#
#/*
# * The following macros MUST be used only on valid buffers.  It is the
# * caller's responsibility to ensure this by using the ISC_BUFFER_VALID
# * check above, or by calling another isc_buffer_*() function (rather than
# * another macro.)
# */
#
#/*
# * Fundamental buffer elements.  (A through E in the introductory comment.)
# */
##define isc_buffer_base(b)    ((void *)(b)->base)			  /*a*/
##define isc_buffer_current(b) \
#		((void *)((unsigned char *)(b)->base + (b)->current))     /*b*/
##define isc_buffer_active(b)  \
#		((void *)((unsigned char *)(b)->base + (b)->active))      /*c*/
##define isc_buffer_used(b)    \
#		((void *)((unsigned char *)(b)->base + (b)->used))        /*d*/
##define isc_buffer_length(b)  ((b)->length)				  /*e*/
#
#/*
# * Derived lengths.  (Described in the introductory comment.)
# */
##define isc_buffer_usedlength(b)	((b)->used)		      /* d-a */
##define isc_buffer_consumedlength(b)	((b)->current)		      /* b-a */
##define isc_buffer_remaininglength(b)	((b)->used - (b)->current)    /* d-b */
##define isc_buffer_activelength(b)	((b)->active - (b)->current)  /* c-b */
##define isc_buffer_availablelength(b)	((b)->length - (b)->used)     /* e-d */
#
#/*
# * Note that the buffer structure is public.  This is principally so buffer
# * operations can be implemented using macros.  Applications are strongly
# * discouraged from directly manipulating the structure.
# */
#
#struct isc_buffer {
#	unsigned int		magic;
#	void		       *base;
#	/* The following integers are byte offsets from 'base'. */
#	unsigned int		length;
#	unsigned int		used;
#	unsigned int 		current;
#	unsigned int 		active;
#	/* linkable */
#	ISC_LINK(isc_buffer_t)	link;
#	/* private internal elements */
#	isc_mem_t	       *mctx;
#};
#
#/***
# *** Functions
# ***/
#
#isc_result_t
#isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
#		    unsigned int length);
#/*
# * Allocate a dynamic linkable buffer which has "length" bytes in the
# * data region.
# *
# * Requires:
# *	"mctx" is valid.
# *
# *	"dynbuffer" is non-NULL, and "*dynbuffer" is NULL.
# *
# * Returns:
# *	ISC_R_SUCCESS		- success
# *	ISC_R_NOMEMORY		- no memory available
# *
# * Note:
# *	Changing the buffer's length field is not permitted.
# */
#
#void
#isc_buffer_free(isc_buffer_t **dynbuffer);
#/*
# * Release resources allocated for a dynamic buffer.
# *
# * Requires:
# *	"dynbuffer" is not NULL.
# *
# *	"*dynbuffer" is a valid dynamic buffer.
# *
# * Ensures:
# *	"*dynbuffer" will be NULL on return, and all memory associated with
# *	the dynamic buffer is returned to the memory context used in
# *	isc_buffer_allocate().
# */
#
#void
#isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length);
#/*
# * Make 'b' refer to the 'length'-byte region starting at base.
# *
# * Requires:
# *
# *	'length' > 0
# *
# *	'base' is a pointer to a sequence of 'length' bytes.
# *
# */
#
#void
#isc__buffer_invalidate(isc_buffer_t *b);
#/*
# * Make 'b' an invalid buffer.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# * Ensures:
# *	If assertion checking is enabled, future attempts to use 'b' without
# *	calling isc_buffer_init() on it will cause an assertion failure.
# */
#
#void
#isc__buffer_region(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_usedregion(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the used region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the available region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_add(isc_buffer_t *b, unsigned int n);
#/*
# * Increase the 'used' region of 'b' by 'n' bytes.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# *	used + n <= length
# *
# */
#
#void
#isc__buffer_subtract(isc_buffer_t *b, unsigned int n);
#/*
# * Decrease the 'used' region of 'b' by 'n' bytes.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# *	used >= n
# *
# */
#
#void
#isc__buffer_clear(isc_buffer_t *b);
#/*
# * Make the used region empty.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# * Ensures:
# *
# *	used = 0
# *
# */
#
#void
#isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the consumed region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the remaining region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r);
#/*
# * Make 'r' refer to the active region of 'b'.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	'r' points to a region structure.
# */
#
#void
#isc__buffer_setactive(isc_buffer_t *b, unsigned int n);
#/*
# * Sets the end of the active region 'n' bytes after current.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	current + n <= used
# */
#
#void
#isc__buffer_first(isc_buffer_t *b);
#/*
# * Make the consumed region empty.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# * Ensures:
# *
# *	current == 0
# *
# */
#
#void
#isc__buffer_forward(isc_buffer_t *b, unsigned int n);
#/*
# * Increase the 'consumed' region of 'b' by 'n' bytes.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# *	current + n <= used
# *
# */
#
#void
#isc__buffer_back(isc_buffer_t *b, unsigned int n);
#/*
# * Decrease the 'consumed' region of 'b' by 'n' bytes.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# *	n <= current
# *
# */
#
#void
#isc_buffer_compact(isc_buffer_t *b);
#/*
# * Compact the used region by moving the remaining region so it occurs
# * at the start of the buffer.  The used region is shrunk by the size of
# * the consumed region, and the consumed region is then made empty.
# *
# * Requires:
# *
# *	'b' is a valid buffer
# *
# * Ensures:
# *
# *	current == 0
# *
# *	The size of the used region is now equal to the size of the remaining
# *	region (as it was before the call).  The contents of the used region
# *	are those of the remaining region (as it was before the call).
# */
#
#isc_uint8_t
#isc_buffer_getuint8(isc_buffer_t *b);
#/*
# * Read an unsigned 8-bit integer from 'b' and return it.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	The length of the available region of 'b' is at least 1.
# *
# * Ensures:
# *
# *	The current pointer in 'b' is advanced by 1.
# *
# * Returns:
# *
# *	A 8-bit unsigned integer.
# */
#
#void
#isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val);
#/*
# * Store an unsigned 8-bit integer from 'val' into 'b'.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	The length of the unused region of 'b' is at least 1.
# *
# * Ensures:
# *	The used pointer in 'b' is advanced by 1.
# */
#
#isc_uint16_t
#isc_buffer_getuint16(isc_buffer_t *b);
#/*
# * Read an unsigned 16-bit integer in network byte order from 'b', convert
# * it to host byte order, and return it.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	The length of the available region of 'b' is at least 2.
# *
# * Ensures:
# *
# *	The current pointer in 'b' is advanced by 2.
# *
# * Returns:
# *
# *	A 16-bit unsigned integer.
# */
#
#void
#isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val);
#/*
# * Store an unsigned 16-bit integer in host byte order from 'val'
# * into 'b' in network byte order.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	The length of the unused region of 'b' is at least 2.
# *
# * Ensures:
# *	The used pointer in 'b' is advanced by 2.
# */
#
#isc_uint32_t
#isc_buffer_getuint32(isc_buffer_t *b);
#/*
# * Read an unsigned 32-bit integer in network byte order from 'b', convert
# * it to host byte order, and return it.
# *
# * Requires:
# *
# *	'b' is a valid buffer.
# *
# *	The length of the available region of 'b' is at least 4.
# *
# * Ensures:
# *
# *	The current pointer in 'b' is advanced by 4.
# *
# * Returns:
# *
# *	A 32-bit unsigned integer.
# */
#
#void
#isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
#/*
# * Store an unsigned 32-bit integer in host byte order from 'val'
# * into 'b' in network byte order.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	The length of the unused region of 'b' is at least 4.
# *
# * Ensures:
# *	The used pointer in 'b' is advanced by 4.
# */
#
#void
#isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
#		   unsigned int length);
#/*
# * Copy 'length' bytes of memory at 'base' into 'b'.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	'base' points to 'length' bytes of valid memory.
# *
# */
#
#void
#isc__buffer_putstr(isc_buffer_t *b, const char *source);
#/*
# * Copy 'source' into 'b', not including terminating NUL.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	'source' to be a valid NULL terminated string.
# *
# *	strlen(source) <= isc_buffer_available(b)
# */
#
#isc_result_t
#isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r);
#/*
# * Copy the contents of 'r' into 'b'.
# *
# * Requires:
# *	'b' is a valid buffer.
# *
# *	'r' is a valid region.
# *
# * Returns:
# *
# *	ISC_R_SUCCESS
# *	ISC_R_NOSPACE			The available region of 'b' is not
# *					big enough.
# */
#
#ISC_LANG_ENDDECLS
#
#/*
# * Inline macro versions of the functions.  These should never be called
# * directly by an application, but will be used by the functions within
# * buffer.c.  The callers should always use "isc_buffer_*()" names, never
# * ones beginning with "isc__"
# */
#
#/*
# * XXXDCL Something more could be done with initializing buffers that
# * point to const data.  For example, a new function, isc_buffer_initconst,
# * could be used, and a new boolean flag in the buffer structure could
# * indicate whether the buffer was initialized with that function.
# * (isc_bufer_init itself would be reprototyped to *not* have its "base"
# * parameter be const.)  Then if the boolean were true, the isc_buffer_put*
# * functions could assert a contractual requirement for a non-const buffer.
# * One drawback is that the isc_buffer_* functions (macros) that return
# * pointers would still need to return non-const pointers to avoid compiler
# * warnings, so it would be up to code that uses them to have to deal
# * with the possibility that the buffer was initialized as const --
# * a problem that they *already* have to deal with but have absolutely
# * no ability to.  With a new isc_buffer_isconst() function returning
# * true/false, they could at least assert a contractual requirement for
# * non-const buffers when needed.
# */
##define ISC__BUFFER_INIT(_b, _base, _length) \
#	do { \
#		union { \
#			const void *	konst; \
#			void *		var; \
#		} _u; \
#		_u.konst = (_base); \
#		(_b)->base = _u.var; \
#		(_b)->length = (_length); \
#		(_b)->used = 0; \
#		(_b)->current = 0; \
#		(_b)->active = 0; \
#		(_b)->mctx = NULL; \
#		ISC_LINK_INIT(_b, link); \
#		(_b)->magic = ISC_BUFFER_MAGIC; \
#	} while (0)
#
##define ISC__BUFFER_INVALIDATE(_b) \
#	do { \
#		(_b)->magic = 0; \
#		(_b)->base = NULL; \
#		(_b)->length = 0; \
#		(_b)->used = 0; \
#		(_b)->current = 0; \
#		(_b)->active = 0; \
#	} while (0)
#
##define ISC__BUFFER_REGION(_b, _r) \
#	do { \
#		(_r)->base = (_b)->base; \
#		(_r)->length = (_b)->length; \
#	} while (0)
#
##define ISC__BUFFER_USEDREGION(_b, _r) \
#	do { \
#		(_r)->base = (_b)->base; \
#		(_r)->length = (_b)->used; \
#	} while (0)
#
##define ISC__BUFFER_AVAILABLEREGION(_b, _r) \
#	do { \
#		(_r)->base = isc_buffer_used(_b); \
#		(_r)->length = isc_buffer_availablelength(_b); \
#	} while (0)
#
##define ISC__BUFFER_ADD(_b, _n) \
#	do { \
#		(_b)->used += (_n); \
#	} while (0)
#
##define ISC__BUFFER_SUBTRACT(_b, _n) \
#	do { \
#		(_b)->used -= (_n); \
#		if ((_b)->current > (_b)->used) \
#			(_b)->current = (_b)->used; \
#		if ((_b)->active > (_b)->used) \
#			(_b)->active = (_b)->used; \
#	} while (0)
#
##define ISC__BUFFER_CLEAR(_b) \
#	do { \
#		(_b)->used = 0; \
#		(_b)->current = 0; \
#		(_b)->active = 0; \
#	} while (0)
#
##define ISC__BUFFER_CONSUMEDREGION(_b, _r) \
#	do { \
#		(_r)->base = (_b)->base; \
#		(_r)->length = (_b)->current; \
#	} while (0)
#
##define ISC__BUFFER_REMAININGREGION(_b, _r) \
#	do { \
#		(_r)->base = isc_buffer_current(_b); \
#		(_r)->length = isc_buffer_remaininglength(_b); \
#	} while (0)
#
##define ISC__BUFFER_ACTIVEREGION(_b, _r) \
#	do { \
#		if ((_b)->current < (_b)->active) { \
#			(_r)->base = isc_buffer_current(_b); \
#			(_r)->length = isc_buffer_activelength(_b); \
#		} else { \
#			(_r)->base = NULL; \
#			(_r)->length = 0; \
#		} \
#	} while (0)
#
##define ISC__BUFFER_SETACTIVE(_b, _n) \
#	do { \
#		(_b)->active = (_b)->current + (_n); \
#	} while (0)
#
##define ISC__BUFFER_FIRST(_b) \
#	do { \
#		(_b)->current = 0; \
#	} while (0)
#
##define ISC__BUFFER_FORWARD(_b, _n) \
#	do { \
#		(_b)->current += (_n); \
#	} while (0)
#
##define ISC__BUFFER_BACK(_b, _n) \
#	do { \
#		(_b)->current -= (_n); \
#	} while (0)
#
##define ISC__BUFFER_PUTMEM(_b, _base, _length) \
#	do { \
#		memcpy(isc_buffer_used(_b), (_base), (_length)); \
#		(_b)->used += (_length); \
#	} while (0)
#
##define ISC__BUFFER_PUTSTR(_b, _source) \
#	do { \
#		unsigned int _length; \
#		unsigned char *_cp; \
#		_length = strlen(_source); \
#		_cp = isc_buffer_used(_b); \
#		memcpy(_cp, (_source), _length); \
#		(_b)->used += (_length); \
#	} while (0)
#
##define ISC__BUFFER_PUTUINT8(_b, _val) \
#	do { \
#		unsigned char *_cp; \
#		isc_uint8_t _val2 = (_val); \
#		_cp = isc_buffer_used(_b); \
#		(_b)->used++; \
#		_cp[0] = _val2 & 0x00ff; \
#	} while (0)
#
##define ISC__BUFFER_PUTUINT16(_b, _val) \
#	do { \
#		unsigned char *_cp; \
#		isc_uint16_t _val2 = (_val); \
#		_cp = isc_buffer_used(_b); \
#		(_b)->used += 2; \
#		_cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \
#		_cp[1] = (unsigned char)(_val2 & 0x00ffU); \
#	} while (0)
#
##define ISC__BUFFER_PUTUINT32(_b, _val) \
#	do { \
#		unsigned char *_cp; \
#		isc_uint32_t _val2 = (_val); \
#		_cp = isc_buffer_used(_b); \
#		(_b)->used += 4; \
#		_cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \
#		_cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \
#		_cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \
#		_cp[3] = (unsigned char)((_val2 & 0x000000ff)); \
#	} while (0)
#
##if defined(ISC_BUFFER_USEINLINE)
##define isc_buffer_init			ISC__BUFFER_INIT
##define isc_buffer_invalidate		ISC__BUFFER_INVALIDATE
##define isc_buffer_region		ISC__BUFFER_REGION
##define isc_buffer_usedregion		ISC__BUFFER_USEDREGION
##define isc_buffer_availableregion	ISC__BUFFER_AVAILABLEREGION
##define isc_buffer_add			ISC__BUFFER_ADD
##define isc_buffer_subtract		ISC__BUFFER_SUBTRACT
##define isc_buffer_clear		ISC__BUFFER_CLEAR
##define isc_buffer_consumedregion	ISC__BUFFER_CONSUMEDREGION
##define isc_buffer_remainingregion	ISC__BUFFER_REMAININGREGION
##define isc_buffer_activeregion		ISC__BUFFER_ACTIVEREGION
##define isc_buffer_setactive		ISC__BUFFER_SETACTIVE
##define isc_buffer_first		ISC__BUFFER_FIRST
##define isc_buffer_forward		ISC__BUFFER_FORWARD
##define isc_buffer_back			ISC__BUFFER_BACK
##define isc_buffer_putmem		ISC__BUFFER_PUTMEM
##define isc_buffer_putstr		ISC__BUFFER_PUTSTR
##define isc_buffer_putuint8		ISC__BUFFER_PUTUINT8
##define isc_buffer_putuint16		ISC__BUFFER_PUTUINT16
##define isc_buffer_putuint32		ISC__BUFFER_PUTUINT32
##else
##define isc_buffer_init			isc__buffer_init
##define isc_buffer_invalidate		isc__buffer_invalidate
##define isc_buffer_region		isc__buffer_region
##define isc_buffer_usedregion		isc__buffer_usedregion
##define isc_buffer_availableregion	isc__buffer_availableregion
##define isc_buffer_add			isc__buffer_add
##define isc_buffer_subtract		isc__buffer_subtract
##define isc_buffer_clear		isc__buffer_clear
##define isc_buffer_consumedregion	isc__buffer_consumedregion
##define isc_buffer_remainingregion	isc__buffer_remainingregion
##define isc_buffer_activeregion		isc__buffer_activeregion
##define isc_buffer_setactive		isc__buffer_setactive
##define isc_buffer_first		isc__buffer_first
##define isc_buffer_forward		isc__buffer_forward
##define isc_buffer_back			isc__buffer_back
##define isc_buffer_putmem		isc__buffer_putmem
##define isc_buffer_putstr		isc__buffer_putstr
##define isc_buffer_putuint8		isc__buffer_putuint8
##define isc_buffer_putuint16		isc__buffer_putuint16
##define isc_buffer_putuint32		isc__buffer_putuint32
##endif
#
##endif /* ISC_BUFFER_H */
#
#--- New file ---
#+++ include/isc/netscope.h	04/12/22 23:56:31
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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: netscope.h,v 1.4.142.5 2004/03/08 09:04:52 marka Exp $ */
#
##ifndef ISC_NETSCOPE_H
##define ISC_NETSCOPE_H 1
#
#ISC_LANG_BEGINDECLS
#
#/*
# * Convert a string of an IPv6 scope zone to zone index.  If the conversion
# * succeeds, 'zoneid' will store the index value.
# * XXXJT: when a standard interface for this purpose is defined,
# * we should use it.
# *
# * Returns:
# *	ISC_R_SUCCESS: conversion succeeds
# *	ISC_R_FAILURE: conversion fails
# */
#isc_result_t
#isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid);
#
#ISC_LANG_ENDDECLS
#
##endif /* ISC_NETADDR_H */
#
#--- New file ---
#+++ include/isc/region.h	04/12/22 23:57:06
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 1998-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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: region.h,v 1.16.12.3 2004/03/08 09:04:53 marka Exp $ */
#
##ifndef ISC_REGION_H
##define ISC_REGION_H 1
#
##include <isc/types.h>
#
#struct isc_region {
#	unsigned char *	base;
#	unsigned int	length;
#};
#
#struct isc_textregion {
#	char *		base;
#	unsigned int	length;
#};
#
#/* XXXDCL questionable ... bears discussion.  we have been putting off
# * discussing the region api.
# */
#struct isc_constregion {
#	const void *	base;
#	unsigned int	length;
#};
#
#struct isc_consttextregion {
#	const char *	base;
#	unsigned int	length;
#};
#
#/*
# * The region structure is not opaque, and is usually directly manipulated.
# * Some macros are defined below for convenience.
# */
#
##define isc_region_consume(r,l) \
#	do { \
#		isc_region_t *_r = (r); \
#		unsigned int _l = (l); \
#		INSIST(_r->length >= _l); \
#		_r->base += _l; \
#		_r->length -= _l; \
#	} while (0)
#
##define isc_textregion_consume(r,l) \
#	do { \
#		isc_textregion_t *_r = (r); \
#		unsigned int _l = (l); \
#		INSIST(_r->length >= _l); \
#		_r->base += _l; \
#		_r->length -= _l; \
#	} while (0)
#
##define isc_constregion_consume(r,l) \
#	do { \
#		isc_constregion_t *_r = (r); \
#		unsigned int _l = (l); \
#		INSIST(_r->length >= _l); \
#		_r->base += _l; \
#		_r->length -= _l; \
#	} while (0)
#
#int
#isc_region_compare(isc_region_t *r1, isc_region_t *r2);
#/*
# * Compares the contents of two regions 
# *
# * Requires: 
# *	'r1' is a valid region
# *	'r2' is a valid region
# *
# * Returns:
# *	 < 0 if r1 is lexicographically less than r2
# *	 = 0 if r1 is lexicographically identical to r2
# *	 > 0 if r1 is lexicographically greater than r2
# */
#
##endif /* ISC_REGION_H */
#
#--- New file ---
#+++ libisc/ifiter_getifaddrs.c	04/12/23 22:58:38
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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: ifiter_getifaddrs.c,v 1.2.68.3 2004/03/06 08:14:59 marka Exp $ */
#
#/*
# * Obtain the list of network interfaces using the getifaddrs(3) library.
# */
#
##include <ifaddrs.h>
#
##define IFITER_MAGIC		ISC_MAGIC('I', 'F', 'I', 'G')
##define VALID_IFITER(t)		ISC_MAGIC_VALID(t, IFITER_MAGIC)
#
#struct isc_interfaceiter {
#	unsigned int		magic;		/* Magic number. */
#	isc_mem_t		*mctx;
#	void			*buf;		/* (unused) */
#	unsigned int		bufsize;	/* (always 0) */
#	struct ifaddrs		*ifaddrs;	/* List of ifaddrs */
#	struct ifaddrs		*pos;		/* Ptr to current ifaddr */
#	isc_interface_t		current;	/* Current interface data. */
#	isc_result_t		result;		/* Last result code. */
#};
#
#isc_result_t
#isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
#	isc_interfaceiter_t *iter;
#	isc_result_t result;
#	char strbuf[ISC_STRERRORSIZE];
#
#	REQUIRE(iterp != NULL);
#	REQUIRE(*iterp == NULL);
#
#	iter = isc_mem_get(mctx, sizeof(*iter));
#	if (iter == NULL)
#		return (ISC_R_NOMEMORY);
#
#	iter->mctx = mctx;
#	iter->buf = NULL;
#	iter->bufsize = 0;
#	iter->ifaddrs = NULL;
#
#	if (getifaddrs(&iter->ifaddrs) < 0) {
#		isc__strerror(errno, strbuf, sizeof(strbuf));
#		UNEXPECTED_ERROR(__FILE__, __LINE__,
#				 isc_msgcat_get(isc_msgcat,
#						ISC_MSGSET_IFITERGETIFADDRS,
#						ISC_MSG_GETIFADDRS,
#						"getting interface "
#						"addresses: getifaddrs: %s"),
#				 strbuf);
#		result = ISC_R_UNEXPECTED;
#		goto failure;
#	}
#
#	/*
#	 * A newly created iterator has an undefined position
#	 * until isc_interfaceiter_first() is called.
#	 */
#	iter->pos = NULL;
#	iter->result = ISC_R_FAILURE;
#
#	iter->magic = IFITER_MAGIC;
#	*iterp = iter;
#	return (ISC_R_SUCCESS);
#
# failure:
#	if (iter->ifaddrs != NULL) /* just in case */
#		freeifaddrs(iter->ifaddrs);
#	isc_mem_put(mctx, iter, sizeof(*iter));
#	return (result);
#}
#
#/*
# * Get information about the current interface to iter->current.
# * If successful, return ISC_R_SUCCESS.
# * If the interface has an unsupported address family,
# * return ISC_R_IGNORE.
# */
#
#static isc_result_t
#internal_current(isc_interfaceiter_t *iter) {
#	struct ifaddrs *ifa;
#	int family;
#	unsigned int namelen;
#
#	REQUIRE(VALID_IFITER(iter));
#
#	ifa = iter->pos;
#
#	INSIST(ifa != NULL);
#	INSIST(ifa->ifa_name != NULL);
#	INSIST(ifa->ifa_addr != NULL);
#
#	family = ifa->ifa_addr->sa_family;
#	if (family != AF_INET && family != AF_INET6)
#		return (ISC_R_IGNORE);
#
#	memset(&iter->current, 0, sizeof(iter->current));
#
#	namelen = strlen(ifa->ifa_name);
#	if (namelen > sizeof(iter->current.name) - 1)
#		namelen = sizeof(iter->current.name) - 1;
#
#	memset(iter->current.name, 0, sizeof(iter->current.name));
#	memcpy(iter->current.name, ifa->ifa_name, namelen);
#
#	iter->current.flags = 0;
#
#	if ((ifa->ifa_flags & IFF_UP) != 0)
#		iter->current.flags |= INTERFACE_F_UP;
#
#	if ((ifa->ifa_flags & IFF_POINTOPOINT) != 0)
#		iter->current.flags |= INTERFACE_F_POINTTOPOINT;
#
#	if ((ifa->ifa_flags & IFF_LOOPBACK) != 0)
#		iter->current.flags |= INTERFACE_F_LOOPBACK;
#
#	if ((ifa->ifa_flags & IFF_BROADCAST) != 0) {
#		iter->current.flags |= INTERFACE_F_BROADCAST;
#	}
#
##ifdef IFF_MULTICAST
#	if ((ifa->ifa_flags & IFF_MULTICAST) != 0) {
#		iter->current.flags |= INTERFACE_F_MULTICAST;
#	}
##endif
#	iter->current.af = family;
#
#	get_addr(family, &iter->current.address, ifa->ifa_addr, ifa->ifa_name);
#
#	if (ifa->ifa_netmask != NULL)
#		get_addr(family, &iter->current.netmask, ifa->ifa_netmask,
#			 ifa->ifa_name);
#
#	if (ifa->ifa_dstaddr != NULL &&
#	    (iter->current.flags & IFF_POINTOPOINT) != 0)
#		get_addr(family, &iter->current.dstaddress, ifa->ifa_dstaddr,
#			 ifa->ifa_name);
#
#	if (ifa->ifa_broadaddr != NULL &&
#	    (iter->current.flags & IFF_BROADCAST) != 0)
#		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,
#			 ifa->ifa_name);
#
#	return (ISC_R_SUCCESS);
#}
#
#/*
# * Step the iterator to the next interface.  Unlike
# * isc_interfaceiter_next(), this may leave the iterator
# * positioned on an interface that will ultimately
# * be ignored.  Return ISC_R_NOMORE if there are no more
# * interfaces, otherwise ISC_R_SUCCESS.
# */
#static isc_result_t
#internal_next(isc_interfaceiter_t *iter) {
#	iter->pos = iter->pos->ifa_next;
#
#	if (iter->pos == NULL)
#		return (ISC_R_NOMORE);
#
#	return (ISC_R_SUCCESS);
#}
#
#static void
#internal_destroy(isc_interfaceiter_t *iter) {
#	if (iter->ifaddrs)
#		freeifaddrs(iter->ifaddrs);
#	iter->ifaddrs = NULL;
#}
#
#static
#void internal_first(isc_interfaceiter_t *iter) {
#	iter->pos = iter->ifaddrs;
#}
#
#--- New file ---
#+++ libisc/netaddr.c	04/12/22 23:58:40
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 1999-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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: netaddr.c,v 1.18.12.9 2004/05/15 03:46:12 jinmei Exp $ */
#
##include <config.h>
#
##define ISC_ONLY_IPV6
#
##include <stdio.h>
#
##include <isc/buffer.h>
##include <isc/msgs.h>
##include <isc/net.h>
##include <isc/netaddr.h>
##include <isc/print.h>
##include <isc/sockaddr.h>
##include <isc/string.h>
##include <isc/util.h>
#
#isc_boolean_t
#isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b) {
#	REQUIRE(a != NULL && b != NULL);
#
#	if (a->family != b->family)
#		return (ISC_FALSE);
#
#	if (a->zone != b->zone)
#		return (ISC_FALSE);
#
#	switch (a->family) {
#	case AF_INET:
#		if (a->type.in.s_addr != b->type.in.s_addr)
#			return (ISC_FALSE);
#		break;
#	case AF_INET6:
#		if (memcmp(&a->type.in6, &b->type.in6,
#			   sizeof(a->type.in6)) != 0 ||
#		    a->zone != b->zone)
#			return (ISC_FALSE);
#		break;
#	default:
#		return (ISC_FALSE);
#	}
#	return (ISC_TRUE);
#}
#
#isc_boolean_t
#isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b,
#		     unsigned int prefixlen)
#{
#	const unsigned char *pa, *pb;
#	unsigned int ipabytes; /* Length of whole IP address in bytes */
#	unsigned int nbytes;   /* Number of significant whole bytes */
#	unsigned int nbits;    /* Number of significant leftover bits */
#
#	REQUIRE(a != NULL && b != NULL);
#
#	if (a->family != b->family)
#		return (ISC_FALSE);
#
#	if (a->zone != b->zone)
#		return (ISC_FALSE);
#
#	switch (a->family) {
#	case AF_INET:
#		pa = (const unsigned char *) &a->type.in;
#		pb = (const unsigned char *) &b->type.in;
#		ipabytes = 4;
#		break;
#	case AF_INET6:
#		pa = (const unsigned char *) &a->type.in6;
#		pb = (const unsigned char *) &b->type.in6;
#		ipabytes = 16;
#		break;
#	default:
#		pa = pb = NULL; /* Avoid silly compiler warning. */
#		ipabytes = 0; /* Ditto. */
#		return (ISC_FALSE);
#	}
#
#	/*
#	 * Don't crash if we get a pattern like 10.0.0.1/9999999.
#	 */
#	if (prefixlen > ipabytes * 8)
#		prefixlen = ipabytes * 8;
#
#	nbytes = prefixlen / 8;
#	nbits = prefixlen % 8;
#
#	if (nbytes > 0) {
#		if (memcmp(pa, pb, nbytes) != 0)
#			return (ISC_FALSE);
#	}
#	if (nbits > 0) {
#		unsigned int bytea, byteb, mask;
#		INSIST(nbytes < ipabytes);
#		INSIST(nbits < 8);
#		bytea = pa[nbytes];
#		byteb = pb[nbytes];
#		mask = (0xFF << (8-nbits)) & 0xFF;
#		if ((bytea & mask) != (byteb & mask))
#			return (ISC_FALSE);
#	}
#	return (ISC_TRUE);
#}
#
#isc_result_t
#isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
#	char abuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")];
#	char zbuf[sizeof("%4294967295")];
#	unsigned int alen;
#	int zlen;
#	const char *r;
#	const void *type;
#
#	REQUIRE(netaddr != NULL);
#
#	switch (netaddr->family) {
#	case AF_INET:
#		type = &netaddr->type.in;
#		break;
#	case AF_INET6:
#		type = &netaddr->type.in6;
#		break;
#	default:
#		return (ISC_R_FAILURE);
#	}
#	r = inet_ntop(netaddr->family, type, abuf, sizeof(abuf));
#	if (r == NULL)
#		return (ISC_R_FAILURE);
#
#	alen = strlen(abuf);
#	INSIST(alen < sizeof(abuf));
#
#	zlen = 0;
#	if (netaddr->family == AF_INET6 && netaddr->zone != 0) {
#		zlen = snprintf(zbuf, sizeof(zbuf), "%%%u", netaddr->zone);
#		if (zlen < 0)
#			return (ISC_R_FAILURE);
#		INSIST((unsigned int)zlen < sizeof(zbuf));
#	}
#
#	if (alen + zlen > isc_buffer_availablelength(target))
#		return (ISC_R_NOSPACE);
#
#	isc_buffer_putmem(target, (unsigned char *)abuf, alen);
#	isc_buffer_putmem(target, (unsigned char *)zbuf, zlen);
#
#	return (ISC_R_SUCCESS);
#}
#
#void
#isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) {
#	isc_result_t result;
#	isc_buffer_t buf;
#
#	isc_buffer_init(&buf, array, size);
#	result = isc_netaddr_totext(na, &buf);
#
#	/*
#	 * Null terminate.
#	 */
#	if (result == ISC_R_SUCCESS) {
#		if (isc_buffer_availablelength(&buf) >= 1)
#			isc_buffer_putuint8(&buf, 0);
#		else
#			result = ISC_R_NOSPACE;
#	}
#
#	if (result != ISC_R_SUCCESS) {
#		snprintf(array, size,
#			 isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
#					ISC_MSG_UNKNOWNADDR,
#					"<unknown address, family %u>"),
#			 na->family);
#		array[size - 1] = '\0';
#	}
#}
#
#isc_result_t
#isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
#	unsigned int nbits, nbytes, ipbytes, i;
#	const unsigned char *p;
#
#	switch (s->family) {
#	case AF_INET:
#		p = (const unsigned char *) &s->type.in;
#		ipbytes = 4;
#		break;
#	case AF_INET6:
#		p = (const unsigned char *) &s->type.in6;
#		ipbytes = 16;
#		break;
#	default:
#		ipbytes = 0;
#		return (ISC_R_NOTIMPLEMENTED);
#	}
#	nbytes = nbits = 0;
#	for (i = 0; i < ipbytes; i++) {
#		if (p[i] != 0xFF)
#			break;
#	}
#	nbytes = i;
#	if (i < ipbytes) {
#		unsigned int c = p[nbytes];
#		while ((c & 0x80) != 0 && nbits < 8) {
#			c <<= 1; nbits++;
#		}
#		if ((c & 0xFF) != 0)
#			return (ISC_R_MASKNONCONTIG);
#		i++;
#	}
#	for (; i < ipbytes; i++) {
#		if (p[i] != 0)
#			return (ISC_R_MASKNONCONTIG);
#		i++;
#	}
#	*lenp = nbytes * 8 + nbits;
#	return (ISC_R_SUCCESS);
#}
#
#void
#isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina) {
#	memset(netaddr, 0, sizeof(*netaddr));
#	netaddr->family = AF_INET;
#	netaddr->type.in = *ina;
#}
#
#void
#isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6) {
#	memset(netaddr, 0, sizeof(*netaddr));
#	netaddr->family = AF_INET6;
#	netaddr->type.in6 = *ina6;
#}
#
#void
#isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone) {
#	/* we currently only support AF_INET6. */
#	REQUIRE(netaddr->family == AF_INET6);
#
#	netaddr->zone = zone;
#}
#
#isc_uint32_t
#isc_netaddr_getzone(const isc_netaddr_t *netaddr) {
#	return (netaddr->zone);
#}
#
#void
#isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
#	int family = s->type.sa.sa_family;
#	t->family = family;
#	switch (family) {
#	case AF_INET:
#		t->type.in = s->type.sin.sin_addr;
#		t->zone = 0;
#		break;
#	case AF_INET6:
#		memcpy(&t->type.in6, &s->type.sin6.sin6_addr, 16);
##ifdef ISC_PLATFORM_HAVESCOPEID
#		t->zone = s->type.sin6.sin6_scope_id;
##else
#		t->zone = 0;
##endif
#		break;
#	default:
#		INSIST(0);
#	}
#}
#
#void
#isc_netaddr_any(isc_netaddr_t *netaddr) {
#	memset(netaddr, 0, sizeof(*netaddr));
#	netaddr->family = AF_INET;
#	netaddr->type.in.s_addr = INADDR_ANY;
#}
#
#void
#isc_netaddr_any6(isc_netaddr_t *netaddr) {
#	memset(netaddr, 0, sizeof(*netaddr));
#	netaddr->family = AF_INET6;
#	netaddr->type.in6 = in6addr_any;
#}
#
#isc_boolean_t
#isc_netaddr_ismulticast(isc_netaddr_t *na) {
#	switch (na->family) {
#	case AF_INET:
#		return (ISC_TF(ISC_IPADDR_ISMULTICAST(na->type.in.s_addr)));
#	case AF_INET6:
#		return (ISC_TF(IN6_IS_ADDR_MULTICAST(&na->type.in6)));
#	default:
#		return (ISC_FALSE);  /* XXXMLG ? */
#	}
#}
#
#isc_boolean_t
#isc_netaddr_isexperimental(isc_netaddr_t *na) {
#	switch (na->family) {
#	case AF_INET:
#		return (ISC_TF(ISC_IPADDR_ISEXPERIMENTAL(na->type.in.s_addr)));
#	default:
#		return (ISC_FALSE);  /* XXXMLG ? */
#	}
#}
#
#isc_boolean_t
#isc_netaddr_islinklocal(isc_netaddr_t *na) {
#	switch (na->family) {
#	case AF_INET:
#		return (ISC_FALSE);
#	case AF_INET6:
#		return (ISC_TF(IN6_IS_ADDR_LINKLOCAL(&na->type.in6)));
#	default:
#		return (ISC_FALSE);
#	}
#}
#
#isc_boolean_t
#isc_netaddr_issitelocal(isc_netaddr_t *na) {
#	switch (na->family) {
#	case AF_INET:
#		return (ISC_FALSE);
#	case AF_INET6:
#		return (ISC_TF(IN6_IS_ADDR_SITELOCAL(&na->type.in6)));
#	default:
#		return (ISC_FALSE);
#	}
#}
#
#void
#isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s) {
#	isc_netaddr_t *src;
#
#	DE_CONST(s, src);	/* Must come before IN6_IS_ADDR_V4MAPPED. */
#
#	REQUIRE(s->family == AF_INET6);
#	REQUIRE(IN6_IS_ADDR_V4MAPPED(&src->type.in6));
#
#	memset(t, 0, sizeof(*t));
#	t->family = AF_INET;
#	memcpy(&t->type.in, (char *)&src->type.in6 + 12, 4);
#	return;
#}
#
#--- New file ---
#+++ libisc/netscope.c	04/12/22 23:59:18
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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.
# */
#
##if defined(LIBC_SCCS) && !defined(lint)
#static char rcsid[] =
#	"$Id: netscope.c,v 1.5.142.7 2004/03/12 10:31:26 marka Exp $";
##endif /* LIBC_SCCS and not lint */
#
##include <config.h>
#
##include <isc/string.h>
##include <isc/net.h>
##include <isc/netscope.h>
##include <isc/result.h>
#
#isc_result_t
#isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
#	char *ep;
##ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
#	unsigned int ifid;
##endif
#	struct in6_addr *in6;
#	isc_uint32_t zone;
#	isc_uint64_t llz;
#
#	/* at this moment, we only support AF_INET6 */
#	if (af != AF_INET6)
#		return (ISC_R_FAILURE);
#
#	in6 = (struct in6_addr *)addr;
#
#	/*
#	 * Basically, "names" are more stable than numeric IDs in terms of
#	 * renumbering, and are more preferred.  However, since there is no
#	 * standard naming convention and APIs to deal with the names.  Thus,
#	 * we only handle the case of link-local addresses, for which we use
#	 * interface names as link names, assuming one to one mapping between
#	 * interfaces and links.
#	 */
##ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
#	if (IN6_IS_ADDR_LINKLOCAL(in6) &&
#	    (ifid = if_nametoindex((const char *)scopename)) != 0)
#		zone = (isc_uint32_t)ifid;
#	else {
##endif
#		llz = isc_string_touint64(scopename, &ep, 10);
#		if (ep == scopename)
#			return (ISC_R_FAILURE);
#
#		/* check overflow */
#		zone = (isc_uint32_t)(llz & 0xffffffffUL);
#		if (zone != llz)
#			return (ISC_R_FAILURE);
##ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
#	}
##endif
#
#	*zoneid = zone;
#	return (ISC_R_SUCCESS);
#}
#
#--- New file ---
#+++ libisc/sockaddr.c	04/12/23 00:00:01
#/*
# * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
# * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
# * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# * AND FITNESS.  IN NO EVENT SHALL ISC 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.48.2.1.2.10 2004/05/15 03:46:12 jinmei Exp $ */
#
##include <config.h>
#
##define ISC_ONLY_IPV6
#
##include <stdio.h>
#
##include <isc/buffer.h>
#/*
# * We currently don't need hashing here
# */
##if 0
##include <isc/hash.h>
##endif
#
##include <isc/msgs.h>
##include <isc/netaddr.h>
##include <isc/print.h>
##include <isc/region.h>
##include <isc/sockaddr.h>
##include <isc/string.h>
##include <isc/util.h>
#
#isc_boolean_t
#isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
#	REQUIRE(a != NULL && b != NULL);
#
#	if (a->length != b->length)
#		return (ISC_FALSE);
#
#	/*
#	 * We don't just memcmp because the sin_zero field isn't always
#	 * zero.
#	 */
#
#	if (a->type.sa.sa_family != b->type.sa.sa_family)
#		return (ISC_FALSE);
#	switch (a->type.sa.sa_family) {
#	case AF_INET:
#		if (memcmp(&a->type.sin.sin_addr, &b->type.sin.sin_addr,
#			   sizeof(a->type.sin.sin_addr)) != 0)
#			return (ISC_FALSE);
#		if (a->type.sin.sin_port != b->type.sin.sin_port)
#			return (ISC_FALSE);
#		break;
#	case AF_INET6:
#		if (memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr,
#			   sizeof(a->type.sin6.sin6_addr)) != 0)
#			return (ISC_FALSE);
##ifdef ISC_PLATFORM_HAVESCOPEID
#		if (a->type.sin6.sin6_scope_id != b->type.sin6.sin6_scope_id)
#			return (ISC_FALSE);
##endif
#		if (a->type.sin6.sin6_port != b->type.sin6.sin6_port)
#			return (ISC_FALSE);
#		break;
#	default:
#		if (memcmp(&a->type, &b->type, a->length) != 0)
#			return (ISC_FALSE);
#	}
#	return (ISC_TRUE);
#}
#
#isc_boolean_t
#isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
#	REQUIRE(a != NULL && b != NULL);
#
#	if (a->length != b->length)
#		return (ISC_FALSE);
#
#	if (a->type.sa.sa_family != b->type.sa.sa_family)
#		return (ISC_FALSE);
#	switch (a->type.sa.sa_family) {
#	case AF_INET:
#		if (memcmp(&a->type.sin.sin_addr, &b->type.sin.sin_addr,
#			   sizeof(a->type.sin.sin_addr)) != 0)
#			return (ISC_FALSE);
#		break;
#	case AF_INET6:
#		if (memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr,
#			   sizeof(a->type.sin6.sin6_addr)) != 0)
#			return (ISC_FALSE);
##ifdef ISC_PLATFORM_HAVESCOPEID
#		if (a->type.sin6.sin6_scope_id != b->type.sin6.sin6_scope_id)
#			return (ISC_FALSE);
##endif
#		break;
#	default:
#		if (memcmp(&a->type, &b->type, a->length) != 0)
#			return (ISC_FALSE);
#	}
#	return (ISC_TRUE);
#}
#
#isc_boolean_t
#isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
#			  unsigned int prefixlen)
#{
#	isc_netaddr_t na, nb;
#	isc_netaddr_fromsockaddr(&na, a);
#	isc_netaddr_fromsockaddr(&nb, b);
#	return (isc_netaddr_eqprefix(&na, &nb, prefixlen));
#}
#
#isc_result_t
#isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
#	isc_result_t result;
#	isc_netaddr_t netaddr;
#	char pbuf[sizeof("65000")];
#	unsigned int plen;
#	isc_region_t avail;
#
#	REQUIRE(sockaddr != NULL);
#
#	/*
#	 * Do the port first, giving us the opportunity to check for
#	 * unsupported address families before calling
#	 * isc_netaddr_fromsockaddr().
#	 */
#	switch (sockaddr->type.sa.sa_family) {
#	case AF_INET:
#		snprintf(pbuf, sizeof(pbuf), "%u", ntohs(sockaddr->type.sin.sin_port));
#		break;
#	case AF_INET6:
#		snprintf(pbuf, sizeof(pbuf), "%u", ntohs(sockaddr->type.sin6.sin6_port));
#		break;
#	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);
#
#	/*
#	 * Null terminate after used region.
#	 */
#	isc_buffer_availableregion(target, &avail);
#	INSIST(avail.length >= 1);
#	avail.base[0] = '\0';
#
#	return (ISC_R_SUCCESS);
#}
#
#void
#isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) {
#	isc_result_t result;
#	isc_buffer_t buf;
#
#	isc_buffer_init(&buf, array, size);
#	result = isc_sockaddr_totext(sa, &buf);
#	if (result != ISC_R_SUCCESS) {
#		/*
#		 * The message is the same as in netaddr.c.
#		 */
#		snprintf(array, size,
#			 isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
#					ISC_MSG_UNKNOWNADDR,
#					"<unknown address, family %u>"),
#			 sa->type.sa.sa_family);
#		array[size - 1] = '\0';
#	}
#}
#
##if 0
#/*
# * We currently don't need hashing here
# */
#unsigned int
#isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
#	unsigned int length = 0;
#	const unsigned char *s = NULL;
#	unsigned int h = 0;
#	unsigned int g;
#	unsigned int p = 0;
#	const struct in6_addr *in6;
#
#	REQUIRE(sockaddr != NULL);
#
#	switch (sockaddr->type.sa.sa_family) {
#	case AF_INET:
#		s = (const unsigned char *)&sockaddr->type.sin.sin_addr;
#		p = ntohs(sockaddr->type.sin.sin_port);
#		length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
#		break;
#	case AF_INET6:
#		in6 = &sockaddr->type.sin6.sin6_addr;
#		if (IN6_IS_ADDR_V4MAPPED(in6)) {
#			s = (const unsigned char *)&in6[12];
#			length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
#		} else {
#			s = (const unsigned char *)in6;
#			length = sizeof(sockaddr->type.sin6.sin6_addr);
#		}
#		p = ntohs(sockaddr->type.sin6.sin6_port);
#		break;
#	default:
#		UNEXPECTED_ERROR(__FILE__, __LINE__,
#				 isc_msgcat_get(isc_msgcat,
#						ISC_MSGSET_SOCKADDR,
#						ISC_MSG_UNKNOWNFAMILY,
#						"unknown address family: %d"),
#					     (int)sockaddr->type.sa.sa_family);
#		s = (const unsigned char *)&sockaddr->type;
#		length = sockaddr->length;
#		p = 0;
#	}
#
#	h = isc_hash_calc(s, length, ISC_TRUE);
#	if (!address_only) {
#		g = isc_hash_calc((const unsigned char *)&p, sizeof(p),
#				  ISC_TRUE);
#		h = h ^ g; /* XXX: we should concatenate h and p first */
#	}
#
#	return (h);
#}
##endif
#
#void
#isc_sockaddr_any(isc_sockaddr_t *sockaddr)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin.sin_family = AF_INET;
##ifdef ISC_PLATFORM_HAVESALEN
#	sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
##endif
#	sockaddr->type.sin.sin_addr.s_addr = INADDR_ANY;
#	sockaddr->type.sin.sin_port = 0;
#	sockaddr->length = sizeof(sockaddr->type.sin);
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#void
#isc_sockaddr_any6(isc_sockaddr_t *sockaddr)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin6.sin6_family = AF_INET6;
##ifdef ISC_PLATFORM_HAVESALEN
#	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
##endif
#	sockaddr->type.sin6.sin6_addr = in6addr_any;
#	sockaddr->type.sin6.sin6_port = 0;
#	sockaddr->length = sizeof(sockaddr->type.sin6);
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#void
#isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
#		    in_port_t port)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin.sin_family = AF_INET;
##ifdef ISC_PLATFORM_HAVESALEN
#	sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
##endif
#	sockaddr->type.sin.sin_addr = *ina;
#	sockaddr->type.sin.sin_port = htons(port);
#	sockaddr->length = sizeof(sockaddr->type.sin);
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#void
#isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int pf) {
#     switch (pf) {
#     case AF_INET:
#	     isc_sockaddr_any(sockaddr);
#	     break;
#     case AF_INET6:
#	     isc_sockaddr_any6(sockaddr);
#	     break;
#     default:
#	     INSIST(0);
#     }
#}
#
#void
#isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6,
#		     in_port_t port)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin6.sin6_family = AF_INET6;
##ifdef ISC_PLATFORM_HAVESALEN
#	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
##endif
#	sockaddr->type.sin6.sin6_addr = *ina6;
#	sockaddr->type.sin6.sin6_port = htons(port);
#	sockaddr->length = sizeof(sockaddr->type.sin6);
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#void
#isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
#		      in_port_t port)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin6.sin6_family = AF_INET6;
##ifdef ISC_PLATFORM_HAVESALEN
#	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
##endif
#	sockaddr->type.sin6.sin6_addr.s6_addr[10] = 0xff;
#	sockaddr->type.sin6.sin6_addr.s6_addr[11] = 0xff;
#	memcpy(&sockaddr->type.sin6.sin6_addr.s6_addr[12], ina, 4);
#	sockaddr->type.sin6.sin6_port = htons(port);
#	sockaddr->length = sizeof(sockaddr->type.sin6);
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#int
#isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) {
#
#	/*
#	 * Get the protocol family of 'sockaddr'.
#	 */
#
##if (AF_INET == PF_INET && AF_INET6 == PF_INET6)
#	/*
#	 * Assume that PF_xxx == AF_xxx for all AF and PF.
#	 */
#	return (sockaddr->type.sa.sa_family);
##else
#	switch (sockaddr->type.sa.sa_family) {
#	case AF_INET:
#		return (PF_INET);
#	case AF_INET6:
#		return (PF_INET6);
#	default:
#		FATAL_ERROR(__FILE__, __LINE__,
#			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
#					   ISC_MSG_UNKNOWNFAMILY,
#					   "unknown address family: %d"),
#			    (int)sockaddr->type.sa.sa_family);
#	}
##endif
#}
#
#void
#isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
#		    in_port_t port)
#{
#	memset(sockaddr, 0, sizeof(*sockaddr));
#	sockaddr->type.sin.sin_family = na->family;
#	switch (na->family) {
#	case AF_INET:
#		sockaddr->length = sizeof(sockaddr->type.sin);
##ifdef ISC_PLATFORM_HAVESALEN
#		sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
##endif
#		sockaddr->type.sin.sin_addr = na->type.in;
#		sockaddr->type.sin.sin_port = htons(port);
#		break;
#	case AF_INET6:
#		sockaddr->length = sizeof(sockaddr->type.sin6);
##ifdef ISC_PLATFORM_HAVESALEN
#		sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
##endif
#		memcpy(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16);
##ifdef ISC_PLATFORM_HAVESCOPEID
#		sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na);
##endif
#		sockaddr->type.sin6.sin6_port = htons(port);
#		break;
#        default:
#                INSIST(0);
#	}
#	ISC_LINK_INIT(sockaddr, link);
#}
#
#void
#isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
#	switch (sockaddr->type.sa.sa_family) {
#	case AF_INET:
#		sockaddr->type.sin.sin_port = htons(port);
#		break;
#	case AF_INET6:
#		sockaddr->type.sin6.sin6_port = htons(port);
#		break;
#	default:
#		FATAL_ERROR(__FILE__, __LINE__,
#			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
#					   ISC_MSG_UNKNOWNFAMILY,
#					   "unknown address family: %d"),
#			    (int)sockaddr->type.sa.sa_family);
#	}
#}
#
#in_port_t
#isc_sockaddr_getport(isc_sockaddr_t *sockaddr) {
#	in_port_t port = 0;
#
#	switch (sockaddr->type.sa.sa_family) {
#	case AF_INET:
#		port = ntohs(sockaddr->type.sin.sin_port);
#		break;
#	case AF_INET6:
#		port = ntohs(sockaddr->type.sin6.sin6_port);
#		break;
#	default:
#		FATAL_ERROR(__FILE__, __LINE__,
#			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
#					   ISC_MSG_UNKNOWNFAMILY,
#					   "unknown address family: %d"),
#			    (int)sockaddr->type.sa.sa_family);
#	}
#
#	return (port);
#}
#
#isc_boolean_t
#isc_sockaddr_ismulticast(isc_sockaddr_t *sockaddr) {
#	isc_netaddr_t netaddr;
#
#	isc_netaddr_fromsockaddr(&netaddr, sockaddr);
#	return (isc_netaddr_ismulticast(&netaddr));
#}
#
#isc_boolean_t
#isc_sockaddr_isexperimental(isc_sockaddr_t *sockaddr) {
#	isc_netaddr_t netaddr;
#
#	if (sockaddr->type.sa.sa_family == AF_INET) {
#		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
#		return (isc_netaddr_isexperimental(&netaddr));
#	}
#	return (ISC_FALSE);
#}
#
#isc_boolean_t
#isc_sockaddr_issitelocal(isc_sockaddr_t *sockaddr) {
#	isc_netaddr_t netaddr;
#
#	if (sockaddr->type.sa.sa_family == AF_INET6) {
#		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
#		return (isc_netaddr_issitelocal(&netaddr));
#	}
#	return (ISC_FALSE);
#}
#
#isc_boolean_t
#isc_sockaddr_islinklocal(isc_sockaddr_t *sockaddr) {
#	isc_netaddr_t netaddr;
#
#	if (sockaddr->type.sa.sa_family == AF_INET6) {
#		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
#		return (isc_netaddr_islinklocal(&netaddr));
#	}
#	return (ISC_FALSE);
#}
#
#
#--- 1.17/include/ntp_machine.h	2003-02-01 18:57:39 -05:00
#+++ 1.18/include/ntp_machine.h	2004-12-23 22:40:38 -05:00
#@@ -272,8 +272,6 @@
# # define unlink _unlink
# # define fileno _fileno
# # define write _write
#-# define vsnprintf _vsnprintf
#-# define snprintf _snprintf
# #ifndef close
# # define close _close
# #endif
#
#--- 1.30/libntp/Makefile.am	2004-08-02 18:27:20 -04:00
#+++ 1.31/libntp/Makefile.am	2004-12-23 22:38:13 -05:00
#@@ -21,7 +21,8 @@
# 	$(srcdir)/../libisc/net.c $(srcdir)/../libisc/isc_strerror.c \
# 	$(srcdir)/../libisc/inet_ntop.c \
# 	$(srcdir)/../libisc/inet_pton.c \
#-	$(srcdir)/../libisc/inet_aton.c
#+	$(srcdir)/../libisc/netaddr.c $(srcdir)/../libisc/sockaddr.c \
#+	$(srcdir)/../libisc/netscope.c
# libntp_a_SOURCES = systime.c $(libntp_a_SRCS)
# libntpsim_a_SOURCES = systime_s.c $(libntp_a_SRCS)
# EXTRA_libntp_a_SOURCES = adjtimex.c log.c random.c
#
#--- 1.156/ntpd/ntp_io.c	2005-01-05 00:12:07 -05:00
#+++ 1.157/ntpd/ntp_io.c	2005-01-05 22:29:50 -05:00
#@@ -2372,14 +2372,7 @@
# 		    }
# 
# 		if (rp == 0)
#-		{
#-			/*
#-			 * Internal error.	Report it.
#-			 */
#-			msyslog(LOG_ERR,
#-				"internal error: refclockio structure not found");
# 			return;
#-		}
# 	}
# 
# 	/*
#
#--- 1.66/ntpd/ntp_peer.c	2004-11-29 01:06:45 -05:00
#+++ 1.67/ntpd/ntp_peer.c	2004-12-02 20:58:08 -05:00
#@@ -568,6 +568,11 @@
# 	if (++current_association_ID == 0)
# 		++current_association_ID;
# 
#+#ifdef DEBUG
#+	if (debug >2)
#+		printf("newpeer: cast flags: 0x%x for address: %s\n",
#+			cast_flags, stoa(srcadr));
#+#endif
# 	/*
# 	 * Initialize the peer structure and dance the interface jig.
# 	 * Reference clocks step the loopback waltz, the others
#
#--- 1.33/ports/winnt/include/config.h	2004-11-18 23:13:26 -05:00
#+++ 1.34/ports/winnt/include/config.h	2004-12-23 22:40:38 -05:00
#@@ -72,10 +72,16 @@
# /* Enable OpenSSL */
# #define OPENSSL 1
# 
#+/*
#+ * Miscellaneous functions that Microsoft maps
#+ * to other names
#+ */
#+#define vsnprintf _vsnprintf
#+#define snprintf _snprintf
# #define isascii __isascii
# #define finite _finite
#-# define random      rand
#-# define srandom     srand
#+#define random      rand
#+#define srandom     srand
# 
# /*
#  * We need to include string.h first before we override strerror
#
#--- 1.23/ports/winnt/libntp/libntp.dsp	2004-11-02 23:01:14 -05:00
#+++ 1.24/ports/winnt/libntp/libntp.dsp	2004-12-23 22:38:34 -05:00
#@@ -306,10 +306,18 @@
# # End Source File
# # Begin Source File
# 
#+SOURCE=..\..\..\libisc\netaddr.c
#+# End Source File
#+# Begin Source File
#+
# SOURCE=..\..\..\libntp\netof.c
# # End Source File
# # Begin Source File
# 
#+SOURCE=..\..\..\libisc\netscope.c
#+# End Source File
#+# Begin Source File
#+
# SOURCE=..\..\..\libntp\ntp_rfc2553.c
# # End Source File
# # Begin Source File
#@@ -354,6 +362,10 @@
# # End Source File
# # Begin Source File
# 
#+SOURCE=..\..\..\libisc\sockaddr.c
#+# End Source File
#+# Begin Source File
#+
# SOURCE=..\..\..\libntp\socktoa.c
# # End Source File
# # Begin Source File
#@@ -486,7 +498,15 @@
# # End Source File
# # Begin Source File
# 
#+SOURCE=..\..\..\include\isc\netaddr.h
#+# End Source File
#+# Begin Source File
#+
# SOURCE=..\include\netdb.h
#+# End Source File
#+# Begin Source File
#+
#+SOURCE=..\..\..\include\isc\netscope.h
# # End Source File
# # Begin Source File
# 
#

# Diff checksum=0974a637


# Patch vers:	1.3
# Patch type:	REGULAR

== ChangeSet ==
stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
stenn at pogo.udel.edu|ChangeSet|20041130102017|27001
D 1.1285 04/12/02 20:58:35-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add info on cast_flags in newpeer
K 26295
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_peer.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_peer.c|20041203015808|30676

mayer at tecotoo.|ChangeSet|20041203015835|26295
D 1.1286 04/12/03 22:29:34-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Undefine UDP_WILDCARD_DELIVERY for testing
K 25812
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20041204032908|63356

mayer at tecotoo.|ChangeSet|20041204032934|25812
D 1.1287 04/12/03 22:36:37-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Undefine UDP_WILDCARD_DELIVERY for testing
K 25807
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20041204033623|63356

mayer at tecotoo.|ChangeSet|20041204033637|25807
D 1.1288 04/12/07 19:40:34-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add debugging detail for adding mcast group membership
K 25800
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20041208003951|16400

mayer at tecotoo.|ChangeSet|20041208004034|25800
D 1.1289 04/12/07 19:44:54-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add debugging detail for adding mcast group membership- error fix
K 25799
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20041208004430|13931

mayer at tecotoo.|ChangeSet|20041208004454|25799
D 1.1290 04/12/07 20:31:52-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Renable wildcard for testing
K 25809
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20041208013136|13983

mayer at tecotoo.|ChangeSet|20041208013152|25809
D 1.1291 04/12/21 08:38:19-05:00 mayer at pogo.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge bk://www.ntp.org/home/bk/ntp-dev
c into pogo.udel.edu:/pogo/users/mayer/ntp-dev
i stenn at whimsy.udel.edu|ChangeSet|20041206020626|27973
i stenn at whimsy.udel.edu|ChangeSet|20041206021240|27973
i stenn at whimsy.udel.edu|ChangeSet|20041206043336|27950
i stenn at whimsy.udel.edu|ChangeSet|20041206043824|27956
i stenn at whimsy.udel.edu|ChangeSet|20041206084148|41816
i stenn at whimsy.udel.edu|ChangeSet|20041206085105|41822
i stenn at whimsy.udel.edu|ChangeSet|20041206190732|42068
i stenn at whimsy.udel.edu|ChangeSet|20041209024905|42076
i stenn at whimsy.udel.edu|ChangeSet|20041209030906|42080
i stenn at whimsy.udel.edu|ChangeSet|20041209193618|42076
i stenn at whimsy.udel.edu|ChangeSet|20041210230032|42053
i stenn at whimsy.udel.edu|ChangeSet|20041210230343|42050
i stenn at whimsy.udel.edu|ChangeSet|20041211043303|42042
i stenn at whimsy.udel.edu|ChangeSet|20041212032210|42019
i stenn at whimsy.udel.edu|ChangeSet|20041212032849|42263
i stenn at whimsy.udel.edu|ChangeSet|20041212034245|42261
i stenn at whimsy.udel.edu|ChangeSet|20041213071109|42272
i stenn at whimsy.udel.edu|ChangeSet|20041213185313|42266
i stenn at whimsy.udel.edu|ChangeSet|20041214050904|42970
i stenn at whimsy.udel.edu|ChangeSet|20041216053818|42964
i stenn at whimsy.udel.edu|ChangeSet|20041217051555|43677
i stenn at whimsy.udel.edu|ChangeSet|20041217082827|43678
i stenn at whimsy.udel.edu|ChangeSet|20041217090526|44163
i stenn at whimsy.udel.edu|ChangeSet|20041217092823|44170
i stenn at whimsy.udel.edu|ChangeSet|20041217094929|44180
i stenn at whimsy.udel.edu|ChangeSet|20041221013618|44173
i stenn at whimsy.udel.edu|ChangeSet|20041221014157|44151
i stenn at whimsy.udel.edu|ChangeSet|20041221015434|44149
i stenn at whimsy.udel.edu|ChangeSet|20041221020108|44150
i stenn at whimsy.udel.edu|ChangeSet|20041221023416|44130
K 42938
M stenn at whimsy.udel.edu|ChangeSet|20041221023416|44130
P ChangeSet
------------------------------------------------


mayer at pogo.udel.edu|ChangeSet|20041221133819|42938
D 1.1292 04/12/23 00:16:06-05:00 mayer at tecotoo. +14 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc xode
K 33315
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|include/isc/buffer.h|20041223045544|11394|9d80e402 mayer at tecotoo.|include/isc/buffer.h|20041223045545|27754
> mayer at tecotoo.myibg.com|include/isc/net.h|20030105020024|42568|cf50355d mayer at tecotoo.|include/isc/net.h|20041223051511|43914
> mayer at tecotoo.myibg.com|include/isc/netaddr.h|20030105020026|37035|cf6e4daa mayer at tecotoo.|include/isc/netaddr.h|20041223051511|04711
> mayer at tecotoo.|include/isc/netscope.h|20041223045631|64463|a0e00b21 mayer at tecotoo.|include/isc/netscope.h|20041223045632|43285
> mayer at tecotoo.|include/isc/region.h|20041223045706|13780|a35676bb mayer at tecotoo.|include/isc/region.h|20041223045707|58015
> mayer at tecotoo.myibg.com|include/isc/result.h|20030105020033|18593|cfeb1beb mayer at tecotoo.|include/isc/result.h|20041223051512|10074
> mayer at tecotoo.myibg.com|include/isc/sockaddr.h|20030105020035|42929|d00c0531 mayer at tecotoo.|include/isc/sockaddr.h|20041223051512|52427
> mayer at tecotoo.myibg.com|libisc/net.c|20030105020057|42881|d19cebcf mayer at tecotoo.|libisc/net.c|20041223051513|09193
> mayer at tecotoo.|libisc/netaddr.c|20041223045840|25979|aa07381e mayer at tecotoo.|libisc/netaddr.c|20041223045841|57489
> mayer at tecotoo.|libisc/netscope.c|20041223045918|25388|acbf0c88 mayer at tecotoo.|libisc/netscope.c|20041223045919|51769
> mayer at tecotoo.|libisc/sockaddr.c|20041223050001|38826|afd59d6e mayer at tecotoo.|libisc/sockaddr.c|20041223050002|39820
> mayer at tecotoo.myibg.com|ports/winnt/include/isc/ipv6.h|20030105020102|23288|d1fdf9f3 mayer at tecotoo.|ports/winnt/include/isc/ipv6.h|20041223051513|26079
> mayer at tecotoo.myibg.com|ports/winnt/include/isc/net.h|20030105020105|14902|d2318535 mayer at tecotoo.|ports/winnt/include/isc/net.h|20041223051514|26712
> mayer at tecotoo.myibg.com|ports/winnt/libisc/net.c|20030105020113|29059|d2d07336 mayer at tecotoo.|ports/winnt/libisc/net.c|20041223051514|31480

mayer at tecotoo.|ChangeSet|20041223051606|33315
D 1.1293 04/12/23 00:17:58-05:00 mayer at pogo.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge bk://www.ntp.org/home/bk/ntp-dev
c into pogo.udel.edu:/pogo/users/mayer/ntp-dev
i stenn at whimsy.udel.edu|ChangeSet|20041222053541|44130
K 33315
M stenn at whimsy.udel.edu|ChangeSet|20041222053541|44130
P ChangeSet
------------------------------------------------


mayer at pogo.udel.edu|ChangeSet|20041223051758|33315
D 1.1294 04/12/23 15:24:48-05:00 mayer at pogo.udel.edu +2 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Miscellaneous compiler errors from port of BIND 9 code
K 34249
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|include/isc/net.h|20030105020024|42568|cf50355d mayer at pogo.udel.edu|include/isc/net.h|20041223202328|41696
> mayer at tecotoo.myibg.com|libisc/net.c|20030105020057|42881|d19cebcf mayer at pogo.udel.edu|libisc/net.c|20041223202412|57618

mayer at pogo.udel.edu|ChangeSet|20041223202448|34249
D 1.1295 04/12/23 22:41:22-05:00 mayer at tecotoo. +4 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Added new files to build and moved some macros
K 32917
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|include/ntp_machine.h|19990526004814|01635|3aed0663 mayer at tecotoo.|include/ntp_machine.h|20041224034038|48967
> stenn at whimsy.udel.edu|libntp/Makefile.am|19990526004815|01635|3aed0663 mayer at tecotoo.|libntp/Makefile.am|20041224033813|15783
> stenn at whimsy.udel.edu|ports/winnt/include/config.h|19990728020335|01289|29080509 mayer at tecotoo.|ports/winnt/include/config.h|20041224034038|45480
> stenn at whimsy.udel.edu|ports/winnt/libntp/libntp.dsp|19990728020416|01289|29080509 mayer at tecotoo.|ports/winnt/libntp/libntp.dsp|20041224033834|51733

mayer at tecotoo.|ChangeSet|20041224034122|32917
D 1.1296 04/12/23 22:59:14-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Alternate method of getting interface addresses
K 44406
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584 mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035839|58686

mayer at tecotoo.|ChangeSet|20041224035914|44406
D 1.1297 04/12/24 18:10:50-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 43493
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|include/isc/ipv6.h|20030105020009|30586|ce4106b8 mayer at tecotoo.|include/isc/ipv6.h|20041224231022|04227

mayer at tecotoo.|ChangeSet|20041224231050|43493
D 1.1298 04/12/24 18:16:16-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes again
K 43506
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|include/isc/ipv6.h|20030105020009|30586|ce4106b8 mayer at tecotoo.|include/isc/ipv6.h|20041224231554|03960

mayer at tecotoo.|ChangeSet|20041224231616|43506
D 1.1299 04/12/24 18:21:09-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 43047
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8 mayer at tecotoo.|libisc/interfaceiter.c|20041224232051|06945

mayer at tecotoo.|ChangeSet|20041224232109|43047
D 1.1300 04/12/24 18:25:12-05:00 mayer at tecotoo. +2 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 43030
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/netaddr.c|20041223045840|25979|aa07381e mayer at tecotoo.|libisc/netaddr.c|20041224232500|59223
> mayer at tecotoo.|libisc/sockaddr.c|20041223050001|38826|afd59d6e mayer at tecotoo.|libisc/sockaddr.c|20041224232501|41554

mayer at tecotoo.|ChangeSet|20041224232512|43030
D 1.1301 04/12/27 11:31:53-05:00 mayer at pogo.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge bk://www.ntp.org/home/bk/ntp-dev
c into pogo.udel.edu:/pogo/users/mayer/ntp-dev
i stenn at whimsy.udel.edu|ChangeSet|20041227111513|44136
K 43036
M stenn at whimsy.udel.edu|ChangeSet|20041227111513|44136
P ChangeSet
------------------------------------------------


mayer at tecotoo.|ChangeSet|20041224232512|43030
D 1.1300.1.1 04/12/30 22:52:08-05:00 mayer at tecotoo. +4 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 41650
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584 mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041231035128|26691
> mayer at tecotoo.myibg.com|libisc/ifiter_ioctl.c|20030105020047|16979|d0eb782d mayer at tecotoo.|libisc/ifiter_ioctl.c|20041231035127|11073
> mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20030105020048|00325|d109ada5 mayer at tecotoo.|libisc/ifiter_sysctl.c|20041231035127|51365
> mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8 mayer at tecotoo.|libisc/interfaceiter.c|20041231035126|38938

mayer at pogo.udel.edu|ChangeSet|20041227163153|43036
D 1.1302 04/12/30 22:53:42-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge mayer at pogo.udel.edu:ntp-dev/ into tecotoo.:H:/ntpbk/ntp-dev
i mayer at tecotoo.|ChangeSet|20041231035208|41650
K 41656
M mayer at tecotoo.|ChangeSet|20041231035208|41650
P ChangeSet
------------------------------------------------


mayer at pogo.udel.edu|ChangeSet|20041227163153|43036
D 1.1301.1.1 05/01/01 00:48:50-05:00 mayer at pogo.udel.edu +4 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 43501
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584 mayer at pogo.udel.edu|libisc/ifiter_getifaddrs.c|20050101054814|26691
> mayer at tecotoo.myibg.com|libisc/ifiter_ioctl.c|20030105020047|16979|d0eb782d mayer at pogo.udel.edu|libisc/ifiter_ioctl.c|20050101054813|11073
> mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20030105020048|00325|d109ada5 mayer at pogo.udel.edu|libisc/ifiter_sysctl.c|20050101054813|51365
> mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8 mayer at pogo.udel.edu|libisc/interfaceiter.c|20050101054813|38938

mayer at pogo.udel.edu|ChangeSet|20050101054850|43501
D 1.1301.1.2 05/01/01 00:49:42-05:00 mayer at pogo.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Use macros in buffer routines
K 43960
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|include/isc/buffer.h|20041223045544|11394|9d80e402 mayer at pogo.udel.edu|include/isc/buffer.h|20050101054928|27544

mayer at tecotoo.|ChangeSet|20041231035342|41656
D 1.1303 05/01/01 18:05:35-05:00 mayer at tecotoo. +4 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge mayer at pogo.udel.edu:ntp-dev/ into tecotoo.:H:/ntpbk/ntp-dev
i mayer at pogo.udel.edu|ChangeSet|20050101054850|43501
i mayer at pogo.udel.edu|ChangeSet|20050101054942|43960
K 42107
M mayer at pogo.udel.edu|ChangeSet|20050101054942|43960
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584 mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20050101230527|26691
> mayer at tecotoo.myibg.com|libisc/ifiter_ioctl.c|20030105020047|16979|d0eb782d mayer at tecotoo.|libisc/ifiter_ioctl.c|20050101230528|11073
> mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20030105020048|00325|d109ada5 mayer at tecotoo.|libisc/ifiter_sysctl.c|20050101230528|51365
> mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8 mayer at tecotoo.|libisc/interfaceiter.c|20050101230529|38938

mayer at tecotoo.|ChangeSet|20050101230535|42107
D 1.1304 05/01/01 18:10:09-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Updated msg macros
K 41391
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|include/isc/msgs.h|20030105020021|25226|cf108149 mayer at tecotoo.|include/isc/msgs.h|20050101230948|21170

mayer at tecotoo.|ChangeSet|20050101231009|41391
D 1.1305 05/01/01 22:14:34-05:00 mayer at tecotoo. +3 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove reference to interface index. Remove isc_log_write references
K 41373
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584 mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20050102031404|21290
> mayer at tecotoo.myibg.com|libisc/ifiter_ioctl.c|20030105020047|16979|d0eb782d mayer at tecotoo.|libisc/ifiter_ioctl.c|20050102031404|26117
> mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20030105020048|00325|d109ada5 mayer at tecotoo.|libisc/ifiter_sysctl.c|20050102031403|45856

mayer at tecotoo.|ChangeSet|20050102031434|41373
D 1.1306 05/01/02 18:28:21-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c remove include net/if.h. Some O/S's don't prevent double inclusions. It is already included in isc/net.h
K 41368
P ChangeSet
------------------------------------------------

0a0
> mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8 mayer at tecotoo.|libisc/interfaceiter.c|20050102232751|37268

mayer at tecotoo.|ChangeSet|20050102232821|41368
D 1.1307 05/01/02 21:13:48-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove unnecessary include ntp_if.h
K 41347
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20050103021321|12308

mayer at tecotoo.|ChangeSet|20050103021348|41347
D 1.1308 05/01/04 21:38:58-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove unnecessary includes
K 41369
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20050105023625|51793

mayer at tecotoo.|ChangeSet|20050105023858|41369
D 1.1309 05/01/05 00:12:51-05:00 mayer at tecotoo. +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Rename index to idx
K 41368
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at tecotoo.|ntpd/ntp_io.c|20050105051207|50949

mayer at tecotoo.|ChangeSet|20050105051251|41368
D 1.1310 05/01/05 22:29:52-05:00 mayer at pogo.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge bk://www.ntp.org/home/bk/ntp-dev
c into pogo.udel.edu:/pogo/users/mayer/ntp-dev
i stenn at whimsy.udel.edu|ChangeSet|20041228054627|44159
i stenn at pogo.udel.edu|ChangeSet|20050101111725|43895
i stenn at whimsy.udel.edu|ChangeSet|20050105061604|44132
K 41589
M stenn at whimsy.udel.edu|ChangeSet|20050105061604|44132
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663 mayer at pogo.udel.edu|ntpd/ntp_io.c|20050106032950|41566

mayer at pogo.udel.edu|ChangeSet|20050106032952|41589
D 1.1311 05/01/09 23:34:19-05:00 mayer at pogo.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Merge bk://www.ntp.org/home/bk/ntp-dev
c into pogo.udel.edu:/pogo/users/mayer/ntp-dev
i abe at pogo.udel.edu|ChangeSet|20041218045509|41550
i abe at pogo.udel.edu|ChangeSet|20041221130252|41500
i abe at pogo.udel.edu|ChangeSet|20041222151217|41500
i abe at pogo.udel.edu|ChangeSet|20050107131442|41502
i stenn at pogo.udel.edu|ChangeSet|20050109065012|41492
i stenn at whimsy.udel.edu|ChangeSet|20050109070542|41493
K 38950
M stenn at whimsy.udel.edu|ChangeSet|20050109070542|41493
P ChangeSet
------------------------------------------------


== include/isc/ipv6.h ==
mayer at tecotoo.myibg.com|include/isc/ipv6.h|20030105020009|30586|ce4106b8
mayer at tecotoo.myibg.com|include/isc/ipv6.h|20031108214851|02374
D 1.5 04/12/24 18:10:22-05:00 mayer at tecotoo. +12 -12
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 4227
O -rw-rw-r--
P include/isc/ipv6.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2002  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ipv6.h,v 1.17.12.4 2004/03/09 05:21:09 marka Exp $ */
D62 1
I62 1
/*#ifdef ISC_ONLY_IPV6 */
D154 1
I154 1
/*#endif /* ISC_ONLY_IPV6 */

mayer at tecotoo.|include/isc/ipv6.h|20041224231022|04227
D 1.6 04/12/24 18:15:54-05:00 mayer at tecotoo. +2 -2
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes again
K 3960
O -rw-rw-r--
P include/isc/ipv6.h
------------------------------------------------

D62 1
I62 1
#ifdef ISC_ONLY_IPV6 
D154 1
I154 1
#endif /* ISC_ONLY_IPV6 */

== include/isc/msgs.h ==
mayer at tecotoo.myibg.com|include/isc/msgs.h|20030105020021|25226|cf108149
stenn at whimsy.udel.edu|include/isc/msgs.h|20030726193611|21091
D 1.3 05/01/01 18:09:48-05:00 mayer at tecotoo. +12 -10
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Updated msg macros
K 21170
O -rw-rw-r--
P include/isc/msgs.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 2000-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: msgs.h,v 1.5.2.2.8.3 2004/03/06 08:14:44 marka Exp $ */
I50 1
#define ISC_MSGSET_IFITERGETIFADDRS 21
I178 1
#define ISC_MSG_GETIFADDRS     1801 /* "getting interface addresses: ..." */

== include/isc/net.h ==
mayer at tecotoo.myibg.com|include/isc/net.h|20030105020024|42568|cf50355d
stenn at whimsy.udel.edu|include/isc/net.h|20030726193612|43026
D 1.5 04/12/23 00:15:11-05:00 mayer at tecotoo. +56 -10
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 43914
O -rw-rw-r--
P include/isc/net.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: net.h,v 1.31.2.2.10.8 2004/04/29 01:31:23 marka Exp $ */
I77 2
#include <net/if.h>
\
I232 4
#define ISC_IPADDR_ISEXPERIMENTAL(i) \
		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
		 == ISC__IPADDR(0xf0000000))
\
I247 1
 *	ISC_R_DISABLED		IPv4 is disabled.
I259 13
 *	ISC_R_DISABLED		IPv6 is disabled.
 *	ISC_R_UNEXPECTED
 */
\
isc_result_t
isc_net_probe_ipv6only(void);
/*
 * Check if the system's kernel supports the IPV6_V6ONLY socket option.
 *
 * Returns:
 *
 *	ISC_R_SUCCESS		the option is supported for both TCP and UDP.
 *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
I262 26
isc_result_t
isc_net_probe_ipv6pktinfo(void);
/*
 * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option
 * for UDP sockets.
 *
 * Returns:
 *
 *	ISC_R_SUCCESS		the option is supported.
 *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
 *	ISC_R_UNEXPECTED
 */
\
void
isc_net_disableipv4(void);
\
void
isc_net_disableipv6(void);
\
void
isc_net_enableipv4(void);
\
void
isc_net_enableipv6(void);
\
#ifdef ISC_PLATFORM_NEEDNTOP

mayer at tecotoo.|include/isc/net.h|20041223051511|43914
D 1.6 04/12/23 15:23:28-05:00 mayer at pogo.udel.edu +2 -3
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c missing #endifs
K 41696
O -rw-rw-r--
P include/isc/net.h
------------------------------------------------

D311 1
I314 1
#ifdef ISC_PLATFORM_NEEDPTON
D317 1
I321 1
#ifdef ISC_PLATFORM_NEEDATON
D324 1

== include/isc/netaddr.h ==
mayer at tecotoo.myibg.com|include/isc/netaddr.h|20030105020026|37035|cf6e4daa
stenn at whimsy.udel.edu|include/isc/netaddr.h|20030726193612|05319
D 1.4 04/12/23 00:15:11-05:00 mayer at tecotoo. +22 -12
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 4711
O -rw-rw-r--
P include/isc/netaddr.h
------------------------------------------------

I1 1
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: netaddr.h,v 1.18.12.7 2004/03/08 09:04:52 marka Exp $ */
D26 3
I37 1
	isc_uint32_t zone;
I100 6
isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone);
\
isc_uint32_t
isc_netaddr_getzone(const isc_netaddr_t *netaddr);
\
void
I115 6
 */
\
isc_boolean_t
isc_netaddr_isexperimental(isc_netaddr_t *na);
/*
 * Returns ISC_TRUE if the address is a experimental (CLASS E) address.

== include/isc/result.h ==
mayer at tecotoo.myibg.com|include/isc/result.h|20030105020033|18593|cfeb1beb
stenn at whimsy.udel.edu|include/isc/result.h|20030726193614|11080
D 1.3 04/12/23 00:15:12-05:00 mayer at tecotoo. +14 -11
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 10074
O -rw-rw-r--
P include/isc/result.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1998-2001, 2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: result.h,v 1.57.2.2.8.5 2004/05/15 03:46:13 jinmei Exp $ */
I82 3
#define ISC_R_DISABLED			57	/* disabled */
#define ISC_R_MAXSIZE			58	/* max size */
#define ISC_R_BADADDRESSFORM		59	/* invalid address format */
D87 1
I87 1
#define ISC_R_NRESULTS 			60

== include/isc/sockaddr.h ==
mayer at tecotoo.myibg.com|include/isc/sockaddr.h|20030105020035|42929|d00c0531
stenn at whimsy.udel.edu|include/isc/sockaddr.h|20030726193614|37912
D 1.3 04/12/23 00:15:12-05:00 mayer at tecotoo. +6 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 52427
O -rw-rw-r--
P include/isc/sockaddr.h
------------------------------------------------

I176 6
isc_sockaddr_isexperimental(isc_sockaddr_t *sa);
/*
 * Returns ISC_TRUE if the address is a experimental (CLASS E) address.
 */
\
isc_boolean_t

== libisc/ifiter_ioctl.c ==
mayer at tecotoo.myibg.com|libisc/ifiter_ioctl.c|20030105020047|16979|d0eb782d
mayer at pogo.udel.edu|libisc/ifiter_ioctl.c|20040108232039|45105
D 1.19 04/12/30 22:51:27-05:00 mayer at tecotoo. +393 -157
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 11073
O -rw-rw-r--
P libisc/ifiter_ioctl.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ifiter_ioctl.c,v 1.19.2.5.2.14 2004/06/22 04:40:23 marka Exp $ */
I53 3
#define ISC_IF_INET6_SZ \
    sizeof("00000000000000000000000000000001 01 80 10 80 XXXXXXloXXXXXXXX\n")
\
D57 1
I58 1
	int			socket;
I59 4
	void			*buf;		/* Buffer for sysctl data. */
	unsigned int		bufsize;	/* Bytes allocated. */
	unsigned int		pos;		/* Current offset in
						   SIOCGIFCONF data */
I60 1
	int			socket6;
I61 6
	void			*buf6;		/* Buffer for sysctl data. */
	unsigned int		bufsize6;	/* Bytes allocated. */
	unsigned int		pos6;		/* Current offset in
						   SIOCGLIFCONF data */
	isc_result_t		result6;	/* Last result code. */
	isc_boolean_t		first6;
D63 2
I66 8
	isc_boolean_t		clua_done;
	struct sockaddr		clua_sa;
#endif
#ifdef	__linux
	FILE *			proc;
	char			entry[ISC_IF_INET6_SZ];
	isc_result_t		valid;
	isc_boolean_t		first;
D68 2
I86 10
#ifdef __linux
#ifndef IF_NAMESIZE
# ifdef IFNAMSIZ
#  define IF_NAMESIZE  IFNAMSIZ  
# else
#  define IF_NAMESIZE 16
# endif
#endif
#endif
\
D151 1
I159 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D162 4
D169 1
I169 1
	iter->bufsize6 = IFCONF_BUFSIZE_INITIAL;
D172 2
I173 2
		iter->buf6 = isc_mem_get(iter->mctx, iter->bufsize6);
		if (iter->buf6 == NULL)
D176 1
I176 1
		memset(&iter->lifc, 0, sizeof(iter->lifc));
D178 1
I178 1
		iter->lifc.lifc_family = AF_INET6;
D183 2
I184 2
		iter->lifc.lifc_len = iter->bufsize6;
		iter->lifc.lifc_buf = iter->buf6;
D190 1
I190 1
		if (ioctl(iter->socket6, SIOCGLIFCONF, (char *)&iter->lifc)
D236 1
I236 1
			    < iter->bufsize6)
D239 1
I239 1
		if (iter->bufsize6 >= IFCONF_BUFSIZE_MAX) {
D251 1
I251 1
		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
D253 1
I253 1
		iter->bufsize6 *= 2;
D256 1
I256 2
	if (iter->lifc.lifc_len != 0)
		iter->mode = 6;
D260 2
I261 2
	isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
	iter->buf6 = NULL;
D263 1
I264 1
#endif
I279 1
	iter->mode = 4;
D281 1
I281 8
	iter->pos = (unsigned int) -1;
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	iter->buf6 = NULL;
	iter->pos6 = (unsigned int) -1;
	iter->result6 = ISC_R_NOMORE;
	iter->socket6 = -1;
	iter->first6 = ISC_FALSE;
#endif
D284 1
I284 2
	 * Get the interface configuration, allocating more memory if
	 * necessary.
I285 27
\
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	result = isc_net_probeipv6();
	if (result == ISC_R_SUCCESS) {
		/*
		 * Create an unbound datagram socket to do the SIOCGLIFCONF
		 * ioctl on.  HP/UX requires an AF_INET6 socket for
		 * SIOCGLIFCONF to get IPv6 addresses.
		 */
		if ((iter->socket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
			isc__strerror(errno, strbuf, sizeof(strbuf));
			UNEXPECTED_ERROR(__FILE__, __LINE__,
					 isc_msgcat_get(isc_msgcat,
							ISC_MSGSET_IFITERIOCTL,
							ISC_MSG_MAKESCANSOCKET,
							"making interface "
							"scan socket: %s"),
					 strbuf);
			result = ISC_R_UNEXPECTED;
			goto socket6_failure;
		}
		iter->result6 = getbuf6(iter);
		if (iter->result6 != ISC_R_NOTIMPLEMENTED &&
		    iter->result6 != ISC_R_SUCCESS)
			goto ioctl6_failure;
	}
#endif
D298 11
I308 1
	result = getbuf4(iter);
I317 6
	iter->clua_done = ISC_TRUE;
#endif
#ifdef __linux
	iter->proc = fopen("/proc/net/if_inet6", "r");
	iter->valid = ISC_R_FAILURE;
	iter->first = ISC_FALSE;
D319 1
I331 9
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->buf6 != NULL)
		isc_mem_put(mctx, iter->buf6, iter->bufsize6);
  ioctl6_failure:
	if (iter->socket6 != -1)
		(void) close(iter->socket6);
  socket6_failure:
#endif
 
D345 1
D347 11
I357 80
	if (clua_getaliasinfo(&iter->clua_sa, &ci) != CLUA_SUCCESS)
		return (ISC_R_IGNORE);
	memset(&iter->current, 0, sizeof(iter->current));
	iter->current.af = iter->clua_sa.sa_family;
	memset(iter->current.name, 0, sizeof(iter->current.name));
	sprintf(iter->current.name, "clua%d", ci.aliasid);
	iter->current.flags = INTERFACE_F_UP;
	get_inaddr(&iter->current.address, &ci.addr);
	get_inaddr(&iter->current.netmask, &ci.netmask);
	return (ISC_R_SUCCESS);
}
#endif
\
#ifdef __linux
static isc_result_t
linux_if_inet6_next(isc_interfaceiter_t *iter) {
	if (iter->proc != NULL &&
	    fgets(iter->entry, sizeof(iter->entry), iter->proc) != NULL)
		iter->valid = ISC_R_SUCCESS;
	else
		iter->valid = ISC_R_NOMORE;
	return (iter->valid);
}
\
static void
linux_if_inet6_first(isc_interfaceiter_t *iter) {
	if (iter->proc != NULL) {
		rewind(iter->proc);
		(void)linux_if_inet6_next(iter);
	} else
		iter->valid = ISC_R_NOMORE;
	iter->first = ISC_FALSE;
}
\
static isc_result_t
linux_if_inet6_current(isc_interfaceiter_t *iter) {
	char address[33];
	char name[IF_NAMESIZE+1];
	struct in6_addr addr6;
	int ifindex, prefix, flag3, flag4;
	int res;
	unsigned int i;
\
	if (iter->valid != ISC_R_SUCCESS)
		return (iter->valid);
	if (iter->proc == NULL) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:iter->proc == NULL");
		return (ISC_R_FAILURE);
	}
\
	res = sscanf(iter->entry, "%32[a-f0-9] %x %x %x %x %16s\n",
		     address, &ifindex, &prefix, &flag3, &flag4, name);
	if (res != 6) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:sscanf() -> %d (expected 6)",
			      res);
		return (ISC_R_FAILURE);
	}
	if (strlen(address) != 32) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:strlen(%s) != 32", address);
		return (ISC_R_FAILURE);
	}
	for (i = 0; i < 16; i++) {
		unsigned char byte;
		static const char hex[] = "0123456789abcdef";
		byte = ((index(hex, address[i * 2]) - hex) << 4) |
		       (index(hex, address[i * 2 + 1]) - hex);
		addr6.s6_addr[i] = byte;
	}
	iter->current.af = AF_INET6;
	iter->current.flags = INTERFACE_F_UP;
	isc_netaddr_fromin6(&iter->current.address, &addr6);
	if (isc_netaddr_islinklocal(&iter->current.address)) {
		isc_netaddr_setzone(&iter->current.address,
				    (isc_uint32_t)ifindex);
D359 1
I359 12
	for (i = 0; i < 16; i++) {
		if (prefix > 8) {
			addr6.s6_addr[i] = 0xff;
			prefix -= 8;
		} else {
			addr6.s6_addr[i] = (0xff << (8 - prefix)) & 0xff;
			prefix = 0;
		}
	}
	isc_netaddr_fromin6(&iter->current.netmask, &addr6);
	strncpy(iter->current.name, name, sizeof(iter->current.name));
	return (ISC_R_SUCCESS);
D377 3
I379 8
#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
	struct lifreq lifreq;
#else
	char sabuf[256];
#endif
	int i, bits, prefixlen;
#ifdef __linux
	isc_result_t result;
I384 7
#ifdef __linux
	result = linux_if_inet6_current(iter);
	if (result != ISC_R_NOMORE)
		return (result);
	iter->first = ISC_TRUE;
#endif
\
D391 2
I392 1
#if defined(ISC_PLATFORM_HAVEIPV6)
D417 1
I417 1
		 (struct sockaddr *)&ifrp->ifr_addr, ifreq.ifr_name);
I455 1
#ifdef IFF_POINTOPOINT
I457 1
#endif
D472 2
I473 1
	if (family == AF_INET)
D476 4
I479 4
#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
	memset(&lifreq, 0, sizeof(lifreq));
	memcpy(lifreq.lifr_name, iter->current.name, sizeof(lifreq.lifr_name));
	memcpy(&lifreq.lifr_addr, &iter->current.address.type.in6,
D482 1
I482 1
	if (ioctl(iter->socket, SIOCGLIFADDR, &lifreq) < 0) {
I488 13
	prefixlen = lifreq.lifr_addrlen;
#else
	isc_netaddr_format(&iter->current.address, sabuf, sizeof(sabuf));
	isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
		      ISC_LOGMODULE_INTERFACE,
		      ISC_LOG_INFO,
		      isc_msgcat_get(isc_msgcat,
				     ISC_MSGSET_IFITERIOCTL,
				     ISC_MSG_GETIFCONFIG,
				     "prefix length for %s is unknown "
				     "(assume 128)"), sabuf);
	prefixlen = 128;
#endif
D495 1
I495 1
		if (prefixlen > 8) {
D497 1
I497 1
			prefixlen -= 8;
D499 2
I500 2
			bits = 8 - prefixlen;
			prefixlen = 0;
D507 1
I509 1
#ifdef IFF_POINTOPOINT
D532 1
I532 1
			 (struct sockaddr *)&ifreq.ifr_dstaddr, ifreq.ifr_name);
D534 1
I534 1
#endif
D554 1
I554 1
			 (struct sockaddr *)&ifreq.ifr_broadaddr, ifreq.ifr_name);
I555 1
\
D566 2
I567 1
	if (ioctl(iter->socket, SIOCGIFNETMASK, (char *)&ifreq) < 0) {
D578 1
I578 1
		 (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name);
I581 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D584 4
I591 1
	int fd;
D594 1
I594 3
	if (iter->result6 != ISC_R_SUCCESS)
		return (iter->result6);
	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
D596 1
I596 1
	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
D618 1
I618 1
		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
D620 3
I643 5
	if (family == AF_INET6)
		fd = iter->socket6;
	else
		fd = iter->socket;
\
D649 10
I658 3
	if (ioctl(fd, SIOCGLIFFLAGS, (char *) &lifreq) < 0) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
D661 2
I662 1
		return (ISC_R_IGNORE);
I667 1
#ifdef IFF_POINTOPOINT
I669 1
#endif
I683 1
#ifdef IFF_POINTOPOINT
D693 1
I693 1
		if (ioctl(fd, SIOCGLIFDSTADDR, (char *)&lifreq)
D706 1
I706 2
			 (struct sockaddr *)&lifreq.lifr_dstaddr,
			 lifreq.lifr_name);
I707 2
#endif
\
D728 1
I728 2
			 (struct sockaddr *)&lifreq.lifr_broadaddr,
			 lifreq.lifr_name);
D733 1
I733 1
	 * Get the network mask.  Netmask already zeroed.
D737 22
I758 1
\
I759 6
	/*
	 * Special case: if the system provides lifr_addrlen member, the
	 * netmask of an IPv6 address can be derived from the length, since
	 * an IPv6 address always has a contiguous mask.
	 */
	if (family == AF_INET6) {
D762 3
D772 2
I773 2
\
		return (ISC_R_SUCCESS);
I774 16
#endif
\
	/*
	 * Ignore the HP/UX warning about "integer overflow during
	 * conversion.  It comes from its own macro definition,
	 * and is really hard to shut up.
	 */
	if (ioctl(fd, SIOCGLIFNETMASK, (char *)&lifreq) < 0) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_IFITERIOCTL,
						ISC_MSG_GETNETMASK,
						"%s: getting netmask: %s"),
				 lifreq.lifr_name, strbuf);
		return (ISC_R_IGNORE);
I775 2
	get_addr(family, &iter->current.netmask,
		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
D778 1
I779 1
#endif
D783 2
I784 11
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->mode == 6) {
		iter->result6 = internal_current6(iter);
		if (iter->result6 != ISC_R_NOMORE)
			return (iter->result6);
	}
#endif
#ifdef HAVE_TRUCLUSTER
	if (!iter->clua_done)
		return(internal_current_clusteralias(iter));
#endif
D801 2
I802 4
#ifdef __linux
	if (linux_if_inet6_next(iter) == ISC_R_SUCCESS)
		return (ISC_R_SUCCESS);
	if (!iter->first)
I819 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D822 4
I826 3
	
	if (iter->result6 != ISC_R_SUCCESS && iter->result6 != ISC_R_IGNORE)
		return (iter->result6);
D828 1
I828 1
	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
D830 1
I830 1
	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
D834 1
I834 1
		iter->pos6 += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len;
D837 1
I837 1
		iter->pos6 += sizeof(*ifrp);
D839 1
I839 1
	if (iter->pos6 >= (unsigned int) iter->lifc.lifc_len)
D843 1
I844 1
#endif
D848 2
I849 23
#ifdef HAVE_TRUCLUSTER
	int clua_result;
#endif
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->mode == 6) {
		iter->result6 = internal_next6(iter);
		if (iter->result6 != ISC_R_NOMORE)
			return (iter->result6);
		if (iter->first6) {
			iter->first6 = ISC_FALSE;
			return (ISC_R_SUCCESS);
		}
	}
#endif
#ifdef HAVE_TRUCLUSTER
	if (!iter->clua_done) {
		clua_result = clua_getaliasaddress(&iter->clua_sa,
						   &iter->clua_context);
		if (clua_result != CLUA_SUCCESS)
			iter->clua_done = ISC_TRUE;
		return (ISC_R_SUCCESS);
	}
#endif
I855 34
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->socket6 != -1)
		(void) close(iter->socket6);
	if (iter->buf6 != NULL) {
		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
	}
#endif
#ifdef __linux
	if (iter->proc != NULL)
		fclose(iter->proc);
#endif
}
\
static
void internal_first(isc_interfaceiter_t *iter) {
#ifdef HAVE_TRUCLUSTER
	int clua_result;
#endif
	iter->pos = 0;
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	iter->pos6 = 0;
	if (iter->result6 == ISC_R_NOMORE)
		iter->result6 = ISC_R_SUCCESS;
	iter->first6 = ISC_TRUE;
#endif
#ifdef HAVE_TRUCLUSTER
	iter->clua_context = 0;
	clua_result = clua_getaliasaddress(&iter->clua_sa,
					   &iter->clua_context);
	iter->clua_done = ISC_TF(clua_result != CLUA_SUCCESS);
#endif
#ifdef __linux
	linux_if_inet6_first(iter);
#endif

mayer at pogo.udel.edu|libisc/ifiter_ioctl.c|20040108232039|45105
D 1.18.1.1 05/01/01 00:48:13-05:00 mayer at pogo.udel.edu +393 -157
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 11073
O -rw-rw-r--
P libisc/ifiter_ioctl.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ifiter_ioctl.c,v 1.19.2.5.2.14 2004/06/22 04:40:23 marka Exp $ */
I53 3
#define ISC_IF_INET6_SZ \
    sizeof("00000000000000000000000000000001 01 80 10 80 XXXXXXloXXXXXXXX\n")
\
D57 1
I58 1
	int			socket;
I59 4
	void			*buf;		/* Buffer for sysctl data. */
	unsigned int		bufsize;	/* Bytes allocated. */
	unsigned int		pos;		/* Current offset in
						   SIOCGIFCONF data */
I60 1
	int			socket6;
I61 6
	void			*buf6;		/* Buffer for sysctl data. */
	unsigned int		bufsize6;	/* Bytes allocated. */
	unsigned int		pos6;		/* Current offset in
						   SIOCGLIFCONF data */
	isc_result_t		result6;	/* Last result code. */
	isc_boolean_t		first6;
D63 2
I66 8
	isc_boolean_t		clua_done;
	struct sockaddr		clua_sa;
#endif
#ifdef	__linux
	FILE *			proc;
	char			entry[ISC_IF_INET6_SZ];
	isc_result_t		valid;
	isc_boolean_t		first;
D68 2
I86 10
#ifdef __linux
#ifndef IF_NAMESIZE
# ifdef IFNAMSIZ
#  define IF_NAMESIZE  IFNAMSIZ  
# else
#  define IF_NAMESIZE 16
# endif
#endif
#endif
\
D151 1
I159 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D162 4
D169 1
I169 1
	iter->bufsize6 = IFCONF_BUFSIZE_INITIAL;
D172 2
I173 2
		iter->buf6 = isc_mem_get(iter->mctx, iter->bufsize6);
		if (iter->buf6 == NULL)
D176 1
I176 1
		memset(&iter->lifc, 0, sizeof(iter->lifc));
D178 1
I178 1
		iter->lifc.lifc_family = AF_INET6;
D183 2
I184 2
		iter->lifc.lifc_len = iter->bufsize6;
		iter->lifc.lifc_buf = iter->buf6;
D190 1
I190 1
		if (ioctl(iter->socket6, SIOCGLIFCONF, (char *)&iter->lifc)
D236 1
I236 1
			    < iter->bufsize6)
D239 1
I239 1
		if (iter->bufsize6 >= IFCONF_BUFSIZE_MAX) {
D251 1
I251 1
		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
D253 1
I253 1
		iter->bufsize6 *= 2;
D256 1
I256 2
	if (iter->lifc.lifc_len != 0)
		iter->mode = 6;
D260 2
I261 2
	isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
	iter->buf6 = NULL;
D263 1
I264 1
#endif
I279 1
	iter->mode = 4;
D281 1
I281 8
	iter->pos = (unsigned int) -1;
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	iter->buf6 = NULL;
	iter->pos6 = (unsigned int) -1;
	iter->result6 = ISC_R_NOMORE;
	iter->socket6 = -1;
	iter->first6 = ISC_FALSE;
#endif
D284 1
I284 2
	 * Get the interface configuration, allocating more memory if
	 * necessary.
I285 27
\
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	result = isc_net_probeipv6();
	if (result == ISC_R_SUCCESS) {
		/*
		 * Create an unbound datagram socket to do the SIOCGLIFCONF
		 * ioctl on.  HP/UX requires an AF_INET6 socket for
		 * SIOCGLIFCONF to get IPv6 addresses.
		 */
		if ((iter->socket6 = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
			isc__strerror(errno, strbuf, sizeof(strbuf));
			UNEXPECTED_ERROR(__FILE__, __LINE__,
					 isc_msgcat_get(isc_msgcat,
							ISC_MSGSET_IFITERIOCTL,
							ISC_MSG_MAKESCANSOCKET,
							"making interface "
							"scan socket: %s"),
					 strbuf);
			result = ISC_R_UNEXPECTED;
			goto socket6_failure;
		}
		iter->result6 = getbuf6(iter);
		if (iter->result6 != ISC_R_NOTIMPLEMENTED &&
		    iter->result6 != ISC_R_SUCCESS)
			goto ioctl6_failure;
	}
#endif
D298 11
I308 1
	result = getbuf4(iter);
I317 6
	iter->clua_done = ISC_TRUE;
#endif
#ifdef __linux
	iter->proc = fopen("/proc/net/if_inet6", "r");
	iter->valid = ISC_R_FAILURE;
	iter->first = ISC_FALSE;
D319 1
I331 9
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->buf6 != NULL)
		isc_mem_put(mctx, iter->buf6, iter->bufsize6);
  ioctl6_failure:
	if (iter->socket6 != -1)
		(void) close(iter->socket6);
  socket6_failure:
#endif
 
D345 1
D347 11
I357 80
	if (clua_getaliasinfo(&iter->clua_sa, &ci) != CLUA_SUCCESS)
		return (ISC_R_IGNORE);
	memset(&iter->current, 0, sizeof(iter->current));
	iter->current.af = iter->clua_sa.sa_family;
	memset(iter->current.name, 0, sizeof(iter->current.name));
	sprintf(iter->current.name, "clua%d", ci.aliasid);
	iter->current.flags = INTERFACE_F_UP;
	get_inaddr(&iter->current.address, &ci.addr);
	get_inaddr(&iter->current.netmask, &ci.netmask);
	return (ISC_R_SUCCESS);
}
#endif
\
#ifdef __linux
static isc_result_t
linux_if_inet6_next(isc_interfaceiter_t *iter) {
	if (iter->proc != NULL &&
	    fgets(iter->entry, sizeof(iter->entry), iter->proc) != NULL)
		iter->valid = ISC_R_SUCCESS;
	else
		iter->valid = ISC_R_NOMORE;
	return (iter->valid);
}
\
static void
linux_if_inet6_first(isc_interfaceiter_t *iter) {
	if (iter->proc != NULL) {
		rewind(iter->proc);
		(void)linux_if_inet6_next(iter);
	} else
		iter->valid = ISC_R_NOMORE;
	iter->first = ISC_FALSE;
}
\
static isc_result_t
linux_if_inet6_current(isc_interfaceiter_t *iter) {
	char address[33];
	char name[IF_NAMESIZE+1];
	struct in6_addr addr6;
	int ifindex, prefix, flag3, flag4;
	int res;
	unsigned int i;
\
	if (iter->valid != ISC_R_SUCCESS)
		return (iter->valid);
	if (iter->proc == NULL) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:iter->proc == NULL");
		return (ISC_R_FAILURE);
	}
\
	res = sscanf(iter->entry, "%32[a-f0-9] %x %x %x %x %16s\n",
		     address, &ifindex, &prefix, &flag3, &flag4, name);
	if (res != 6) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:sscanf() -> %d (expected 6)",
			      res);
		return (ISC_R_FAILURE);
	}
	if (strlen(address) != 32) {
		isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
			      ISC_LOGMODULE_INTERFACE, ISC_LOG_ERROR,
			      "/proc/net/if_inet6:strlen(%s) != 32", address);
		return (ISC_R_FAILURE);
	}
	for (i = 0; i < 16; i++) {
		unsigned char byte;
		static const char hex[] = "0123456789abcdef";
		byte = ((index(hex, address[i * 2]) - hex) << 4) |
		       (index(hex, address[i * 2 + 1]) - hex);
		addr6.s6_addr[i] = byte;
	}
	iter->current.af = AF_INET6;
	iter->current.flags = INTERFACE_F_UP;
	isc_netaddr_fromin6(&iter->current.address, &addr6);
	if (isc_netaddr_islinklocal(&iter->current.address)) {
		isc_netaddr_setzone(&iter->current.address,
				    (isc_uint32_t)ifindex);
D359 1
I359 12
	for (i = 0; i < 16; i++) {
		if (prefix > 8) {
			addr6.s6_addr[i] = 0xff;
			prefix -= 8;
		} else {
			addr6.s6_addr[i] = (0xff << (8 - prefix)) & 0xff;
			prefix = 0;
		}
	}
	isc_netaddr_fromin6(&iter->current.netmask, &addr6);
	strncpy(iter->current.name, name, sizeof(iter->current.name));
	return (ISC_R_SUCCESS);
D377 3
I379 8
#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
	struct lifreq lifreq;
#else
	char sabuf[256];
#endif
	int i, bits, prefixlen;
#ifdef __linux
	isc_result_t result;
I384 7
#ifdef __linux
	result = linux_if_inet6_current(iter);
	if (result != ISC_R_NOMORE)
		return (result);
	iter->first = ISC_TRUE;
#endif
\
D391 2
I392 1
#if defined(ISC_PLATFORM_HAVEIPV6)
D417 1
I417 1
		 (struct sockaddr *)&ifrp->ifr_addr, ifreq.ifr_name);
I455 1
#ifdef IFF_POINTOPOINT
I457 1
#endif
D472 2
I473 1
	if (family == AF_INET)
D476 4
I479 4
#if !defined(ISC_PLATFORM_HAVEIF_LADDRREQ) && defined(SIOCGLIFADDR)
	memset(&lifreq, 0, sizeof(lifreq));
	memcpy(lifreq.lifr_name, iter->current.name, sizeof(lifreq.lifr_name));
	memcpy(&lifreq.lifr_addr, &iter->current.address.type.in6,
D482 1
I482 1
	if (ioctl(iter->socket, SIOCGLIFADDR, &lifreq) < 0) {
I488 13
	prefixlen = lifreq.lifr_addrlen;
#else
	isc_netaddr_format(&iter->current.address, sabuf, sizeof(sabuf));
	isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
		      ISC_LOGMODULE_INTERFACE,
		      ISC_LOG_INFO,
		      isc_msgcat_get(isc_msgcat,
				     ISC_MSGSET_IFITERIOCTL,
				     ISC_MSG_GETIFCONFIG,
				     "prefix length for %s is unknown "
				     "(assume 128)"), sabuf);
	prefixlen = 128;
#endif
D495 1
I495 1
		if (prefixlen > 8) {
D497 1
I497 1
			prefixlen -= 8;
D499 2
I500 2
			bits = 8 - prefixlen;
			prefixlen = 0;
D507 1
I509 1
#ifdef IFF_POINTOPOINT
D532 1
I532 1
			 (struct sockaddr *)&ifreq.ifr_dstaddr, ifreq.ifr_name);
D534 1
I534 1
#endif
D554 1
I554 1
			 (struct sockaddr *)&ifreq.ifr_broadaddr, ifreq.ifr_name);
I555 1
\
D566 2
I567 1
	if (ioctl(iter->socket, SIOCGIFNETMASK, (char *)&ifreq) < 0) {
D578 1
I578 1
		 (struct sockaddr *)&ifreq.ifr_addr, ifreq.ifr_name);
I581 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D584 4
I591 1
	int fd;
D594 1
I594 3
	if (iter->result6 != ISC_R_SUCCESS)
		return (iter->result6);
	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
D596 1
I596 1
	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
D618 1
I618 1
		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
D620 3
I643 5
	if (family == AF_INET6)
		fd = iter->socket6;
	else
		fd = iter->socket;
\
D649 10
I658 3
	if (ioctl(fd, SIOCGLIFFLAGS, (char *) &lifreq) < 0) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
D661 2
I662 1
		return (ISC_R_IGNORE);
I667 1
#ifdef IFF_POINTOPOINT
I669 1
#endif
I683 1
#ifdef IFF_POINTOPOINT
D693 1
I693 1
		if (ioctl(fd, SIOCGLIFDSTADDR, (char *)&lifreq)
D706 1
I706 2
			 (struct sockaddr *)&lifreq.lifr_dstaddr,
			 lifreq.lifr_name);
I707 2
#endif
\
D728 1
I728 2
			 (struct sockaddr *)&lifreq.lifr_broadaddr,
			 lifreq.lifr_name);
D733 1
I733 1
	 * Get the network mask.  Netmask already zeroed.
D737 22
I758 1
\
I759 6
	/*
	 * Special case: if the system provides lifr_addrlen member, the
	 * netmask of an IPv6 address can be derived from the length, since
	 * an IPv6 address always has a contiguous mask.
	 */
	if (family == AF_INET6) {
D762 3
D772 2
I773 2
\
		return (ISC_R_SUCCESS);
I774 16
#endif
\
	/*
	 * Ignore the HP/UX warning about "integer overflow during
	 * conversion.  It comes from its own macro definition,
	 * and is really hard to shut up.
	 */
	if (ioctl(fd, SIOCGLIFNETMASK, (char *)&lifreq) < 0) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_IFITERIOCTL,
						ISC_MSG_GETNETMASK,
						"%s: getting netmask: %s"),
				 lifreq.lifr_name, strbuf);
		return (ISC_R_IGNORE);
I775 2
	get_addr(family, &iter->current.netmask,
		 (struct sockaddr *)&lifreq.lifr_addr, lifreq.lifr_name);
D778 1
I779 1
#endif
D783 2
I784 11
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->mode == 6) {
		iter->result6 = internal_current6(iter);
		if (iter->result6 != ISC_R_NOMORE)
			return (iter->result6);
	}
#endif
#ifdef HAVE_TRUCLUSTER
	if (!iter->clua_done)
		return(internal_current_clusteralias(iter));
#endif
D801 2
I802 4
#ifdef __linux
	if (linux_if_inet6_next(iter) == ISC_R_SUCCESS)
		return (ISC_R_SUCCESS);
	if (!iter->first)
I819 1
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
D822 4
I826 3
	
	if (iter->result6 != ISC_R_SUCCESS && iter->result6 != ISC_R_IGNORE)
		return (iter->result6);
D828 1
I828 1
	REQUIRE(iter->pos6 < (unsigned int) iter->lifc.lifc_len);
D830 1
I830 1
	ifrp = (struct LIFREQ *)((char *) iter->lifc.lifc_req + iter->pos6);
D834 1
I834 1
		iter->pos6 += sizeof(ifrp->lifr_name) + ifrp->lifr_addr.sa_len;
D837 1
I837 1
		iter->pos6 += sizeof(*ifrp);
D839 1
I839 1
	if (iter->pos6 >= (unsigned int) iter->lifc.lifc_len)
D843 1
I844 1
#endif
D848 2
I849 23
#ifdef HAVE_TRUCLUSTER
	int clua_result;
#endif
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->mode == 6) {
		iter->result6 = internal_next6(iter);
		if (iter->result6 != ISC_R_NOMORE)
			return (iter->result6);
		if (iter->first6) {
			iter->first6 = ISC_FALSE;
			return (ISC_R_SUCCESS);
		}
	}
#endif
#ifdef HAVE_TRUCLUSTER
	if (!iter->clua_done) {
		clua_result = clua_getaliasaddress(&iter->clua_sa,
						   &iter->clua_context);
		if (clua_result != CLUA_SUCCESS)
			iter->clua_done = ISC_TRUE;
		return (ISC_R_SUCCESS);
	}
#endif
I855 34
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	if (iter->socket6 != -1)
		(void) close(iter->socket6);
	if (iter->buf6 != NULL) {
		isc_mem_put(iter->mctx, iter->buf6, iter->bufsize6);
	}
#endif
#ifdef __linux
	if (iter->proc != NULL)
		fclose(iter->proc);
#endif
}
\
static
void internal_first(isc_interfaceiter_t *iter) {
#ifdef HAVE_TRUCLUSTER
	int clua_result;
#endif
	iter->pos = 0;
#if defined(SIOCGLIFCONF) && defined(SIOCGLIFADDR)
	iter->pos6 = 0;
	if (iter->result6 == ISC_R_NOMORE)
		iter->result6 = ISC_R_SUCCESS;
	iter->first6 = ISC_TRUE;
#endif
#ifdef HAVE_TRUCLUSTER
	iter->clua_context = 0;
	clua_result = clua_getaliasaddress(&iter->clua_sa,
					   &iter->clua_context);
	iter->clua_done = ISC_TF(clua_result != CLUA_SUCCESS);
#endif
#ifdef __linux
	linux_if_inet6_first(iter);
#endif

mayer at tecotoo.|libisc/ifiter_ioctl.c|20041231035127|11073
D 1.20 05/01/01 18:05:28-05:00 mayer at tecotoo. +0 -393
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i mayer at pogo.udel.edu|libisc/ifiter_ioctl.c|20050101054813|11073
K 11073
M mayer at pogo.udel.edu|libisc/ifiter_ioctl.c|20050101054813|11073
O -rw-rw-r--
P libisc/ifiter_ioctl.c
------------------------------------------------

D4 2
D18 7
D28 1
D67 3
D75 1
D81 4
D87 1
D95 6
D112 8
D148 10
D231 1
D238 1
D243 2
D248 1
D251 1
D258 2
D266 1
D313 1
D317 1
D330 1
D333 1
D338 2
D345 2
D350 1
D367 1
D377 8
D389 2
D419 27
D459 1
D475 6
D503 9
D606 89
D696 3
D736 8
D756 7
D770 1
D796 1
D836 1
D840 1
D856 1
D863 4
D870 1
D890 13
D910 1
D913 1
D917 2
D928 1
D952 1
D955 1
D976 1
D979 1
D991 1
D1003 1
D1008 1
D1016 1
D1022 3
D1027 1
D1050 1
D1078 5
D1091 3
D1097 1
D1104 1
D1108 1
D1124 1
D1135 1
D1150 2
D1155 2
D1179 2
D1186 1
D1191 1
D1199 6
D1216 2
D1235 16
D1254 2
D1260 1
D1275 11
D1306 4
D1328 1
D1335 3
D1340 1
D1343 1
D1348 1
D1352 1
D1355 1
D1361 1
D1388 23
D1417 34

mayer at tecotoo.|libisc/ifiter_ioctl.c|20050101230528|11073
D 1.21 05/01/01 22:14:04-05:00 mayer at tecotoo. +4 -20
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove reference to interface index. Remove isc_log_write references
K 26117
O -rw-rw-r--
P libisc/ifiter_ioctl.c
------------------------------------------------

D457 2
I458 1
		UNEXPECTED_ERROR(__FILE__, __LINE__,
D466 2
I467 1
		UNEXPECTED_ERROR(__FILE__, __LINE__,
D473 2
I474 1
		UNEXPECTED_ERROR(__FILE__, __LINE__,
D561 10
D648 3
I650 1
	UNEXPECTED_ERROR(__FILE__, __LINE__,
D784 1

== libisc/ifiter_sysctl.c ==
mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20030105020048|00325|d109ada5
mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20031203044532|40396
D 1.9 04/12/30 22:51:27-05:00 mayer at tecotoo. +24 -16
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 51365
O -rw-rw-r--
P libisc/ifiter_sysctl.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ifiter_sysctl.c,v 1.14.12.7 2004/03/08 09:04:56 marka Exp $ */
D255 3
I257 2
		get_addr(family, &iter->current.address, addr_sa,
			 iter->current.name);
D260 1
I260 2
			get_addr(family, &iter->current.netmask, mask_sa,
				 iter->current.name);
D264 1
I264 3
			get_addr(family, &iter->current.dstaddress, dst_sa,
				 iter->current.name);
\
D267 1
I267 3
			get_addr(family, &iter->current.dstaddress, dst_sa,
				 iter->current.name);
\
I308 4
static
void internal_first(isc_interfaceiter_t *iter) {
	iter->pos = 0;
}

mayer at tecotoo.myibg.com|libisc/ifiter_sysctl.c|20031203044532|40396
D 1.8.1.1 05/01/01 00:48:13-05:00 mayer at pogo.udel.edu +24 -16
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 51365
O -rw-rw-r--
P libisc/ifiter_sysctl.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ifiter_sysctl.c,v 1.14.12.7 2004/03/08 09:04:56 marka Exp $ */
D255 3
I257 2
		get_addr(family, &iter->current.address, addr_sa,
			 iter->current.name);
D260 1
I260 2
			get_addr(family, &iter->current.netmask, mask_sa,
				 iter->current.name);
D264 1
I264 3
			get_addr(family, &iter->current.dstaddress, dst_sa,
				 iter->current.name);
\
D267 1
I267 3
			get_addr(family, &iter->current.dstaddress, dst_sa,
				 iter->current.name);
\
I308 4
static
void internal_first(isc_interfaceiter_t *iter) {
	iter->pos = 0;
}

mayer at tecotoo.|libisc/ifiter_sysctl.c|20041231035127|51365
D 1.10 05/01/01 18:05:28-05:00 mayer at tecotoo. +0 -24
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i mayer at pogo.udel.edu|libisc/ifiter_sysctl.c|20050101054813|51365
K 51365
M mayer at pogo.udel.edu|libisc/ifiter_sysctl.c|20050101054813|51365
O -rw-rw-r--
P libisc/ifiter_sysctl.c
------------------------------------------------

D4 2
D18 7
D28 1
D267 2
D273 2
D281 3
D289 3
D333 4

mayer at tecotoo.|libisc/ifiter_sysctl.c|20050101230528|51365
D 1.11 05/01/01 22:14:03-05:00 mayer at tecotoo. +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove reference to interface index. Remove isc_log_write references
K 45856
O -rw-rw-r--
P libisc/ifiter_sysctl.c
------------------------------------------------

D173 1

== libisc/interfaceiter.c ==
mayer at tecotoo.myibg.com|libisc/interfaceiter.c|20030105020050|06985|d127dfd8
mayer at pogo.udel.edu|libisc/interfaceiter.c|20040804220936|05211
D 1.12 04/12/24 18:20:51-05:00 mayer at tecotoo. +2 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 6945
O -rw-rw-r--
P libisc/interfaceiter.c
------------------------------------------------

I21 2
#define ISC_ONLY_IPV6
\

mayer at tecotoo.|libisc/interfaceiter.c|20041224232051|06945
D 1.13 04/12/30 22:51:26-05:00 mayer at tecotoo. +79 -73
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 38938
O -rw-rw-r--
P libisc/interfaceiter.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: interfaceiter.c,v 1.22.2.1.10.14 2004/08/28 06:25:22 marka Exp $ */
I39 1
#include <isc/print.h>
D57 1
I57 1
 * The address family is given explicitly
D64 1
I64 13
get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
	 char *ifname)
{
	struct sockaddr_in6 *sa6;
\
#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) || \
    !defined(ISC_PLATFORM_HAVESCOPEID)
	UNUSED(ifname);
#endif
\
	/* clear any remaining value for safety */
	memset(dst, 0, sizeof(*dst));
\
D72 3
I74 3
	case AF_INET6:
		sa6 = (struct sockaddr_in6 *)src;
		memcpy(&dst->type.in6, &sa6->sin6_addr,
D76 9
I84 45
#ifdef ISC_PLATFORM_HAVESCOPEID
		if (sa6->sin6_scope_id != 0)
			isc_netaddr_setzone(dst, sa6->sin6_scope_id);
		else {
			/*
			 * BSD variants embed scope zone IDs in the 128bit
			 * address as a kernel internal form.  Unfortunately,
			 * the embedded IDs are not hidden from applications
			 * when getting access to them by sysctl or ioctl.
			 * We convert the internal format to the pure address
			 * part and the zone ID part.
			 * Since multicast addresses should not appear here
			 * and they cannot be distinguished from netmasks,
			 * we only consider unicast link-local addresses.
			 */
			if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) {
				isc_uint16_t zone16;
\
				memcpy(&zone16, &sa6->sin6_addr.s6_addr[2],
				       sizeof(zone16));
				zone16 = ntohs(zone16);
				if (zone16 != 0) {
					/* the zone ID is embedded */
					isc_netaddr_setzone(dst,
							    (isc_uint32_t)zone16);
					dst->type.in6.s6_addr[2] = 0;
					dst->type.in6.s6_addr[3] = 0;
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
				} else if (ifname != NULL) {
					unsigned int zone;
\
					/*
					 * sin6_scope_id is still not provided,
					 * but the corresponding interface name
					 * is know.  Use the interface ID as
					 * the link ID.
					 */
					zone = if_nametoindex(ifname);
					if (zone != 0) {
						isc_netaddr_setzone(dst,
								    (isc_uint32_t)zone);
					}
#endif
				}
			}
D86 1
D95 42
D141 1
I141 3
#if HAVE_GETIFADDRS
#include "ifiter_getifaddrs.c"
#elif HAVE_IFLIST_SYSCTL
D166 4
I169 1
	internal_first(iter);
D210 1
I210 2
	if (iter->buf != NULL)
		isc_mem_put(iter->mctx, iter->buf, iter->bufsize);

mayer at tecotoo.|libisc/interfaceiter.c|20041224232051|06945
D 1.12.1.1 05/01/01 00:48:13-05:00 mayer at pogo.udel.edu +79 -73
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 38938
O -rw-rw-r--
P libisc/interfaceiter.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: interfaceiter.c,v 1.22.2.1.10.14 2004/08/28 06:25:22 marka Exp $ */
I39 1
#include <isc/print.h>
D57 1
I57 1
 * The address family is given explicitly
D64 1
I64 13
get_addr(unsigned int family, isc_netaddr_t *dst, struct sockaddr *src,
	 char *ifname)
{
	struct sockaddr_in6 *sa6;
\
#if !defined(ISC_PLATFORM_HAVEIFNAMETOINDEX) || \
    !defined(ISC_PLATFORM_HAVESCOPEID)
	UNUSED(ifname);
#endif
\
	/* clear any remaining value for safety */
	memset(dst, 0, sizeof(*dst));
\
D72 3
I74 3
	case AF_INET6:
		sa6 = (struct sockaddr_in6 *)src;
		memcpy(&dst->type.in6, &sa6->sin6_addr,
D76 9
I84 45
#ifdef ISC_PLATFORM_HAVESCOPEID
		if (sa6->sin6_scope_id != 0)
			isc_netaddr_setzone(dst, sa6->sin6_scope_id);
		else {
			/*
			 * BSD variants embed scope zone IDs in the 128bit
			 * address as a kernel internal form.  Unfortunately,
			 * the embedded IDs are not hidden from applications
			 * when getting access to them by sysctl or ioctl.
			 * We convert the internal format to the pure address
			 * part and the zone ID part.
			 * Since multicast addresses should not appear here
			 * and they cannot be distinguished from netmasks,
			 * we only consider unicast link-local addresses.
			 */
			if (IN6_IS_ADDR_LINKLOCAL(&sa6->sin6_addr)) {
				isc_uint16_t zone16;
\
				memcpy(&zone16, &sa6->sin6_addr.s6_addr[2],
				       sizeof(zone16));
				zone16 = ntohs(zone16);
				if (zone16 != 0) {
					/* the zone ID is embedded */
					isc_netaddr_setzone(dst,
							    (isc_uint32_t)zone16);
					dst->type.in6.s6_addr[2] = 0;
					dst->type.in6.s6_addr[3] = 0;
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
				} else if (ifname != NULL) {
					unsigned int zone;
\
					/*
					 * sin6_scope_id is still not provided,
					 * but the corresponding interface name
					 * is know.  Use the interface ID as
					 * the link ID.
					 */
					zone = if_nametoindex(ifname);
					if (zone != 0) {
						isc_netaddr_setzone(dst,
								    (isc_uint32_t)zone);
					}
#endif
				}
			}
D86 1
D95 42
D141 1
I141 3
#if HAVE_GETIFADDRS
#include "ifiter_getifaddrs.c"
#elif HAVE_IFLIST_SYSCTL
D166 4
I169 1
	internal_first(iter);
D210 1
I210 2
	if (iter->buf != NULL)
		isc_mem_put(iter->mctx, iter->buf, iter->bufsize);

mayer at tecotoo.|libisc/interfaceiter.c|20041231035126|38938
D 1.14 05/01/01 18:05:29-05:00 mayer at tecotoo. +0 -79
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i mayer at pogo.udel.edu|libisc/interfaceiter.c|20050101054813|38938
K 38938
M mayer at pogo.udel.edu|libisc/interfaceiter.c|20050101054813|38938
O -rw-rw-r--
P libisc/interfaceiter.c
------------------------------------------------

D4 2
D18 7
D28 1
D51 1
D70 1
D90 13
D113 3
D162 45
D223 3
D251 1
D292 2

mayer at tecotoo.|libisc/interfaceiter.c|20050101230529|38938
D 1.15 05/01/02 18:27:51-05:00 mayer at tecotoo. +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c remove include net/if.h. Some O/S's don't prevent double inclusions. It is already included in isc/net.h
K 37268
O -rw-rw-r--
P libisc/interfaceiter.c
------------------------------------------------

D51 1

== libisc/net.c ==
mayer at tecotoo.myibg.com|libisc/net.c|20030105020057|42881|d19cebcf
stenn at whimsy.udel.edu|libisc/net.c|20030726193624|24149
D 1.4 04/12/23 00:15:13-05:00 mayer at tecotoo. +210 -10
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 9193
O -rw-rw-r--
P libisc/net.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: net.c,v 1.22.2.2.10.7 2004/04/29 01:31:22 marka Exp $ */
I25 1
#include <isc/once.h>
I33 4
#if defined(ISC_PLATFORM_HAVEIPV6) && defined(ISC_PLATFORM_NEEDIN6ADDRLOOPBACK)
const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT;
#endif
\
I34 2
static isc_once_t 	once_ipv6only = ISC_ONCE_INIT;
static isc_once_t 	once_ipv6pktinfo = ISC_ONCE_INIT;
I36 2
static isc_result_t	ipv6only_result = ISC_R_NOTFOUND;
static isc_result_t	ipv6pktinfo_result = ISC_R_NOTFOUND;
I66 1
#ifdef WANT_IPV6
I88 1
#endif
I98 1
#ifdef WANT_IPV6
I102 1
#endif
I122 187
}
\
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
static void
try_ipv6only(void) {
#ifdef IPV6_V6ONLY
	int s, on;
	char strbuf[ISC_STRERRORSIZE];
#endif
	isc_result_t result;
\
	result = isc_net_probeipv6();
	if (result != ISC_R_SUCCESS) {
		ipv6only_result = result;
		return;
	}
\
#ifndef IPV6_V6ONLY
	ipv6only_result = ISC_R_NOTFOUND;
	return;
#else
	/* check for TCP sockets */
	s = socket(PF_INET6, SOCK_STREAM, 0);
	if (s == -1) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6only_result = ISC_R_UNEXPECTED;
		return;
	}
\
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
		ipv6only_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
\
	/* check for UDP sockets */
	s = socket(PF_INET6, SOCK_DGRAM, 0);
	if (s == -1) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6only_result = ISC_R_UNEXPECTED;
		return;
	}
\
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
		ipv6only_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
\
	ipv6only_result = ISC_R_SUCCESS;
\
close:
	close(s);
	return;
#endif /* IPV6_V6ONLY */
}
\
static void
initialize_ipv6only(void) {
	RUNTIME_CHECK(isc_once_do(&once_ipv6only,
				  try_ipv6only) == ISC_R_SUCCESS);
}
#endif /* IPV6_V6ONLY */
\
static void
try_ipv6pktinfo(void) {
	int s, on;
	char strbuf[ISC_STRERRORSIZE];
	isc_result_t result;
	int optname;
\
	result = isc_net_probeipv6();
	if (result != ISC_R_SUCCESS) {
		ipv6pktinfo_result = result;
		return;
	}
\
	/* we only use this for UDP sockets */
	s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
	if (s == -1) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6pktinfo_result = ISC_R_UNEXPECTED;
		return;
	}
\
#ifdef IPV6_RECVPKTINFO
	optname = IPV6_RECVPKTINFO;
#else
	optname = IPV6_PKTINFO;
#endif
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, optname, &on, sizeof(on)) < 0) {
		ipv6pktinfo_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
	ipv6pktinfo_result = ISC_R_SUCCESS;
\
close:
	close(s);
	return;
}
\
static void
initialize_ipv6pktinfo(void) {
	RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo,
				  try_ipv6pktinfo) == ISC_R_SUCCESS);
}
#endif /* WANT_IPV6 */
\
isc_result_t
isc_net_probe_ipv6only(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
	initialize_ipv6only();
#else
	ipv6only_result = ISC_R_NOTFOUND;
#endif
#endif
	return (ipv6only_result);
}
\
isc_result_t
isc_net_probe_ipv6pktinfo(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
	initialize_ipv6pktinfo();
#else
	ipv6pktinfo_result = ISC_R_NOTFOUND;
#endif
#endif
	return (ipv6pktinfo_result);
}
\
void
isc_net_disableipv4(void) {
	initialize();
	if (ipv4_result == ISC_R_SUCCESS)
		ipv4_result = ISC_R_DISABLED;
}
\
void
isc_net_disableipv6(void) {
	initialize();
	if (ipv6_result == ISC_R_SUCCESS)
		ipv6_result = ISC_R_DISABLED;
}
\
void
isc_net_enableipv4(void) {
	initialize();
	if (ipv4_result == ISC_R_DISABLED)
		ipv4_result = ISC_R_SUCCESS;
}
\
void
isc_net_enableipv6(void) {
	initialize();
	if (ipv6_result == ISC_R_DISABLED)
		ipv6_result = ISC_R_SUCCESS;

mayer at tecotoo.|libisc/net.c|20041223051513|09193
D 1.5 04/12/23 15:24:12-05:00 mayer at pogo.udel.edu +4 -16
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Don't use the catalog like BIND 9
K 57618
O -rw-rw-r--
P libisc/net.c
------------------------------------------------

D69 1
I69 1
					 "socket() failed: %s",
D163 5
I167 1
				 "socket() failed: %s",
D186 5
I190 1
				 "socket() failed: %s",
D237 5
I241 1
				 "socket() failed: %s",

== ports/winnt/include/isc/ipv6.h ==
mayer at tecotoo.myibg.com|ports/winnt/include/isc/ipv6.h|20030105020102|23288|d1fdf9f3
mayer at tecotoo.|ports/winnt/include/isc/ipv6.h|20041103042224|15519
D 1.5 04/12/23 00:15:13-05:00 mayer at tecotoo. +16 -12
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 26079
O -rw-rw-r--
P ports/winnt/include/isc/ipv6.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 2000-2002  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: ipv6.h,v 1.9.2.2.2.5 2004/04/19 06:39:55 marka Exp $ */
D46 1
I46 1
#if _MSC_VER < 1300
I47 1
#endif
I55 3
extern const struct in6_addr isc_in6addr_any;
extern const struct in6_addr isc_in6addr_loopback;
\
D108 1
I108 1
	((a)->s6_addr[0] == 0xffU)

== ports/winnt/include/isc/net.h ==
mayer at tecotoo.myibg.com|ports/winnt/include/isc/net.h|20030105020105|14902|d2318535
mayer at tecotoo.|ports/winnt/include/isc/net.h|20041103041810|08378
D 1.5 04/12/23 00:15:14-05:00 mayer at tecotoo. +60 -12
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 26712
O -rw-rw-r--
P ports/winnt/include/isc/net.h
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: net.h,v 1.15.12.10 2004/04/29 01:31:23 marka Exp $ */
D100 2
I101 2
#include <ws2tcpip.h>
#include <isc/ipv6.h>
I121 5
#if _MSC_VER < 1300
#define in6addr_any isc_in6addr_any
#define in6addr_loopback isc_in6addr_loopback
#endif
\
I143 4
#define ISC_IPADDR_ISEXPERIMENTAL(i) \
		(((isc_uint32_t)(i) & ISC__IPADDR(0xf0000000)) \
		 == ISC__IPADDR(0xf0000000))
\
I236 1
 *	ISC_R_DISABLED		IPv4 is disabled.
I248 13
 *	ISC_R_DISABLED		IPv6 is disabled.
 *	ISC_R_UNEXPECTED
 */
\
isc_result_t
isc_net_probe_ipv6only(void);
/*
 * Check if the system's kernel supports the IPV6_V6ONLY socket option.
 *
 * Returns:
 *
 *	ISC_R_SUCCESS		the option is supported for both TCP and UDP.
 *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
I250 25
\
isc_result_t
isc_net_probe_ipv6pktinfo(void);
/*
 * Check if the system's kernel supports the IPV6_(RECV)PKTINFO socket option
 * for UDP sockets.
 *
 * Returns:
 *
 *	ISC_R_SUCCESS		the option is supported.
 *	ISC_R_NOTFOUND		IPv6 itself or the option is not supported.
 *	ISC_R_UNEXPECTED
 */
\
void
isc_net_disableipv4(void);
\
void
isc_net_disableipv6(void);
\
void
isc_net_enableipv4(void);
\
void
isc_net_enableipv6(void);

== ports/winnt/libisc/net.c ==
mayer at tecotoo.myibg.com|ports/winnt/libisc/net.c|20030105020113|29059|d2d07336
mayer at tecotoo.|ports/winnt/libisc/net.c|20041103041810|54370
D 1.6 04/12/23 00:15:14-05:00 mayer at tecotoo. +206 -10
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c ports from BIND 9.3.0 and reintegrated into ntp libisc code
K 31480
O -rw-rw-r--
P ports/winnt/libisc/net.c
------------------------------------------------

D2 1
I2 2
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  Internet Software Consortium.
D8 8
I15 7
 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
D18 1
I18 1
/* $Id: net.c,v 1.3.2.2.4.7 2004/04/29 01:31:23 marka Exp $ */
I27 1
#include <isc/once.h>
I36 2
static isc_once_t 	once_ipv6only = ISC_ONCE_INIT;
static isc_once_t 	once_ipv6pktinfo = ISC_ONCE_INIT;
I38 2
static isc_result_t	ipv6only_result = ISC_R_NOTFOUND;
static isc_result_t	ipv6pktinfo_result = ISC_R_NOTFOUND;
I64 1
#ifdef WANT_IPV6
I86 1
#endif
I96 1
#ifdef WANT_IPV6
I100 1
#endif
I120 187
}
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
static void
try_ipv6only(void) {
#ifdef IPV6_V6ONLY
	SOCKET s;
	int on;
	char strbuf[ISC_STRERRORSIZE];
#endif
	isc_result_t result;
\
	result = isc_net_probeipv6();
	if (result != ISC_R_SUCCESS) {
		ipv6only_result = result;
		return;
	}
\
#ifndef IPV6_V6ONLY
	ipv6only_result = ISC_R_NOTFOUND;
	return;
#else
	/* check for TCP sockets */
	s = socket(PF_INET6, SOCK_STREAM, 0);
	if (s == INVALID_SOCKET) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6only_result = ISC_R_UNEXPECTED;
		return;
	}
\
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
		ipv6only_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
\
	/* check for UDP sockets */
	s = socket(PF_INET6, SOCK_DGRAM, 0);
	if (s == INVALID_SOCKET) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6only_result = ISC_R_UNEXPECTED;
		return;
	}
\
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0) {
		ipv6only_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
\
	ipv6only_result = ISC_R_SUCCESS;
\
close:
	close(s);
	return;
#endif /* IPV6_V6ONLY */
}
\
static void
initialize_ipv6only(void) {
	RUNTIME_CHECK(isc_once_do(&once_ipv6only,
				  try_ipv6only) == ISC_R_SUCCESS);
}
\
static void
try_ipv6pktinfo(void) {
	int s, on;
	char strbuf[ISC_STRERRORSIZE];
	isc_result_t result;
	int optname;
\
	result = isc_net_probeipv6();
	if (result != ISC_R_SUCCESS) {
		ipv6pktinfo_result = result;
		return;
	}
\
	/* we only use this for UDP sockets */
	s = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
	if (s == -1) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 "socket() %s: %s",
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_GENERAL,
						ISC_MSG_FAILED,
						"failed"),
				 strbuf);
		ipv6pktinfo_result = ISC_R_UNEXPECTED;
		return;
	}
\
#ifdef IPV6_RECVPKTINFO
	optname = IPV6_RECVPKTINFO;
#else
	optname = IPV6_PKTINFO;
#endif
	on = 1;
	if (setsockopt(s, IPPROTO_IPV6, optname, &on, sizeof(on)) < 0) {
		ipv6pktinfo_result = ISC_R_NOTFOUND;
		goto close;
	}
\
	close(s);
	ipv6pktinfo_result = ISC_R_SUCCESS;
\
close:
	close(s);
	return;
}
\
static void
initialize_ipv6pktinfo(void) {
	RUNTIME_CHECK(isc_once_do(&once_ipv6pktinfo,
				  try_ipv6pktinfo) == ISC_R_SUCCESS);
}
#endif /* WANT_IPV6 */
#endif /* ISC_PLATFORM_HAVEIPV6 */
\
isc_result_t
isc_net_probe_ipv6only(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
	initialize_ipv6only();
#else
	ipv6only_result = ISC_R_NOTFOUND;
#endif
#endif
	return (ipv6only_result);
}
\
isc_result_t
isc_net_probe_ipv6pktinfo(void) {
#ifdef ISC_PLATFORM_HAVEIPV6
#ifdef WANT_IPV6
	initialize_ipv6pktinfo();
#else
	ipv6pktinfo_result = ISC_R_NOTFOUND;
#endif
#endif
	return (ipv6pktinfo_result);
}
\
void
isc_net_disableipv4(void) {
	initialize();
	if (ipv4_result == ISC_R_SUCCESS)
		ipv4_result = ISC_R_DISABLED;
}
\
void
isc_net_disableipv6(void) {
	initialize();
	if (ipv6_result == ISC_R_SUCCESS)
		ipv6_result = ISC_R_DISABLED;
}
\
void
isc_net_enableipv4(void) {
	initialize();
	if (ipv4_result == ISC_R_DISABLED)
		ipv4_result = ISC_R_SUCCESS;
}
\
void
isc_net_enableipv6(void) {
	initialize();
	if (ipv6_result == ISC_R_DISABLED)
		ipv6_result = ISC_R_SUCCESS;

== include/isc/buffer.h ==
New file: include/isc/buffer.h
f e 4
V 4

mayer at tecotoo.|include/isc/buffer.h|20041223045544|11394|9d80e402
D 1.0 04/12/22 23:55:44-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/include/isc/buffer.h
K 11394
P include/isc/buffer.h
R 9d80e402
X 0x821
------------------------------------------------


mayer at tecotoo.|include/isc/buffer.h|20041223045544|11394|9d80e402
D 1.1 04/12/22 23:55:44-05:00 mayer at tecotoo. +800 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c isc_buffer header file
F 1
K 27754
O -rw-rw-rw-
P include/isc/buffer.h
------------------------------------------------

I0 800
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1998-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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: buffer.h,v 1.39.12.2 2004/03/08 09:04:51 marka Exp $ */
\
#ifndef ISC_BUFFER_H
#define ISC_BUFFER_H 1
\
/*****
 ***** Module Info
 *****/
\
/*
 * Buffers
 *
 * A buffer is a region of memory, together with a set of related subregions.
 * Buffers are used for parsing and I/O operations.
 *
 * The 'used region' and the 'available' region are disjoint, and their
 * union is the buffer's region.  The used region extends from the beginning
 * of the buffer region to the last used byte.  The available region
 * extends from one byte greater than the last used byte to the end of the
 * buffer's region.  The size of the used region can be changed using various
 * buffer commands.  Initially, the used region is empty.
 *
 * The used region is further subdivided into two disjoint regions: the
 * 'consumed region' and the 'remaining region'.  The union of these two
 * regions is the used region.  The consumed region extends from the beginning
 * of the used region to the byte before the 'current' offset (if any).  The
 * 'remaining' region the current pointer to the end of the used
 * region.  The size of the consumed region can be changed using various
 * buffer commands.  Initially, the consumed region is empty.
 *
 * The 'active region' is an (optional) subregion of the remaining region.
 * It extends from the current offset to an offset in the remaining region
 * that is selected with isc_buffer_setactive().  Initially, the active region
 * is empty.  If the current offset advances beyond the chosen offset, the
 * active region will also be empty.
 *
 *  /------------entire length---------------\
 *  /----- used region -----\/-- available --\
 *  +----------------------------------------+
 *  | consumed  | remaining |                |
 *  +----------------------------------------+
 *  a           b     c     d                e
 *
 * a == base of buffer.
 * b == current pointer.  Can be anywhere between a and d.
 * c == active pointer.  Meaningful between b and d.
 * d == used pointer.
 * e == length of buffer.
 *
 * a-e == entire length of buffer.
 * a-d == used region.
 * a-b == consumed region.
 * b-d == remaining region.
 * b-c == optional active region.
 *
 * The following invariants are maintained by all routines:
 *
 *	length > 0
 *
 *	base is a valid pointer to length bytes of memory
 *
 *	0 <= used <= length
 *
 *	0 <= current <= used
 *
 *	0 <= active <= used
 *	(although active < current implies empty active region)
 *
 * MP:
 *	Buffers have no synchronization.  Clients must ensure exclusive
 *	access.
 *
 * Reliability:
 *	No anticipated impact.
 *
 * Resources:
 *	Memory: 1 pointer + 6 unsigned integers per buffer.
 *
 * Security:
 *	No anticipated impact.
 *
 * Standards:
 *	None.
 */
\
/***
 *** Imports
 ***/
\
#include <isc/lang.h>
#include <isc/magic.h>
#include <isc/types.h>
\
/*
 * To make many functions be inline macros (via #define) define this.
 * If it is undefined, a function will be used.
 */
/* #define ISC_BUFFER_USEINLINE */
\
ISC_LANG_BEGINDECLS
\
/***
 *** Magic numbers
 ***/
#define ISC_BUFFER_MAGIC		0x42756621U	/* Buf!. */
#define ISC_BUFFER_VALID(b)		ISC_MAGIC_VALID(b, ISC_BUFFER_MAGIC)
\
/*
 * The following macros MUST be used only on valid buffers.  It is the
 * caller's responsibility to ensure this by using the ISC_BUFFER_VALID
 * check above, or by calling another isc_buffer_*() function (rather than
 * another macro.)
 */
\
/*
 * Fundamental buffer elements.  (A through E in the introductory comment.)
 */
#define isc_buffer_base(b)    ((void *)(b)->base)			  /*a*/
#define isc_buffer_current(b) \
		((void *)((unsigned char *)(b)->base + (b)->current))     /*b*/
#define isc_buffer_active(b)  \
		((void *)((unsigned char *)(b)->base + (b)->active))      /*c*/
#define isc_buffer_used(b)    \
		((void *)((unsigned char *)(b)->base + (b)->used))        /*d*/
#define isc_buffer_length(b)  ((b)->length)				  /*e*/
\
/*
 * Derived lengths.  (Described in the introductory comment.)
 */
#define isc_buffer_usedlength(b)	((b)->used)		      /* d-a */
#define isc_buffer_consumedlength(b)	((b)->current)		      /* b-a */
#define isc_buffer_remaininglength(b)	((b)->used - (b)->current)    /* d-b */
#define isc_buffer_activelength(b)	((b)->active - (b)->current)  /* c-b */
#define isc_buffer_availablelength(b)	((b)->length - (b)->used)     /* e-d */
\
/*
 * Note that the buffer structure is public.  This is principally so buffer
 * operations can be implemented using macros.  Applications are strongly
 * discouraged from directly manipulating the structure.
 */
\
struct isc_buffer {
	unsigned int		magic;
	void		       *base;
	/* The following integers are byte offsets from 'base'. */
	unsigned int		length;
	unsigned int		used;
	unsigned int 		current;
	unsigned int 		active;
	/* linkable */
	ISC_LINK(isc_buffer_t)	link;
	/* private internal elements */
	isc_mem_t	       *mctx;
};
\
/***
 *** Functions
 ***/
\
isc_result_t
isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer,
		    unsigned int length);
/*
 * Allocate a dynamic linkable buffer which has "length" bytes in the
 * data region.
 *
 * Requires:
 *	"mctx" is valid.
 *
 *	"dynbuffer" is non-NULL, and "*dynbuffer" is NULL.
 *
 * Returns:
 *	ISC_R_SUCCESS		- success
 *	ISC_R_NOMEMORY		- no memory available
 *
 * Note:
 *	Changing the buffer's length field is not permitted.
 */
\
void
isc_buffer_free(isc_buffer_t **dynbuffer);
/*
 * Release resources allocated for a dynamic buffer.
 *
 * Requires:
 *	"dynbuffer" is not NULL.
 *
 *	"*dynbuffer" is a valid dynamic buffer.
 *
 * Ensures:
 *	"*dynbuffer" will be NULL on return, and all memory associated with
 *	the dynamic buffer is returned to the memory context used in
 *	isc_buffer_allocate().
 */
\
void
isc__buffer_init(isc_buffer_t *b, const void *base, unsigned int length);
/*
 * Make 'b' refer to the 'length'-byte region starting at base.
 *
 * Requires:
 *
 *	'length' > 0
 *
 *	'base' is a pointer to a sequence of 'length' bytes.
 *
 */
\
void
isc__buffer_invalidate(isc_buffer_t *b);
/*
 * Make 'b' an invalid buffer.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 * Ensures:
 *	If assertion checking is enabled, future attempts to use 'b' without
 *	calling isc_buffer_init() on it will cause an assertion failure.
 */
\
void
isc__buffer_region(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_usedregion(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the used region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_availableregion(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the available region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_add(isc_buffer_t *b, unsigned int n);
/*
 * Increase the 'used' region of 'b' by 'n' bytes.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 *	used + n <= length
 *
 */
\
void
isc__buffer_subtract(isc_buffer_t *b, unsigned int n);
/*
 * Decrease the 'used' region of 'b' by 'n' bytes.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 *	used >= n
 *
 */
\
void
isc__buffer_clear(isc_buffer_t *b);
/*
 * Make the used region empty.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 * Ensures:
 *
 *	used = 0
 *
 */
\
void
isc__buffer_consumedregion(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the consumed region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_remainingregion(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the remaining region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_activeregion(isc_buffer_t *b, isc_region_t *r);
/*
 * Make 'r' refer to the active region of 'b'.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	'r' points to a region structure.
 */
\
void
isc__buffer_setactive(isc_buffer_t *b, unsigned int n);
/*
 * Sets the end of the active region 'n' bytes after current.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	current + n <= used
 */
\
void
isc__buffer_first(isc_buffer_t *b);
/*
 * Make the consumed region empty.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 * Ensures:
 *
 *	current == 0
 *
 */
\
void
isc__buffer_forward(isc_buffer_t *b, unsigned int n);
/*
 * Increase the 'consumed' region of 'b' by 'n' bytes.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 *	current + n <= used
 *
 */
\
void
isc__buffer_back(isc_buffer_t *b, unsigned int n);
/*
 * Decrease the 'consumed' region of 'b' by 'n' bytes.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 *	n <= current
 *
 */
\
void
isc_buffer_compact(isc_buffer_t *b);
/*
 * Compact the used region by moving the remaining region so it occurs
 * at the start of the buffer.  The used region is shrunk by the size of
 * the consumed region, and the consumed region is then made empty.
 *
 * Requires:
 *
 *	'b' is a valid buffer
 *
 * Ensures:
 *
 *	current == 0
 *
 *	The size of the used region is now equal to the size of the remaining
 *	region (as it was before the call).  The contents of the used region
 *	are those of the remaining region (as it was before the call).
 */
\
isc_uint8_t
isc_buffer_getuint8(isc_buffer_t *b);
/*
 * Read an unsigned 8-bit integer from 'b' and return it.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	The length of the available region of 'b' is at least 1.
 *
 * Ensures:
 *
 *	The current pointer in 'b' is advanced by 1.
 *
 * Returns:
 *
 *	A 8-bit unsigned integer.
 */
\
void
isc__buffer_putuint8(isc_buffer_t *b, isc_uint8_t val);
/*
 * Store an unsigned 8-bit integer from 'val' into 'b'.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	The length of the unused region of 'b' is at least 1.
 *
 * Ensures:
 *	The used pointer in 'b' is advanced by 1.
 */
\
isc_uint16_t
isc_buffer_getuint16(isc_buffer_t *b);
/*
 * Read an unsigned 16-bit integer in network byte order from 'b', convert
 * it to host byte order, and return it.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	The length of the available region of 'b' is at least 2.
 *
 * Ensures:
 *
 *	The current pointer in 'b' is advanced by 2.
 *
 * Returns:
 *
 *	A 16-bit unsigned integer.
 */
\
void
isc__buffer_putuint16(isc_buffer_t *b, isc_uint16_t val);
/*
 * Store an unsigned 16-bit integer in host byte order from 'val'
 * into 'b' in network byte order.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	The length of the unused region of 'b' is at least 2.
 *
 * Ensures:
 *	The used pointer in 'b' is advanced by 2.
 */
\
isc_uint32_t
isc_buffer_getuint32(isc_buffer_t *b);
/*
 * Read an unsigned 32-bit integer in network byte order from 'b', convert
 * it to host byte order, and return it.
 *
 * Requires:
 *
 *	'b' is a valid buffer.
 *
 *	The length of the available region of 'b' is at least 4.
 *
 * Ensures:
 *
 *	The current pointer in 'b' is advanced by 4.
 *
 * Returns:
 *
 *	A 32-bit unsigned integer.
 */
\
void
isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val);
/*
 * Store an unsigned 32-bit integer in host byte order from 'val'
 * into 'b' in network byte order.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	The length of the unused region of 'b' is at least 4.
 *
 * Ensures:
 *	The used pointer in 'b' is advanced by 4.
 */
\
void
isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
		   unsigned int length);
/*
 * Copy 'length' bytes of memory at 'base' into 'b'.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	'base' points to 'length' bytes of valid memory.
 *
 */
\
void
isc__buffer_putstr(isc_buffer_t *b, const char *source);
/*
 * Copy 'source' into 'b', not including terminating NUL.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	'source' to be a valid NULL terminated string.
 *
 *	strlen(source) <= isc_buffer_available(b)
 */
\
isc_result_t
isc_buffer_copyregion(isc_buffer_t *b, const isc_region_t *r);
/*
 * Copy the contents of 'r' into 'b'.
 *
 * Requires:
 *	'b' is a valid buffer.
 *
 *	'r' is a valid region.
 *
 * Returns:
 *
 *	ISC_R_SUCCESS
 *	ISC_R_NOSPACE			The available region of 'b' is not
 *					big enough.
 */
\
ISC_LANG_ENDDECLS
\
/*
 * Inline macro versions of the functions.  These should never be called
 * directly by an application, but will be used by the functions within
 * buffer.c.  The callers should always use "isc_buffer_*()" names, never
 * ones beginning with "isc__"
 */
\
/*
 * XXXDCL Something more could be done with initializing buffers that
 * point to const data.  For example, a new function, isc_buffer_initconst,
 * could be used, and a new boolean flag in the buffer structure could
 * indicate whether the buffer was initialized with that function.
 * (isc_bufer_init itself would be reprototyped to *not* have its "base"
 * parameter be const.)  Then if the boolean were true, the isc_buffer_put*
 * functions could assert a contractual requirement for a non-const buffer.
 * One drawback is that the isc_buffer_* functions (macros) that return
 * pointers would still need to return non-const pointers to avoid compiler
 * warnings, so it would be up to code that uses them to have to deal
 * with the possibility that the buffer was initialized as const --
 * a problem that they *already* have to deal with but have absolutely
 * no ability to.  With a new isc_buffer_isconst() function returning
 * true/false, they could at least assert a contractual requirement for
 * non-const buffers when needed.
 */
#define ISC__BUFFER_INIT(_b, _base, _length) \
	do { \
		union { \
			const void *	konst; \
			void *		var; \
		} _u; \
		_u.konst = (_base); \
		(_b)->base = _u.var; \
		(_b)->length = (_length); \
		(_b)->used = 0; \
		(_b)->current = 0; \
		(_b)->active = 0; \
		(_b)->mctx = NULL; \
		ISC_LINK_INIT(_b, link); \
		(_b)->magic = ISC_BUFFER_MAGIC; \
	} while (0)
\
#define ISC__BUFFER_INVALIDATE(_b) \
	do { \
		(_b)->magic = 0; \
		(_b)->base = NULL; \
		(_b)->length = 0; \
		(_b)->used = 0; \
		(_b)->current = 0; \
		(_b)->active = 0; \
	} while (0)
\
#define ISC__BUFFER_REGION(_b, _r) \
	do { \
		(_r)->base = (_b)->base; \
		(_r)->length = (_b)->length; \
	} while (0)
\
#define ISC__BUFFER_USEDREGION(_b, _r) \
	do { \
		(_r)->base = (_b)->base; \
		(_r)->length = (_b)->used; \
	} while (0)
\
#define ISC__BUFFER_AVAILABLEREGION(_b, _r) \
	do { \
		(_r)->base = isc_buffer_used(_b); \
		(_r)->length = isc_buffer_availablelength(_b); \
	} while (0)
\
#define ISC__BUFFER_ADD(_b, _n) \
	do { \
		(_b)->used += (_n); \
	} while (0)
\
#define ISC__BUFFER_SUBTRACT(_b, _n) \
	do { \
		(_b)->used -= (_n); \
		if ((_b)->current > (_b)->used) \
			(_b)->current = (_b)->used; \
		if ((_b)->active > (_b)->used) \
			(_b)->active = (_b)->used; \
	} while (0)
\
#define ISC__BUFFER_CLEAR(_b) \
	do { \
		(_b)->used = 0; \
		(_b)->current = 0; \
		(_b)->active = 0; \
	} while (0)
\
#define ISC__BUFFER_CONSUMEDREGION(_b, _r) \
	do { \
		(_r)->base = (_b)->base; \
		(_r)->length = (_b)->current; \
	} while (0)
\
#define ISC__BUFFER_REMAININGREGION(_b, _r) \
	do { \
		(_r)->base = isc_buffer_current(_b); \
		(_r)->length = isc_buffer_remaininglength(_b); \
	} while (0)
\
#define ISC__BUFFER_ACTIVEREGION(_b, _r) \
	do { \
		if ((_b)->current < (_b)->active) { \
			(_r)->base = isc_buffer_current(_b); \
			(_r)->length = isc_buffer_activelength(_b); \
		} else { \
			(_r)->base = NULL; \
			(_r)->length = 0; \
		} \
	} while (0)
\
#define ISC__BUFFER_SETACTIVE(_b, _n) \
	do { \
		(_b)->active = (_b)->current + (_n); \
	} while (0)
\
#define ISC__BUFFER_FIRST(_b) \
	do { \
		(_b)->current = 0; \
	} while (0)
\
#define ISC__BUFFER_FORWARD(_b, _n) \
	do { \
		(_b)->current += (_n); \
	} while (0)
\
#define ISC__BUFFER_BACK(_b, _n) \
	do { \
		(_b)->current -= (_n); \
	} while (0)
\
#define ISC__BUFFER_PUTMEM(_b, _base, _length) \
	do { \
		memcpy(isc_buffer_used(_b), (_base), (_length)); \
		(_b)->used += (_length); \
	} while (0)
\
#define ISC__BUFFER_PUTSTR(_b, _source) \
	do { \
		unsigned int _length; \
		unsigned char *_cp; \
		_length = strlen(_source); \
		_cp = isc_buffer_used(_b); \
		memcpy(_cp, (_source), _length); \
		(_b)->used += (_length); \
	} while (0)
\
#define ISC__BUFFER_PUTUINT8(_b, _val) \
	do { \
		unsigned char *_cp; \
		isc_uint8_t _val2 = (_val); \
		_cp = isc_buffer_used(_b); \
		(_b)->used++; \
		_cp[0] = _val2 & 0x00ff; \
	} while (0)
\
#define ISC__BUFFER_PUTUINT16(_b, _val) \
	do { \
		unsigned char *_cp; \
		isc_uint16_t _val2 = (_val); \
		_cp = isc_buffer_used(_b); \
		(_b)->used += 2; \
		_cp[0] = (unsigned char)((_val2 & 0xff00U) >> 8); \
		_cp[1] = (unsigned char)(_val2 & 0x00ffU); \
	} while (0)
\
#define ISC__BUFFER_PUTUINT32(_b, _val) \
	do { \
		unsigned char *_cp; \
		isc_uint32_t _val2 = (_val); \
		_cp = isc_buffer_used(_b); \
		(_b)->used += 4; \
		_cp[0] = (unsigned char)((_val2 & 0xff000000) >> 24); \
		_cp[1] = (unsigned char)((_val2 & 0x00ff0000) >> 16); \
		_cp[2] = (unsigned char)((_val2 & 0x0000ff00) >> 8); \
		_cp[3] = (unsigned char)((_val2 & 0x000000ff)); \
	} while (0)
\
#if defined(ISC_BUFFER_USEINLINE)
#define isc_buffer_init			ISC__BUFFER_INIT
#define isc_buffer_invalidate		ISC__BUFFER_INVALIDATE
#define isc_buffer_region		ISC__BUFFER_REGION
#define isc_buffer_usedregion		ISC__BUFFER_USEDREGION
#define isc_buffer_availableregion	ISC__BUFFER_AVAILABLEREGION
#define isc_buffer_add			ISC__BUFFER_ADD
#define isc_buffer_subtract		ISC__BUFFER_SUBTRACT
#define isc_buffer_clear		ISC__BUFFER_CLEAR
#define isc_buffer_consumedregion	ISC__BUFFER_CONSUMEDREGION
#define isc_buffer_remainingregion	ISC__BUFFER_REMAININGREGION
#define isc_buffer_activeregion		ISC__BUFFER_ACTIVEREGION
#define isc_buffer_setactive		ISC__BUFFER_SETACTIVE
#define isc_buffer_first		ISC__BUFFER_FIRST
#define isc_buffer_forward		ISC__BUFFER_FORWARD
#define isc_buffer_back			ISC__BUFFER_BACK
#define isc_buffer_putmem		ISC__BUFFER_PUTMEM
#define isc_buffer_putstr		ISC__BUFFER_PUTSTR
#define isc_buffer_putuint8		ISC__BUFFER_PUTUINT8
#define isc_buffer_putuint16		ISC__BUFFER_PUTUINT16
#define isc_buffer_putuint32		ISC__BUFFER_PUTUINT32
#else
#define isc_buffer_init			isc__buffer_init
#define isc_buffer_invalidate		isc__buffer_invalidate
#define isc_buffer_region		isc__buffer_region
#define isc_buffer_usedregion		isc__buffer_usedregion
#define isc_buffer_availableregion	isc__buffer_availableregion
#define isc_buffer_add			isc__buffer_add
#define isc_buffer_subtract		isc__buffer_subtract
#define isc_buffer_clear		isc__buffer_clear
#define isc_buffer_consumedregion	isc__buffer_consumedregion
#define isc_buffer_remainingregion	isc__buffer_remainingregion
#define isc_buffer_activeregion		isc__buffer_activeregion
#define isc_buffer_setactive		isc__buffer_setactive
#define isc_buffer_first		isc__buffer_first
#define isc_buffer_forward		isc__buffer_forward
#define isc_buffer_back			isc__buffer_back
#define isc_buffer_putmem		isc__buffer_putmem
#define isc_buffer_putstr		isc__buffer_putstr
#define isc_buffer_putuint8		isc__buffer_putuint8
#define isc_buffer_putuint16		isc__buffer_putuint16
#define isc_buffer_putuint32		isc__buffer_putuint32
#endif
\
#endif /* ISC_BUFFER_H */

mayer at tecotoo.|include/isc/buffer.h|20041223045545|27754
D 1.2 05/01/01 00:49:28-05:00 mayer at pogo.udel.edu +1 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Use macros in buffer routines
K 27544
O -rw-rw-rw-
P include/isc/buffer.h
------------------------------------------------

D115 1
I115 1
#define ISC_BUFFER_USEINLINE 

== include/isc/netscope.h ==
New file: include/isc/netscope.h
f e 4
V 4

mayer at tecotoo.|include/isc/netscope.h|20041223045631|64463|a0e00b21
D 1.0 04/12/22 23:56:31-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/include/isc/netscope.h
K 64463
P include/isc/netscope.h
R a0e00b21
X 0x821
------------------------------------------------


mayer at tecotoo.|include/isc/netscope.h|20041223045631|64463|a0e00b21
D 1.1 04/12/22 23:56:31-05:00 mayer at tecotoo. +40 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c isc_netscope header file
F 1
K 43285
O -rw-rw-rw-
P include/isc/netscope.h
------------------------------------------------

I0 40
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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: netscope.h,v 1.4.142.5 2004/03/08 09:04:52 marka Exp $ */
\
#ifndef ISC_NETSCOPE_H
#define ISC_NETSCOPE_H 1
\
ISC_LANG_BEGINDECLS
\
/*
 * Convert a string of an IPv6 scope zone to zone index.  If the conversion
 * succeeds, 'zoneid' will store the index value.
 * XXXJT: when a standard interface for this purpose is defined,
 * we should use it.
 *
 * Returns:
 *	ISC_R_SUCCESS: conversion succeeds
 *	ISC_R_FAILURE: conversion fails
 */
isc_result_t
isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid);
\
ISC_LANG_ENDDECLS
\
#endif /* ISC_NETADDR_H */

== include/isc/region.h ==
New file: include/isc/region.h
f e 4
V 4

mayer at tecotoo.|include/isc/region.h|20041223045706|13780|a35676bb
D 1.0 04/12/22 23:57:06-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/include/isc/region.h
K 13780
P include/isc/region.h
R a35676bb
X 0x821
------------------------------------------------


mayer at tecotoo.|include/isc/region.h|20041223045706|13780|a35676bb
D 1.1 04/12/22 23:57:06-05:00 mayer at tecotoo. +95 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c isc_region header file
F 1
K 58015
O -rw-rw-rw-
P include/isc/region.h
------------------------------------------------

I0 95
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1998-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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: region.h,v 1.16.12.3 2004/03/08 09:04:53 marka Exp $ */
\
#ifndef ISC_REGION_H
#define ISC_REGION_H 1
\
#include <isc/types.h>
\
struct isc_region {
	unsigned char *	base;
	unsigned int	length;
};
\
struct isc_textregion {
	char *		base;
	unsigned int	length;
};
\
/* XXXDCL questionable ... bears discussion.  we have been putting off
 * discussing the region api.
 */
struct isc_constregion {
	const void *	base;
	unsigned int	length;
};
\
struct isc_consttextregion {
	const char *	base;
	unsigned int	length;
};
\
/*
 * The region structure is not opaque, and is usually directly manipulated.
 * Some macros are defined below for convenience.
 */
\
#define isc_region_consume(r,l) \
	do { \
		isc_region_t *_r = (r); \
		unsigned int _l = (l); \
		INSIST(_r->length >= _l); \
		_r->base += _l; \
		_r->length -= _l; \
	} while (0)
\
#define isc_textregion_consume(r,l) \
	do { \
		isc_textregion_t *_r = (r); \
		unsigned int _l = (l); \
		INSIST(_r->length >= _l); \
		_r->base += _l; \
		_r->length -= _l; \
	} while (0)
\
#define isc_constregion_consume(r,l) \
	do { \
		isc_constregion_t *_r = (r); \
		unsigned int _l = (l); \
		INSIST(_r->length >= _l); \
		_r->base += _l; \
		_r->length -= _l; \
	} while (0)
\
int
isc_region_compare(isc_region_t *r1, isc_region_t *r2);
/*
 * Compares the contents of two regions 
 *
 * Requires: 
 *	'r1' is a valid region
 *	'r2' is a valid region
 *
 * Returns:
 *	 < 0 if r1 is lexicographically less than r2
 *	 = 0 if r1 is lexicographically identical to r2
 *	 > 0 if r1 is lexicographically greater than r2
 */
\
#endif /* ISC_REGION_H */

== libisc/ifiter_getifaddrs.c ==
New file: libisc/ifiter_getifaddrs.c
f e 4
V 4

mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584
D 1.0 04/12/23 22:58:38-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/libisc/ifiter_getifaddrs.c
K 26262
P libisc/ifiter_getifaddrs.c
R aa7d1584
X 0x821
------------------------------------------------


mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035838|26262|aa7d1584
D 1.1 04/12/23 22:58:38-05:00 mayer at tecotoo. +178 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Alternate method of getting interface addresses
F 1
K 58686
O -rw-rw-rw-
P libisc/ifiter_getifaddrs.c
------------------------------------------------

I0 178
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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: ifiter_getifaddrs.c,v 1.2.68.3 2004/03/06 08:14:59 marka Exp $ */
\
/*
 * Obtain the list of network interfaces using the getifaddrs(3) library.
 */
\
#include <ifaddrs.h>
\
#define IFITER_MAGIC		ISC_MAGIC('I', 'F', 'I', 'G')
#define VALID_IFITER(t)		ISC_MAGIC_VALID(t, IFITER_MAGIC)
\
struct isc_interfaceiter {
	unsigned int		magic;		/* Magic number. */
	isc_mem_t		*mctx;
	void			*buf;		/* (unused) */
	unsigned int		bufsize;	/* (always 0) */
	struct ifaddrs		*ifaddrs;	/* List of ifaddrs */
	struct ifaddrs		*pos;		/* Ptr to current ifaddr */
	isc_interface_t		current;	/* Current interface data. */
	isc_result_t		result;		/* Last result code. */
};
\
isc_result_t
isc_interfaceiter_create(isc_mem_t *mctx, isc_interfaceiter_t **iterp) {
	isc_interfaceiter_t *iter;
	isc_result_t result;
	char strbuf[ISC_STRERRORSIZE];
\
	REQUIRE(mctx != NULL);
	REQUIRE(iterp != NULL);
	REQUIRE(*iterp == NULL);
\
	iter = isc_mem_get(mctx, sizeof(*iter));
	if (iter == NULL)
		return (ISC_R_NOMEMORY);
\
	iter->mctx = mctx;
	iter->buf = NULL;
	iter->bufsize = 0;
	iter->ifaddrs = NULL;
\
	if (getifaddrs(&iter->ifaddrs) < 0) {
		isc__strerror(errno, strbuf, sizeof(strbuf));
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_IFITERGETIFADDRS,
						ISC_MSG_GETIFADDRS,
						"getting interface "
						"addresses: getifaddrs: %s"),
				 strbuf);
		result = ISC_R_UNEXPECTED;
		goto failure;
	}
\
	/*
	 * A newly created iterator has an undefined position
	 * until isc_interfaceiter_first() is called.
	 */
	iter->pos = NULL;
	iter->result = ISC_R_FAILURE;
\
	iter->magic = IFITER_MAGIC;
	*iterp = iter;
	return (ISC_R_SUCCESS);
\
 failure:
	if (iter->ifaddrs != NULL) /* just in case */
		freeifaddrs(iter->ifaddrs);
	isc_mem_put(mctx, iter, sizeof(*iter));
	return (result);
}
\
/*
 * Get information about the current interface to iter->current.
 * If successful, return ISC_R_SUCCESS.
 * If the interface has an unsupported address family,
 * return ISC_R_IGNORE.
 */
\
static isc_result_t
internal_current(isc_interfaceiter_t *iter) {
	struct ifaddrs *ifa;
	int family;
	unsigned int namelen;
\
	REQUIRE(VALID_IFITER(iter));
\
	ifa = iter->pos;
\
	INSIST(ifa != NULL);
	INSIST(ifa->ifa_name != NULL);
	INSIST(ifa->ifa_addr != NULL);
\
	family = ifa->ifa_addr->sa_family;
	if (family != AF_INET && family != AF_INET6)
		return (ISC_R_IGNORE);
\
	memset(&iter->current, 0, sizeof(iter->current));
\
	namelen = strlen(ifa->ifa_name);
	if (namelen > sizeof(iter->current.name) - 1)
		namelen = sizeof(iter->current.name) - 1;
\
	memset(iter->current.name, 0, sizeof(iter->current.name));
	memcpy(iter->current.name, ifa->ifa_name, namelen);
\
	iter->current.flags = 0;
\
	if ((ifa->ifa_flags & IFF_UP) != 0)
		iter->current.flags |= INTERFACE_F_UP;
\
	if ((ifa->ifa_flags & IFF_POINTOPOINT) != 0)
		iter->current.flags |= INTERFACE_F_POINTTOPOINT;
\
	if ((ifa->ifa_flags & IFF_LOOPBACK) != 0)
		iter->current.flags |= INTERFACE_F_LOOPBACK;
\
	iter->current.af = family;
\
	get_addr(family, &iter->current.address, ifa->ifa_addr, ifa->ifa_name);
\
	if (ifa->ifa_netmask != NULL)
		get_addr(family, &iter->current.netmask, ifa->ifa_netmask,
			 ifa->ifa_name);
\
	if (ifa->ifa_dstaddr != NULL &&
	    (iter->current.flags & IFF_POINTOPOINT) != 0)
		get_addr(family, &iter->current.dstaddress, ifa->ifa_dstaddr,
			 ifa->ifa_name);
\
	return (ISC_R_SUCCESS);
}
\
/*
 * Step the iterator to the next interface.  Unlike
 * isc_interfaceiter_next(), this may leave the iterator
 * positioned on an interface that will ultimately
 * be ignored.  Return ISC_R_NOMORE if there are no more
 * interfaces, otherwise ISC_R_SUCCESS.
 */
static isc_result_t
internal_next(isc_interfaceiter_t *iter) {
	iter->pos = iter->pos->ifa_next;
\
	if (iter->pos == NULL)
		return (ISC_R_NOMORE);
\
	return (ISC_R_SUCCESS);
}
\
static void
internal_destroy(isc_interfaceiter_t *iter) {
	if (iter->ifaddrs)
		freeifaddrs(iter->ifaddrs);
	iter->ifaddrs = NULL;
}
\
static
void internal_first(isc_interfaceiter_t *iter) {
	iter->pos = iter->ifaddrs;
}

mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035839|58686
D 1.2 04/12/30 22:51:28-05:00 mayer at tecotoo. +15 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 26691
O -rw-rw-rw-
P libisc/ifiter_getifaddrs.c
------------------------------------------------

D46 1
I122 1
	iter->current.ifindex = ifa.ifa_index;	/* Save the if index */
I134 9
	if ((ifa->ifa_flags & IFF_BROADCAST) != 0) {
		iter->current.flags |= INTERFACE_F_BROADCAST;
	}
\
#ifdef IFF_MULTICAST
	if ((ifa->ifa_flags & IFF_MULTICAST) != 0) {
		iter->current.flags |= INTERFACE_F_MULTICAST;
	}
#endif
I145 5
			 ifa->ifa_name);
\
	if (ifa->ifa_broadaddr != NULL &&
	    (iter->current.flags & IFF_BROADCAST) != 0)
		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,

mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041224035839|58686
D 1.1.1.1 05/01/01 00:48:14-05:00 mayer at pogo.udel.edu +15 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c First upgrade of interfaceiter routines
K 26691
O -rw-rw-rw-
P libisc/ifiter_getifaddrs.c
------------------------------------------------

D46 1
I122 1
	iter->current.ifindex = ifa.ifa_index;	/* Save the if index */
I134 9
	if ((ifa->ifa_flags & IFF_BROADCAST) != 0) {
		iter->current.flags |= INTERFACE_F_BROADCAST;
	}
\
#ifdef IFF_MULTICAST
	if ((ifa->ifa_flags & IFF_MULTICAST) != 0) {
		iter->current.flags |= INTERFACE_F_MULTICAST;
	}
#endif
I145 5
			 ifa->ifa_name);
\
	if (ifa->ifa_broadaddr != NULL &&
	    (iter->current.flags & IFF_BROADCAST) != 0)
		get_addr(family, &iter->current.broadcast, ifa->ifa_broadaddr,

mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20041231035128|26691
D 1.3 05/01/01 18:05:27-05:00 mayer at tecotoo. +0 -15
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i mayer at pogo.udel.edu|libisc/ifiter_getifaddrs.c|20050101054814|26691
K 26691
M mayer at pogo.udel.edu|libisc/ifiter_getifaddrs.c|20050101054814|26691
O -rw-rw-rw-
P libisc/ifiter_getifaddrs.c
------------------------------------------------

D123 1
D145 9
D165 5

mayer at tecotoo.|libisc/ifiter_getifaddrs.c|20050101230527|26691
D 1.4 05/01/01 22:14:04-05:00 mayer at tecotoo. +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove reference to interface index. Remove isc_log_write references
K 21290
O -rw-rw-rw-
P libisc/ifiter_getifaddrs.c
------------------------------------------------

D122 1

== libisc/netaddr.c ==
New file: libisc/netaddr.c
f e 4
V 4

mayer at tecotoo.|libisc/netaddr.c|20041223045840|25979|aa07381e
D 1.0 04/12/22 23:58:40-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/libisc/netaddr.c
K 25979
P libisc/netaddr.c
R aa07381e
X 0x821
------------------------------------------------


mayer at tecotoo.|libisc/netaddr.c|20041223045840|25979|aa07381e
D 1.1 04/12/22 23:58:40-05:00 mayer at tecotoo. +357 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c isc_netaddr functions
F 1
K 57489
O -rw-rw-rw-
P libisc/netaddr.c
------------------------------------------------

I0 357
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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: netaddr.c,v 1.18.12.9 2004/05/15 03:46:12 jinmei Exp $ */
\
#include <config.h>
\
#include <stdio.h>
\
#include <isc/buffer.h>
#include <isc/msgs.h>
#include <isc/net.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/util.h>
\
isc_boolean_t
isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b) {
	REQUIRE(a != NULL && b != NULL);
\
	if (a->family != b->family)
		return (ISC_FALSE);
\
	if (a->zone != b->zone)
		return (ISC_FALSE);
\
	switch (a->family) {
	case AF_INET:
		if (a->type.in.s_addr != b->type.in.s_addr)
			return (ISC_FALSE);
		break;
	case AF_INET6:
		if (memcmp(&a->type.in6, &b->type.in6,
			   sizeof(a->type.in6)) != 0 ||
		    a->zone != b->zone)
			return (ISC_FALSE);
		break;
	default:
		return (ISC_FALSE);
	}
	return (ISC_TRUE);
}
\
isc_boolean_t
isc_netaddr_eqprefix(const isc_netaddr_t *a, const isc_netaddr_t *b,
		     unsigned int prefixlen)
{
	const unsigned char *pa, *pb;
	unsigned int ipabytes; /* Length of whole IP address in bytes */
	unsigned int nbytes;   /* Number of significant whole bytes */
	unsigned int nbits;    /* Number of significant leftover bits */
\
	REQUIRE(a != NULL && b != NULL);
\
	if (a->family != b->family)
		return (ISC_FALSE);
\
	if (a->zone != b->zone)
		return (ISC_FALSE);
\
	switch (a->family) {
	case AF_INET:
		pa = (const unsigned char *) &a->type.in;
		pb = (const unsigned char *) &b->type.in;
		ipabytes = 4;
		break;
	case AF_INET6:
		pa = (const unsigned char *) &a->type.in6;
		pb = (const unsigned char *) &b->type.in6;
		ipabytes = 16;
		break;
	default:
		pa = pb = NULL; /* Avoid silly compiler warning. */
		ipabytes = 0; /* Ditto. */
		return (ISC_FALSE);
	}
\
	/*
	 * Don't crash if we get a pattern like 10.0.0.1/9999999.
	 */
	if (prefixlen > ipabytes * 8)
		prefixlen = ipabytes * 8;
\
	nbytes = prefixlen / 8;
	nbits = prefixlen % 8;
\
	if (nbytes > 0) {
		if (memcmp(pa, pb, nbytes) != 0)
			return (ISC_FALSE);
	}
	if (nbits > 0) {
		unsigned int bytea, byteb, mask;
		INSIST(nbytes < ipabytes);
		INSIST(nbits < 8);
		bytea = pa[nbytes];
		byteb = pb[nbytes];
		mask = (0xFF << (8-nbits)) & 0xFF;
		if ((bytea & mask) != (byteb & mask))
			return (ISC_FALSE);
	}
	return (ISC_TRUE);
}
\
isc_result_t
isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
	char abuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:255.255.255.255")];
	char zbuf[sizeof("%4294967295")];
	unsigned int alen;
	int zlen;
	const char *r;
	const void *type;
\
	REQUIRE(netaddr != NULL);
\
	switch (netaddr->family) {
	case AF_INET:
		type = &netaddr->type.in;
		break;
	case AF_INET6:
		type = &netaddr->type.in6;
		break;
	default:
		return (ISC_R_FAILURE);
	}
	r = inet_ntop(netaddr->family, type, abuf, sizeof(abuf));
	if (r == NULL)
		return (ISC_R_FAILURE);
\
	alen = strlen(abuf);
	INSIST(alen < sizeof(abuf));
\
	zlen = 0;
	if (netaddr->family == AF_INET6 && netaddr->zone != 0) {
		zlen = snprintf(zbuf, sizeof(zbuf), "%%%u", netaddr->zone);
		if (zlen < 0)
			return (ISC_R_FAILURE);
		INSIST((unsigned int)zlen < sizeof(zbuf));
	}
\
	if (alen + zlen > isc_buffer_availablelength(target))
		return (ISC_R_NOSPACE);
\
	isc_buffer_putmem(target, (unsigned char *)abuf, alen);
	isc_buffer_putmem(target, (unsigned char *)zbuf, zlen);
\
	return (ISC_R_SUCCESS);
}
\
void
isc_netaddr_format(const isc_netaddr_t *na, char *array, unsigned int size) {
	isc_result_t result;
	isc_buffer_t buf;
\
	isc_buffer_init(&buf, array, size);
	result = isc_netaddr_totext(na, &buf);
\
	/*
	 * Null terminate.
	 */
	if (result == ISC_R_SUCCESS) {
		if (isc_buffer_availablelength(&buf) >= 1)
			isc_buffer_putuint8(&buf, 0);
		else
			result = ISC_R_NOSPACE;
	}
\
	if (result != ISC_R_SUCCESS) {
		snprintf(array, size,
			 isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
					ISC_MSG_UNKNOWNADDR,
					"<unknown address, family %u>"),
			 na->family);
		array[size - 1] = '\0';
	}
}
\
isc_result_t
isc_netaddr_masktoprefixlen(const isc_netaddr_t *s, unsigned int *lenp) {
	unsigned int nbits, nbytes, ipbytes, i;
	const unsigned char *p;
\
	switch (s->family) {
	case AF_INET:
		p = (const unsigned char *) &s->type.in;
		ipbytes = 4;
		break;
	case AF_INET6:
		p = (const unsigned char *) &s->type.in6;
		ipbytes = 16;
		break;
	default:
		ipbytes = 0;
		return (ISC_R_NOTIMPLEMENTED);
	}
	nbytes = nbits = 0;
	for (i = 0; i < ipbytes; i++) {
		if (p[i] != 0xFF)
			break;
	}
	nbytes = i;
	if (i < ipbytes) {
		unsigned int c = p[nbytes];
		while ((c & 0x80) != 0 && nbits < 8) {
			c <<= 1; nbits++;
		}
		if ((c & 0xFF) != 0)
			return (ISC_R_MASKNONCONTIG);
		i++;
	}
	for (; i < ipbytes; i++) {
		if (p[i] != 0)
			return (ISC_R_MASKNONCONTIG);
		i++;
	}
	*lenp = nbytes * 8 + nbits;
	return (ISC_R_SUCCESS);
}
\
void
isc_netaddr_fromin(isc_netaddr_t *netaddr, const struct in_addr *ina) {
	memset(netaddr, 0, sizeof(*netaddr));
	netaddr->family = AF_INET;
	netaddr->type.in = *ina;
}
\
void
isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6) {
	memset(netaddr, 0, sizeof(*netaddr));
	netaddr->family = AF_INET6;
	netaddr->type.in6 = *ina6;
}
\
void
isc_netaddr_setzone(isc_netaddr_t *netaddr, isc_uint32_t zone) {
	/* we currently only support AF_INET6. */
	REQUIRE(netaddr->family == AF_INET6);
\
	netaddr->zone = zone;
}
\
isc_uint32_t
isc_netaddr_getzone(const isc_netaddr_t *netaddr) {
	return (netaddr->zone);
}
\
void
isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) {
	int family = s->type.sa.sa_family;
	t->family = family;
	switch (family) {
	case AF_INET:
		t->type.in = s->type.sin.sin_addr;
		t->zone = 0;
		break;
	case AF_INET6:
		memcpy(&t->type.in6, &s->type.sin6.sin6_addr, 16);
#ifdef ISC_PLATFORM_HAVESCOPEID
		t->zone = s->type.sin6.sin6_scope_id;
#else
		t->zone = 0;
#endif
		break;
	default:
		INSIST(0);
	}
}
\
void
isc_netaddr_any(isc_netaddr_t *netaddr) {
	memset(netaddr, 0, sizeof(*netaddr));
	netaddr->family = AF_INET;
	netaddr->type.in.s_addr = INADDR_ANY;
}
\
void
isc_netaddr_any6(isc_netaddr_t *netaddr) {
	memset(netaddr, 0, sizeof(*netaddr));
	netaddr->family = AF_INET6;
	netaddr->type.in6 = in6addr_any;
}
\
isc_boolean_t
isc_netaddr_ismulticast(isc_netaddr_t *na) {
	switch (na->family) {
	case AF_INET:
		return (ISC_TF(ISC_IPADDR_ISMULTICAST(na->type.in.s_addr)));
	case AF_INET6:
		return (ISC_TF(IN6_IS_ADDR_MULTICAST(&na->type.in6)));
	default:
		return (ISC_FALSE);  /* XXXMLG ? */
	}
}
\
isc_boolean_t
isc_netaddr_isexperimental(isc_netaddr_t *na) {
	switch (na->family) {
	case AF_INET:
		return (ISC_TF(ISC_IPADDR_ISEXPERIMENTAL(na->type.in.s_addr)));
	default:
		return (ISC_FALSE);  /* XXXMLG ? */
	}
}
\
isc_boolean_t
isc_netaddr_islinklocal(isc_netaddr_t *na) {
	switch (na->family) {
	case AF_INET:
		return (ISC_FALSE);
	case AF_INET6:
		return (ISC_TF(IN6_IS_ADDR_LINKLOCAL(&na->type.in6)));
	default:
		return (ISC_FALSE);
	}
}
\
isc_boolean_t
isc_netaddr_issitelocal(isc_netaddr_t *na) {
	switch (na->family) {
	case AF_INET:
		return (ISC_FALSE);
	case AF_INET6:
		return (ISC_TF(IN6_IS_ADDR_SITELOCAL(&na->type.in6)));
	default:
		return (ISC_FALSE);
	}
}
\
void
isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s) {
	isc_netaddr_t *src;
\
	DE_CONST(s, src);	/* Must come before IN6_IS_ADDR_V4MAPPED. */
\
	REQUIRE(s->family == AF_INET6);
	REQUIRE(IN6_IS_ADDR_V4MAPPED(&src->type.in6));
\
	memset(t, 0, sizeof(*t));
	t->family = AF_INET;
	memcpy(&t->type.in, (char *)&src->type.in6 + 12, 4);
	return;
}

mayer at tecotoo.|libisc/netaddr.c|20041223045841|57489
D 1.2 04/12/24 18:25:00-05:00 mayer at tecotoo. +2 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 59223
O -rw-rw-rw-
P libisc/netaddr.c
------------------------------------------------

I21 2
#define ISC_ONLY_IPV6
\

== libisc/netscope.c ==
New file: libisc/netscope.c
f e 4
V 4

mayer at tecotoo.|libisc/netscope.c|20041223045918|25388|acbf0c88
D 1.0 04/12/22 23:59:18-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/libisc/netscope.c
K 25388
P libisc/netscope.c
R acbf0c88
X 0x821
------------------------------------------------


mayer at tecotoo.|libisc/netscope.c|20041223045918|25388|acbf0c88
D 1.1 04/12/22 23:59:18-05:00 mayer at tecotoo. +74 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
F 1
K 51769
O -rw-rw-rw-
P libisc/netscope.c
------------------------------------------------

I0 74
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 2002  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.
 */
\
#if defined(LIBC_SCCS) && !defined(lint)
static char rcsid[] =
	"$Id: netscope.c,v 1.5.142.7 2004/03/12 10:31:26 marka Exp $";
#endif /* LIBC_SCCS and not lint */
\
#include <config.h>
\
#include <isc/string.h>
#include <isc/net.h>
#include <isc/netscope.h>
#include <isc/result.h>
\
isc_result_t
isc_netscope_pton(int af, char *scopename, void *addr, isc_uint32_t *zoneid) {
	char *ep;
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
	unsigned int ifid;
#endif
	struct in6_addr *in6;
	isc_uint32_t zone;
	isc_uint64_t llz;
\
	/* at this moment, we only support AF_INET6 */
	if (af != AF_INET6)
		return (ISC_R_FAILURE);
\
	in6 = (struct in6_addr *)addr;
\
	/*
	 * Basically, "names" are more stable than numeric IDs in terms of
	 * renumbering, and are more preferred.  However, since there is no
	 * standard naming convention and APIs to deal with the names.  Thus,
	 * we only handle the case of link-local addresses, for which we use
	 * interface names as link names, assuming one to one mapping between
	 * interfaces and links.
	 */
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
	if (IN6_IS_ADDR_LINKLOCAL(in6) &&
	    (ifid = if_nametoindex((const char *)scopename)) != 0)
		zone = (isc_uint32_t)ifid;
	else {
#endif
		llz = isc_string_touint64(scopename, &ep, 10);
		if (ep == scopename)
			return (ISC_R_FAILURE);
\
		/* check overflow */
		zone = (isc_uint32_t)(llz & 0xffffffffUL);
		if (zone != llz)
			return (ISC_R_FAILURE);
#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX
	}
#endif
\
	*zoneid = zone;
	return (ISC_R_SUCCESS);
}

== libisc/sockaddr.c ==
New file: libisc/sockaddr.c
f e 4
V 4

mayer at tecotoo.|libisc/sockaddr.c|20041223050001|38826|afd59d6e
D 1.0 04/12/23 00:00:01-05:00 mayer at tecotoo. +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
c BitKeeper file H:/ntpbk/ntp-dev/libisc/sockaddr.c
K 38826
P libisc/sockaddr.c
R afd59d6e
X 0x821
------------------------------------------------


mayer at tecotoo.|libisc/sockaddr.c|20041223050001|38826|afd59d6e
D 1.1 04/12/23 00:00:01-05:00 mayer at tecotoo. +474 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c isc_sockaddr functions
F 1
K 39820
O -rw-rw-rw-
P libisc/sockaddr.c
------------------------------------------------

I0 474
/*
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 * Copyright (C) 1999-2003  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 ISC DISCLAIMS ALL WARRANTIES WITH
 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS.  IN NO EVENT SHALL ISC 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.48.2.1.2.10 2004/05/15 03:46:12 jinmei Exp $ */
\
#include <config.h>
\
#include <stdio.h>
\
#include <isc/buffer.h>
/*
 * We currently don't need hashing here
 */
#if 0
#include <isc/hash.h>
#endif
\
#include <isc/msgs.h>
#include <isc/netaddr.h>
#include <isc/print.h>
#include <isc/region.h>
#include <isc/sockaddr.h>
#include <isc/string.h>
#include <isc/util.h>
\
isc_boolean_t
isc_sockaddr_equal(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
	REQUIRE(a != NULL && b != NULL);
\
	if (a->length != b->length)
		return (ISC_FALSE);
\
	/*
	 * We don't just memcmp because the sin_zero field isn't always
	 * zero.
	 */
\
	if (a->type.sa.sa_family != b->type.sa.sa_family)
		return (ISC_FALSE);
	switch (a->type.sa.sa_family) {
	case AF_INET:
		if (memcmp(&a->type.sin.sin_addr, &b->type.sin.sin_addr,
			   sizeof(a->type.sin.sin_addr)) != 0)
			return (ISC_FALSE);
		if (a->type.sin.sin_port != b->type.sin.sin_port)
			return (ISC_FALSE);
		break;
	case AF_INET6:
		if (memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr,
			   sizeof(a->type.sin6.sin6_addr)) != 0)
			return (ISC_FALSE);
#ifdef ISC_PLATFORM_HAVESCOPEID
		if (a->type.sin6.sin6_scope_id != b->type.sin6.sin6_scope_id)
			return (ISC_FALSE);
#endif
		if (a->type.sin6.sin6_port != b->type.sin6.sin6_port)
			return (ISC_FALSE);
		break;
	default:
		if (memcmp(&a->type, &b->type, a->length) != 0)
			return (ISC_FALSE);
	}
	return (ISC_TRUE);
}
\
isc_boolean_t
isc_sockaddr_eqaddr(const isc_sockaddr_t *a, const isc_sockaddr_t *b) {
	REQUIRE(a != NULL && b != NULL);
\
	if (a->length != b->length)
		return (ISC_FALSE);
\
	if (a->type.sa.sa_family != b->type.sa.sa_family)
		return (ISC_FALSE);
	switch (a->type.sa.sa_family) {
	case AF_INET:
		if (memcmp(&a->type.sin.sin_addr, &b->type.sin.sin_addr,
			   sizeof(a->type.sin.sin_addr)) != 0)
			return (ISC_FALSE);
		break;
	case AF_INET6:
		if (memcmp(&a->type.sin6.sin6_addr, &b->type.sin6.sin6_addr,
			   sizeof(a->type.sin6.sin6_addr)) != 0)
			return (ISC_FALSE);
#ifdef ISC_PLATFORM_HAVESCOPEID
		if (a->type.sin6.sin6_scope_id != b->type.sin6.sin6_scope_id)
			return (ISC_FALSE);
#endif
		break;
	default:
		if (memcmp(&a->type, &b->type, a->length) != 0)
			return (ISC_FALSE);
	}
	return (ISC_TRUE);
}
\
isc_boolean_t
isc_sockaddr_eqaddrprefix(const isc_sockaddr_t *a, const isc_sockaddr_t *b,
			  unsigned int prefixlen)
{
	isc_netaddr_t na, nb;
	isc_netaddr_fromsockaddr(&na, a);
	isc_netaddr_fromsockaddr(&nb, b);
	return (isc_netaddr_eqprefix(&na, &nb, prefixlen));
}
\
isc_result_t
isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
	isc_result_t result;
	isc_netaddr_t netaddr;
	char pbuf[sizeof("65000")];
	unsigned int plen;
	isc_region_t avail;
\
	REQUIRE(sockaddr != NULL);
\
	/*
	 * Do the port first, giving us the opportunity to check for
	 * unsupported address families before calling
	 * isc_netaddr_fromsockaddr().
	 */
	switch (sockaddr->type.sa.sa_family) {
	case AF_INET:
		snprintf(pbuf, sizeof(pbuf), "%u", ntohs(sockaddr->type.sin.sin_port));
		break;
	case AF_INET6:
		snprintf(pbuf, sizeof(pbuf), "%u", ntohs(sockaddr->type.sin6.sin6_port));
		break;
	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);
\
	/*
	 * Null terminate after used region.
	 */
	isc_buffer_availableregion(target, &avail);
	INSIST(avail.length >= 1);
	avail.base[0] = '\0';
\
	return (ISC_R_SUCCESS);
}
\
void
isc_sockaddr_format(const isc_sockaddr_t *sa, char *array, unsigned int size) {
	isc_result_t result;
	isc_buffer_t buf;
\
	isc_buffer_init(&buf, array, size);
	result = isc_sockaddr_totext(sa, &buf);
	if (result != ISC_R_SUCCESS) {
		/*
		 * The message is the same as in netaddr.c.
		 */
		snprintf(array, size,
			 isc_msgcat_get(isc_msgcat, ISC_MSGSET_NETADDR,
					ISC_MSG_UNKNOWNADDR,
					"<unknown address, family %u>"),
			 sa->type.sa.sa_family);
		array[size - 1] = '\0';
	}
}
\
#if 0
/*
 * We currently don't need hashing here
 */
unsigned int
isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) {
	unsigned int length = 0;
	const unsigned char *s = NULL;
	unsigned int h = 0;
	unsigned int g;
	unsigned int p = 0;
	const struct in6_addr *in6;
\
	REQUIRE(sockaddr != NULL);
\
	switch (sockaddr->type.sa.sa_family) {
	case AF_INET:
		s = (const unsigned char *)&sockaddr->type.sin.sin_addr;
		p = ntohs(sockaddr->type.sin.sin_port);
		length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
		break;
	case AF_INET6:
		in6 = &sockaddr->type.sin6.sin6_addr;
		if (IN6_IS_ADDR_V4MAPPED(in6)) {
			s = (const unsigned char *)&in6[12];
			length = sizeof(sockaddr->type.sin.sin_addr.s_addr);
		} else {
			s = (const unsigned char *)in6;
			length = sizeof(sockaddr->type.sin6.sin6_addr);
		}
		p = ntohs(sockaddr->type.sin6.sin6_port);
		break;
	default:
		UNEXPECTED_ERROR(__FILE__, __LINE__,
				 isc_msgcat_get(isc_msgcat,
						ISC_MSGSET_SOCKADDR,
						ISC_MSG_UNKNOWNFAMILY,
						"unknown address family: %d"),
					     (int)sockaddr->type.sa.sa_family);
		s = (const unsigned char *)&sockaddr->type;
		length = sockaddr->length;
		p = 0;
	}
\
	h = isc_hash_calc(s, length, ISC_TRUE);
	if (!address_only) {
		g = isc_hash_calc((const unsigned char *)&p, sizeof(p),
				  ISC_TRUE);
		h = h ^ g; /* XXX: we should concatenate h and p first */
	}
\
	return (h);
}
#endif
\
void
isc_sockaddr_any(isc_sockaddr_t *sockaddr)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin.sin_family = AF_INET;
#ifdef ISC_PLATFORM_HAVESALEN
	sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
#endif
	sockaddr->type.sin.sin_addr.s_addr = INADDR_ANY;
	sockaddr->type.sin.sin_port = 0;
	sockaddr->length = sizeof(sockaddr->type.sin);
	ISC_LINK_INIT(sockaddr, link);
}
\
void
isc_sockaddr_any6(isc_sockaddr_t *sockaddr)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin6.sin6_family = AF_INET6;
#ifdef ISC_PLATFORM_HAVESALEN
	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
#endif
	sockaddr->type.sin6.sin6_addr = in6addr_any;
	sockaddr->type.sin6.sin6_port = 0;
	sockaddr->length = sizeof(sockaddr->type.sin6);
	ISC_LINK_INIT(sockaddr, link);
}
\
void
isc_sockaddr_fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
		    in_port_t port)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin.sin_family = AF_INET;
#ifdef ISC_PLATFORM_HAVESALEN
	sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
#endif
	sockaddr->type.sin.sin_addr = *ina;
	sockaddr->type.sin.sin_port = htons(port);
	sockaddr->length = sizeof(sockaddr->type.sin);
	ISC_LINK_INIT(sockaddr, link);
}
\
void
isc_sockaddr_anyofpf(isc_sockaddr_t *sockaddr, int pf) {
     switch (pf) {
     case AF_INET:
	     isc_sockaddr_any(sockaddr);
	     break;
     case AF_INET6:
	     isc_sockaddr_any6(sockaddr);
	     break;
     default:
	     INSIST(0);
     }
}
\
void
isc_sockaddr_fromin6(isc_sockaddr_t *sockaddr, const struct in6_addr *ina6,
		     in_port_t port)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin6.sin6_family = AF_INET6;
#ifdef ISC_PLATFORM_HAVESALEN
	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
#endif
	sockaddr->type.sin6.sin6_addr = *ina6;
	sockaddr->type.sin6.sin6_port = htons(port);
	sockaddr->length = sizeof(sockaddr->type.sin6);
	ISC_LINK_INIT(sockaddr, link);
}
\
void
isc_sockaddr_v6fromin(isc_sockaddr_t *sockaddr, const struct in_addr *ina,
		      in_port_t port)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin6.sin6_family = AF_INET6;
#ifdef ISC_PLATFORM_HAVESALEN
	sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
#endif
	sockaddr->type.sin6.sin6_addr.s6_addr[10] = 0xff;
	sockaddr->type.sin6.sin6_addr.s6_addr[11] = 0xff;
	memcpy(&sockaddr->type.sin6.sin6_addr.s6_addr[12], ina, 4);
	sockaddr->type.sin6.sin6_port = htons(port);
	sockaddr->length = sizeof(sockaddr->type.sin6);
	ISC_LINK_INIT(sockaddr, link);
}
\
int
isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) {
\
	/*
	 * Get the protocol family of 'sockaddr'.
	 */
\
#if (AF_INET == PF_INET && AF_INET6 == PF_INET6)
	/*
	 * Assume that PF_xxx == AF_xxx for all AF and PF.
	 */
	return (sockaddr->type.sa.sa_family);
#else
	switch (sockaddr->type.sa.sa_family) {
	case AF_INET:
		return (PF_INET);
	case AF_INET6:
		return (PF_INET6);
	default:
		FATAL_ERROR(__FILE__, __LINE__,
			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
					   ISC_MSG_UNKNOWNFAMILY,
					   "unknown address family: %d"),
			    (int)sockaddr->type.sa.sa_family);
	}
#endif
}
\
void
isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na,
		    in_port_t port)
{
	memset(sockaddr, 0, sizeof(*sockaddr));
	sockaddr->type.sin.sin_family = na->family;
	switch (na->family) {
	case AF_INET:
		sockaddr->length = sizeof(sockaddr->type.sin);
#ifdef ISC_PLATFORM_HAVESALEN
		sockaddr->type.sin.sin_len = sizeof(sockaddr->type.sin);
#endif
		sockaddr->type.sin.sin_addr = na->type.in;
		sockaddr->type.sin.sin_port = htons(port);
		break;
	case AF_INET6:
		sockaddr->length = sizeof(sockaddr->type.sin6);
#ifdef ISC_PLATFORM_HAVESALEN
		sockaddr->type.sin6.sin6_len = sizeof(sockaddr->type.sin6);
#endif
		memcpy(&sockaddr->type.sin6.sin6_addr, &na->type.in6, 16);
#ifdef ISC_PLATFORM_HAVESCOPEID
		sockaddr->type.sin6.sin6_scope_id = isc_netaddr_getzone(na);
#endif
		sockaddr->type.sin6.sin6_port = htons(port);
		break;
        default:
                INSIST(0);
	}
	ISC_LINK_INIT(sockaddr, link);
}
\
void
isc_sockaddr_setport(isc_sockaddr_t *sockaddr, in_port_t port) {
	switch (sockaddr->type.sa.sa_family) {
	case AF_INET:
		sockaddr->type.sin.sin_port = htons(port);
		break;
	case AF_INET6:
		sockaddr->type.sin6.sin6_port = htons(port);
		break;
	default:
		FATAL_ERROR(__FILE__, __LINE__,
			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
					   ISC_MSG_UNKNOWNFAMILY,
					   "unknown address family: %d"),
			    (int)sockaddr->type.sa.sa_family);
	}
}
\
in_port_t
isc_sockaddr_getport(isc_sockaddr_t *sockaddr) {
	in_port_t port = 0;
\
	switch (sockaddr->type.sa.sa_family) {
	case AF_INET:
		port = ntohs(sockaddr->type.sin.sin_port);
		break;
	case AF_INET6:
		port = ntohs(sockaddr->type.sin6.sin6_port);
		break;
	default:
		FATAL_ERROR(__FILE__, __LINE__,
			    isc_msgcat_get(isc_msgcat, ISC_MSGSET_SOCKADDR,
					   ISC_MSG_UNKNOWNFAMILY,
					   "unknown address family: %d"),
			    (int)sockaddr->type.sa.sa_family);
	}
\
	return (port);
}
\
isc_boolean_t
isc_sockaddr_ismulticast(isc_sockaddr_t *sockaddr) {
	isc_netaddr_t netaddr;
\
	isc_netaddr_fromsockaddr(&netaddr, sockaddr);
	return (isc_netaddr_ismulticast(&netaddr));
}
\
isc_boolean_t
isc_sockaddr_isexperimental(isc_sockaddr_t *sockaddr) {
	isc_netaddr_t netaddr;
\
	if (sockaddr->type.sa.sa_family == AF_INET) {
		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
		return (isc_netaddr_isexperimental(&netaddr));
	}
	return (ISC_FALSE);
}
\
isc_boolean_t
isc_sockaddr_issitelocal(isc_sockaddr_t *sockaddr) {
	isc_netaddr_t netaddr;
\
	if (sockaddr->type.sa.sa_family == AF_INET6) {
		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
		return (isc_netaddr_issitelocal(&netaddr));
	}
	return (ISC_FALSE);
}
\
isc_boolean_t
isc_sockaddr_islinklocal(isc_sockaddr_t *sockaddr) {
	isc_netaddr_t netaddr;
\
	if (sockaddr->type.sa.sa_family == AF_INET6) {
		isc_netaddr_fromsockaddr(&netaddr, sockaddr);
		return (isc_netaddr_islinklocal(&netaddr));
	}
	return (ISC_FALSE);
}

mayer at tecotoo.|libisc/sockaddr.c|20041223050002|39820
D 1.2 04/12/24 18:25:01-05:00 mayer at tecotoo. +2 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c IPv6 changes
K 41554
O -rw-rw-rw-
P libisc/sockaddr.c
------------------------------------------------

I21 2
#define ISC_ONLY_IPV6
\

== include/ntp_machine.h ==
stenn at whimsy.udel.edu|include/ntp_machine.h|19990526004814|01635|3aed0663
mayer at tecotoo.myibg.com|include/ntp_machine.h|20030201235739|54449
D 1.18 04/12/23 22:40:38-05:00 mayer at tecotoo. +0 -2
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Moved function defines for Win32 from ntp_machine.h to winnt/config.h
K 48967
O -rw-rw-r--
P include/ntp_machine.h
------------------------------------------------

D275 2

== libntp/Makefile.am ==
stenn at whimsy.udel.edu|libntp/Makefile.am|19990526004815|01635|3aed0663
mayer at pogo.udel.edu|libntp/Makefile.am|20040802222720|10579
D 1.31 04/12/23 22:38:13-05:00 mayer at tecotoo. +2 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Added new files to build
K 15783
O -rw-rw-r--
P libntp/Makefile.am
------------------------------------------------

D24 1
I24 2
	$(srcdir)/../libisc/netaddr.c $(srcdir)/../libisc/sockaddr.c \
	$(srcdir)/../libisc/netscope.c

== ntpd/ntp_io.c ==
stenn at whimsy.udel.edu|ntpd/ntp_io.c|19990526004817|01635|3aed0663
stenn at pogo.udel.edu|ntpd/ntp_io.c|20041130034545|57979
D 1.149 04/12/03 22:29:08-05:00 mayer at tecotoo. +5 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Undefine UDP_WILDCARD_DELIVERY for testing
K 63356
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

I9 5
/*
 * Don't allow wildcard delivery
 */
#undef UDP_WILDCARD_DELIVERY
\

mayer at tecotoo.|ntpd/ntp_io.c|20041204032908|63356
D 1.150 04/12/03 22:36:23-05:00 mayer at tecotoo. +5 -5
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Undefine UDP_WILDCARD_DELIVERY for testing
K 63356
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D10 5
I58 5
\
/*
 * Don't allow wildcard delivery
 */
#undef UDP_WILDCARD_DELIVERY

mayer at tecotoo.|ntpd/ntp_io.c|20041204033623|63356
D 1.151 04/12/07 19:39:51-05:00 mayer at tecotoo. +11 -6
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add debugging detail for adding mcast group membership
K 16400
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D835 1
I835 2
			"setsockopt IP_ADD_MEMBERSHIP failure: %m on socket %d, addr %s for %x / %x (%s)",
			iface->fd, stoa(&iface->sin),
D862 2
I863 4
			 "setsockopt IPV6_JOIN_GROUP failure: %m on socket %d, addr %s for interface %d(%s)",
			iface->fd, stoa(&iface->sin),
			mreq6.ipv6mr_interface, stoa(maddr));
			iface->fd, stoa(&iface->sin),
D900 1
I900 2
			"setsockopt IP_DROP_MEMBERSHIP failure: %m on socket %d, addr %s for %x / %x (%s)",
			iface->fd, stoa(&iface->sin),
D927 2
I928 3
			"setsockopt IPV6_LEAVE_GROUP failure: %m on socket %d, addr %s for %d(%s)",
			iface->fd, stoa(&iface->sin),
			mreq6.ipv6mr_interface, stoa(maddr));

mayer at tecotoo.|ntpd/ntp_io.c|20041208003951|16400
D 1.152 04/12/07 19:44:30-05:00 mayer at tecotoo. +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add debugging detail for adding mcast group membership- error fix
K 13931
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D866 1

mayer at tecotoo.|ntpd/ntp_io.c|20041208004430|13931
D 1.153 04/12/07 20:31:36-05:00 mayer at tecotoo. +2 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Renable wildcard for testing
K 13983
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D57 1
I57 1
 *
I58 1
*/

mayer at tecotoo.|ntpd/ntp_io.c|20041208013136|13983
D 1.154 05/01/02 21:13:21-05:00 mayer at tecotoo. +0 -1
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove unnecessary include ntp_if.h
K 12308
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D15 1

mayer at tecotoo.|ntpd/ntp_io.c|20050103021321|12308
D 1.155 05/01/04 21:36:25-05:00 mayer at tecotoo. +7 -17
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Remove unnecessary includes
K 51793
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D33 13
D52 1
D165 2
I168 4
/*
 * Not all platforms support multicast
 */
#ifdef MCAST
D170 1
I170 3
static	isc_boolean_t	socket_multicast_enable	 P((struct interface *, int, struct sockaddr_storage *));
static	isc_boolean_t	socket_multicast_disable P((struct interface *, int, struct sockaddr_storage *));
#endif

mayer at tecotoo.|ntpd/ntp_io.c|20050105023625|51793
D 1.156 05/01/05 00:12:07-05:00 mayer at tecotoo. +4 -4
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Rename index to idx
K 50949
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------

D2479 1
I2479 1
	int idx;
D2488 1
I2488 1
	idx = -1;
D2493 1
I2493 1
			idx = laddr->if_index;
D2499 1
I2499 1
	return (idx); /* Not found */

mayer at tecotoo.|ntpd/ntp_io.c|20050105051207|50949
D 1.157 05/01/05 22:29:50-05:00 mayer at pogo.udel.edu +0 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Auto merged
i stenn at whimsy.udel.edu|ntpd/ntp_io.c|20050105061549|48596
K 41566
M stenn at whimsy.udel.edu|ntpd/ntp_io.c|20050105061549|48596
O -rw-rw-r--
P ntpd/ntp_io.c
------------------------------------------------


== ntpd/ntp_peer.c ==
stenn at whimsy.udel.edu|ntpd/ntp_peer.c|19990526004817|01635|3aed0663
stenn at whimsy.udel.edu|ntpd/ntp_peer.c|20041129060645|21083
D 1.67 04/12/02 20:58:08-05:00 mayer at tecotoo. +5 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Add info on cast_flags in newpeer
K 30676
O -rw-rw-r--
P ntpd/ntp_peer.c
------------------------------------------------

I570 5
#ifdef DEBUG
	if (debug >2)
		printf("newpeer: cast flags: 0x%x for address: %s\n",
			cast_flags, stoa(srcadr));
#endif

== ports/winnt/include/config.h ==
stenn at whimsy.udel.edu|ports/winnt/include/config.h|19990728020335|01289|29080509
mayer at tecotoo.|ports/winnt/include/config.h|20041119041326|34002
D 1.34 04/12/23 22:40:38-05:00 mayer at tecotoo. +8 -2
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Moved function defines for Win32 from ntp_machine.h to winnt/config.h
K 45480
O -rw-rw-r--
P ports/winnt/include/config.h
------------------------------------------------

I74 6
/*
 * Miscellaneous functions that Microsoft maps
 * to other names
 */
#define vsnprintf _vsnprintf
#define snprintf _snprintf
D77 2
I78 2
#define random      rand
#define srandom     srand

== ports/winnt/libntp/libntp.dsp ==
stenn at whimsy.udel.edu|ports/winnt/libntp/libntp.dsp|19990728020416|01289|29080509
mayer at tecotoo.|ports/winnt/libntp/libntp.dsp|20041103040114|21487
D 1.24 04/12/23 22:38:34-05:00 mayer at tecotoo. +20 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Added new files to build
K 51733
O -rw-rw-r--
P ports/winnt/libntp/libntp.dsp
------------------------------------------------

I308 4
SOURCE=..\..\..\libisc\netaddr.c
# End Source File
# Begin Source File
\
I312 4
SOURCE=..\..\..\libisc\netscope.c
# End Source File
# Begin Source File
\
I356 4
SOURCE=..\..\..\libisc\sockaddr.c
# End Source File
# Begin Source File
\
I488 4
SOURCE=..\..\..\include\isc\netaddr.h
# End Source File
# Begin Source File
\
I489 4
# End Source File
# Begin Source File
\
SOURCE=..\..\..\include\isc\netscope.h

# Patch checksum=114459c3


More information about the bk-ntp-dev-send mailing list