diff options
author | Xin LI <delphij@FreeBSD.org> | 2016-09-28 03:45:43 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2016-09-28 03:45:43 +0000 |
commit | c2a8859aa5c96190c179c911d3841c4de17b9c34 (patch) | |
tree | d692d2581f8989d075abe40c9f3f55f2fa650949 /lib | |
parent | 5ef882476736cbe802bb4e6437c520162c4f44ce (diff) |
Notes
Diffstat (limited to 'lib')
228 files changed, 6380 insertions, 4134 deletions
diff --git a/lib/bind9/Makefile.in b/lib/bind9/Makefile.in index e9e65daa9661..32481c40c7ce 100644 --- a/lib/bind9/Makefile.in +++ b/lib/bind9/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2009, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBBIND9_API@ diff --git a/lib/bind9/api b/lib/bind9/api index bd19d6da532f..b4f3c8dc4f55 100644 --- a/lib/bind9/api +++ b/lib/bind9/api @@ -5,5 +5,5 @@ # 9.9: 90-109 # 9.9-sub: 130-139 LIBINTERFACE = 90 -LIBREVISION = 14 +LIBREVISION = 15 LIBAGE = 0 diff --git a/lib/bind9/check.c b/lib/bind9/check.c index bc7aabe2e0e7..cbfa8301e3f4 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2001-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1292,6 +1292,8 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, dns_name_t *zname = NULL; isc_buffer_t b; isc_boolean_t root = ISC_FALSE; + isc_boolean_t rfc1918 = ISC_FALSE; + isc_boolean_t ula = ISC_FALSE; const cfg_listelt_t *element; isc_boolean_t ddns = ISC_FALSE; @@ -1461,6 +1463,10 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, result = tresult; if (dns_name_equal(zname, dns_rootname)) root = ISC_TRUE; + else if (dns_name_isrfc1918(zname)) + rfc1918 = ISC_TRUE; + else if (dns_name_isula(zname)) + ula = ISC_TRUE; } /* @@ -1731,6 +1737,32 @@ check_zoneconf(const cfg_obj_t *zconfig, const cfg_obj_t *voptions, result = ISC_R_FAILURE; /* + * Check that a RFC 1918 / ULA reverse zone is not forward first + * unless explictly configured to be so. + */ + if (ztype == FORWARDZONE && (rfc1918 || ula)) { + obj = NULL; + (void)cfg_map_get(zoptions, "forward", &obj); + if (obj == NULL) { + /* + * Forward mode not explicity configured. + */ + if (voptions != NULL) + cfg_map_get(voptions, "forward", &obj); + if (obj == NULL && goptions != NULL) + cfg_map_get(goptions, "forward", &obj); + if (obj == NULL || + strcasecmp(cfg_obj_asstring(obj), "first") == 0) + cfg_obj_log(zconfig, logctx, ISC_LOG_WARNING, + "inherited 'forward first;' for " + "%s zone '%s' - did you want " + "'forward only;'?", + rfc1918 ? "rfc1918" : "ula", + znamestr); + } + } + + /* * Check validity of static stub server addresses. */ obj = NULL; diff --git a/lib/bind9/include/bind9/Makefile.in b/lib/bind9/include/bind9/Makefile.in index 11ae586205ef..0ba184b5102d 100644 --- a/lib/bind9/include/bind9/Makefile.in +++ b/lib/bind9/include/bind9/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index eec4c9ef0e77..ee2327a13f3b 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -13,8 +13,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.180 2011/10/11 00:09:03 each Exp $ - srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ @@ -23,7 +21,7 @@ top_srcdir = @top_srcdir@ .NOTPARALLEL: .NO_PARALLEL: -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBDNS_API@ @@ -53,7 +51,7 @@ OPENSSLLINKOBJS = openssl_link.@O@ openssldh_link.@O@ openssldsa_link.@O@ \ DSTOBJS = @DST_EXTRA_OBJS@ @OPENSSLLINKOBJS@ \ dst_api.@O@ dst_lib.@O@ dst_parse.@O@ dst_result.@O@ \ - gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ key.@O@ + gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ key.@O@ RRLOBJS = rrl.@O@ diff --git a/lib/dns/acache.c b/lib/dns/acache.c index d3d28f856171..d7a11f764391 100644 --- a/lib/dns/acache.c +++ b/lib/dns/acache.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2012, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -472,8 +472,7 @@ finddbent(dns_acache_t *acache, dns_db_t *db, dbentry_t **dbentryp) { * The caller must be holding the acache lock. */ - bucket = isc_hash_calc((const unsigned char *)&db, - sizeof(db), ISC_TRUE) % DBBUCKETS; + bucket = isc_hash_function(&db, sizeof(db), ISC_TRUE, NULL) % DBBUCKETS; for (dbentry = ISC_LIST_HEAD(acache->dbbucket[bucket]); dbentry != NULL; @@ -1264,8 +1263,7 @@ dns_acache_setdb(dns_acache_t *acache, dns_db_t *db) { dbentry->db = NULL; dns_db_attach(db, &dbentry->db); - bucket = isc_hash_calc((const unsigned char *)&db, - sizeof(db), ISC_TRUE) % DBBUCKETS; + bucket = isc_hash_function(&db, sizeof(db), ISC_TRUE, NULL) % DBBUCKETS; ISC_LIST_APPEND(acache->dbbucket[bucket], dbentry, link); @@ -1353,8 +1351,8 @@ dns_acache_putdb(dns_acache_t *acache, dns_db_t *db) { INSIST(ISC_LIST_EMPTY(dbentry->originlist) && ISC_LIST_EMPTY(dbentry->referlist)); - bucket = isc_hash_calc((const unsigned char *)&db, - sizeof(db), ISC_TRUE) % DBBUCKETS; + bucket = isc_hash_function(&db, sizeof(db), ISC_TRUE, NULL) % DBBUCKETS; + ISC_LIST_UNLINK(acache->dbbucket[bucket], dbentry, link); dns_db_detach(&dbentry->db); diff --git a/lib/dns/api b/lib/dns/api index df171fa191b4..95055594c127 100644 --- a/lib/dns/api +++ b/lib/dns/api @@ -6,6 +6,6 @@ # 9.9-sub: 130-139, 150-159 # 9.10: 140-149 # 9.11: 160-169 -LIBINTERFACE = 170 -LIBREVISION = 3 -LIBAGE = 1 +LIBINTERFACE = 172 +LIBREVISION = 2 +LIBAGE = 0 diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 098823314980..0b6ddb46f2db 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011, 2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1199,10 +1199,16 @@ static isc_result_t cleartree(dns_db_t *db, dns_name_t *name) { isc_result_t result, answer = ISC_R_SUCCESS; dns_dbiterator_t *iter = NULL; - dns_dbnode_t *node = NULL; + dns_dbnode_t *node = NULL, *top = NULL; dns_fixedname_t fnodename; dns_name_t *nodename; + /* + * Create the node if it doesn't exist so dns_dbiterator_seek() + * can find it. We will continue even if this fails. + */ + (void)dns_db_findnode(db, name, ISC_TRUE, &top); + dns_fixedname_init(&fnodename); nodename = dns_fixedname_name(&fnodename); @@ -1211,6 +1217,8 @@ cleartree(dns_db_t *db, dns_name_t *name) { goto cleanup; result = dns_dbiterator_seek(iter, name); + if (result == DNS_R_PARTIALMATCH) + result = dns_dbiterator_next(iter); if (result != ISC_R_SUCCESS) goto cleanup; @@ -1245,6 +1253,8 @@ cleartree(dns_db_t *db, dns_name_t *name) { dns_db_detachnode(db, &node); if (iter != NULL) dns_dbiterator_destroy(&iter); + if (top != NULL) + dns_db_detachnode(db, &top); return (answer); } @@ -1262,7 +1272,7 @@ dns_cache_flushnode(dns_cache_t *cache, dns_name_t *name, dns_dbnode_t *node = NULL; dns_db_t *db = NULL; - if (dns_name_equal(name, dns_rootname)) + if (tree && dns_name_equal(name, dns_rootname)) return (dns_cache_flush(cache)); LOCK(&cache->lock); diff --git a/lib/dns/client.c b/lib/dns/client.c index b433e348fe31..f21f666d33b1 100644 --- a/lib/dns/client.c +++ b/lib/dns/client.c @@ -1120,7 +1120,6 @@ client_resfind(resctx_t *rctx, dns_fetchevent_t *event) { UNLOCK(&rctx->lock); } - static void suspend(isc_task_t *task, isc_event_t *event) { isc_appctx_t *actx = event->ev_arg; @@ -1434,6 +1433,13 @@ dns_client_destroyrestrans(dns_clientrestrans_t **transp) { mctx = client->mctx; dns_view_detach(&rctx->view); + /* + * Wait for the lock in client_resfind to be released before + * destroying the lock. + */ + LOCK(&rctx->lock); + UNLOCK(&rctx->lock); + LOCK(&client->lock); INSIST(ISC_LINK_LINKED(rctx, link)); diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 680a0184319e..5834a58223f0 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004-2013, 2015 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004-2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -302,12 +302,15 @@ dst_context_create2(dst_key_t *key, isc_mem_t *mctx, dctx = isc_mem_get(mctx, sizeof(dst_context_t)); if (dctx == NULL) return (ISC_R_NOMEMORY); - dctx->key = key; - dctx->mctx = mctx; + memset(dctx, 0, sizeof(*dctx)); + dst_key_attach(key, &dctx->key); + isc_mem_attach(mctx, &dctx->mctx); dctx->category = category; result = key->func->createctx(key, dctx); if (result != ISC_R_SUCCESS) { - isc_mem_put(mctx, dctx, sizeof(dst_context_t)); + if (dctx->key != NULL) + dst_key_free(&dctx->key); + isc_mem_putanddetach(&dctx->mctx, dctx, sizeof(dst_context_t)); return (result); } dctx->magic = CTX_MAGIC; @@ -324,8 +327,10 @@ dst_context_destroy(dst_context_t **dctxp) { dctx = *dctxp; INSIST(dctx->key->func->destroyctx != NULL); dctx->key->func->destroyctx(dctx); + if (dctx->key != NULL) + dst_key_free(&dctx->key); dctx->magic = 0; - isc_mem_put(dctx->mctx, dctx, sizeof(dst_context_t)); + isc_mem_putanddetach(&dctx->mctx, dctx, sizeof(dst_context_t)); *dctxp = NULL; } diff --git a/lib/dns/dst_openssl.h b/lib/dns/dst_openssl.h index dd6740586d8a..12f8bfcd6794 100644 --- a/lib/dns/dst_openssl.h +++ b/lib/dns/dst_openssl.h @@ -36,7 +36,7 @@ #define USE_ENGINE 1 #endif -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) /* * These are new in OpenSSL 1.1.0. BN_GENCB _cb needs to be declared in * the function like this before the BN_GENCB_new call: diff --git a/lib/dns/forward.c b/lib/dns/forward.c index 7ec4e5c9debb..c465ddf90db9 100644 --- a/lib/dns/forward.c +++ b/lib/dns/forward.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: forward.c,v 1.14 2009/09/02 23:48:02 tbox Exp $ */ - /*! \file */ #include <config.h> @@ -24,7 +22,6 @@ #include <isc/magic.h> #include <isc/mem.h> #include <isc/rwlock.h> -#include <isc/sockaddr.h> #include <isc/util.h> #include <dns/forward.h> diff --git a/lib/dns/gen.c b/lib/dns/gen.c index 7a7dafb46100..4a8d50ea5415 100644 --- a/lib/dns/gen.c +++ b/lib/dns/gen.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -770,7 +770,7 @@ main(int argc, char **argv) { continue; if (hash == HASH(ttn2->typename)) { fprintf(stdout, "\t\t\tRDATATYPE_COMPARE" - "(\"%s\", %u, " + "(\"%s\", %d, " "_typename, _length, _typep); \\\n", ttn2->typename, ttn2->type); ttn2->sorted = 1; @@ -786,7 +786,7 @@ main(int argc, char **argv) { ttn = find_typename(i); if (ttn == NULL) continue; - fprintf(stdout, "\tcase %u: return (%s); \\\n", + fprintf(stdout, "\tcase %d: return (%s); \\\n", i, upper(ttn->attr)); } fprintf(stdout, "\t}\n"); @@ -805,7 +805,7 @@ main(int argc, char **argv) { */ if (i == 65533U) continue; - fprintf(stdout, "\tcase %u: return " + fprintf(stdout, "\tcase %d: return " "(str_totext(\"%s\", target)); \\\n", i, upper(ttn->typename)); } diff --git a/lib/dns/include/dns/Makefile.in b/lib/dns/include/dns/Makefile.in index 640a63e2c8e7..6be914d9f948 100644 --- a/lib/dns/include/dns/Makefile.in +++ b/lib/dns/include/dns/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007-2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007-2009, 2011, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = acache.h acl.h adb.h bit.h byaddr.h cache.h callbacks.h cert.h \ client.h clientinfo.h compress.h \ diff --git a/lib/dns/include/dns/dbiterator.h b/lib/dns/include/dns/dbiterator.h index 366d6767a79f..c36f18d48922 100644 --- a/lib/dns/include/dns/dbiterator.h +++ b/lib/dns/include/dns/dbiterator.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -166,6 +166,8 @@ dns_dbiterator_seek(dns_dbiterator_t *iterator, dns_name_t *name); * Returns: *\li #ISC_R_SUCCESS *\li #ISC_R_NOTFOUND + *\li #DNS_R_PARTIALMATCH + * (node is at name above requested named when name has children) * *\li Other results are possible, depending on the DB implementation. */ @@ -286,7 +288,7 @@ dns_dbiterator_setcleanmode(dns_dbiterator_t *iterator, isc_boolean_t mode); * Indicate that the given iterator is/is not cleaning the DB. * * Notes: - *\li When 'mode' is ISC_TRUE, + *\li When 'mode' is ISC_TRUE, * * Requires: *\li 'iterator' is a valid iterator. diff --git a/lib/dns/include/dns/forward.h b/lib/dns/include/dns/forward.h index 23e94be7894e..9bda7989a1d0 100644 --- a/lib/dns/include/dns/forward.h +++ b/lib/dns/include/dns/forward.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: forward.h,v 1.13 2009/09/02 23:48:02 tbox Exp $ */ - #ifndef DNS_FORWARD_H #define DNS_FORWARD_H 1 @@ -24,6 +22,7 @@ #include <isc/lang.h> #include <isc/result.h> +#include <isc/sockaddr.h> #include <dns/types.h> diff --git a/lib/dns/include/dns/message.h b/lib/dns/include/dns/message.h index 395d066a4851..191920ff7a22 100644 --- a/lib/dns/include/dns/message.h +++ b/lib/dns/include/dns/message.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010, 2012-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -102,10 +102,11 @@ #define DNS_MESSAGEEXTFLAG_DO 0x8000U /*%< EDNS0 extended OPT codes */ -#define DNS_OPT_NSID 0x0003 /*%< NSID opt code */ -#define DNS_OPT_CLIENT_SUBNET 0x0008 /*%< client subnet opt code */ -#define DNS_OPT_EXPIRE 0x0009 /*%< EXPIRE opt code */ -#define DNS_OPT_COOKIE 0x000a /*%< COOKIE opt code */ +#define DNS_OPT_NSID 3 /*%< NSID opt code */ +#define DNS_OPT_CLIENT_SUBNET 8 /*%< client subnet opt code */ +#define DNS_OPT_EXPIRE 9 /*%< EXPIRE opt code */ +#define DNS_OPT_COOKIE 10 /*%< COOKIE opt code */ +#define DNS_OPT_PAD 12 /*%< PAD opt code */ /*%< The number of EDNS options we know about. */ #define DNS_EDNSOPTIONS 4 diff --git a/lib/dns/include/dns/name.h b/lib/dns/include/dns/name.h index d6e9a90c1eb5..48abbace0fcf 100644 --- a/lib/dns/include/dns/name.h +++ b/lib/dns/include/dns/name.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009-2012, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009-2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1286,6 +1286,18 @@ dns_name_isdnssd(const dns_name_t *owner); * Determine if the 'owner' is a DNS-SD prefix. */ +isc_boolean_t +dns_name_isrfc1918(const dns_name_t *owner); +/*%< + * Determine if the 'name' is in the RFC 1918 reverse namespace. + */ + +isc_boolean_t +dns_name_isula(const dns_name_t *owner); +/*%< + * Determine if the 'name' is in the ULA reverse namespace. + */ + ISC_LANG_ENDDECLS /* diff --git a/lib/dns/include/dns/rbt.h b/lib/dns/include/dns/rbt.h index 947e7c177a47..490cf6f8b745 100644 --- a/lib/dns/include/dns/rbt.h +++ b/lib/dns/include/dns/rbt.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2014-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -80,21 +80,6 @@ struct dns_rbtnode { #if DNS_RBT_USEMAGIC unsigned int magic; #endif - dns_rbtnode_t *parent; - dns_rbtnode_t *left; - dns_rbtnode_t *right; - dns_rbtnode_t *down; -#ifdef DNS_RBT_USEHASH - dns_rbtnode_t *hashnext; -#endif - - /*% - * Used for LRU cache. This linked list is used to mark nodes which - * have no data any longer, but we cannot unlink at that exact moment - * because we did not or could not obtain a write lock on the tree. - */ - ISC_LINK(dns_rbtnode_t) deadlink; - /*@{*/ /*! * The following bitfields add up to a total bitwidth of 32. @@ -104,7 +89,18 @@ struct dns_rbtnode { * * In each case below the "range" indicated is what's _necessary_ for * the bitfield to hold, not what it actually _can_ hold. + * + * Note: Tree lock must be held before modifying these + * bit-fields. + * + * Note: The two "unsigned int :0;" unnamed bitfields on either + * side of the bitfields below are scaffolding that border the + * set of bitfields which are accessed after acquiring the tree + * lock. Please don't insert any other bitfield members between + * the unnamed bitfields unless they should also be accessed + * after acquiring the tree lock. */ + unsigned int :0; /* start of bitfields c/o tree lock */ unsigned int is_root : 1; /*%< range is 0..1 */ unsigned int color : 1; /*%< range is 0..1 */ unsigned int find_callback : 1; /*%< range is 0..1 */ @@ -117,23 +113,53 @@ struct dns_rbtnode { /* node needs to be cleaned from rpz */ unsigned int rpz : 1; + unsigned int :0; /* end of bitfields c/o tree lock */ #ifdef DNS_RBT_USEHASH unsigned int hashval; + dns_rbtnode_t *uppernode; + dns_rbtnode_t *hashnext; #endif + dns_rbtnode_t *parent; + dns_rbtnode_t *left; + dns_rbtnode_t *right; + dns_rbtnode_t *down; + + /*% + * Used for LRU cache. This linked list is used to mark nodes which + * have no data any longer, but we cannot unlink at that exact moment + * because we did not or could not obtain a write lock on the tree. + */ + ISC_LINK(dns_rbtnode_t) deadlink; /*@{*/ /*! * These values are used in the RBT DB implementation. The appropriate * node lock must be held before accessing them. + * + * Note: The two "unsigned int :0;" unnamed bitfields on either + * side of the bitfields below are scaffolding that border the + * set of bitfields which are accessed after acquiring the node + * lock. Please don't insert any other bitfield members between + * the unnamed bitfields unless they should also be accessed + * after acquiring the node lock. + * + * NOTE: Do not merge these fields into bitfields above, as + * they'll all be put in the same qword that could be accessed + * without the node lock as it shares the qword with other + * members. Leave these members here so that they occupy a + * separate region of memory. */ void *data; + unsigned int :0; /* start of bitfields c/o node lock */ unsigned int dirty:1; unsigned int wild:1; unsigned int locknum:DNS_RBT_LOCKLENGTH; #ifndef DNS_RBT_USEISCREFCOUNT unsigned int references:DNS_RBT_REFLENGTH; -#else +#endif + unsigned int :0; /* end of bitfields c/o node lock */ +#ifdef DNS_RBT_USEISCREFCOUNT isc_refcount_t references; /* note that this is not in the bitfield */ #endif /*@}*/ diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index b9d6084f351c..6f4f4f937baa 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2014, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1082,6 +1082,12 @@ dns_view_untrust(dns_view_t *view, dns_name_t *keyname, * Remove keys that match 'keyname' and 'dnskey' from the views trust * anchors. * + * (NOTE: If the configuration specifies that there should be a + * trust anchor at 'keyname', but no keys are left after this + * operation, that is an error. We fail closed, inserting a NULL + * key so as to prevent validation until a legimitate key has been + * provided.) + * * Requires: * \li 'view' is valid. * \li 'keyname' is valid. diff --git a/lib/dns/include/dst/Makefile.in b/lib/dns/include/dst/Makefile.in index cece67dd33a0..293e0edf7f7c 100644 --- a/lib/dns/include/dst/Makefile.in +++ b/lib/dns/include/dst/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = dst.h gssapi.h lib.h result.h diff --git a/lib/dns/journal.c b/lib/dns/journal.c index 4811ebbd80b6..102efd16f8de 100644 --- a/lib/dns/journal.c +++ b/lib/dns/journal.c @@ -677,11 +677,12 @@ journal_open(isc_mem_t *mctx, const char *filename, isc_boolean_t writable, failure: j->magic = 0; - if (j->index != NULL) { - isc_mem_put(j->mctx, j->index, j->header.index_size * + if (j->rawindex != NULL) + isc_mem_put(j->mctx, j->rawindex, j->header.index_size * sizeof(journal_rawpos_t)); - j->index = NULL; - } + if (j->index != NULL) + isc_mem_put(j->mctx, j->index, j->header.index_size * + sizeof(journal_pos_t)); if (j->filename != NULL) isc_mem_free(j->mctx, j->filename); if (j->fp != NULL) diff --git a/lib/dns/master.c b/lib/dns/master.c index 4dba0d7c5558..beb0ae661b69 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -147,6 +147,7 @@ struct dns_loadctx { isc_uint32_t references; dns_incctx_t *inc; isc_uint32_t resign; + isc_stdtime_t now; }; struct dns_incctx { @@ -601,6 +602,7 @@ loadctx_create(dns_masterformat_t format, isc_mem_t *mctx, lctx->zclass = zclass; lctx->resign = resign; lctx->result = ISC_R_SUCCESS; + isc_stdtime_get(&lctx->now); dns_fixedname_init(&lctx->fixed_top); lctx->top = dns_fixedname_name(&lctx->fixed_top); @@ -816,7 +818,7 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs, isc_textregion_t r; int i, n, start, stop, step = 0; dns_incctx_t *ictx; - char dummy; + char dummy[2]; ictx = lctx->inc; callbacks = lctx->callbacks; @@ -833,7 +835,7 @@ generate(dns_loadctx_t *lctx, char *range, char *lhs, char *gtype, char *rhs, } isc_buffer_init(&target, target_mem, target_size); - n = sscanf(range, "%d-%d%[/]%d", &start, &stop, &dummy, &step); + n = sscanf(range, "%d-%d%1[/]%d", &start, &stop, dummy, &step); if ((n != 2 && n != 4) || (start < 0) || (stop < 0) || (n == 4 && step < 1) || (stop < start)) { @@ -1061,7 +1063,6 @@ load_text(dns_loadctx_t *lctx) { const char *source = ""; unsigned long line = 0; isc_boolean_t explicit_ttl; - isc_stdtime_t now; char classname1[DNS_RDATACLASS_FORMATSIZE]; char classname2[DNS_RDATACLASS_FORMATSIZE]; unsigned int options = 0; @@ -1074,7 +1075,6 @@ load_text(dns_loadctx_t *lctx) { ISC_LIST_INIT(glue_list); ISC_LIST_INIT(current_list); - isc_stdtime_get(&now); /* * Allocate target_size of buffer space. This is greater than twice @@ -1115,6 +1115,7 @@ load_text(dns_loadctx_t *lctx) { incctx_destroy(lctx->mctx, ictx); RUNTIME_CHECK(isc_lex_close(lctx->lex) == ISC_R_SUCCESS); line = isc_lex_getsourceline(lctx->lex); + POST(line); source = isc_lex_getsourcename(lctx->lex); ictx = lctx->inc; continue; @@ -1888,7 +1889,7 @@ load_text(dns_loadctx_t *lctx) { result = dns_rdata_tostruct(&rdata[rdcount], &sig, NULL); RUNTIME_CHECK(result == ISC_R_SUCCESS); - if (isc_serial_lt(sig.timeexpire, now)) { + if (isc_serial_lt(sig.timeexpire, lctx->now)) { (*callbacks->warn)(callbacks, "%s:%lu: " "signature has expired", @@ -2090,12 +2091,18 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t *lctx) { return (result); } +/* + * Fill/check exists buffer with 'len' bytes. Track remaining bytes to be + * read when incrementally filling the buffer. + */ static inline isc_result_t read_and_check(isc_boolean_t do_read, isc_buffer_t *buffer, - size_t len, FILE *f) + size_t len, FILE *f, isc_uint32_t *totallen) { isc_result_t result; + REQUIRE(totallen != NULL); + if (do_read) { INSIST(isc_buffer_availablelength(buffer) >= len); result = isc_stdio_read(isc_buffer_used(buffer), 1, len, @@ -2103,6 +2110,9 @@ read_and_check(isc_boolean_t do_read, isc_buffer_t *buffer, if (result != ISC_R_SUCCESS) return (result); isc_buffer_add(buffer, (unsigned int)len); + if (*totallen < len) + return (ISC_R_RANGE); + *totallen -= (isc_uint32_t)len; } else if (isc_buffer_remaininglength(buffer) < len) return (ISC_R_RANGE); @@ -2129,7 +2139,6 @@ load_raw(dns_loadctx_t *lctx) { dns_masterrawheader_t header; dns_decompress_t dctx; - REQUIRE(DNS_LCTX_VALID(lctx)); callbacks = lctx->callbacks; dns_decompress_init(&dctx, -1, DNS_DECOMPRESS_NONE); @@ -2245,6 +2254,7 @@ load_raw(dns_loadctx_t *lctx) { goto cleanup; isc_buffer_add(&target, sizeof(totallen)); totallen = isc_buffer_getuint32(&target); + /* * Validation: the input data must at least contain the common * header. @@ -2286,10 +2296,15 @@ load_raw(dns_loadctx_t *lctx) { if (result != ISC_R_SUCCESS) goto cleanup; isc_buffer_add(&target, (unsigned int)readlen); + totallen -= (isc_uint32_t)readlen; /* Construct RRset headers */ dns_rdatalist_init(&rdatalist); rdatalist.rdclass = isc_buffer_getuint16(&target); + if (lctx->zclass != rdatalist.rdclass) { + result = DNS_R_BADCLASS; + goto cleanup; + } rdatalist.type = isc_buffer_getuint16(&target); rdatalist.covers = isc_buffer_getuint16(&target); rdatalist.ttl = isc_buffer_getuint32(&target); @@ -2302,7 +2317,7 @@ load_raw(dns_loadctx_t *lctx) { /* Owner name: length followed by name */ result = read_and_check(sequential_read, &target, - sizeof(namelen), lctx->f); + sizeof(namelen), lctx->f, &totallen); if (result != ISC_R_SUCCESS) goto cleanup; namelen = isc_buffer_getuint16(&target); @@ -2312,7 +2327,7 @@ load_raw(dns_loadctx_t *lctx) { } result = read_and_check(sequential_read, &target, namelen, - lctx->f); + lctx->f, &totallen); if (result != ISC_R_SUCCESS) goto cleanup; @@ -2370,14 +2385,15 @@ load_raw(dns_loadctx_t *lctx) { /* rdata length */ result = read_and_check(sequential_read, &target, - sizeof(rdlen), lctx->f); + sizeof(rdlen), lctx->f, + &totallen); if (result != ISC_R_SUCCESS) goto cleanup; rdlen = isc_buffer_getuint16(&target); /* rdata */ result = read_and_check(sequential_read, &target, - rdlen, lctx->f); + rdlen, lctx->f, &totallen); if (result != ISC_R_SUCCESS) goto cleanup; isc_buffer_setactive(&target, (unsigned int)rdlen); @@ -2403,7 +2419,7 @@ load_raw(dns_loadctx_t *lctx) { * necessarily critical, but it very likely indicates broken * or malformed data. */ - if (isc_buffer_remaininglength(&target) != 0) { + if (isc_buffer_remaininglength(&target) != 0 || totallen != 0) { result = ISC_R_RANGE; goto cleanup; } @@ -2856,7 +2872,7 @@ grow_rdata(int new_len, dns_rdata_t *old, int old_len, } static isc_uint32_t -resign_fromlist(dns_rdatalist_t *this, isc_uint32_t resign) { +resign_fromlist(dns_rdatalist_t *this, dns_loadctx_t *lctx) { dns_rdata_t *rdata; dns_rdata_rrsig_t sig; isc_uint32_t when; @@ -2864,13 +2880,18 @@ resign_fromlist(dns_rdatalist_t *this, isc_uint32_t resign) { rdata = ISC_LIST_HEAD(this->rdata); INSIST(rdata != NULL); (void)dns_rdata_tostruct(rdata, &sig, NULL); - when = sig.timeexpire - resign; + if (isc_serial_gt(sig.timesigned, lctx->now)) + when = lctx->now; + else + when = sig.timeexpire - lctx->resign; rdata = ISC_LIST_NEXT(rdata, link); while (rdata != NULL) { (void)dns_rdata_tostruct(rdata, &sig, NULL); - if (sig.timeexpire - resign < when) - when = sig.timeexpire - resign; + if (isc_serial_gt(sig.timesigned, lctx->now)) + when = lctx->now; + else if (sig.timeexpire - lctx->resign < when) + when = sig.timeexpire - lctx->resign; rdata = ISC_LIST_NEXT(rdata, link); } return (when); @@ -2908,8 +2929,7 @@ commit(dns_rdatacallbacks_t *callbacks, dns_loadctx_t *lctx, if (dataset.type == dns_rdatatype_rrsig && (lctx->options & DNS_MASTER_RESIGN) != 0) { dataset.attributes |= DNS_RDATASETATTR_RESIGN; - dns_name_format(owner, namebuf, sizeof(namebuf)); - dataset.resign = resign_fromlist(this, lctx->resign); + dataset.resign = resign_fromlist(this, lctx); } result = ((*callbacks->add)(callbacks->add_private, owner, &dataset)); diff --git a/lib/dns/message.c b/lib/dns/message.c index d3ae609a6de1..869d25823eea 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -36,6 +36,7 @@ #include <dns/masterdump.h> #include <dns/message.h> #include <dns/opcode.h> +#include <dns/rcode.h> #include <dns/rdata.h> #include <dns/rdatalist.h> #include <dns/rdataset.h> @@ -145,27 +146,6 @@ static const char *opcodetext[] = { "RESERVED15" }; -static const char *rcodetext[] = { - "NOERROR", - "FORMERR", - "SERVFAIL", - "NXDOMAIN", - "NOTIMP", - "REFUSED", - "YXDOMAIN", - "YXRRSET", - "NXRRSET", - "NOTAUTH", - "NOTZONE", - "RESERVED11", - "RESERVED12", - "RESERVED13", - "RESERVED14", - "RESERVED15", - "BADVERS" -}; - - /*% * "helper" type, which consists of a block of some type, and is linkable. * For it to work, sizeof(dns_msgblock_t) must be a multiple of the pointer @@ -850,9 +830,8 @@ dns_message_find(dns_name_t *name, dns_rdataclass_t rdclass, { dns_rdataset_t *curr; - if (rdataset != NULL) { - REQUIRE(*rdataset == NULL); - } + REQUIRE(name != NULL); + REQUIRE(rdataset == NULL || *rdataset == NULL); for (curr = ISC_LIST_TAIL(name->list); curr != NULL; @@ -875,15 +854,13 @@ dns_message_findtype(dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t *curr; REQUIRE(name != NULL); - if (rdataset != NULL) { - REQUIRE(*rdataset == NULL); - } + REQUIRE(rdataset == NULL || *rdataset == NULL); for (curr = ISC_LIST_TAIL(name->list); curr != NULL; curr = ISC_LIST_PREV(curr, link)) { if (curr->type == type && curr->covers == covers) { - if (rdataset != NULL) + if (ISC_UNLIKELY(rdataset != NULL)) *rdataset = curr; return (ISC_R_SUCCESS); } @@ -1300,6 +1277,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, * it must be the first OPT we've seen. */ if (!dns_name_equal(dns_rootname, name) || + sectionid != DNS_SECTION_ADDITIONAL || msg->opt != NULL) DO_FORMERR; skip_name_search = ISC_TRUE; @@ -1541,9 +1519,12 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, ISC_LIST_APPEND(rdatalist->rdata, rdata, link); /* - * If this is an OPT record, remember it. Also, set - * the extended rcode. Note that msg->opt will only be set - * if best-effort parsing is enabled. + * If this is an OPT, SIG(0) or TSIG record, remember it. + * Also, set the extended rcode for TSIG. + * + * Note msg->opt, msg->sig0 and msg->tsig will only be + * already set if best-effort parsing is enabled otherwise + * there will only be at most one of each. */ if (rdtype == dns_rdatatype_opt && msg->opt == NULL) { dns_rcode_t ercode; @@ -1557,14 +1538,7 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx, msg->rcode |= ercode; isc_mempool_put(msg->namepool, name); free_name = ISC_FALSE; - } - - /* - * If this is an SIG(0) or TSIG record, remember it. Note - * that msg->sig0 or msg->tsig will only be set if best-effort - * parsing is enabled. - */ - if (issigzero && msg->sig0 == NULL) { + } else if (issigzero && msg->sig0 == NULL) { msg->sig0 = rdataset; msg->sig0name = name; rdataset = NULL; @@ -1748,7 +1722,7 @@ dns_message_renderbegin(dns_message_t *msg, dns_compress_t *cctx, if (r.length < DNS_MESSAGE_HEADERLEN) return (ISC_R_NOSPACE); - if (r.length < msg->reserved) + if (r.length - DNS_MESSAGE_HEADERLEN < msg->reserved) return (ISC_R_NOSPACE); /* @@ -1889,8 +1863,29 @@ norender_rdataset(const dns_rdataset_t *rdataset, unsigned int options, return (ISC_TRUE); } - #endif + +static isc_result_t +renderset(dns_rdataset_t *rdataset, dns_name_t *owner_name, + dns_compress_t *cctx, isc_buffer_t *target, + unsigned int reserved, unsigned int options, unsigned int *countp) +{ + isc_result_t result; + + /* + * Shrink the space in the buffer by the reserved amount. + */ + if (target->length - target->used < reserved) + return (ISC_R_NOSPACE); + + target->length -= reserved; + result = dns_rdataset_towire(rdataset, owner_name, + cctx, target, options, countp); + target->length += reserved; + + return (result); +} + isc_result_t dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, unsigned int options) @@ -1933,6 +1928,8 @@ dns_message_rendersection(dns_message_t *msg, dns_section_t sectionid, /* * Shrink the space in the buffer by the reserved amount. */ + if (msg->buffer->length - msg->buffer->used < msg->reserved) + return (ISC_R_NOSPACE); msg->buffer->length -= msg->reserved; total = 0; @@ -2208,9 +2205,8 @@ dns_message_renderend(dns_message_t *msg) { * Render. */ count = 0; - result = dns_rdataset_towire(msg->opt, dns_rootname, - msg->cctx, msg->buffer, 0, - &count); + result = renderset(msg->opt, dns_rootname, msg->cctx, + msg->buffer, msg->reserved, 0, &count); msg->counts[DNS_SECTION_ADDITIONAL] += count; if (result != ISC_R_SUCCESS) return (result); @@ -2226,9 +2222,8 @@ dns_message_renderend(dns_message_t *msg) { if (result != ISC_R_SUCCESS) return (result); count = 0; - result = dns_rdataset_towire(msg->tsig, msg->tsigname, - msg->cctx, msg->buffer, 0, - &count); + result = renderset(msg->tsig, msg->tsigname, msg->cctx, + msg->buffer, msg->reserved, 0, &count); msg->counts[DNS_SECTION_ADDITIONAL] += count; if (result != ISC_R_SUCCESS) return (result); @@ -2249,9 +2244,8 @@ dns_message_renderend(dns_message_t *msg) { * the owner name of a SIG(0) is irrelevant, and will not * be set in a message being rendered. */ - result = dns_rdataset_towire(msg->sig0, dns_rootname, - msg->cctx, msg->buffer, 0, - &count); + result = renderset(msg->sig0, dns_rootname, msg->cctx, + msg->buffer, msg->reserved, 0, &count); msg->counts[DNS_SECTION_ADDITIONAL] += count; if (result != ISC_R_SUCCESS) return (result); @@ -2364,13 +2358,12 @@ dns_message_findname(dns_message_t *msg, dns_section_t section, REQUIRE(msg != NULL); REQUIRE(VALID_SECTION(section)); REQUIRE(target != NULL); - if (name != NULL) - REQUIRE(*name == NULL); + REQUIRE(name == NULL || *name == NULL); + if (type == dns_rdatatype_any) { REQUIRE(rdataset == NULL); } else { - if (rdataset != NULL) - REQUIRE(*rdataset == NULL); + REQUIRE(rdataset == NULL || *rdataset == NULL); } result = findname(&foundname, target, @@ -2387,7 +2380,7 @@ dns_message_findname(dns_message_t *msg, dns_section_t section, /* * And now look for the type. */ - if (type == dns_rdatatype_any) + if (ISC_UNLIKELY(type == dns_rdatatype_any)) return (ISC_R_SUCCESS); result = dns_message_findtype(foundname, type, covers, rdataset); @@ -3277,7 +3270,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg, mbz &= ~DNS_MESSAGEEXTFLAG_DO; /* Known Flags. */ if (mbz != 0) { ADD_STRING(target, "; MBZ: "); - snprintf(buf, sizeof(buf), "%.4x ", mbz); + snprintf(buf, sizeof(buf), "0x%.4x", mbz); ADD_STRING(target, buf); ADD_STRING(target, ", udp: "); } else @@ -3313,11 +3306,17 @@ dns_message_pseudosectiontotext(dns_message_t *msg, snprintf(buf, sizeof(buf), "%u", secs); ADD_STRING(target, buf); ADD_STRING(target, " ("); - dns_ttl_totext(secs, ISC_TRUE, target); + result = dns_ttl_totext(secs, + ISC_TRUE, + target); + if (result != ISC_R_SUCCESS) + return (result); ADD_STRING(target, ")\n"); continue; } ADD_STRING(target, "; EXPIRE"); + } else if (optcode == DNS_OPT_PAD) { + ADD_STRING(target, "; PAD"); } else { ADD_STRING(target, "; OPT="); snprintf(buf, sizeof(buf), "%u", optcode); @@ -3399,7 +3398,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg, isc_result_t dns_message_totext(dns_message_t *msg, const dns_master_style_t *style, - dns_messagetextflag_t flags, isc_buffer_t *target) { + dns_messagetextflag_t flags, isc_buffer_t *target) +{ char buf[sizeof("1234567890")]; isc_result_t result; @@ -3410,12 +3410,9 @@ dns_message_totext(dns_message_t *msg, const dns_master_style_t *style, ADD_STRING(target, ";; ->>HEADER<<- opcode: "); ADD_STRING(target, opcodetext[msg->opcode]); ADD_STRING(target, ", status: "); - if (msg->rcode < (sizeof(rcodetext)/sizeof(rcodetext[0]))) { - ADD_STRING(target, rcodetext[msg->rcode]); - } else { - snprintf(buf, sizeof(buf), "%4u", msg->rcode); - ADD_STRING(target, buf); - } + result = dns_rcode_totext(msg->rcode, target); + if (result != ISC_R_SUCCESS) + return (result); ADD_STRING(target, ", id: "); snprintf(buf, sizeof(buf), "%6u", msg->id); ADD_STRING(target, buf); diff --git a/lib/dns/name.c b/lib/dns/name.c index 6db373c03b0e..a14f12bd7324 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -29,6 +29,7 @@ #include <isc/mem.h> #include <isc/once.h> #include <isc/print.h> +#include <isc/random.h> #include <isc/string.h> #include <isc/thread.h> #include <isc/util.h> @@ -438,42 +439,10 @@ dns_name_internalwildcard(const dns_name_t *name) { return (ISC_FALSE); } -static inline unsigned int -name_hash(dns_name_t *name, isc_boolean_t case_sensitive) { - unsigned int length; - const unsigned char *s; - unsigned int h = 0; - unsigned char c; - - length = name->length; - if (length > 16) - length = 16; - - /* - * This hash function is similar to the one Ousterhout - * uses in Tcl. - */ - s = name->ndata; - if (case_sensitive) { - while (length > 0) { - h += ( h << 3 ) + *s; - s++; - length--; - } - } else { - while (length > 0) { - c = maptolower[*s]; - h += ( h << 3 ) + c; - s++; - length--; - } - } - - return (h); -} - unsigned int dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive) { + unsigned int length; + /* * Provide a hash value for 'name'. */ @@ -482,7 +451,12 @@ dns_name_hash(dns_name_t *name, isc_boolean_t case_sensitive) { if (name->labels == 0) return (0); - return (name_hash(name, case_sensitive)); + length = name->length; + if (length > 16) + length = 16; + + return (isc_hash_function_reverse(name->ndata, length, + case_sensitive, NULL)); } unsigned int @@ -495,19 +469,17 @@ dns_name_fullhash(dns_name_t *name, isc_boolean_t case_sensitive) { if (name->labels == 0) return (0); - return (isc_hash_calc((const unsigned char *)name->ndata, - name->length, case_sensitive)); + return (isc_hash_function_reverse(name->ndata, name->length, + case_sensitive, NULL)); } unsigned int dns_fullname_hash(dns_name_t *name, isc_boolean_t case_sensitive) { /* * This function was deprecated due to the breakage of the name space - * convention. We only keep this internally to provide binary backward + * convention. We only keep this internally to provide binary backward * compatibility. */ - REQUIRE(VALID_NAME(name)); - return (dns_name_fullhash(name, case_sensitive)); } @@ -527,7 +499,8 @@ dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive) { if (name->labels == 0) return (0); else if (name->labels == 1) - return (name_hash(name, case_sensitive)); + return (isc_hash_function_reverse(name->ndata, name->length, + case_sensitive, NULL)); SETUP_OFFSETS(name, offsets, odata); DNS_NAME_INIT(&tname, NULL); @@ -539,7 +512,8 @@ dns_name_hashbylabel(dns_name_t *name, isc_boolean_t case_sensitive) { tname.length = name->length - offsets[i]; else tname.length = offsets[i + 1] - offsets[i]; - h += name_hash(&tname, case_sensitive); + h += isc_hash_function_reverse(tname.ndata, tname.length, + case_sensitive, NULL); } return (h); @@ -577,7 +551,7 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) == (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); - if (name1 == name2) { + if (ISC_UNLIKELY(name1 == name2)) { *orderp = 0; *nlabelsp = name1->labels; return (dns_namereln_equal); @@ -597,12 +571,15 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, ldiff = l1 - l2; } - while (l > 0) { + offsets1 += l1; + offsets2 += l2; + + while (ISC_LIKELY(l > 0)) { l--; - l1--; - l2--; - label1 = &name1->ndata[offsets1[l1]]; - label2 = &name2->ndata[offsets2[l2]]; + offsets1--; + offsets2--; + label1 = &name1->ndata[*offsets1]; + label2 = &name2->ndata[*offsets2]; count1 = *label1++; count2 = *label2++; @@ -618,16 +595,43 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, else count = count2; - while (count > 0) { - chdiff = (int)maptolower[*label1] - - (int)maptolower[*label2]; + /* Loop unrolled for performance */ + while (ISC_LIKELY(count > 3)) { + chdiff = (int)maptolower[label1[0]] - + (int)maptolower[label2[0]]; + if (chdiff != 0) { + *orderp = chdiff; + goto done; + } + chdiff = (int)maptolower[label1[1]] - + (int)maptolower[label2[1]]; + if (chdiff != 0) { + *orderp = chdiff; + goto done; + } + chdiff = (int)maptolower[label1[2]] - + (int)maptolower[label2[2]]; + if (chdiff != 0) { + *orderp = chdiff; + goto done; + } + chdiff = (int)maptolower[label1[3]] - + (int)maptolower[label2[3]]; + if (chdiff != 0) { + *orderp = chdiff; + goto done; + } + count -= 4; + label1 += 4; + label2 += 4; + } + while (ISC_LIKELY(count-- > 0)) { + chdiff = (int)maptolower[*label1++] - + (int)maptolower[*label2++]; if (chdiff != 0) { *orderp = chdiff; goto done; } - count--; - label1++; - label2++; } if (cdiff != 0) { *orderp = cdiff; @@ -643,11 +647,12 @@ dns_name_fullcompare(const dns_name_t *name1, const dns_name_t *name2, namereln = dns_namereln_subdomain; else namereln = dns_namereln_equal; + *nlabelsp = nlabels; + return (namereln); done: *nlabelsp = nlabels; - - if (nlabels > 0 && namereln == dns_namereln_none) + if (nlabels > 0) namereln = dns_namereln_commonancestor; return (namereln); @@ -696,7 +701,7 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { REQUIRE((name1->attributes & DNS_NAMEATTR_ABSOLUTE) == (name2->attributes & DNS_NAMEATTR_ABSOLUTE)); - if (name1 == name2) + if (ISC_UNLIKELY(name1 == name2)) return (ISC_TRUE); if (name1->length != name2->length) @@ -709,16 +714,32 @@ dns_name_equal(const dns_name_t *name1, const dns_name_t *name2) { label1 = name1->ndata; label2 = name2->ndata; - while (l > 0) { - l--; + while (ISC_LIKELY(l-- > 0)) { count = *label1++; if (count != *label2++) return (ISC_FALSE); INSIST(count <= 63); /* no bitstring support */ - while (count > 0) { - count--; + /* Loop unrolled for performance */ + while (ISC_LIKELY(count > 3)) { + c = maptolower[label1[0]]; + if (c != maptolower[label2[0]]) + return (ISC_FALSE); + c = maptolower[label1[1]]; + if (c != maptolower[label2[1]]) + return (ISC_FALSE); + c = maptolower[label1[2]]; + if (c != maptolower[label2[2]]) + return (ISC_FALSE); + c = maptolower[label1[3]]; + if (c != maptolower[label2[3]]) + return (ISC_FALSE); + count -= 4; + label1 += 4; + label2 += 4; + } + while (ISC_LIKELY(count-- > 0)) { c = maptolower[*label1++]; if (c != maptolower[*label2++]) return (ISC_FALSE); @@ -2574,3 +2595,87 @@ dns_name_isdnssd(const dns_name_t *name) { return (ISC_FALSE); } + +#define NS_NAME_INIT(A,B) \ + { \ + DNS_NAME_MAGIC, \ + A, sizeof(A), sizeof(B), \ + DNS_NAMEATTR_READONLY | DNS_NAMEATTR_ABSOLUTE, \ + B, NULL, { (void *)-1, (void *)-1}, \ + {NULL, NULL} \ + } + +static unsigned char inaddr10_offsets[] = { 0, 3, 11, 16 }; +static unsigned char inaddr172_offsets[] = { 0, 3, 7, 15, 20 }; +static unsigned char inaddr192_offsets[] = { 0, 4, 8, 16, 21 }; + +static unsigned char inaddr10[] = "\00210\007IN-ADDR\004ARPA"; + +static unsigned char inaddr16172[] = "\00216\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr17172[] = "\00217\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr18172[] = "\00218\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr19172[] = "\00219\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr20172[] = "\00220\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr21172[] = "\00221\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr22172[] = "\00222\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr23172[] = "\00223\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr24172[] = "\00224\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr25172[] = "\00225\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr26172[] = "\00226\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr27172[] = "\00227\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr28172[] = "\00228\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr29172[] = "\00229\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr30172[] = "\00230\003172\007IN-ADDR\004ARPA"; +static unsigned char inaddr31172[] = "\00231\003172\007IN-ADDR\004ARPA"; + +static unsigned char inaddr168192[] = "\003168\003192\007IN-ADDR\004ARPA"; + +static dns_name_t const rfc1918names[] = { + NS_NAME_INIT(inaddr10, inaddr10_offsets), + NS_NAME_INIT(inaddr16172, inaddr172_offsets), + NS_NAME_INIT(inaddr17172, inaddr172_offsets), + NS_NAME_INIT(inaddr18172, inaddr172_offsets), + NS_NAME_INIT(inaddr19172, inaddr172_offsets), + NS_NAME_INIT(inaddr20172, inaddr172_offsets), + NS_NAME_INIT(inaddr21172, inaddr172_offsets), + NS_NAME_INIT(inaddr22172, inaddr172_offsets), + NS_NAME_INIT(inaddr23172, inaddr172_offsets), + NS_NAME_INIT(inaddr24172, inaddr172_offsets), + NS_NAME_INIT(inaddr25172, inaddr172_offsets), + NS_NAME_INIT(inaddr26172, inaddr172_offsets), + NS_NAME_INIT(inaddr27172, inaddr172_offsets), + NS_NAME_INIT(inaddr28172, inaddr172_offsets), + NS_NAME_INIT(inaddr29172, inaddr172_offsets), + NS_NAME_INIT(inaddr30172, inaddr172_offsets), + NS_NAME_INIT(inaddr31172, inaddr172_offsets), + NS_NAME_INIT(inaddr168192, inaddr192_offsets) +}; + +isc_boolean_t +dns_name_isrfc1918(const dns_name_t *name) { + size_t i; + + for (i = 0; i < (sizeof(rfc1918names)/sizeof(*rfc1918names)); i++) + if (dns_name_issubdomain(name, &rfc1918names[i])) + return (ISC_TRUE); + return (ISC_FALSE); +} + +static unsigned char ulaoffsets[] = { 0, 2, 4, 8, 13 }; +static unsigned char ip6fc[] = "\001c\001f\003ip6\004ARPA"; +static unsigned char ip6fd[] = "\001d\001f\003ip6\004ARPA"; + +static dns_name_t const ulanames[] = { + NS_NAME_INIT(ip6fc, ulaoffsets), + NS_NAME_INIT(ip6fd, ulaoffsets), +}; + +isc_boolean_t +dns_name_isula(const dns_name_t *name) { + size_t i; + + for (i = 0; i < (sizeof(ulanames)/sizeof(*ulanames)); i++) + if (dns_name_issubdomain(name, &ulanames[i])) + return (ISC_TRUE); + return (ISC_FALSE); +} diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 74ab9ddf6497..3d47217113d5 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2006, 2008-2016 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -1342,7 +1342,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, CHECK(dns_db_createiterator(db, DNS_DB_NSEC3ONLY, &dbit)); result = dns_dbiterator_seek(dbit, hashname); - if (result == ISC_R_NOTFOUND) + if (result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH) goto success; if (result != ISC_R_SUCCESS) goto failure; @@ -1447,7 +1447,7 @@ dns_nsec3_delnsec3(dns_db_t *db, dns_dbversion_t *version, dns_name_t *name, &empty, origin, hash, iterations, salt, salt_length)); result = dns_dbiterator_seek(dbit, hashname); - if (result == ISC_R_NOTFOUND) + if (result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH) goto success; if (result != ISC_R_SUCCESS) goto failure; diff --git a/lib/dns/openssl_link.c b/lib/dns/openssl_link.c index 8683bee4d60e..1cb46172c862 100644 --- a/lib/dns/openssl_link.c +++ b/lib/dns/openssl_link.c @@ -1,5 +1,5 @@ /* - * Portions Copyright (C) 2004-2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") + * Portions Copyright (C) 2004-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -88,7 +88,7 @@ entropy_getpseudo(unsigned char *buf, int num) { return (result == ISC_R_SUCCESS ? 1 : -1); } -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) static void entropy_add(const void *buf, int num, double entropy) { /* @@ -121,7 +121,7 @@ lock_callback(int mode, int type, const char *file, int line) { UNLOCK(&locks[type]); } -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) static unsigned long id_callback(void) { return ((unsigned long)isc_thread_self()); @@ -187,7 +187,7 @@ dst__openssl_init(const char *engine) { if (result != ISC_R_SUCCESS) goto cleanup_mutexalloc; CRYPTO_set_locking_callback(lock_callback); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) CRYPTO_set_id_callback(id_callback); #endif @@ -206,7 +206,20 @@ dst__openssl_init(const char *engine) { rm->status = entropy_status; #ifdef USE_ENGINE +#if !defined(CONF_MFLAGS_DEFAULT_SECTION) OPENSSL_config(NULL); +#else + /* + * OPENSSL_config() can only be called a single time as of + * 1.0.2e so do the steps individually. + */ + OPENSSL_load_builtin_modules(); + ENGINE_load_builtin_engines(); + ERR_clear_error(); + CONF_modules_load_file(NULL, NULL, + CONF_MFLAGS_DEFAULT_SECTION | + CONF_MFLAGS_IGNORE_MISSING_FILE); +#endif if (engine != NULL && *engine == '\0') engine = NULL; @@ -287,7 +300,7 @@ dst__openssl_destroy(void) { CRYPTO_cleanup_all_ex_data(); #endif ERR_clear_error(); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ERR_remove_state(0); #endif ERR_free_strings(); diff --git a/lib/dns/openssldh_link.c b/lib/dns/openssldh_link.c index 4d77c5bf164f..44114b8066f6 100644 --- a/lib/dns/openssldh_link.c +++ b/lib/dns/openssldh_link.c @@ -173,7 +173,7 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) { DH *dh = NULL; #if OPENSSL_VERSION_NUMBER > 0x00908000L BN_GENCB *cb; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) BN_GENCB _cb; #endif union { @@ -210,7 +210,7 @@ openssldh_generate(dst_key_t *key, int generator, void (*callback)(int)) { if (dh == NULL) return (dst__openssl_toresult(ISC_R_NOMEMORY)); cb = BN_GENCB_new(); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) if (cb == NULL) { DH_free(dh); return (dst__openssl_toresult(ISC_R_NOMEMORY)); @@ -617,7 +617,7 @@ BN_fromhex(BIGNUM *b, const char *str) { RUNTIME_CHECK(strlen(str) < 1024U && strlen(str) % 2 == 0U); for (i = 0; i < strlen(str); i += 2) { - char *s; + const char *s; unsigned int high, low; s = strchr(hexdigits, tolower((unsigned char)str[i])); diff --git a/lib/dns/openssldsa_link.c b/lib/dns/openssldsa_link.c index 34348f07767f..81a09cf2f344 100644 --- a/lib/dns/openssldsa_link.c +++ b/lib/dns/openssldsa_link.c @@ -78,6 +78,8 @@ openssldsa_createctx(dst_key_t *key, dst_context_t *dctx) { UNUSED(key); sha1ctx = isc_mem_get(dctx->mctx, sizeof(isc_sha1_t)); + if (sha1ctx == NULL) + return (ISC_R_NOMEMORY); isc_sha1_init(sha1ctx); dctx->ctxdata.sha1ctx = sha1ctx; return (ISC_R_SUCCESS); @@ -359,7 +361,7 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { isc_result_t result; #if OPENSSL_VERSION_NUMBER > 0x00908000L BN_GENCB *cb; -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) BN_GENCB _cb; #endif union { @@ -383,7 +385,7 @@ openssldsa_generate(dst_key_t *key, int unused, void (*callback)(int)) { if (dsa == NULL) return (dst__openssl_toresult(DST_R_OPENSSLFAILURE)); cb = BN_GENCB_new(); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER) if (cb == NULL) { DSA_free(dsa); return (dst__openssl_toresult(DST_R_OPENSSLFAILURE)); diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index f78732d6dc3f..03ea1bd6eb17 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -774,7 +774,7 @@ opensslrsa_generate(dst_key_t *key, int exp, void (*callback)(int)) { } u; RSA *rsa = RSA_new(); BIGNUM *e = BN_new(); -#if OPENSSL_VERSION_NUMBER < 0x10100000L +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) BN_GENCB _cb; #endif BN_GENCB *cb = BN_GENCB_new(); @@ -1393,8 +1393,7 @@ opensslrsa_fromlabel(dst_key_t *key, const char *engine, const char *label, UNUSED(pin); if (engine == NULL) { - colon = strchr(label, ':'); - if (colon == NULL) + if (strchr(label, ':') == NULL) DST_RET(DST_R_NOENGINE); tmpengine = isc_mem_strdup(key->mctx, label); if (tmpengine == NULL) diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index 74aad1b3553f..cf8cd91ca18c 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007-2009, 2011-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007-2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -58,14 +58,14 @@ #endif struct dns_rbt { - unsigned int magic; - isc_mem_t * mctx; - dns_rbtnode_t * root; - void (*data_deleter)(void *, void *); - void * deleter_arg; - unsigned int nodecount; - unsigned int hashsize; - dns_rbtnode_t ** hashtable; + unsigned int magic; + isc_mem_t * mctx; + dns_rbtnode_t * root; + void (*data_deleter)(void *, void *); + void * deleter_arg; + unsigned int nodecount; + unsigned int hashsize; + dns_rbtnode_t ** hashtable; }; #define RED 0 @@ -78,6 +78,9 @@ struct dns_rbt { #define LEFT(node) ((node)->left) #define RIGHT(node) ((node)->right) #define DOWN(node) ((node)->down) +#ifdef DNS_RBT_USEHASH +#define UPPERNODE(node) ((node)->uppernode) +#endif /* DNS_RBT_USEHASH */ #define DATA(node) ((node)->data) #define HASHNEXT(node) ((node)->hashnext) #define HASHVAL(node) ((node)->hashval) @@ -174,25 +177,45 @@ Name(dns_rbtnode_t *node) { return (name); } +#endif /* DEBUG */ -static void dns_rbt_printnodename(dns_rbtnode_t *node); -#endif +#ifdef DNS_RBT_USEHASH + +/* + * Upper node is the parent of the root of the passed node's + * subtree. The passed node must not be NULL. + */ +static inline dns_rbtnode_t * +get_upper_node(dns_rbtnode_t *node) { + return (UPPERNODE(node)); +} + +#else + +/* The passed node must not be NULL. */ +static inline dns_rbtnode_t * +get_subtree_root(dns_rbtnode_t *node) { + while (!IS_ROOT(node)) { + node = PARENT(node); + } + + return (node); +} +/* Upper node is the parent of the root of the passed node's + * subtree. The passed node must not be NULL. + */ static inline dns_rbtnode_t * -find_up(dns_rbtnode_t *node) { +get_upper_node(dns_rbtnode_t *node) { dns_rbtnode_t *root; - /* - * Return the node in the level above the argument node that points - * to the level the argument node is in. If the argument node is in - * the top level, the return value is NULL. - */ - for (root = node; ! IS_ROOT(root); root = PARENT(root)) - ; /* Nothing. */ + root = get_subtree_root(node); return (PARENT(root)); } +#endif /* DNS_RBT_USEHASH */ + /* * Forward declarations. */ @@ -219,14 +242,14 @@ dns_rbt_addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order, dns_rbtnode_t **rootp); static void -dns_rbt_deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp); +deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp); -static isc_result_t -dns_rbt_deletetree(dns_rbt_t *rbt, dns_rbtnode_t *node); +static void +deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, isc_boolean_t unhash, + dns_rbtnode_t **nodep); static void -dns_rbt_deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, - dns_rbtnode_t **nodep); +freenode(dns_rbt_t *rbt, dns_rbtnode_t **nodep); /* * Initialize a red/black tree of trees. @@ -289,7 +312,7 @@ dns_rbt_destroy2(dns_rbt_t **rbtp, unsigned int quantum) { rbt = *rbtp; - dns_rbt_deletetreeflat(rbt, quantum, &rbt->root); + deletetreeflat(rbt, quantum, ISC_FALSE, &rbt->root); if (rbt->root != NULL) return (ISC_R_QUOTA); @@ -377,7 +400,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { dns_offsets_t current_offsets; dns_namereln_t compared; isc_result_t result = ISC_R_SUCCESS; - dns_rbtnodechain_t chain; + unsigned int level_count; unsigned int common_labels; unsigned int nlabels, hlabels; int order; @@ -387,6 +410,37 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { REQUIRE(nodep != NULL && *nodep == NULL); /* + * Dear future BIND developer, + * + * After you have tried attempting to optimize this routine by + * using the hashtable and have realized your folly, please + * append another cross ("X") below as a warning to the next + * future BIND developer: + * + * Number of victim developers: X + * + * I wish the past developer had included such a notice. + * + * Long form: Unlike dns_rbt_findnode(), this function does not + * lend itself to be optimized using the hashtable: + * + * 1. In the subtree where the insertion occurs, this function + * needs to have the insertion point and the order where the + * lookup terminated (i.e., at the insertion point where left or + * right child is NULL). This cannot be determined from the + * hashtable, so at least in that subtree, a BST O(log N) lookup + * is necessary. + * + * 2. Our RBT nodes contain not only single labels but label + * sequences to optimize space usage. So at every level, we have + * to look for a match in the hashtable for all superdomains in + * the rest of the name we're searching. This is an O(N) + * operation at least, here N being the label size of name, each + * of which is a hashtable lookup involving dns_name_equal() + * comparisons. + */ + + /* * Create a copy of the name so the original name structure is * not modified. */ @@ -394,11 +448,14 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { add_name = dns_fixedname_name(&fixedcopy); dns_name_clone(name, add_name); - if (rbt->root == NULL) { + if (ISC_UNLIKELY(rbt->root == NULL)) { result = create_node(rbt->mctx, add_name, &new_current); if (result == ISC_R_SUCCESS) { rbt->nodecount++; new_current->is_root = 1; +#ifdef DNS_RBT_USEHASH + UPPERNODE(new_current) = NULL; +#endif /* DNS_RBT_USEHASH */ rbt->root = new_current; *nodep = new_current; hash_node(rbt, new_current, name); @@ -406,7 +463,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { return (result); } - dns_rbtnodechain_init(&chain, rbt->mctx); + level_count = 0; dns_fixedname_init(&fixedprefix); dns_fixedname_init(&fixedsuffix); @@ -485,8 +542,9 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { parent = NULL; child = DOWN(current); - ADD_LEVEL(&chain, current); + INSIST(level_count < DNS_RBT_LEVELBLOCK); + level_count++; } else { /* * The number of labels in common is fewer @@ -513,9 +571,7 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { * a simple integer variable, but I am pressed * for time. */ - if (chain.level_count == - (sizeof(chain.levels) / - sizeof(*chain.levels))) { + if (level_count >= DNS_RBT_LEVELBLOCK) { result = ISC_R_NOSPACE; break; } @@ -578,8 +634,13 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { PARENT(current) = new_current; DOWN(new_current) = current; root = &DOWN(new_current); +#ifdef DNS_RBT_USEHASH + UPPERNODE(new_current) = UPPERNODE(current); + UPPERNODE(current) = new_current; +#endif /* DNS_RBT_USEHASH */ - ADD_LEVEL(&chain, new_current); + INSIST(level_count < DNS_RBT_LEVELBLOCK); + level_count++; LEFT(current) = NULL; RIGHT(current) = NULL; @@ -629,12 +690,18 @@ dns_rbt_addnode(dns_rbt_t *rbt, dns_name_t *name, dns_rbtnode_t **nodep) { } - } while (child != NULL); + } while (ISC_LIKELY(child != NULL)); - if (result == ISC_R_SUCCESS) + if (ISC_LIKELY(result == ISC_R_SUCCESS)) result = create_node(rbt->mctx, add_name, &new_current); - if (result == ISC_R_SUCCESS) { + if (ISC_LIKELY(result == ISC_R_SUCCESS)) { +#ifdef DNS_RBT_USEHASH + if (*root == NULL) + UPPERNODE(new_current) = current; + else + UPPERNODE(new_current) = PARENT(*root); +#endif /* DNS_RBT_USEHASH */ dns_rbt_addonlevel(new_current, current, order, root); rbt->nodecount++; *nodep = new_current; @@ -683,7 +750,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, unsigned int options, dns_rbtfindcallback_t callback, void *callback_arg) { - dns_rbtnode_t *current, *last_compared, *current_root; + dns_rbtnode_t *current, *last_compared; dns_rbtnodechain_t localchain; dns_name_t *search_name, current_name, *callback_name; dns_fixedname_t fixedcallbackname, fixedsearchname; @@ -711,7 +778,7 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, } else dns_rbtnodechain_reset(chain); - if (rbt->root == NULL) + if (ISC_UNLIKELY(rbt->root == NULL)) return (ISC_R_NOTFOUND); else { /* @@ -741,9 +808,8 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, saved_result = ISC_R_SUCCESS; current = rbt->root; - current_root = rbt->root; - while (current != NULL) { + while (ISC_LIKELY(current != NULL)) { NODENAME(current, ¤t_name); compared = dns_name_fullcompare(search_name, ¤t_name, &order, &common_labels); @@ -762,28 +828,23 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, unsigned int hash; /* - * If there is no hash table, hashing can't be done. - */ - if (rbt->hashtable == NULL) - goto nohash; - - /* - * The case of current != current_root, that - * means a left or right pointer was followed, - * only happens when the algorithm fell through to - * the traditional binary search because of a - * bitstring label. Since we dropped the bitstring - * support, this should not happen. + * The case of current not being a subtree root, + * that means a left or right pointer was + * followed, only happens when the algorithm + * fell through to the traditional binary search + * because of a bitstring label. Since we + * dropped the bitstring support, this should + * not happen. */ - INSIST(current == current_root); + INSIST(IS_ROOT(current)); nlabels = dns_name_countlabels(search_name); /* - * current_root is the root of the current level, so - * it's parent is the same as it's "up" pointer. + * current is the root of the current level, so + * its parent is the same as its "up" pointer. */ - up_current = PARENT(current_root); + up_current = PARENT(current); dns_name_init(&hash_name, NULL); hashagain: @@ -805,13 +866,20 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, { dns_name_t hnode_name; - if (hash != HASHVAL(hnode)) + if (ISC_LIKELY(hash != HASHVAL(hnode))) continue; - if (find_up(hnode) != up_current) + /* + * This checks that the hashed label + * sequence being looked up is at the + * same tree level, so that we don't + * match a labelsequence from some other + * subdomain. + */ + if (ISC_LIKELY(get_upper_node(hnode) != up_current)) continue; dns_name_init(&hnode_name, NULL); NODENAME(hnode, &hnode_name); - if (dns_name_equal(&hnode_name, &hash_name)) + if (ISC_LIKELY(dns_name_equal(&hnode_name, &hash_name))) break; } @@ -848,8 +916,8 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, current = NULL; continue; - nohash: -#endif /* DNS_RBT_USEHASH */ +#else /* DNS_RBT_USEHASH */ + /* * Standard binary search tree movement. */ @@ -858,6 +926,8 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, else current = RIGHT(current); +#endif /* DNS_RBT_USEHASH */ + } else { /* * The names have some common suffix labels. @@ -930,8 +1000,6 @@ dns_rbt_findnode(dns_rbt_t *rbt, dns_name_t *name, dns_name_t *foundname, * Finally, head to the next tree level. */ current = DOWN(current); - current_root = current; - } else { /* * Though there are labels in common, the @@ -1285,10 +1353,10 @@ dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse) REQUIRE(DNS_RBTNODE_VALID(node)); if (DOWN(node) != NULL) { - if (recurse) - RUNTIME_CHECK(dns_rbt_deletetree(rbt, DOWN(node)) - == ISC_R_SUCCESS); - else { + if (recurse) { + PARENT(DOWN(node)) = NULL; + deletetreeflat(rbt, 0, ISC_TRUE, &DOWN(node)); + } else { if (DATA(node) != NULL && rbt->data_deleter != NULL) rbt->data_deleter(DATA(node), rbt->deleter_arg); DATA(node) = NULL; @@ -1300,25 +1368,24 @@ dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse) * by itself on a single level, so join_nodes() could * be used to collapse the tree (with all the caveats * of the comment at the start of this function). + * But join_nodes() function has now been removed. */ return (ISC_R_SUCCESS); } } /* - * Note the node that points to the level of the node that is being - * deleted. If the deleted node is the top level, parent will be set - * to NULL. + * Note the node that points to the level of the node + * that is being deleted. If the deleted node is the + * top level, parent will be set to NULL. */ - parent = find_up(node); + parent = get_upper_node(node); /* - * This node now has no down pointer (either because it didn't - * have one to start, or because it was recursively removed). - * So now the node needs to be removed from this level. + * This node now has no down pointer, so now it needs + * to be removed from this level. */ - dns_rbt_deletefromlevel(node, parent == NULL ? &rbt->root : - &DOWN(parent)); + deletefromlevel(node, parent == NULL ? &rbt->root : &DOWN(parent)); if (DATA(node) != NULL && rbt->data_deleter != NULL) rbt->data_deleter(DATA(node), rbt->deleter_arg); @@ -1328,31 +1395,8 @@ dns_rbt_deletenode(dns_rbt_t *rbt, dns_rbtnode_t *node, isc_boolean_t recurse) node->magic = 0; #endif dns_rbtnode_refdestroy(node); - isc_mem_put(rbt->mctx, node, NODE_SIZE(node)); - rbt->nodecount--; - /* - * There are now two special cases that can exist that would - * not have existed if the tree had been created using only - * the names that now exist in it. (This is all related to - * join_nodes() as described in this function's introductory comment.) - * Both cases exist when the deleted node's parent (the node - * that pointed to the deleted node's level) is not null but - * it has no data: parent != NULL && DATA(parent) == NULL. - * - * The first case is that the deleted node was the last on its level: - * DOWN(parent) == NULL. This case can only exist if the parent was - * previously deleted -- and so now, apparently, the parent should go - * away. That can't be done though because there might be external - * references to it, such as through a nodechain. - * - * The other case also involves a parent with no data, but with the - * deleted node being the next-to-last node instead of the last: - * LEFT(DOWN(parent)) == NULL && RIGHT(DOWN(parent)) == NULL. - * Presumably now the remaining node on the level should be joined - * with the parent, but it's already been described why that can't be - * done. - */ + freenode(rbt, &node); /* * This function never fails. @@ -1391,7 +1435,7 @@ dns_rbt_fullnamefromnode(dns_rbtnode_t *node, dns_name_t *name) { if (result != ISC_R_SUCCESS) break; - node = find_up(node); + node = get_upper_node(node); } while (! dns_name_isabsolute(name)); return (result); @@ -1511,7 +1555,7 @@ inithash(dns_rbt_t *rbt) { unsigned int bytes; rbt->hashsize = RBT_HASH_SIZE; - bytes = rbt->hashsize * sizeof(dns_rbtnode_t *); + bytes = (unsigned int)rbt->hashsize * sizeof(dns_rbtnode_t *); rbt->hashtable = isc_mem_get(rbt->mctx, bytes); if (rbt->hashtable == NULL) @@ -1527,10 +1571,11 @@ rehash(dns_rbt_t *rbt) { unsigned int oldsize; dns_rbtnode_t **oldtable; dns_rbtnode_t *node; + dns_rbtnode_t *nextnode; unsigned int hash; unsigned int i; - oldsize = rbt->hashsize; + oldsize = (unsigned int)rbt->hashsize; oldtable = rbt->hashtable; rbt->hashsize = rbt->hashsize * 2 + 1; rbt->hashtable = isc_mem_get(rbt->mctx, @@ -1541,19 +1586,15 @@ rehash(dns_rbt_t *rbt) { return; } - INSIST(rbt->hashsize > 0); - for (i = 0; i < rbt->hashsize; i++) rbt->hashtable[i] = NULL; for (i = 0; i < oldsize; i++) { - node = oldtable[i]; - while (node != NULL) { + for (node = oldtable[i]; node != NULL; node = nextnode) { hash = HASHVAL(node) % rbt->hashsize; - oldtable[i] = HASHNEXT(node); + nextnode = HASHNEXT(node); HASHNEXT(node) = rbt->hashtable[hash]; rbt->hashtable[hash] = node; - node = oldtable[i]; } } @@ -1578,19 +1619,17 @@ unhash_node(dns_rbt_t *rbt, dns_rbtnode_t *node) { REQUIRE(DNS_RBTNODE_VALID(node)); - if (rbt->hashtable != NULL) { - bucket = HASHVAL(node) % rbt->hashsize; - bucket_node = rbt->hashtable[bucket]; + bucket = HASHVAL(node) % rbt->hashsize; + bucket_node = rbt->hashtable[bucket]; - if (bucket_node == node) - rbt->hashtable[bucket] = HASHNEXT(node); - else { - while (HASHNEXT(bucket_node) != node) { - INSIST(HASHNEXT(bucket_node) != NULL); - bucket_node = HASHNEXT(bucket_node); - } - HASHNEXT(bucket_node) = HASHNEXT(node); + if (bucket_node == node) { + rbt->hashtable[bucket] = HASHNEXT(node); + } else { + while (HASHNEXT(bucket_node) != node) { + INSIST(HASHNEXT(bucket_node) != NULL); + bucket_node = HASHNEXT(bucket_node); } + HASHNEXT(bucket_node) = HASHNEXT(node); } } #endif /* DNS_RBT_USEHASH */ @@ -1771,7 +1810,7 @@ dns_rbt_addonlevel(dns_rbtnode_t *node, dns_rbtnode_t *current, int order, * true red/black tree on a single level. */ static void -dns_rbt_deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) { +deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) { dns_rbtnode_t *child, *sibling, *parent; dns_rbtnode_t *successor; @@ -2004,117 +2043,66 @@ dns_rbt_deletefromlevel(dns_rbtnode_t *delete, dns_rbtnode_t **rootp) { } } -/* - * This should only be used on the root of a tree, because no color fixup - * is done at all. - * - * NOTE: No root pointer maintenance is done, because the function is only - * used for two cases: - * + deleting everything DOWN from a node that is itself being deleted, and - * + deleting the entire tree of trees from dns_rbt_destroy. - * In each case, the root pointer is no longer relevant, so there - * is no need for a root parameter to this function. - * - * If the function is ever intended to be used to delete something where - * a pointer needs to be told that this tree no longer exists, - * this function would need to adjusted accordingly. - */ -static isc_result_t -dns_rbt_deletetree(dns_rbt_t *rbt, dns_rbtnode_t *node) { - isc_result_t result = ISC_R_SUCCESS; - REQUIRE(VALID_RBT(rbt)); - - if (node == NULL) - return (result); - - if (LEFT(node) != NULL) { - result = dns_rbt_deletetree(rbt, LEFT(node)); - if (result != ISC_R_SUCCESS) - goto done; - LEFT(node) = NULL; - } - if (RIGHT(node) != NULL) { - result = dns_rbt_deletetree(rbt, RIGHT(node)); - if (result != ISC_R_SUCCESS) - goto done; - RIGHT(node) = NULL; - } - if (DOWN(node) != NULL) { - result = dns_rbt_deletetree(rbt, DOWN(node)); - if (result != ISC_R_SUCCESS) - goto done; - DOWN(node) = NULL; - } - done: - if (result != ISC_R_SUCCESS) - return (result); - - if (DATA(node) != NULL && rbt->data_deleter != NULL) - rbt->data_deleter(DATA(node), rbt->deleter_arg); - - unhash_node(rbt, node); -#if DNS_RBT_USEMAGIC - node->magic = 0; -#endif +static void +freenode(dns_rbt_t *rbt, dns_rbtnode_t **nodep) { + dns_rbtnode_t *node = *nodep; isc_mem_put(rbt->mctx, node, NODE_SIZE(node)); + *nodep = NULL; + rbt->nodecount--; - return (result); } static void -dns_rbt_deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, - dns_rbtnode_t **nodep) +deletetreeflat(dns_rbt_t *rbt, unsigned int quantum, isc_boolean_t unhash, + dns_rbtnode_t **nodep) { - dns_rbtnode_t *parent; - dns_rbtnode_t *node = *nodep; - REQUIRE(VALID_RBT(rbt)); - - again: - if (node == NULL) { - *nodep = NULL; - return; - } - - traverse: - if (LEFT(node) != NULL) { - node = LEFT(node); - goto traverse; - } - if (DOWN(node) != NULL) { - node = DOWN(node); - goto traverse; - } + dns_rbtnode_t *root = *nodep; - if (DATA(node) != NULL && rbt->data_deleter != NULL) - rbt->data_deleter(DATA(node), rbt->deleter_arg); + while (root != NULL) { + /* + * If there is a left, right or down node, walk into it + * and iterate. + */ + if (LEFT(root) != NULL) { + dns_rbtnode_t *node = root; + root = LEFT(root); + LEFT(node) = NULL; + } else if (RIGHT(root) != NULL) { + dns_rbtnode_t *node = root; + root = RIGHT(root); + RIGHT(node) = NULL; + } else if (DOWN(root) != NULL) { + dns_rbtnode_t *node = root; + root = DOWN(root); + DOWN(node) = NULL; + } else { + /* + * There are no left, right or down nodes, so we + * can free this one and go back to its parent. + */ + dns_rbtnode_t *node = root; + root = PARENT(root); - /* - * Note: we don't call unhash_node() here as we are destroying - * the complete rbt tree. - */ + if (DATA(node) != NULL && rbt->data_deleter != NULL) + rbt->data_deleter(DATA(node), + rbt->deleter_arg); + if (unhash) + unhash_node(rbt, node); + /* + * Note: we don't call unhash_node() here as we + * are destroying the complete RBT tree. + */ #if DNS_RBT_USEMAGIC - node->magic = 0; + node->magic = 0; #endif - parent = PARENT(node); - if (RIGHT(node) != NULL) - PARENT(RIGHT(node)) = parent; - if (parent != NULL) { - if (LEFT(parent) == node) - LEFT(parent) = RIGHT(node); - else if (DOWN(parent) == node) - DOWN(parent) = RIGHT(node); - } else - parent = RIGHT(node); - - isc_mem_put(rbt->mctx, node, NODE_SIZE(node)); - rbt->nodecount--; - node = parent; - if (quantum != 0 && --quantum == 0) { - *nodep = node; - return; + freenode(rbt, &node); + if (quantum != 0 && --quantum == 0) + break; + } } - goto again; + + *nodep = root; } static void diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index a0fa148cf545..82499d85c0ee 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -401,6 +401,9 @@ typedef ISC_LIST(dns_rbtnode_t) rbtnodelist_t; #define RDATASET_ATTR_STATCOUNT 0x0040 #define RDATASET_ATTR_OPTOUT 0x0080 #define RDATASET_ATTR_NEGATIVE 0x0100 +#define RDATASET_ATTR_PREFETCH 0x0200 +#define RDATASET_ATTR_CASESET 0x0400 +#define RDATASET_ATTR_ZEROTTL 0x0800 typedef struct acache_cbarg { dns_rdatasetadditional_t type; @@ -441,6 +444,16 @@ struct acachectl { (((header)->attributes & RDATASET_ATTR_OPTOUT) != 0) #define NEGATIVE(header) \ (((header)->attributes & RDATASET_ATTR_NEGATIVE) != 0) +#define PREFETCH(header) \ + (((header)->attributes & RDATASET_ATTR_PREFETCH) != 0) +#define CASESET(header) \ + (((header)->attributes & RDATASET_ATTR_CASESET) != 0) +#define ZEROTTL(header) \ + (((header)->attributes & RDATASET_ATTR_ZEROTTL) != 0) + +#define ACTIVE(header, now) \ + (((header)->rdh_ttl > (now)) || \ + ((header)->rdh_ttl == (now) && ZEROTTL(header))) #define DEFAULT_NODE_LOCK_COUNT 7 /*%< Should be prime. */ @@ -1637,6 +1650,19 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) INSIST(!ISC_LINK_LINKED(node, deadlink)); + if (isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(1))) { + char printname[DNS_NAME_FORMATSIZE]; + isc_log_write(dns_lctx, + DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE, + ISC_LOG_DEBUG(1), + "delete_node(): %p %s (bucket %d)", + node, + dns_rbt_formatnodename(node, + printname, sizeof(printname)), + node->locknum); + } + switch (node->nsec) { case DNS_RBT_NSEC_NORMAL: #ifdef BIND9 @@ -1704,6 +1730,24 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) } } +/* + * Caller must be holding the node lock. + */ +static inline void +new_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { + unsigned int lockrefs, noderefs; + isc_refcount_t *lockref; + + INSIST(!ISC_LINK_LINKED(node, deadlink)); + dns_rbtnode_refincrement0(node, &noderefs); + if (noderefs == 1) { /* this is the first reference to the node */ + lockref = &rbtdb->node_locks[node->locknum].references; + isc_refcount_increment0(lockref, &lockrefs); + INSIST(lockrefs != 0); + } + INSIST(noderefs != 0); +} + /*% * Clean up dead nodes. These are nodes which have no references, and * have no data. They are dead but we could not or chose not to delete @@ -1728,32 +1772,36 @@ cleanup_dead_nodes(dns_rbtdb_t *rbtdb, int bucketnum) { INSIST(dns_rbtnode_refcurrent(node) == 0 && node->data == NULL); - delete_node(rbtdb, node); + if (node->parent != NULL && + node->parent->down == node && node->left == NULL && + node->right == NULL && rbtdb->task != NULL) + { + isc_event_t *ev; + dns_db_t *db; + ev = isc_event_allocate(rbtdb->common.mctx, NULL, + DNS_EVENT_RBTPRUNE, + prune_tree, node, + sizeof(isc_event_t)); + if (ev != NULL) { + new_reference(rbtdb, node); + db = NULL; + attach((dns_db_t *)rbtdb, &db); + ev->ev_sender = db; + isc_task_send(rbtdb->task, &ev); + } else { + ISC_LIST_APPEND(rbtdb->deadnodes[bucketnum], + node, deadlink); + } + } else { + delete_node(rbtdb, node); + } node = ISC_LIST_HEAD(rbtdb->deadnodes[bucketnum]); count--; } } /* - * Caller must be holding the node lock. - */ -static inline void -new_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) { - unsigned int lockrefs, noderefs; - isc_refcount_t *lockref; - - INSIST(!ISC_LINK_LINKED(node, deadlink)); - dns_rbtnode_refincrement0(node, &noderefs); - if (noderefs == 1) { /* this is the first reference to the node */ - lockref = &rbtdb->node_locks[node->locknum].references; - isc_refcount_increment0(lockref, &lockrefs); - INSIST(lockrefs != 0); - } - INSIST(noderefs != 0); -} - -/* * This function is assumed to be called when a node is newly referenced * and can be in the deadnode list. In that case the node must be retrieved * from the list because it is going to be used. In addition, if the caller @@ -1969,21 +2017,6 @@ decrement_reference(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node, deadlink); } } else { - if (isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(1))) { - char printname[DNS_NAME_FORMATSIZE]; - - isc_log_write(dns_lctx, - DNS_LOGCATEGORY_DATABASE, - DNS_LOGMODULE_CACHE, - ISC_LOG_DEBUG(1), - "decrement_reference: " - "delete from rbt: %p %s", - node, - dns_rbt_formatnodename(node, - printname, - sizeof(printname))); - } - delete_node(rbtdb, node); } } else { @@ -4305,7 +4338,7 @@ cache_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { header_prev = NULL; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < search->now) { + if (!ACTIVE(header, search->now)) { /* * This rdataset is stale. If no one else is * using the node, we can clean it up right @@ -4313,7 +4346,7 @@ cache_zonecut_callback(dns_rbtnode_t *node, dns_name_t *name, void *arg) { * the node as dirty, so it will get cleaned * up later. */ - if ((header->rdh_ttl < search->now - RBTDB_VIRTUAL) && + if ((header->rdh_ttl < search->now - RBTDB_VIRTUAL) && (locktype == isc_rwlocktype_write || NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { /* @@ -4429,7 +4462,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < search->now) { + if (!ACTIVE(header, search->now)) { /* * This rdataset is stale. If no one else is * using the node, we can clean it up right @@ -4437,7 +4470,7 @@ find_deepest_zonecut(rbtdb_search_t *search, dns_rbtnode_t *node, * the node as dirty, so it will get cleaned * up later. */ - if ((header->rdh_ttl < search->now - + if ((header->rdh_ttl < search->now - RBTDB_VIRTUAL) && (locktype == isc_rwlocktype_write || NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { @@ -4606,7 +4639,7 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < now) { + if (!ACTIVE(header, now)) { /* * This rdataset is stale. If no one else is * using the node, we can clean it up right @@ -4614,7 +4647,7 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, * node as dirty, so it will get cleaned up * later. */ - if ((header->rdh_ttl < now - RBTDB_VIRTUAL) && + if ((header->rdh_ttl < now - RBTDB_VIRTUAL) && (locktype == isc_rwlocktype_write || NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { /* @@ -5013,14 +5046,14 @@ cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, header_prev = NULL; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < now) { + if (!ACTIVE(header, now)) { /* * This rdataset is stale. If no one else is using the * node, we can clean it up right now, otherwise we * mark it as stale, and the node as dirty, so it will * get cleaned up later. */ - if ((header->rdh_ttl < now - RBTDB_VIRTUAL) && + if ((header->rdh_ttl < now - RBTDB_VIRTUAL) && (locktype == isc_rwlocktype_write || NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { /* @@ -5320,7 +5353,7 @@ cache_findzonecut(dns_db_t *db, dns_name_t *name, unsigned int options, header_prev = NULL; for (header = node->data; header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < now) { + if (!ACTIVE(header, now)) { /* * This rdataset is stale. If no one else is using the * node, we can clean it up right now, otherwise we @@ -5809,7 +5842,7 @@ cache_findrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, for (header = rbtnode->data; header != NULL; header = header_next) { header_next = header->next; - if (header->rdh_ttl < now) { + if (!ACTIVE(header, now)) { if ((header->rdh_ttl < now - RBTDB_VIRTUAL) && (locktype == isc_rwlocktype_write || NODE_TRYUPGRADE(lock) == ISC_R_SUCCESS)) { @@ -6134,7 +6167,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, } } if (topheader != NULL && EXISTS(topheader) && - topheader->rdh_ttl >= now) { + ACTIVE(topheader, now)) { /* * Found one. */ @@ -6200,7 +6233,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, * has no effect, provided that the cache data isn't stale. */ if (rbtversion == NULL && trust < header->trust && - (header->rdh_ttl >= now || header_nx)) { + (ACTIVE(header, now) || header_nx)) { free_rdataset(rbtdb, rbtdb->common.mctx, newheader); if (addedrdataset != NULL) bind_rdataset(rbtdb, rbtnode, header, now, @@ -6270,7 +6303,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, * Don't lower trust of existing record if the * update is forced. */ - if (IS_CACHE(rbtdb) && header->rdh_ttl >= now && + if (IS_CACHE(rbtdb) && ACTIVE(header, now) && header->type == dns_rdatatype_ns && !header_nx && !newheader_nx && header->trust >= newheader->trust && @@ -6306,7 +6339,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, * to be no more than the current NS RRset's TTL. This * ensures the delegations that are withdrawn are honoured. */ - if (IS_CACHE(rbtdb) && header->rdh_ttl >= now && + if (IS_CACHE(rbtdb) && ACTIVE(header, now) && header->type == dns_rdatatype_ns && !header_nx && !newheader_nx && header->trust <= newheader->trust) { @@ -6314,7 +6347,7 @@ add32(dns_rbtdb_t *rbtdb, dns_rbtnode_t *rbtnode, rbtdb_version_t *rbtversion, newheader->rdh_ttl = header->rdh_ttl; } } - if (IS_CACHE(rbtdb) && header->rdh_ttl >= now && + if (IS_CACHE(rbtdb) && ACTIVE(header, now) && (header->type == dns_rdatatype_a || header->type == dns_rdatatype_aaaa || header->type == dns_rdatatype_ds || @@ -6646,6 +6679,8 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version, newheader->type = RBTDB_RDATATYPE_VALUE(rdataset->type, rdataset->covers); newheader->attributes = 0; + if (rdataset->ttl == 0U) + newheader->attributes |= RDATASET_ATTR_ZEROTTL; newheader->noqname = NULL; newheader->closest = NULL; newheader->count = init_count++; @@ -7130,13 +7165,14 @@ loading_addrdataset(void *arg, dns_name_t *name, dns_rdataset_t *rdataset) { isc_region_t region; rdatasetheader_t *newheader; + REQUIRE(rdataset->rdclass == rbtdb->common.rdclass); + /* * This routine does no node locking. See comments in * 'load' below for more information on loading and * locking. */ - /* * SOA records are only allowed at top of zone. */ @@ -8615,6 +8651,8 @@ dbiterator_first(dns_dbiterator_t *iterator) { dns_name_t *name, *origin; if (rbtdbiter->result != ISC_R_SUCCESS && + rbtdbiter->result != ISC_R_NOTFOUND && + rbtdbiter->result != DNS_R_PARTIALMATCH && rbtdbiter->result != ISC_R_NOMORE) return (rbtdbiter->result); @@ -8668,6 +8706,8 @@ dbiterator_last(dns_dbiterator_t *iterator) { dns_name_t *name, *origin; if (rbtdbiter->result != ISC_R_SUCCESS && + rbtdbiter->result != ISC_R_NOTFOUND && + rbtdbiter->result != DNS_R_PARTIALMATCH && rbtdbiter->result != ISC_R_NOMORE) return (rbtdbiter->result); @@ -8718,6 +8758,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, dns_name_t *name) { if (rbtdbiter->result != ISC_R_SUCCESS && rbtdbiter->result != ISC_R_NOTFOUND && + rbtdbiter->result != DNS_R_PARTIALMATCH && rbtdbiter->result != ISC_R_NOMORE) return (rbtdbiter->result); @@ -8766,23 +8807,7 @@ dbiterator_seek(dns_dbiterator_t *iterator, dns_name_t *name) { } } -#if 1 - if (result == ISC_R_SUCCESS) { - result = dns_rbtnodechain_current(rbtdbiter->current, iname, - origin, NULL); - if (result == ISC_R_SUCCESS) { - rbtdbiter->new_origin = ISC_TRUE; - reference_iter_node(rbtdbiter); - } - } else if (result == DNS_R_PARTIALMATCH) { - result = ISC_R_NOTFOUND; - rbtdbiter->node = NULL; - } - - rbtdbiter->result = result; -#else if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { - isc_result_t tresult; tresult = dns_rbtnodechain_current(rbtdbiter->current, iname, origin, NULL); if (tresult == ISC_R_SUCCESS) { @@ -8797,7 +8822,6 @@ dbiterator_seek(dns_dbiterator_t *iterator, dns_name_t *name) { rbtdbiter->result = (result == DNS_R_PARTIALMATCH) ? ISC_R_SUCCESS : result; -#endif return (result); } @@ -8960,6 +8984,8 @@ dbiterator_pause(dns_dbiterator_t *iterator) { rbtdb_dbiterator_t *rbtdbiter = (rbtdb_dbiterator_t *)iterator; if (rbtdbiter->result != ISC_R_SUCCESS && + rbtdbiter->result != ISC_R_NOTFOUND && + rbtdbiter->result != DNS_R_PARTIALMATCH && rbtdbiter->result != ISC_R_NOMORE) return (rbtdbiter->result); diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 2fdb751e6dbf..1f97ad03768f 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -49,6 +49,8 @@ #define NUMBERSIZE sizeof("037777777777") /* 2^32-1 octal + NUL */ +#define TOTEXTONLY 0x01 + #define RCODENAMES \ /* standard rcodes */ \ { dns_rcode_noerror, "NOERROR", 0}, \ @@ -61,7 +63,12 @@ { dns_rcode_yxrrset, "YXRRSET", 0}, \ { dns_rcode_nxrrset, "NXRRSET", 0}, \ { dns_rcode_notauth, "NOTAUTH", 0}, \ - { dns_rcode_notzone, "NOTZONE", 0}, + { dns_rcode_notzone, "NOTZONE", 0}, \ + { 11, "RESERVED11", TOTEXTONLY}, \ + { 12, "RESERVED12", TOTEXTONLY}, \ + { 13, "RESERVED13", TOTEXTONLY}, \ + { 14, "RESERVED14", TOTEXTONLY}, \ + { 15, "RESERVED15", TOTEXTONLY}, #define ERCODENAMES \ /* extended rcodes */ \ @@ -247,6 +254,7 @@ dns_mnemonic_fromtext(unsigned int *valuep, isc_textregion_t *source, unsigned int n; n = strlen(table[i].name); if (n == source->length && + (table[i].flags & TOTEXTONLY) == 0 && strncasecmp(source->base, table[i].name, n) == 0) { *valuep = table[i].value; return (ISC_R_SUCCESS); diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index 6c0a3195379b..2788cba9a5af 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -218,6 +218,84 @@ static isc_result_t unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx, isc_buffer_t *target); +static inline isc_result_t +generic_fromtext_key(ARGS_FROMTEXT); + +static inline isc_result_t +generic_totext_key(ARGS_TOTEXT); + +static inline isc_result_t +generic_fromwire_key(ARGS_FROMWIRE); + +static inline isc_result_t +generic_fromstruct_key(ARGS_FROMSTRUCT); + +static inline isc_result_t +generic_tostruct_key(ARGS_TOSTRUCT); + +static inline void +generic_freestruct_key(ARGS_FREESTRUCT); + +static isc_result_t +generic_fromtext_txt(ARGS_FROMTEXT); + +static isc_result_t +generic_totext_txt(ARGS_TOTEXT); + +static isc_result_t +generic_fromwire_txt(ARGS_FROMWIRE); + +static isc_result_t +generic_fromstruct_txt(ARGS_FROMSTRUCT); + +static isc_result_t +generic_tostruct_txt(ARGS_TOSTRUCT); + +static void +generic_freestruct_txt(ARGS_FREESTRUCT); + +static isc_result_t +generic_txt_first(dns_rdata_txt_t *txt); + +static isc_result_t +generic_txt_next(dns_rdata_txt_t *txt); + +static isc_result_t +generic_txt_current(dns_rdata_txt_t *txt, dns_rdata_txt_string_t *string); + +static isc_result_t +generic_totext_ds(ARGS_TOTEXT); + +static isc_result_t +generic_tostruct_ds(ARGS_TOSTRUCT); + +static isc_result_t +generic_fromtext_ds(ARGS_FROMTEXT); + +static isc_result_t +generic_fromwire_ds(ARGS_FROMWIRE); + +static isc_result_t +generic_fromstruct_ds(ARGS_FROMSTRUCT); + +static isc_result_t +generic_fromtext_tlsa(ARGS_FROMTEXT); + +static isc_result_t +generic_totext_tlsa(ARGS_TOTEXT); + +static isc_result_t +generic_fromwire_tlsa(ARGS_FROMWIRE); + +static isc_result_t +generic_fromstruct_tlsa(ARGS_FROMSTRUCT); + +static isc_result_t +generic_tostruct_tlsa(ARGS_TOSTRUCT); + +static void +generic_freestruct_tlsa(ARGS_FREESTRUCT); + /*% INT16 Size */ #define NS_INT16SZ 2 /*% IPv6 Address Size */ @@ -339,6 +417,160 @@ mem_maybedup(isc_mem_t *mctx, void *source, size_t length) { return (copy); } +static inline isc_result_t +typemap_fromtext(isc_lex_t *lexer, isc_buffer_t *target, + isc_boolean_t allow_empty) +{ + isc_token_t token; + unsigned char bm[8*1024]; /* 64k bits */ + dns_rdatatype_t covered, max_used; + int octet; + unsigned int max_octet, newend, end; + int window; + isc_boolean_t first = ISC_TRUE; + + max_used = 0; + bm[0] = 0; + end = 0; + + do { + RETERR(isc_lex_getmastertoken(lexer, &token, + isc_tokentype_string, ISC_TRUE)); + if (token.type != isc_tokentype_string) + break; + RETTOK(dns_rdatatype_fromtext(&covered, + &token.value.as_textregion)); + if (covered > max_used) { + newend = covered / 8; + if (newend > end) { + memset(&bm[end + 1], 0, newend - end); + end = newend; + } + max_used = covered; + } + bm[covered/8] |= (0x80>>(covered%8)); + first = ISC_FALSE; + } while (1); + isc_lex_ungettoken(lexer, &token); + if (!allow_empty && first) + return (DNS_R_FORMERR); + + for (window = 0; window < 256 ; window++) { + if (max_used < window * 256) + break; + + max_octet = max_used - (window * 256); + if (max_octet >= 256) + max_octet = 31; + else + max_octet /= 8; + + /* + * Find if we have a type in this window. + */ + for (octet = max_octet; octet >= 0; octet--) { + if (bm[window * 32 + octet] != 0) + break; + } + if (octet < 0) + continue; + RETERR(uint8_tobuffer(window, target)); + RETERR(uint8_tobuffer(octet + 1, target)); + RETERR(mem_tobuffer(target, &bm[window * 32], octet + 1)); + } + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +typemap_totext(isc_region_t *sr, dns_rdata_textctx_t *tctx, + isc_buffer_t *target) +{ + unsigned int i, j, k; + unsigned int window, len; + isc_boolean_t first = ISC_FALSE; + + for (i = 0; i < sr->length; i += len) { + if (tctx != NULL && + (tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) { + RETERR(str_totext(tctx->linebreak, target)); + first = ISC_TRUE; + } + INSIST(i + 2 <= sr->length); + window = sr->base[i]; + len = sr->base[i + 1]; + INSIST(len > 0 && len <= 32); + i += 2; + INSIST(i + len <= sr->length); + for (j = 0; j < len; j++) { + dns_rdatatype_t t; + if (sr->base[i + j] == 0) + continue; + for (k = 0; k < 8; k++) { + if ((sr->base[i + j] & (0x80 >> k)) == 0) + continue; + t = window * 256 + j * 8 + k; + if (!first) + RETERR(str_totext(" ", target)); + first = ISC_FALSE; + if (dns_rdatatype_isknown(t)) { + RETERR(dns_rdatatype_totext(t, target)); + } else { + char buf[sizeof("TYPE65535")]; + sprintf(buf, "TYPE%u", t); + RETERR(str_totext(buf, target)); + } + } + } + } + return (ISC_R_SUCCESS); +} + +static isc_result_t +typemap_test(isc_region_t *sr, isc_boolean_t allow_empty) { + unsigned int window, lastwindow = 0; + unsigned int len; + isc_boolean_t first = ISC_TRUE; + unsigned int i; + + for (i = 0; i < sr->length; i += len) { + /* + * Check for overflow. + */ + if (i + 2 > sr->length) + RETERR(DNS_R_FORMERR); + window = sr->base[i]; + len = sr->base[i + 1]; + i += 2; + /* + * Check that bitmap windows are in the correct order. + */ + if (!first && window <= lastwindow) + RETERR(DNS_R_FORMERR); + /* + * Check for legal lengths. + */ + if (len < 1 || len > 32) + RETERR(DNS_R_FORMERR); + /* + * Check for overflow. + */ + if (i + len > sr->length) + RETERR(DNS_R_FORMERR); + /* + * The last octet of the bitmap must be non zero. + */ + if (sr->base[i + len - 1] == 0) + RETERR(DNS_R_FORMERR); + lastwindow = window; + first = ISC_FALSE; + } + if (i != sr->length) + return (DNS_R_EXTRADATA); + if (!allow_empty && first) + RETERR(DNS_R_FORMERR); + return (ISC_R_SUCCESS); +} + static const char hexdigits[] = "0123456789abcdef"; static const char decdigits[] = "0123456789"; @@ -1591,6 +1823,9 @@ static isc_result_t mem_tobuffer(isc_buffer_t *target, void *base, unsigned int length) { isc_region_t tr; + if (length == 0U) + return (ISC_R_SUCCESS); + isc_buffer_availableregion(target, &tr); if (length > tr.length) return (ISC_R_NOSPACE); diff --git a/lib/dns/rdata/any_255/tsig_250.c b/lib/dns/rdata/any_255/tsig_250.c index 65ceb84152c9..abdf3203ebf3 100644 --- a/lib/dns/rdata/any_255/tsig_250.c +++ b/lib/dns/rdata/any_255/tsig_250.c @@ -49,7 +49,8 @@ fromtext_any_tsig(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); /* diff --git a/lib/dns/rdata/ch_3/a_1.c b/lib/dns/rdata/ch_3/a_1.c index 34a059b34374..5250bd5a9498 100644 --- a/lib/dns/rdata/ch_3/a_1.c +++ b/lib/dns/rdata/ch_3/a_1.c @@ -44,7 +44,8 @@ fromtext_ch_a(ARGS_FROMTEXT) { /* get domain name */ dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); if ((options & DNS_RDATA_CHECKNAMES) != 0 && (options & DNS_RDATA_CHECKREVERSE) != 0) { diff --git a/lib/dns/rdata/generic/afsdb_18.c b/lib/dns/rdata/generic/afsdb_18.c index 75f644f2c7ab..88564a15026a 100644 --- a/lib/dns/rdata/generic/afsdb_18.c +++ b/lib/dns/rdata/generic/afsdb_18.c @@ -55,7 +55,8 @@ fromtext_afsdb(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/rdata/generic/avc_258.c b/lib/dns/rdata/generic/avc_258.c new file mode 100644 index 000000000000..e74903f48555 --- /dev/null +++ b/lib/dns/rdata/generic/avc_258.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_AVC_258_C +#define RDATA_GENERIC_AVC_258_C + +#define RRTYPE_AVC_ATTRIBUTES (0) + +static inline isc_result_t +fromtext_avc(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_avc); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + return (generic_fromtext_txt(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_avc(ARGS_TOTEXT) { + + UNUSED(tctx); + + REQUIRE(rdata->type == dns_rdatatype_avc); + + return (generic_totext_txt(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_avc(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_avc); + + UNUSED(type); + UNUSED(dctx); + UNUSED(rdclass); + UNUSED(options); + + return (generic_fromwire_txt(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t +towire_avc(ARGS_TOWIRE) { + + REQUIRE(rdata->type == dns_rdatatype_avc); + + UNUSED(cctx); + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static inline int +compare_avc(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_avc); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_avc(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_avc); + + return (generic_fromstruct_txt(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_avc(ARGS_TOSTRUCT) { + dns_rdata_avc_t *avc = target; + + REQUIRE(rdata->type == dns_rdatatype_avc); + REQUIRE(target != NULL); + + avc->common.rdclass = rdata->rdclass; + avc->common.rdtype = rdata->type; + ISC_LINK_INIT(&avc->common, link); + + return (generic_tostruct_txt(rdata, target, mctx)); +} + +static inline void +freestruct_avc(ARGS_FREESTRUCT) { + dns_rdata_avc_t *txt = source; + + REQUIRE(source != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_avc); + + generic_freestruct_txt(source); +} + +static inline isc_result_t +additionaldata_avc(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_avc); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_avc(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_avc); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_avc(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_avc); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_avc(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_avc); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_avc(ARGS_COMPARE) { + return (compare_avc(rdata1, rdata2)); +} +#endif /* RDATA_GENERIC_AVC_258_C */ diff --git a/lib/dns/rdata/generic/avc_258.h b/lib/dns/rdata/generic/avc_258.h new file mode 100644 index 000000000000..d32282e3d068 --- /dev/null +++ b/lib/dns/rdata/generic/avc_258.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_AVC_258_H +#define GENERIC_AVC_258_H 1 + +typedef dns_rdata_txt_string_t dns_rdata_avc_string_t; + +typedef struct dns_rdata_avc { + dns_rdatacommon_t common; + isc_mem_t *mctx; + unsigned char *data; + isc_uint16_t length; + /* private */ + isc_uint16_t offset; +} dns_rdata_avc_t; + +/* + * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done + * via rdatastructpre.h and rdatastructsuf.h. + */ +#endif /* GENERIC_AVC_258_H */ diff --git a/lib/dns/rdata/generic/caa_257.c b/lib/dns/rdata/generic/caa_257.c index 648f4afdc3b6..1a681652afcd 100644 --- a/lib/dns/rdata/generic/caa_257.c +++ b/lib/dns/rdata/generic/caa_257.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -58,7 +58,7 @@ fromtext_caa(ARGS_FROMTEXT) { ISC_FALSE)); if (token.value.as_ulong > 255U) RETTOK(ISC_R_RANGE); - flags = token.value.as_ulong; + flags = (isc_uint8_t)(token.value.as_ulong & 255U); RETERR(uint8_tobuffer(flags, target)); /* diff --git a/lib/dns/rdata/generic/cdnskey_60.c b/lib/dns/rdata/generic/cdnskey_60.c index 945b3644ce67..15f93fd4ef91 100644 --- a/lib/dns/rdata/generic/cdnskey_60.c +++ b/lib/dns/rdata/generic/cdnskey_60.c @@ -31,180 +31,29 @@ static inline isc_result_t fromtext_cdnskey(ARGS_FROMTEXT) { - isc_result_t result; - isc_token_t token; - dns_secalg_t alg; - dns_secproto_t proto; - dns_keyflags_t flags; REQUIRE(type == dns_rdatatype_cdnskey); - UNUSED(type); - UNUSED(rdclass); - UNUSED(origin); - UNUSED(options); - UNUSED(callbacks); - - /* flags */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion)); - RETERR(uint16_tobuffer(flags, target)); - - /* protocol */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion)); - RETERR(mem_tobuffer(target, &proto, 1)); - - /* algorithm */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion)); - RETERR(mem_tobuffer(target, &alg, 1)); - - /* No Key? */ - if ((flags & 0xc000) == 0xc000) - return (ISC_R_SUCCESS); - - result = isc_base64_tobuffer(lexer, target, -1); - if (result != ISC_R_SUCCESS) - return (result); - - /* Ensure there's at least enough data to compute a key ID for MD5 */ - if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 7) - return (ISC_R_UNEXPECTEDEND); - - return (ISC_R_SUCCESS); + return (generic_fromtext_key(rdclass, type, lexer, origin, + options, target, callbacks)); } static inline isc_result_t totext_cdnskey(ARGS_TOTEXT) { - isc_region_t sr; - char buf[sizeof("64000")]; - unsigned int flags; - unsigned char algorithm; - char algbuf[DNS_NAME_FORMATSIZE]; - const char *keyinfo; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_cdnskey); - REQUIRE(rdata->length != 0); - - dns_rdata_toregion(rdata, &sr); - /* flags */ - flags = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - sprintf(buf, "%u", flags); - RETERR(str_totext(buf, target)); - RETERR(str_totext(" ", target)); - if ((flags & DNS_KEYFLAG_KSK) != 0) { - if (flags & DNS_KEYFLAG_REVOKE) - keyinfo = "revoked KSK"; - else - keyinfo = "KSK"; - } else - keyinfo = "ZSK"; - - /* protocol */ - sprintf(buf, "%u", sr.base[0]); - isc_region_consume(&sr, 1); - RETERR(str_totext(buf, target)); - RETERR(str_totext(" ", target)); - - /* algorithm */ - algorithm = sr.base[0]; - sprintf(buf, "%u", algorithm); - isc_region_consume(&sr, 1); - RETERR(str_totext(buf, target)); - - /* No Key? */ - if ((flags & 0xc000) == 0xc000) - return (ISC_R_SUCCESS); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0 && - algorithm == DNS_KEYALG_PRIVATEDNS) { - dns_name_t name; - dns_name_init(&name, NULL); - dns_name_fromregion(&name, &sr); - dns_name_format(&name, algbuf, sizeof(algbuf)); - } else { - dns_secalg_format((dns_secalg_t) algorithm, algbuf, - sizeof(algbuf)); - } - - /* key */ - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" (", target)); - RETERR(str_totext(tctx->linebreak, target)); - if (tctx->width == 0) /* No splitting */ - RETERR(isc_base64_totext(&sr, 0, "", target)); - else - RETERR(isc_base64_totext(&sr, tctx->width - 2, - tctx->linebreak, target)); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) - RETERR(str_totext(tctx->linebreak, target)); - else if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" ", target)); - - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(")", target)); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) { - isc_region_t tmpr; - - RETERR(str_totext(" ; ", target)); - RETERR(str_totext(keyinfo, target)); - RETERR(str_totext("; alg = ", target)); - RETERR(str_totext(algbuf, target)); - RETERR(str_totext("; key id = ", target)); - dns_rdata_toregion(rdata, &tmpr); - sprintf(buf, "%u", dst_region_computeid(&tmpr, algorithm)); - RETERR(str_totext(buf, target)); - } - return (ISC_R_SUCCESS); + return (generic_totext_key(rdata, tctx, target)); } static inline isc_result_t fromwire_cdnskey(ARGS_FROMWIRE) { - unsigned char algorithm; - isc_region_t sr; REQUIRE(type == dns_rdatatype_cdnskey); - UNUSED(type); - UNUSED(rdclass); - UNUSED(dctx); - UNUSED(options); - - isc_buffer_activeregion(source, &sr); - if (sr.length < 4) - return (ISC_R_UNEXPECTEDEND); - - algorithm = sr.base[3]; - RETERR(mem_tobuffer(target, sr.base, 4)); - isc_region_consume(&sr, 4); - isc_buffer_forward(source, 4); - - if (algorithm == DNS_KEYALG_PRIVATEDNS) { - dns_name_t name; - dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); - dns_name_init(&name, NULL); - RETERR(dns_name_fromwire(&name, source, dctx, options, target)); - } - - /* - * RSAMD5 computes key ID differently from other - * algorithms: we need to ensure there's enough data - * present for the computation - */ - if (algorithm == DST_ALG_RSAMD5 && sr.length < 3) - return (ISC_R_UNEXPECTEDEND); - - isc_buffer_activeregion(source, &sr); - isc_buffer_forward(source, sr.length); - return (mem_tobuffer(target, sr.base, sr.length)); + return (generic_fromwire_key(rdclass, type, source, dctx, + options, target)); } static inline isc_result_t @@ -225,6 +74,8 @@ compare_cdnskey(ARGS_COMPARE) { isc_region_t r1; isc_region_t r2; + REQUIRE(rdata1 != NULL); + REQUIRE(rdata2 != NULL); REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->rdclass == rdata2->rdclass); REQUIRE(rdata1->type == dns_rdatatype_cdnskey); @@ -238,85 +89,35 @@ compare_cdnskey(ARGS_COMPARE) { static inline isc_result_t fromstruct_cdnskey(ARGS_FROMSTRUCT) { - dns_rdata_cdnskey_t *dnskey = source; REQUIRE(type == dns_rdatatype_cdnskey); - REQUIRE(source != NULL); - REQUIRE(dnskey->common.rdtype == type); - REQUIRE(dnskey->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - /* Flags */ - RETERR(uint16_tobuffer(dnskey->flags, target)); - /* Protocol */ - RETERR(uint8_tobuffer(dnskey->protocol, target)); - - /* Algorithm */ - RETERR(uint8_tobuffer(dnskey->algorithm, target)); - - /* Data */ - return (mem_tobuffer(target, dnskey->data, dnskey->datalen)); + return (generic_fromstruct_key(rdclass, type, source, target)); } static inline isc_result_t tostruct_cdnskey(ARGS_TOSTRUCT) { dns_rdata_cdnskey_t *dnskey = target; - isc_region_t sr; + REQUIRE(dnskey != NULL); + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_cdnskey); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); dnskey->common.rdclass = rdata->rdclass; dnskey->common.rdtype = rdata->type; ISC_LINK_INIT(&dnskey->common, link); - dns_rdata_toregion(rdata, &sr); - - /* Flags */ - if (sr.length < 2) - return (ISC_R_UNEXPECTEDEND); - dnskey->flags = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* Protocol */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - dnskey->protocol = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Algorithm */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - dnskey->algorithm = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Data */ - dnskey->datalen = sr.length; - dnskey->data = mem_maybedup(mctx, sr.base, dnskey->datalen); - if (dnskey->data == NULL) - return (ISC_R_NOMEMORY); - - dnskey->mctx = mctx; - return (ISC_R_SUCCESS); + return (generic_tostruct_key(rdata, target, mctx)); } static inline void freestruct_cdnskey(ARGS_FREESTRUCT) { dns_rdata_cdnskey_t *dnskey = (dns_rdata_cdnskey_t *) source; - REQUIRE(source != NULL); + REQUIRE(dnskey != NULL); REQUIRE(dnskey->common.rdtype == dns_rdatatype_cdnskey); - if (dnskey->mctx == NULL) - return; - - if (dnskey->data != NULL) - isc_mem_free(dnskey->mctx, dnskey->data); - dnskey->mctx = NULL; + generic_freestruct_key(source); } static inline isc_result_t @@ -334,6 +135,7 @@ static inline isc_result_t digest_cdnskey(ARGS_DIGEST) { isc_region_t r; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_cdnskey); dns_rdata_toregion(rdata, &r); @@ -357,6 +159,7 @@ checkowner_cdnskey(ARGS_CHECKOWNER) { static inline isc_boolean_t checknames_cdnskey(ARGS_CHECKNAMES) { + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_cdnskey); UNUSED(rdata); diff --git a/lib/dns/rdata/generic/cdnskey_60.h b/lib/dns/rdata/generic/cdnskey_60.h index d284177c118d..c52035eaceec 100644 --- a/lib/dns/rdata/generic/cdnskey_60.h +++ b/lib/dns/rdata/generic/cdnskey_60.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -18,15 +18,6 @@ #define GENERIC_CDNSKEY_60_H 1 /* CDNSKEY records have the same RDATA fields as DNSKEY records. */ -typedef struct dns_rdata_cdnskey { - dns_rdatacommon_t common; - isc_mem_t * mctx; - isc_uint16_t flags; - isc_uint8_t protocol; - isc_uint8_t algorithm; - isc_uint16_t datalen; - unsigned char * data; -} dns_rdata_cdnskey_t; - +typedef struct dns_rdata_key dns_rdata_cdnskey_t; #endif /* GENERIC_CDNSKEY_60_H */ diff --git a/lib/dns/rdata/generic/cds_59.c b/lib/dns/rdata/generic/cds_59.c index b58d5f7999d2..966ba0a3f3ff 100644 --- a/lib/dns/rdata/generic/cds_59.c +++ b/lib/dns/rdata/generic/cds_59.c @@ -30,164 +30,28 @@ static inline isc_result_t fromtext_cds(ARGS_FROMTEXT) { - isc_token_t token; - unsigned char c; - int length; REQUIRE(type == dns_rdatatype_cds); - UNUSED(type); - UNUSED(rdclass); - UNUSED(origin); - UNUSED(options); - UNUSED(callbacks); - - /* - * Key tag. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); - if (token.value.as_ulong > 0xffffU) - RETTOK(ISC_R_RANGE); - RETERR(uint16_tobuffer(token.value.as_ulong, target)); - - /* - * Algorithm. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion)); - RETERR(mem_tobuffer(target, &c, 1)); - - /* - * Digest type. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); - if (token.value.as_ulong > 0xffU) - RETTOK(ISC_R_RANGE); - RETERR(uint8_tobuffer(token.value.as_ulong, target)); - c = (unsigned char) token.value.as_ulong; - - /* - * Digest. - */ - switch (c) { - case DNS_DSDIGEST_SHA1: - length = ISC_SHA1_DIGESTLENGTH; - break; - case DNS_DSDIGEST_SHA256: - length = ISC_SHA256_DIGESTLENGTH; - break; - case DNS_DSDIGEST_GOST: - length = ISC_GOST_DIGESTLENGTH; - break; - case DNS_DSDIGEST_SHA384: - length = ISC_SHA384_DIGESTLENGTH; - break; - default: - length = -1; - break; - } - return (isc_hex_tobuffer(lexer, target, length)); + return (generic_fromtext_ds(rdclass, type, lexer, origin, options, + target, callbacks)); } static inline isc_result_t totext_cds(ARGS_TOTEXT) { - isc_region_t sr; - char buf[sizeof("64000 ")]; - unsigned int n; REQUIRE(rdata->type == dns_rdatatype_cds); - REQUIRE(rdata->length != 0); - UNUSED(tctx); - - dns_rdata_toregion(rdata, &sr); - - /* - * Key tag. - */ - n = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - sprintf(buf, "%u ", n); - RETERR(str_totext(buf, target)); - - /* - * Algorithm. - */ - n = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - sprintf(buf, "%u ", n); - RETERR(str_totext(buf, target)); - - /* - * Digest type. - */ - n = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - sprintf(buf, "%u", n); - RETERR(str_totext(buf, target)); - - /* - * Digest. - */ - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" (", target)); - RETERR(str_totext(tctx->linebreak, target)); - if (tctx->width == 0) /* No splitting */ - RETERR(isc_hex_totext(&sr, 0, "", target)); - else - RETERR(isc_hex_totext(&sr, tctx->width - 2, - tctx->linebreak, target)); - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" )", target)); - return (ISC_R_SUCCESS); + return (generic_totext_ds(rdata, tctx, target)); } static inline isc_result_t fromwire_cds(ARGS_FROMWIRE) { - isc_region_t sr; REQUIRE(type == dns_rdatatype_cds); - UNUSED(type); - UNUSED(rdclass); - UNUSED(dctx); - UNUSED(options); - - isc_buffer_activeregion(source, &sr); - - /* - * Check digest lengths if we know them. - */ - if (sr.length < 4 || - (sr.base[3] == DNS_DSDIGEST_SHA1 && - sr.length < 4 + ISC_SHA1_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_SHA256 && - sr.length < 4 + ISC_SHA256_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_GOST && - sr.length < 4 + ISC_GOST_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_SHA384 && - sr.length < 4 + ISC_SHA384_DIGESTLENGTH)) - return (ISC_R_UNEXPECTEDEND); - - /* - * Only copy digest lengths if we know them. - * If there is extra data dns_rdata_fromwire() will - * detect that. - */ - if (sr.base[3] == DNS_DSDIGEST_SHA1) - sr.length = 4 + ISC_SHA1_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_SHA256) - sr.length = 4 + ISC_SHA256_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_GOST) - sr.length = 4 + ISC_GOST_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_SHA384) - sr.length = 4 + ISC_SHA384_DIGESTLENGTH; - - isc_buffer_forward(source, sr.length); - return (mem_tobuffer(target, sr.base, sr.length)); + return (generic_fromwire_ds(rdclass, type, source, dctx, options, + target)); } static inline isc_result_t @@ -221,66 +85,28 @@ compare_cds(ARGS_COMPARE) { static inline isc_result_t fromstruct_cds(ARGS_FROMSTRUCT) { - dns_rdata_cds_t *ds = source; REQUIRE(type == dns_rdatatype_cds); - REQUIRE(source != NULL); - REQUIRE(ds->common.rdtype == type); - REQUIRE(ds->common.rdclass == rdclass); - switch (ds->digest_type) { - case DNS_DSDIGEST_SHA1: - REQUIRE(ds->length == ISC_SHA1_DIGESTLENGTH); - break; - case DNS_DSDIGEST_SHA256: - REQUIRE(ds->length == ISC_SHA256_DIGESTLENGTH); - break; - case DNS_DSDIGEST_GOST: - REQUIRE(ds->length == ISC_GOST_DIGESTLENGTH); - break; - case DNS_DSDIGEST_SHA384: - REQUIRE(ds->length == ISC_SHA384_DIGESTLENGTH); - break; - } - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(ds->key_tag, target)); - RETERR(uint8_tobuffer(ds->algorithm, target)); - RETERR(uint8_tobuffer(ds->digest_type, target)); - return (mem_tobuffer(target, ds->digest, ds->length)); + return (generic_fromstruct_ds(rdclass, type, source, target)); } static inline isc_result_t tostruct_cds(ARGS_TOSTRUCT) { - dns_rdata_cds_t *ds = target; - isc_region_t region; + dns_rdata_cds_t *cds = target; REQUIRE(rdata->type == dns_rdatatype_cds); REQUIRE(target != NULL); REQUIRE(rdata->length != 0); - ds->common.rdclass = rdata->rdclass; - ds->common.rdtype = rdata->type; - ISC_LINK_INIT(&ds->common, link); - - dns_rdata_toregion(rdata, ®ion); - - ds->key_tag = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - ds->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - ds->digest_type = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - ds->length = region.length; - - ds->digest = mem_maybedup(mctx, region.base, region.length); - if (ds->digest == NULL) - return (ISC_R_NOMEMORY); + /* + * Checked by generic_tostruct_ds(). + */ + cds->common.rdclass = rdata->rdclass; + cds->common.rdtype = rdata->type; + ISC_LINK_INIT(&cds->common, link); - ds->mctx = mctx; - return (ISC_R_SUCCESS); + return (generic_tostruct_ds(rdata, target, mctx)); } static inline void diff --git a/lib/dns/rdata/generic/cds_59.h b/lib/dns/rdata/generic/cds_59.h index 099cba39468c..c51cefbf27c0 100644 --- a/lib/dns/rdata/generic/cds_59.h +++ b/lib/dns/rdata/generic/cds_59.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -18,14 +18,6 @@ #define GENERIC_CDS_59_H 1 /* CDS records have the same RDATA fields as DS records. */ -typedef struct dns_rdata_cds { - dns_rdatacommon_t common; - isc_mem_t *mctx; - isc_uint16_t key_tag; - isc_uint8_t algorithm; - isc_uint8_t digest_type; - isc_uint16_t length; - unsigned char *digest; -} dns_rdata_cds_t; +typedef struct dns_rdata_ds dns_rdata_cds_t; #endif /* GENERIC_CDS_59_H */ diff --git a/lib/dns/rdata/generic/cname_5.c b/lib/dns/rdata/generic/cname_5.c index 3f8a69b28dbf..fc7356189014 100644 --- a/lib/dns/rdata/generic/cname_5.c +++ b/lib/dns/rdata/generic/cname_5.c @@ -42,7 +42,8 @@ fromtext_cname(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/csync_62.c b/lib/dns/rdata/generic/csync_62.c new file mode 100644 index 000000000000..cd8019593076 --- /dev/null +++ b/lib/dns/rdata/generic/csync_62.c @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +/* RFC 7477 */ + +#ifndef RDATA_GENERIC_CSYNC_62_C +#define RDATA_GENERIC_CSYNC_62_C + +#define RRTYPE_CSYNC_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_csync(ARGS_FROMTEXT) { + isc_token_t token; + + REQUIRE(type == dns_rdatatype_csync); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* Serial. */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + RETERR(uint32_tobuffer(token.value.as_ulong, target)); + + /* Flags. */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffffU) + RETTOK(ISC_R_RANGE); + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + /* Type Map */ + return (typemap_fromtext(lexer, target, ISC_TRUE)); +} + +static inline isc_result_t +totext_csync(ARGS_TOTEXT) { + unsigned long num; + char buf[sizeof("0123456789")]; /* Also TYPE65535 */ + isc_region_t sr; + + REQUIRE(rdata->type == dns_rdatatype_csync); + REQUIRE(rdata->length >= 6); + + UNUSED(tctx); + + dns_rdata_toregion(rdata, &sr); + + num = uint32_fromregion(&sr); + isc_region_consume(&sr, 4); + sprintf(buf, "%lu", num); + RETERR(str_totext(buf, target)); + + RETERR(str_totext(" ", target)); + + num = uint16_fromregion(&sr); + isc_region_consume(&sr, 2); + sprintf(buf, "%lu", num); + RETERR(str_totext(buf, target)); + + return (typemap_totext(&sr, NULL, target)); +} + +static /* inline */ isc_result_t +fromwire_csync(ARGS_FROMWIRE) { + isc_region_t sr; + + REQUIRE(type == dns_rdatatype_csync); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(options); + UNUSED(dctx); + + /* + * Serial + Flags + */ + isc_buffer_activeregion(source, &sr); + if (sr.length < 6) + return (ISC_R_UNEXPECTEDEND); + + RETERR(mem_tobuffer(target, sr.base, 6)); + isc_buffer_forward(source, 6); + isc_region_consume(&sr, 6); + + RETERR(typemap_test(&sr, ISC_TRUE)); + + RETERR(mem_tobuffer(target, sr.base, sr.length)); + isc_buffer_forward(source, sr.length); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +towire_csync(ARGS_TOWIRE) { + + REQUIRE(rdata->type == dns_rdatatype_csync); + REQUIRE(rdata->length >= 6); + + UNUSED(cctx); + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static inline int +compare_csync(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_csync); + REQUIRE(rdata1->length >= 6); + REQUIRE(rdata2->length >= 6); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_csync(ARGS_FROMSTRUCT) { + dns_rdata_csync_t *csync = source; + isc_region_t region; + + REQUIRE(type == dns_rdatatype_csync); + REQUIRE(source != NULL); + REQUIRE(csync->common.rdtype == type); + REQUIRE(csync->common.rdclass == rdclass); + REQUIRE(csync->typebits != NULL || csync->len == 0); + + UNUSED(type); + UNUSED(rdclass); + + RETERR(uint32_tobuffer(csync->serial, target)); + RETERR(uint16_tobuffer(csync->flags, target)); + + region.base = csync->typebits; + region.length = csync->len; + RETERR(typemap_test(®ion, ISC_TRUE)); + return (mem_tobuffer(target, csync->typebits, csync->len)); +} + +static inline isc_result_t +tostruct_csync(ARGS_TOSTRUCT) { + isc_region_t region; + dns_rdata_csync_t *csync = target; + + REQUIRE(rdata->type == dns_rdatatype_csync); + REQUIRE(target != NULL); + REQUIRE(rdata->length != 0); + + csync->common.rdclass = rdata->rdclass; + csync->common.rdtype = rdata->type; + ISC_LINK_INIT(&csync->common, link); + + dns_rdata_toregion(rdata, ®ion); + + csync->serial = uint32_fromregion(®ion); + isc_region_consume(®ion, 4); + + csync->flags = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + + csync->len = region.length; + csync->typebits = mem_maybedup(mctx, region.base, region.length); + if (csync->typebits == NULL) + goto cleanup; + + csync->mctx = mctx; + return (ISC_R_SUCCESS); + + cleanup: + return (ISC_R_NOMEMORY); +} + +static inline void +freestruct_csync(ARGS_FREESTRUCT) { + dns_rdata_csync_t *csync = source; + + REQUIRE(source != NULL); + REQUIRE(csync->common.rdtype == dns_rdatatype_csync); + + if (csync->mctx == NULL) + return; + + if (csync->typebits != NULL) + isc_mem_free(csync->mctx, csync->typebits); + csync->mctx = NULL; +} + +static inline isc_result_t +additionaldata_csync(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_csync); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_csync(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_csync); + + dns_rdata_toregion(rdata, &r); + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_csync(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_csync); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_csync(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_csync); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_csync(ARGS_COMPARE) { + isc_region_t region1; + isc_region_t region2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_csync); + REQUIRE(rdata1->length >= 6); + REQUIRE(rdata2->length >= 6); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + return (isc_region_compare(®ion1, ®ion2)); +} +#endif /* RDATA_GENERIC_CSYNC_62_C */ diff --git a/lib/dns/rdata/generic/csync_62.h b/lib/dns/rdata/generic/csync_62.h new file mode 100644 index 000000000000..1e4d3de42818 --- /dev/null +++ b/lib/dns/rdata/generic/csync_62.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_CSYNC_62_H +#define GENERIC_CSYNC_62_H 1 + +/*! + * \brief Per RFC 7477 + */ + +typedef struct dns_rdata_csync { + dns_rdatacommon_t common; + isc_mem_t *mctx; + isc_uint32_t serial; + isc_uint16_t flags; + unsigned char *typebits; + isc_uint16_t len; +} dns_rdata_csync_t; + +#endif /* GENERIC_CSYNC_62_H */ diff --git a/lib/dns/rdata/generic/dlv_32769.c b/lib/dns/rdata/generic/dlv_32769.c index 3ff575766e3b..263f3f568cfa 100644 --- a/lib/dns/rdata/generic/dlv_32769.c +++ b/lib/dns/rdata/generic/dlv_32769.c @@ -31,165 +31,28 @@ static inline isc_result_t fromtext_dlv(ARGS_FROMTEXT) { - isc_token_t token; - unsigned char c; - int length; REQUIRE(type == dns_rdatatype_dlv); - UNUSED(type); - UNUSED(rdclass); - UNUSED(origin); - UNUSED(options); - UNUSED(callbacks); - - /* - * Key tag. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); - if (token.value.as_ulong > 0xffffU) - RETTOK(ISC_R_RANGE); - RETERR(uint16_tobuffer(token.value.as_ulong, target)); - - /* - * Algorithm. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); - if (token.value.as_ulong > 0xffU) - RETTOK(ISC_R_RANGE); - RETERR(uint8_tobuffer(token.value.as_ulong, target)); - - /* - * Digest type. - */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, - ISC_FALSE)); - if (token.value.as_ulong > 0xffU) - RETTOK(ISC_R_RANGE); - RETERR(uint8_tobuffer(token.value.as_ulong, target)); - c = (unsigned char) token.value.as_ulong; - - /* - * Digest. - */ - switch (c) { - case DNS_DSDIGEST_SHA1: - length = ISC_SHA1_DIGESTLENGTH; - break; - case DNS_DSDIGEST_SHA256: - length = ISC_SHA256_DIGESTLENGTH; - break; - case DNS_DSDIGEST_GOST: - length = ISC_GOST_DIGESTLENGTH; - break; - case DNS_DSDIGEST_SHA384: - length = ISC_SHA384_DIGESTLENGTH; - break; - default: - length = -1; - break; - } - return (isc_hex_tobuffer(lexer, target, length)); + return (generic_fromtext_ds(rdclass, type, lexer, origin, options, + target, callbacks)); } static inline isc_result_t totext_dlv(ARGS_TOTEXT) { - isc_region_t sr; - char buf[sizeof("64000 ")]; - unsigned int n; REQUIRE(rdata->type == dns_rdatatype_dlv); - REQUIRE(rdata->length != 0); - - UNUSED(tctx); - dns_rdata_toregion(rdata, &sr); - - /* - * Key tag. - */ - n = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - sprintf(buf, "%u ", n); - RETERR(str_totext(buf, target)); - - /* - * Algorithm. - */ - n = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - sprintf(buf, "%u ", n); - RETERR(str_totext(buf, target)); - - /* - * Digest type. - */ - n = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - sprintf(buf, "%u", n); - RETERR(str_totext(buf, target)); - - /* - * Digest. - */ - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" (", target)); - RETERR(str_totext(tctx->linebreak, target)); - if (tctx->width == 0) /* No splitting */ - RETERR(isc_hex_totext(&sr, 0, "", target)); - else - RETERR(isc_hex_totext(&sr, tctx->width - 2, - tctx->linebreak, target)); - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" )", target)); - return (ISC_R_SUCCESS); + return (generic_totext_ds(rdata, tctx, target)); } static inline isc_result_t fromwire_dlv(ARGS_FROMWIRE) { - isc_region_t sr; REQUIRE(type == dns_rdatatype_dlv); - UNUSED(type); - UNUSED(rdclass); - UNUSED(dctx); - UNUSED(options); - - isc_buffer_activeregion(source, &sr); - - /* - * Check digest lengths if we know them. - */ - if (sr.length < 4 || - (sr.base[3] == DNS_DSDIGEST_SHA1 && - sr.length < 4 + ISC_SHA1_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_SHA256 && - sr.length < 4 + ISC_SHA256_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_GOST && - sr.length < 4 + ISC_GOST_DIGESTLENGTH) || - (sr.base[3] == DNS_DSDIGEST_SHA384 && - sr.length < 4 + ISC_SHA384_DIGESTLENGTH)) - return (ISC_R_UNEXPECTEDEND); - - /* - * Only copy digest lengths if we know them. - * If there is extra data dns_rdata_fromwire() will - * detect that. - */ - if (sr.base[3] == DNS_DSDIGEST_SHA1) - sr.length = 4 + ISC_SHA1_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_SHA256) - sr.length = 4 + ISC_SHA256_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_GOST) - sr.length = 4 + ISC_GOST_DIGESTLENGTH; - else if (sr.base[3] == DNS_DSDIGEST_SHA384) - sr.length = 4 + ISC_SHA384_DIGESTLENGTH; - - isc_buffer_forward(source, sr.length); - return (mem_tobuffer(target, sr.base, sr.length)); + return (generic_fromwire_ds(rdclass, type, source, dctx, options, + target)); } static inline isc_result_t @@ -223,66 +86,23 @@ compare_dlv(ARGS_COMPARE) { static inline isc_result_t fromstruct_dlv(ARGS_FROMSTRUCT) { - dns_rdata_dlv_t *dlv = source; REQUIRE(type == dns_rdatatype_dlv); - REQUIRE(source != NULL); - REQUIRE(dlv->common.rdtype == type); - REQUIRE(dlv->common.rdclass == rdclass); - switch (dlv->digest_type) { - case DNS_DSDIGEST_SHA1: - REQUIRE(dlv->length == ISC_SHA1_DIGESTLENGTH); - break; - case DNS_DSDIGEST_SHA256: - REQUIRE(dlv->length == ISC_SHA256_DIGESTLENGTH); - break; - case DNS_DSDIGEST_GOST: - REQUIRE(dlv->length == ISC_GOST_DIGESTLENGTH); - break; - case DNS_DSDIGEST_SHA384: - REQUIRE(dlv->length == ISC_SHA384_DIGESTLENGTH); - break; - } - - UNUSED(type); - UNUSED(rdclass); - - RETERR(uint16_tobuffer(dlv->key_tag, target)); - RETERR(uint8_tobuffer(dlv->algorithm, target)); - RETERR(uint8_tobuffer(dlv->digest_type, target)); - return (mem_tobuffer(target, dlv->digest, dlv->length)); + return (generic_fromstruct_ds(rdclass, type, source, target)); } static inline isc_result_t tostruct_dlv(ARGS_TOSTRUCT) { dns_rdata_dlv_t *dlv = target; - isc_region_t region; REQUIRE(rdata->type == dns_rdatatype_dlv); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); dlv->common.rdclass = rdata->rdclass; dlv->common.rdtype = rdata->type; ISC_LINK_INIT(&dlv->common, link); - dns_rdata_toregion(rdata, ®ion); - - dlv->key_tag = uint16_fromregion(®ion); - isc_region_consume(®ion, 2); - dlv->algorithm = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - dlv->digest_type = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - dlv->length = region.length; - - dlv->digest = mem_maybedup(mctx, region.base, region.length); - if (dlv->digest == NULL) - return (ISC_R_NOMEMORY); - - dlv->mctx = mctx; - return (ISC_R_SUCCESS); + return (generic_tostruct_ds(rdata, target, mctx)); } static inline void diff --git a/lib/dns/rdata/generic/dlv_32769.h b/lib/dns/rdata/generic/dlv_32769.h index 2313c57582d8..404b2856c929 100644 --- a/lib/dns/rdata/generic/dlv_32769.h +++ b/lib/dns/rdata/generic/dlv_32769.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2006, 2007, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -20,14 +20,6 @@ #ifndef GENERIC_DLV_32769_H #define GENERIC_DLV_32769_H 1 -typedef struct dns_rdata_dlv { - dns_rdatacommon_t common; - isc_mem_t *mctx; - isc_uint16_t key_tag; - isc_uint8_t algorithm; - isc_uint8_t digest_type; - isc_uint16_t length; - unsigned char *digest; -} dns_rdata_dlv_t; +typedef struct dns_rdata_ds dns_rdata_dlv_t; #endif /* GENERIC_DLV_32769_H */ diff --git a/lib/dns/rdata/generic/dname_39.c b/lib/dns/rdata/generic/dname_39.c index d181a6cd10c7..e061161f79c5 100644 --- a/lib/dns/rdata/generic/dname_39.c +++ b/lib/dns/rdata/generic/dname_39.c @@ -43,7 +43,8 @@ fromtext_dname(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/dnskey_48.c b/lib/dns/rdata/generic/dnskey_48.c index 3b0387503a1b..41afd57fe1ab 100644 --- a/lib/dns/rdata/generic/dnskey_48.c +++ b/lib/dns/rdata/generic/dnskey_48.c @@ -32,186 +32,36 @@ static inline isc_result_t fromtext_dnskey(ARGS_FROMTEXT) { - isc_result_t result; - isc_token_t token; - dns_secalg_t alg; - dns_secproto_t proto; - dns_keyflags_t flags; REQUIRE(type == dns_rdatatype_dnskey); - UNUSED(type); - UNUSED(rdclass); - UNUSED(origin); - UNUSED(options); - UNUSED(callbacks); - - /* flags */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion)); - RETERR(uint16_tobuffer(flags, target)); - - /* protocol */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion)); - RETERR(mem_tobuffer(target, &proto, 1)); - - /* algorithm */ - RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, - ISC_FALSE)); - RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion)); - RETERR(mem_tobuffer(target, &alg, 1)); - - /* No Key? */ - if ((flags & 0xc000) == 0xc000) - return (ISC_R_SUCCESS); - - result = isc_base64_tobuffer(lexer, target, -1); - if (result != ISC_R_SUCCESS) - return (result); - - /* Ensure there's at least enough data to compute a key ID for MD5 */ - if (alg == DST_ALG_RSAMD5 && isc_buffer_usedlength(target) < 7) - return (ISC_R_UNEXPECTEDEND); - - return (ISC_R_SUCCESS); + return (generic_fromtext_key(rdclass, type, lexer, origin, + options, target, callbacks)); } static inline isc_result_t totext_dnskey(ARGS_TOTEXT) { - isc_region_t sr; - char buf[sizeof("64000")]; - unsigned int flags; - unsigned char algorithm; - char algbuf[DNS_NAME_FORMATSIZE]; - const char *keyinfo; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_dnskey); - REQUIRE(rdata->length != 0); - - dns_rdata_toregion(rdata, &sr); - /* flags */ - flags = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - sprintf(buf, "%u", flags); - RETERR(str_totext(buf, target)); - RETERR(str_totext(" ", target)); - if ((flags & DNS_KEYFLAG_KSK) != 0) { - if (flags & DNS_KEYFLAG_REVOKE) - keyinfo = "revoked KSK"; - else - keyinfo = "KSK"; - } else - keyinfo = "ZSK"; - - /* protocol */ - sprintf(buf, "%u", sr.base[0]); - isc_region_consume(&sr, 1); - RETERR(str_totext(buf, target)); - RETERR(str_totext(" ", target)); - - /* algorithm */ - algorithm = sr.base[0]; - sprintf(buf, "%u", algorithm); - isc_region_consume(&sr, 1); - RETERR(str_totext(buf, target)); - - /* No Key? */ - if ((flags & 0xc000) == 0xc000) - return (ISC_R_SUCCESS); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0 && - algorithm == DNS_KEYALG_PRIVATEDNS) { - dns_name_t name; - dns_name_init(&name, NULL); - dns_name_fromregion(&name, &sr); - dns_name_format(&name, algbuf, sizeof(algbuf)); - } else { - dns_secalg_format((dns_secalg_t) algorithm, algbuf, - sizeof(algbuf)); - } - - /* key */ - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" (", target)); - RETERR(str_totext(tctx->linebreak, target)); - if (tctx->width == 0) /* No splitting */ - RETERR(isc_base64_totext(&sr, 0, "", target)); - else - RETERR(isc_base64_totext(&sr, tctx->width - 2, - tctx->linebreak, target)); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) - RETERR(str_totext(tctx->linebreak, target)); - else if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(" ", target)); - - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) - RETERR(str_totext(")", target)); - - if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) { - isc_region_t tmpr; - - RETERR(str_totext(" ; ", target)); - RETERR(str_totext(keyinfo, target)); - RETERR(str_totext("; alg = ", target)); - RETERR(str_totext(algbuf, target)); - RETERR(str_totext("; key id = ", target)); - dns_rdata_toregion(rdata, &tmpr); - sprintf(buf, "%u", dst_region_computeid(&tmpr, algorithm)); - RETERR(str_totext(buf, target)); - } - return (ISC_R_SUCCESS); + return (generic_totext_key(rdata, tctx, target)); } static inline isc_result_t fromwire_dnskey(ARGS_FROMWIRE) { - unsigned char algorithm; - isc_region_t sr; REQUIRE(type == dns_rdatatype_dnskey); - UNUSED(type); - UNUSED(rdclass); - UNUSED(dctx); - UNUSED(options); - - isc_buffer_activeregion(source, &sr); - if (sr.length < 4) - return (ISC_R_UNEXPECTEDEND); - - algorithm = sr.base[3]; - RETERR(mem_tobuffer(target, sr.base, 4)); - isc_region_consume(&sr, 4); - isc_buffer_forward(source, 4); - - if (algorithm == DNS_KEYALG_PRIVATEDNS) { - dns_name_t name; - dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); - dns_name_init(&name, NULL); - RETERR(dns_name_fromwire(&name, source, dctx, options, target)); - } - - /* - * RSAMD5 computes key ID differently from other - * algorithms: we need to ensure there's enough data - * present for the computation - */ - if (algorithm == DST_ALG_RSAMD5 && sr.length < 3) - return (ISC_R_UNEXPECTEDEND); - - isc_buffer_activeregion(source, &sr); - isc_buffer_forward(source, sr.length); - return (mem_tobuffer(target, sr.base, sr.length)); + return (generic_fromwire_key(rdclass, type, source, dctx, + options, target)); } static inline isc_result_t towire_dnskey(ARGS_TOWIRE) { isc_region_t sr; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_dnskey); REQUIRE(rdata->length != 0); @@ -226,6 +76,8 @@ compare_dnskey(ARGS_COMPARE) { isc_region_t r1; isc_region_t r2; + REQUIRE(rdata1 != NULL); + REQUIRE(rdata2 != NULL); REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->rdclass == rdata2->rdclass); REQUIRE(rdata1->type == dns_rdatatype_dnskey); @@ -239,89 +91,40 @@ compare_dnskey(ARGS_COMPARE) { static inline isc_result_t fromstruct_dnskey(ARGS_FROMSTRUCT) { - dns_rdata_dnskey_t *dnskey = source; REQUIRE(type == dns_rdatatype_dnskey); - REQUIRE(source != NULL); - REQUIRE(dnskey->common.rdtype == type); - REQUIRE(dnskey->common.rdclass == rdclass); - - UNUSED(type); - UNUSED(rdclass); - - /* Flags */ - RETERR(uint16_tobuffer(dnskey->flags, target)); - - /* Protocol */ - RETERR(uint8_tobuffer(dnskey->protocol, target)); - /* Algorithm */ - RETERR(uint8_tobuffer(dnskey->algorithm, target)); - - /* Data */ - return (mem_tobuffer(target, dnskey->data, dnskey->datalen)); + return (generic_fromstruct_key(rdclass, type, source, target)); } static inline isc_result_t tostruct_dnskey(ARGS_TOSTRUCT) { dns_rdata_dnskey_t *dnskey = target; - isc_region_t sr; + REQUIRE(dnskey != NULL); + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_dnskey); - REQUIRE(target != NULL); - REQUIRE(rdata->length != 0); dnskey->common.rdclass = rdata->rdclass; dnskey->common.rdtype = rdata->type; ISC_LINK_INIT(&dnskey->common, link); - dns_rdata_toregion(rdata, &sr); - - /* Flags */ - if (sr.length < 2) - return (ISC_R_UNEXPECTEDEND); - dnskey->flags = uint16_fromregion(&sr); - isc_region_consume(&sr, 2); - - /* Protocol */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - dnskey->protocol = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Algorithm */ - if (sr.length < 1) - return (ISC_R_UNEXPECTEDEND); - dnskey->algorithm = uint8_fromregion(&sr); - isc_region_consume(&sr, 1); - - /* Data */ - dnskey->datalen = sr.length; - dnskey->data = mem_maybedup(mctx, sr.base, dnskey->datalen); - if (dnskey->data == NULL) - return (ISC_R_NOMEMORY); - - dnskey->mctx = mctx; - return (ISC_R_SUCCESS); + return (generic_tostruct_key(rdata, target, mctx)); } static inline void freestruct_dnskey(ARGS_FREESTRUCT) { dns_rdata_dnskey_t *dnskey = (dns_rdata_dnskey_t *) source; - REQUIRE(source != NULL); + REQUIRE(dnskey != NULL); REQUIRE(dnskey->common.rdtype == dns_rdatatype_dnskey); - if (dnskey->mctx == NULL) - return; - - if (dnskey->data != NULL) - isc_mem_free(dnskey->mctx, dnskey->data); - dnskey->mctx = NULL; + generic_freestruct_key(source); } static inline isc_result_t additionaldata_dnskey(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_dnskey); UNUSED(rdata); @@ -335,6 +138,7 @@ static inline isc_result_t digest_dnskey(ARGS_DIGEST) { isc_region_t r; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_dnskey); dns_rdata_toregion(rdata, &r); @@ -358,6 +162,7 @@ checkowner_dnskey(ARGS_CHECKOWNER) { static inline isc_boolean_t checknames_dnskey(ARGS_CHECKNAMES) { + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_dnskey); UNUSED(rdata); diff --git a/lib/dns/rdata/generic/dnskey_48.h b/lib/dns/rdata/generic/dnskey_48.h index ce88cd1bf37a..67b1d7a3573a 100644 --- a/lib/dns/rdata/generic/dnskey_48.h +++ b/lib/dns/rdata/generic/dnskey_48.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -18,20 +18,10 @@ #ifndef GENERIC_DNSKEY_48_H #define GENERIC_DNSKEY_48_H 1 -/* $Id: dnskey_48.h,v 1.7 2007/06/19 23:47:17 tbox Exp $ */ - /*! - * \brief per RFC2535 */ - -typedef struct dns_rdata_dnskey { - dns_rdatacommon_t common; - isc_mem_t * mctx; - isc_uint16_t flags; - isc_uint8_t protocol; - isc_uint8_t algorithm; - isc_uint16_t datalen; - unsigned char * data; -} dns_rdata_dnskey_t; + * \brief per RFC2535 + */ +typedef struct dns_rdata_key dns_rdata_dnskey_t; #endif /* GENERIC_DNSKEY_48_H */ diff --git a/lib/dns/rdata/generic/ds_43.c b/lib/dns/rdata/generic/ds_43.c index 975fdfd2b3a6..cdaec4dba9c8 100644 --- a/lib/dns/rdata/generic/ds_43.c +++ b/lib/dns/rdata/generic/ds_43.c @@ -31,13 +31,11 @@ #include <dns/ds.h> static inline isc_result_t -fromtext_ds(ARGS_FROMTEXT) { +generic_fromtext_ds(ARGS_FROMTEXT) { isc_token_t token; unsigned char c; int length; - REQUIRE(type == dns_rdatatype_ds); - UNUSED(type); UNUSED(rdclass); UNUSED(origin); @@ -95,12 +93,20 @@ fromtext_ds(ARGS_FROMTEXT) { } static inline isc_result_t -totext_ds(ARGS_TOTEXT) { +fromtext_ds(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_ds); + + return (generic_fromtext_ds(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +generic_totext_ds(ARGS_TOTEXT) { isc_region_t sr; char buf[sizeof("64000 ")]; unsigned int n; - REQUIRE(rdata->type == dns_rdatatype_ds); REQUIRE(rdata->length != 0); UNUSED(tctx); @@ -148,10 +154,16 @@ totext_ds(ARGS_TOTEXT) { } static inline isc_result_t -fromwire_ds(ARGS_FROMWIRE) { - isc_region_t sr; +totext_ds(ARGS_TOTEXT) { - REQUIRE(type == dns_rdatatype_ds); + REQUIRE(rdata->type == dns_rdatatype_ds); + + return (generic_totext_ds(rdata, tctx, target)); +} + +static inline isc_result_t +generic_fromwire_ds(ARGS_FROMWIRE) { + isc_region_t sr; UNUSED(type); UNUSED(rdclass); @@ -193,6 +205,15 @@ fromwire_ds(ARGS_FROMWIRE) { } static inline isc_result_t +fromwire_ds(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_ds); + + return (generic_fromwire_ds(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t towire_ds(ARGS_TOWIRE) { isc_region_t sr; @@ -222,13 +243,16 @@ compare_ds(ARGS_COMPARE) { } static inline isc_result_t -fromstruct_ds(ARGS_FROMSTRUCT) { +generic_fromstruct_ds(ARGS_FROMSTRUCT) { dns_rdata_ds_t *ds = source; - REQUIRE(type == dns_rdatatype_ds); REQUIRE(source != NULL); REQUIRE(ds->common.rdtype == type); REQUIRE(ds->common.rdclass == rdclass); + + UNUSED(type); + UNUSED(rdclass); + switch (ds->digest_type) { case DNS_DSDIGEST_SHA1: REQUIRE(ds->length == ISC_SHA1_DIGESTLENGTH); @@ -244,9 +268,6 @@ fromstruct_ds(ARGS_FROMSTRUCT) { break; } - UNUSED(type); - UNUSED(rdclass); - RETERR(uint16_tobuffer(ds->key_tag, target)); RETERR(uint8_tobuffer(ds->algorithm, target)); RETERR(uint8_tobuffer(ds->digest_type, target)); @@ -255,17 +276,23 @@ fromstruct_ds(ARGS_FROMSTRUCT) { } static inline isc_result_t -tostruct_ds(ARGS_TOSTRUCT) { +fromstruct_ds(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_ds); + + return (generic_fromstruct_ds(rdclass, type, source, target)); +} + +static inline isc_result_t +generic_tostruct_ds(ARGS_TOSTRUCT) { dns_rdata_ds_t *ds = target; isc_region_t region; - REQUIRE(rdata->type == dns_rdatatype_ds); REQUIRE(target != NULL); REQUIRE(rdata->length != 0); - - ds->common.rdclass = rdata->rdclass; - ds->common.rdtype = rdata->type; - ISC_LINK_INIT(&ds->common, link); + REQUIRE(ds->common.rdtype == rdata->type); + REQUIRE(ds->common.rdclass == rdata->rdclass); + REQUIRE(!ISC_LINK_LINKED(&ds->common, link)); dns_rdata_toregion(rdata, ®ion); @@ -285,6 +312,20 @@ tostruct_ds(ARGS_TOSTRUCT) { return (ISC_R_SUCCESS); } +static inline isc_result_t +tostruct_ds(ARGS_TOSTRUCT) { + dns_rdata_ds_t *ds = target; + + REQUIRE(rdata->type == dns_rdatatype_ds); + REQUIRE(target != NULL); + + ds->common.rdclass = rdata->rdclass; + ds->common.rdtype = rdata->type; + ISC_LINK_INIT(&ds->common, link); + + return (generic_tostruct_ds(rdata, target, mctx)); +} + static inline void freestruct_ds(ARGS_FREESTRUCT) { dns_rdata_ds_t *ds = source; diff --git a/lib/dns/rdata/generic/hip_55.c b/lib/dns/rdata/generic/hip_55.c index 7c51d1f72a54..8e7002298c3d 100644 --- a/lib/dns/rdata/generic/hip_55.c +++ b/lib/dns/rdata/generic/hip_55.c @@ -94,6 +94,9 @@ fromtext_hip(ARGS_FROMTEXT) { RETTOK(ISC_R_RANGE); RETERR(uint16_tobuffer((isc_uint32_t)len, &key_len)); + if (origin == NULL) + origin = dns_rootname; + /* * Rendezvous Servers. */ @@ -105,7 +108,6 @@ fromtext_hip(ARGS_FROMTEXT) { if (token.type != isc_tokentype_string) break; buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); } while (1); diff --git a/lib/dns/rdata/generic/ipseckey_45.c b/lib/dns/rdata/generic/ipseckey_45.c index c5462c1a69a8..cc6fb6d402d4 100644 --- a/lib/dns/rdata/generic/ipseckey_45.c +++ b/lib/dns/rdata/generic/ipseckey_45.c @@ -104,7 +104,8 @@ fromtext_ipseckey(ARGS_FROMTEXT) { case 3: dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); break; diff --git a/lib/dns/rdata/generic/key_25.c b/lib/dns/rdata/generic/key_25.c index c2ddd57fc108..4c65408ceaf9 100644 --- a/lib/dns/rdata/generic/key_25.c +++ b/lib/dns/rdata/generic/key_25.c @@ -31,15 +31,13 @@ #define RRTYPE_KEY_ATTRIBUTES (0) static inline isc_result_t -fromtext_key(ARGS_FROMTEXT) { +generic_fromtext_key(ARGS_FROMTEXT) { isc_result_t result; isc_token_t token; dns_secalg_t alg; dns_secproto_t proto; dns_keyflags_t flags; - REQUIRE(type == dns_rdatatype_key); - UNUSED(type); UNUSED(rdclass); UNUSED(origin); @@ -80,14 +78,15 @@ fromtext_key(ARGS_FROMTEXT) { } static inline isc_result_t -totext_key(ARGS_TOTEXT) { +generic_totext_key(ARGS_TOTEXT) { isc_region_t sr; - char buf[sizeof("64000")]; + char buf[sizeof("[key id = 64000]")]; unsigned int flags; unsigned char algorithm; - char namebuf[DNS_NAME_FORMATSIZE]; + char algbuf[DNS_NAME_FORMATSIZE]; + const char *keyinfo; + isc_region_t tmpr; - REQUIRE(rdata->type == dns_rdatatype_key); REQUIRE(rdata->length != 0); dns_rdata_toregion(rdata, &sr); @@ -98,6 +97,14 @@ totext_key(ARGS_TOTEXT) { sprintf(buf, "%u", flags); RETERR(str_totext(buf, target)); RETERR(str_totext(" ", target)); + if ((flags & DNS_KEYFLAG_KSK) != 0) { + if (flags & DNS_KEYFLAG_REVOKE) + keyinfo = "revoked KSK"; + else + keyinfo = "KSK"; + } else + keyinfo = "ZSK"; + /* protocol */ sprintf(buf, "%u", sr.base[0]); @@ -120,19 +127,22 @@ totext_key(ARGS_TOTEXT) { dns_name_t name; dns_name_init(&name, NULL); dns_name_fromregion(&name, &sr); - dns_name_format(&name, namebuf, sizeof(namebuf)); - } else - namebuf[0] = 0; + dns_name_format(&name, algbuf, sizeof(algbuf)); + } else { + dns_secalg_format((dns_secalg_t) algorithm, algbuf, + sizeof(algbuf)); + } /* key */ if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) RETERR(str_totext(" (", target)); RETERR(str_totext(tctx->linebreak, target)); + if (tctx->width == 0) /* No splitting */ RETERR(isc_base64_totext(&sr, 60, "", target)); else RETERR(isc_base64_totext(&sr, tctx->width - 2, - tctx->linebreak, target)); + tctx->linebreak, target)); if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) RETERR(str_totext(tctx->linebreak, target)); @@ -143,28 +153,27 @@ totext_key(ARGS_TOTEXT) { RETERR(str_totext(")", target)); if ((tctx->flags & DNS_STYLEFLAG_RRCOMMENT) != 0) { - isc_region_t tmpr; + if (rdata->type == dns_rdatatype_dnskey || + rdata->type == dns_rdatatype_cdnskey) { + RETERR(str_totext(" ; ", target)); + RETERR(str_totext(keyinfo, target)); + } + RETERR(str_totext("; alg = ", target)); + RETERR(str_totext(algbuf, target)); RETERR(str_totext(" ; key id = ", target)); dns_rdata_toregion(rdata, &tmpr); sprintf(buf, "%u", dst_region_computeid(&tmpr, algorithm)); RETERR(str_totext(buf, target)); - if (algorithm == DNS_KEYALG_PRIVATEDNS) { - RETERR(str_totext(tctx->linebreak, target)); - RETERR(str_totext("; alg = ", target)); - RETERR(str_totext(namebuf, target)); - } } return (ISC_R_SUCCESS); } static inline isc_result_t -fromwire_key(ARGS_FROMWIRE) { +generic_fromwire_key(ARGS_FROMWIRE) { unsigned char algorithm; isc_region_t sr; - REQUIRE(type == dns_rdatatype_key); - UNUSED(type); UNUSED(rdclass); UNUSED(dctx); @@ -200,9 +209,37 @@ fromwire_key(ARGS_FROMWIRE) { } static inline isc_result_t +fromtext_key(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_key); + + return (generic_fromtext_key(rdclass, type, lexer, origin, + options, target, callbacks)); +} + +static inline isc_result_t +totext_key(ARGS_TOTEXT) { + + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_key); + + return (generic_totext_key(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_key(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_key); + + return (generic_fromwire_key(rdclass, type, source, dctx, + options, target)); +} + +static inline isc_result_t towire_key(ARGS_TOWIRE) { isc_region_t sr; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_key); REQUIRE(rdata->length != 0); @@ -217,6 +254,8 @@ compare_key(ARGS_COMPARE) { isc_region_t r1; isc_region_t r2; + REQUIRE(rdata1 != NULL); + REQUIRE(rdata2 != NULL); REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->rdclass == rdata2->rdclass); REQUIRE(rdata1->type == dns_rdatatype_key); @@ -229,11 +268,10 @@ compare_key(ARGS_COMPARE) { } static inline isc_result_t -fromstruct_key(ARGS_FROMSTRUCT) { +generic_fromstruct_key(ARGS_FROMSTRUCT) { dns_rdata_key_t *key = source; - REQUIRE(type == dns_rdatatype_key); - REQUIRE(source != NULL); + REQUIRE(key != NULL); REQUIRE(key->common.rdtype == type); REQUIRE(key->common.rdclass == rdclass); @@ -254,17 +292,17 @@ fromstruct_key(ARGS_FROMSTRUCT) { } static inline isc_result_t -tostruct_key(ARGS_TOSTRUCT) { +generic_tostruct_key(ARGS_TOSTRUCT) { dns_rdata_key_t *key = target; isc_region_t sr; - REQUIRE(rdata->type == dns_rdatatype_key); - REQUIRE(target != NULL); + REQUIRE(rdata != NULL); REQUIRE(rdata->length != 0); - key->common.rdclass = rdata->rdclass; - key->common.rdtype = rdata->type; - ISC_LINK_INIT(&key->common, link); + REQUIRE(key != NULL); + REQUIRE(key->common.rdclass == rdata->rdclass); + REQUIRE(key->common.rdtype == rdata->type); + REQUIRE(!ISC_LINK_LINKED(&key->common, link)); dns_rdata_toregion(rdata, &sr); @@ -297,11 +335,10 @@ tostruct_key(ARGS_TOSTRUCT) { } static inline void -freestruct_key(ARGS_FREESTRUCT) { +generic_freestruct_key(ARGS_FREESTRUCT) { dns_rdata_key_t *key = (dns_rdata_key_t *) source; - REQUIRE(source != NULL); - REQUIRE(key->common.rdtype == dns_rdatatype_key); + REQUIRE(key != NULL); if (key->mctx == NULL) return; @@ -312,7 +349,42 @@ freestruct_key(ARGS_FREESTRUCT) { } static inline isc_result_t +fromstruct_key(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_key); + + return (generic_fromstruct_key(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_key(ARGS_TOSTRUCT) { + dns_rdata_key_t *key = target; + + REQUIRE(key != NULL); + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_key); + + key->common.rdclass = rdata->rdclass; + key->common.rdtype = rdata->type; + ISC_LINK_INIT(&key->common, link); + + return (generic_tostruct_key(rdata, target, mctx)); +} + +static inline void +freestruct_key(ARGS_FREESTRUCT) { + dns_rdata_key_t *key = (dns_rdata_key_t *) source; + + REQUIRE(key != NULL); + REQUIRE(key->common.rdtype == dns_rdatatype_key); + + generic_freestruct_key(source); +} + +static inline isc_result_t additionaldata_key(ARGS_ADDLDATA) { + + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_key); UNUSED(rdata); @@ -326,6 +398,7 @@ static inline isc_result_t digest_key(ARGS_DIGEST) { isc_region_t r; + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_key); dns_rdata_toregion(rdata, &r); @@ -349,6 +422,7 @@ checkowner_key(ARGS_CHECKOWNER) { static inline isc_boolean_t checknames_key(ARGS_CHECKNAMES) { + REQUIRE(rdata != NULL); REQUIRE(rdata->type == dns_rdatatype_key); UNUSED(rdata); diff --git a/lib/dns/rdata/generic/key_25.h b/lib/dns/rdata/generic/key_25.h index bcf9cb6a22bf..e3aa8beaec3d 100644 --- a/lib/dns/rdata/generic/key_25.h +++ b/lib/dns/rdata/generic/key_25.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -23,14 +23,14 @@ /*! * \brief Per RFC2535 */ -typedef struct dns_rdata_key_t { - dns_rdatacommon_t common; - isc_mem_t * mctx; - isc_uint16_t flags; - isc_uint8_t protocol; - isc_uint8_t algorithm; - isc_uint16_t datalen; - unsigned char * data; +typedef struct dns_rdata_key { + dns_rdatacommon_t common; + isc_mem_t * mctx; + isc_uint16_t flags; + isc_uint8_t protocol; + isc_uint8_t algorithm; + isc_uint16_t datalen; + unsigned char * data; } dns_rdata_key_t; diff --git a/lib/dns/rdata/generic/lp_107.c b/lib/dns/rdata/generic/lp_107.c index 08d6b1763593..b9e2f039f824 100644 --- a/lib/dns/rdata/generic/lp_107.c +++ b/lib/dns/rdata/generic/lp_107.c @@ -46,7 +46,8 @@ fromtext_lp(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; return (dns_name_fromtext(&name, &buffer, origin, options, target)); } diff --git a/lib/dns/rdata/generic/mb_7.c b/lib/dns/rdata/generic/mb_7.c index 47c7308ebb03..cd92af512040 100644 --- a/lib/dns/rdata/generic/mb_7.c +++ b/lib/dns/rdata/generic/mb_7.c @@ -41,7 +41,8 @@ fromtext_mb(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/md_3.c b/lib/dns/rdata/generic/md_3.c index 7485d1e49016..9738878aad4e 100644 --- a/lib/dns/rdata/generic/md_3.c +++ b/lib/dns/rdata/generic/md_3.c @@ -41,7 +41,8 @@ fromtext_md(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/mf_4.c b/lib/dns/rdata/generic/mf_4.c index 97402a9dc6db..f7513fdbec57 100644 --- a/lib/dns/rdata/generic/mf_4.c +++ b/lib/dns/rdata/generic/mf_4.c @@ -41,7 +41,8 @@ fromtext_mf(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/mg_8.c b/lib/dns/rdata/generic/mg_8.c index 6c3b7e2b2d41..3f50a9ed3447 100644 --- a/lib/dns/rdata/generic/mg_8.c +++ b/lib/dns/rdata/generic/mg_8.c @@ -41,7 +41,8 @@ fromtext_mg(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/minfo_14.c b/lib/dns/rdata/generic/minfo_14.c index 2a868f857f8f..173567ef6b35 100644 --- a/lib/dns/rdata/generic/minfo_14.c +++ b/lib/dns/rdata/generic/minfo_14.c @@ -38,13 +38,15 @@ fromtext_minfo(ARGS_FROMTEXT) { UNUSED(rdclass); UNUSED(callbacks); + if (origin == NULL) + origin = dns_rootname; + for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; diff --git a/lib/dns/rdata/generic/mr_9.c b/lib/dns/rdata/generic/mr_9.c index 7e69cf1cfe85..c82ad218868a 100644 --- a/lib/dns/rdata/generic/mr_9.c +++ b/lib/dns/rdata/generic/mr_9.c @@ -41,7 +41,8 @@ fromtext_mr(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c index 7364b4ac1fd8..37fd7e6e5ba8 100644 --- a/lib/dns/rdata/generic/mx_15.c +++ b/lib/dns/rdata/generic/mx_15.c @@ -77,7 +77,8 @@ fromtext_mx(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/rdata/generic/naptr_35.c b/lib/dns/rdata/generic/naptr_35.c index e8cbda87b74e..418a9d25f143 100644 --- a/lib/dns/rdata/generic/naptr_35.c +++ b/lib/dns/rdata/generic/naptr_35.c @@ -181,7 +181,8 @@ fromtext_naptr(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/generic/ninfo_56.c b/lib/dns/rdata/generic/ninfo_56.c new file mode 100644 index 000000000000..f31f47ed65ef --- /dev/null +++ b/lib/dns/rdata/generic/ninfo_56.c @@ -0,0 +1,196 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_NINFO_56_C +#define RDATA_GENERIC_NINFO_56_C + +#define RRTYPE_NINFO_ATTRIBUTES (0) + +static inline isc_result_t +fromtext_ninfo(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_ninfo); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + return (generic_fromtext_txt(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_ninfo(ARGS_TOTEXT) { + + UNUSED(tctx); + + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + return (generic_totext_txt(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_ninfo(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_ninfo); + + UNUSED(type); + UNUSED(dctx); + UNUSED(rdclass); + UNUSED(options); + + return (generic_fromwire_txt(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t +towire_ninfo(ARGS_TOWIRE) { + + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + UNUSED(cctx); + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static inline int +compare_ninfo(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_ninfo); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_ninfo(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_ninfo); + + return (generic_fromstruct_txt(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_ninfo(ARGS_TOSTRUCT) { + dns_rdata_ninfo_t *txt = target; + + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + txt->common.rdclass = rdata->rdclass; + txt->common.rdtype = rdata->type; + ISC_LINK_INIT(&txt->common, link); + + return (generic_tostruct_txt(rdata, target, mctx)); +} + +static inline void +freestruct_ninfo(ARGS_FREESTRUCT) { + dns_rdata_ninfo_t *ninfo = source; + + REQUIRE(source != NULL); + REQUIRE(ninfo->common.rdtype == dns_rdatatype_ninfo); + + generic_freestruct_txt(source); +} + +static inline isc_result_t +additionaldata_ninfo(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_ninfo(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_ninfo(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_ninfo); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_ninfo(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_ninfo); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline isc_result_t +casecompare_ninfo(ARGS_COMPARE) { + return (compare_ninfo(rdata1, rdata2)); +} + +isc_result_t +dns_rdata_ninfo_first(dns_rdata_ninfo_t *ninfo) { + + REQUIRE(ninfo != NULL); + REQUIRE(ninfo->common.rdtype == dns_rdatatype_ninfo); + + return (generic_txt_first(ninfo)); +} + +isc_result_t +dns_rdata_ninfo_next(dns_rdata_ninfo_t *ninfo) { + + REQUIRE(ninfo != NULL); + REQUIRE(ninfo->common.rdtype == dns_rdatatype_ninfo); + + return (generic_txt_next(ninfo)); +} + +isc_result_t +dns_rdata_ninfo_current(dns_rdata_ninfo_t *ninfo, + dns_rdata_ninfo_string_t *string) +{ + + REQUIRE(ninfo != NULL); + REQUIRE(ninfo->common.rdtype == dns_rdatatype_ninfo); + + return (generic_txt_current(ninfo, string)); +} +#endif /* RDATA_GENERIC_NINFO_56_C */ diff --git a/lib/dns/rdata/generic/ninfo_56.h b/lib/dns/rdata/generic/ninfo_56.h new file mode 100644 index 000000000000..343cae387b0e --- /dev/null +++ b/lib/dns/rdata/generic/ninfo_56.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +/* */ +#ifndef GENERIC_NINFO_56_H +#define GENERIC_NINFO_56_H 1 + +typedef struct dns_rdata_txt_string dns_rdata_ninfo_string_t; + +typedef struct dns_rdata_txt dns_rdata_ninfo_t; + +/* + * ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS are already done + * via rdatastructpre.h and rdatastructsuf.h. + */ + +isc_result_t +dns_rdata_ninfo_first(dns_rdata_ninfo_t *); + +isc_result_t +dns_rdata_ninfo_next(dns_rdata_ninfo_t *); + +isc_result_t +dns_rdata_ninfo_current(dns_rdata_ninfo_t *, dns_rdata_ninfo_string_t *); + +#endif /* GENERIC_NINFO_16_H */ diff --git a/lib/dns/rdata/generic/ns_2.c b/lib/dns/rdata/generic/ns_2.c index d7e095b09bf2..eaac08c289d3 100644 --- a/lib/dns/rdata/generic/ns_2.c +++ b/lib/dns/rdata/generic/ns_2.c @@ -42,7 +42,8 @@ fromtext_ns(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/rdata/generic/nsec3_50.c b/lib/dns/rdata/generic/nsec3_50.c index 2aec339c2453..b8245a0417a9 100644 --- a/lib/dns/rdata/generic/nsec3_50.c +++ b/lib/dns/rdata/generic/nsec3_50.c @@ -45,13 +45,10 @@ static inline isc_result_t fromtext_nsec3(ARGS_FROMTEXT) { isc_token_t token; - unsigned char bm[8*1024]; /* 64k bits */ - dns_rdatatype_t covered; - int octet; - int window; unsigned int flags; unsigned char hashalg; isc_buffer_t b; + unsigned char buf[256]; REQUIRE(type == dns_rdatatype_nsec3); @@ -99,50 +96,24 @@ fromtext_nsec3(ARGS_FROMTEXT) { */ RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); - isc_buffer_init(&b, bm, sizeof(bm)); + isc_buffer_init(&b, buf, sizeof(buf)); RETTOK(isc_base32hexnp_decodestring(DNS_AS_STR(token), &b)); if (isc_buffer_usedlength(&b) > 0xffU) RETTOK(ISC_R_RANGE); RETERR(uint8_tobuffer(isc_buffer_usedlength(&b), target)); - RETERR(mem_tobuffer(target, &bm, isc_buffer_usedlength(&b))); - - memset(bm, 0, sizeof(bm)); - do { - RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); - if (token.type != isc_tokentype_string) - break; - RETTOK(dns_rdatatype_fromtext(&covered, - &token.value.as_textregion)); - bm[covered/8] |= (0x80>>(covered%8)); - } while (1); - isc_lex_ungettoken(lexer, &token); - for (window = 0; window < 256 ; window++) { - /* - * Find if we have a type in this window. - */ - for (octet = 31; octet >= 0; octet--) - if (bm[window * 32 + octet] != 0) - break; - if (octet < 0) - continue; - RETERR(uint8_tobuffer(window, target)); - RETERR(uint8_tobuffer(octet + 1, target)); - RETERR(mem_tobuffer(target, &bm[window * 32], octet + 1)); - } - return (ISC_R_SUCCESS); + RETERR(mem_tobuffer(target, &buf, isc_buffer_usedlength(&b))); + + return (typemap_fromtext(lexer, target, ISC_TRUE)); } static inline isc_result_t totext_nsec3(ARGS_TOTEXT) { isc_region_t sr; - unsigned int i, j, k; - unsigned int window, len; + unsigned int i, j; unsigned char hash; unsigned char flags; char buf[sizeof("TYPE65535")]; isc_uint32_t iterations; - isc_boolean_t first; REQUIRE(rdata->type == dns_rdatatype_nsec3); REQUIRE(rdata->length != 0); @@ -197,39 +168,7 @@ totext_nsec3(ARGS_TOTEXT) { if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) == 0) RETERR(str_totext(" ", target)); - /* Types covered */ - first = ISC_TRUE; - for (i = 0; i < sr.length; i += len) { - if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) { - RETERR(str_totext(tctx->linebreak, target)); - first = ISC_TRUE; - } - INSIST(i + 2 <= sr.length); - window = sr.base[i]; - len = sr.base[i + 1]; - INSIST(len > 0 && len <= 32); - i += 2; - INSIST(i + len <= sr.length); - for (j = 0; j < len; j++) { - dns_rdatatype_t t; - if (sr.base[i + j] == 0) - continue; - for (k = 0; k < 8; k++) { - if ((sr.base[i + j] & (0x80 >> k)) == 0) - continue; - t = window * 256 + j * 8 + k; - if (!first) - RETERR(str_totext(" ", target)); - first = ISC_FALSE; - if (dns_rdatatype_isknown(t)) { - RETERR(dns_rdatatype_totext(t, target)); - } else { - sprintf(buf, "TYPE%u", t); - RETERR(str_totext(buf, target)); - } - } - } - } + RETERR(typemap_totext(&sr, tctx, target)); if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) RETERR(str_totext(" )", target)); @@ -240,11 +179,7 @@ totext_nsec3(ARGS_TOTEXT) { static inline isc_result_t fromwire_nsec3(ARGS_FROMWIRE) { isc_region_t sr, rr; - unsigned int window, lastwindow = 0; - unsigned int len; unsigned int saltlen, hashlen; - isc_boolean_t first = ISC_TRUE; - unsigned int i; REQUIRE(type == dns_rdatatype_nsec3); @@ -275,40 +210,8 @@ fromwire_nsec3(ARGS_FROMWIRE) { RETERR(DNS_R_FORMERR); isc_region_consume(&sr, hashlen); - for (i = 0; i < sr.length; i += len) { - /* - * Check for overflow. - */ - if (i + 2 > sr.length) - RETERR(DNS_R_FORMERR); - window = sr.base[i]; - len = sr.base[i + 1]; - i += 2; - /* - * Check that bitmap windows are in the correct order. - */ - if (!first && window <= lastwindow) - RETERR(DNS_R_FORMERR); - /* - * Check for legal lengths. - */ - if (len < 1 || len > 32) - RETERR(DNS_R_FORMERR); - /* - * Check for overflow. - */ - if (i + len > sr.length) - RETERR(DNS_R_FORMERR); - /* - * The last octet of the bitmap must be non zero. - */ - if (sr.base[i + len - 1] == 0) - RETERR(DNS_R_FORMERR); - lastwindow = window; - first = ISC_FALSE; - } - if (i != sr.length) - return (DNS_R_EXTRADATA); + RETERR(typemap_test(&sr, ISC_TRUE)); + RETERR(mem_tobuffer(target, rr.base, rr.length)); isc_buffer_forward(source, rr.length); return (ISC_R_SUCCESS); @@ -346,8 +249,7 @@ compare_nsec3(ARGS_COMPARE) { static inline isc_result_t fromstruct_nsec3(ARGS_FROMSTRUCT) { dns_rdata_nsec3_t *nsec3 = source; - unsigned int i, len, window, lastwindow = 0; - isc_boolean_t first = ISC_TRUE; + isc_region_t region; REQUIRE(type == dns_rdatatype_nsec3); REQUIRE(source != NULL); @@ -367,21 +269,9 @@ fromstruct_nsec3(ARGS_FROMSTRUCT) { RETERR(uint8_tobuffer(nsec3->next_length, target)); RETERR(mem_tobuffer(target, nsec3->next, nsec3->next_length)); - /* - * Perform sanity check. - */ - for (i = 0; i < nsec3->len ; i += len) { - INSIST(i + 2 <= nsec3->len); - window = nsec3->typebits[i]; - len = nsec3->typebits[i+1]; - i += 2; - INSIST(first || window > lastwindow); - INSIST(len > 0 && len <= 32); - INSIST(i + len <= nsec3->len); - INSIST(nsec3->typebits[i + len - 1] != 0); - lastwindow = window; - first = ISC_FALSE; - } + region.base = nsec3->typebits; + region.length = nsec3->len; + RETERR(typemap_test(®ion, ISC_TRUE)); return (mem_tobuffer(target, nsec3->typebits, nsec3->len)); } diff --git a/lib/dns/rdata/generic/nsec_47.c b/lib/dns/rdata/generic/nsec_47.c index 64bd757fd33a..3e80612a7b44 100644 --- a/lib/dns/rdata/generic/nsec_47.c +++ b/lib/dns/rdata/generic/nsec_47.c @@ -35,10 +35,6 @@ fromtext_nsec(ARGS_FROMTEXT) { isc_token_t token; dns_name_t name; isc_buffer_t buffer; - unsigned char bm[8*1024]; /* 64k bits */ - dns_rdatatype_t covered; - int octet; - int window; REQUIRE(type == dns_rdatatype_nsec); @@ -53,42 +49,17 @@ fromtext_nsec(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); - memset(bm, 0, sizeof(bm)); - do { - RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_string, ISC_TRUE)); - if (token.type != isc_tokentype_string) - break; - RETTOK(dns_rdatatype_fromtext(&covered, - &token.value.as_textregion)); - bm[covered/8] |= (0x80>>(covered%8)); - } while (1); - isc_lex_ungettoken(lexer, &token); - for (window = 0; window < 256 ; window++) { - /* - * Find if we have a type in this window. - */ - for (octet = 31; octet >= 0; octet--) - if (bm[window * 32 + octet] != 0) - break; - if (octet < 0) - continue; - RETERR(uint8_tobuffer(window, target)); - RETERR(uint8_tobuffer(octet + 1, target)); - RETERR(mem_tobuffer(target, &bm[window * 32], octet + 1)); - } - return (ISC_R_SUCCESS); + return (typemap_fromtext(lexer, target, ISC_FALSE)); } static inline isc_result_t totext_nsec(ARGS_TOTEXT) { isc_region_t sr; - unsigned int i, j, k; dns_name_t name; - unsigned int window, len; REQUIRE(rdata->type == dns_rdatatype_nsec); REQUIRE(rdata->length != 0); @@ -100,45 +71,13 @@ totext_nsec(ARGS_TOTEXT) { dns_name_fromregion(&name, &sr); isc_region_consume(&sr, name_length(&name)); RETERR(dns_name_totext(&name, ISC_FALSE, target)); - - - for (i = 0; i < sr.length; i += len) { - INSIST(i + 2 <= sr.length); - window = sr.base[i]; - len = sr.base[i + 1]; - INSIST(len > 0 && len <= 32); - i += 2; - INSIST(i + len <= sr.length); - for (j = 0; j < len; j++) { - dns_rdatatype_t t; - if (sr.base[i + j] == 0) - continue; - for (k = 0; k < 8; k++) { - if ((sr.base[i + j] & (0x80 >> k)) == 0) - continue; - t = window * 256 + j * 8 + k; - RETERR(str_totext(" ", target)); - if (dns_rdatatype_isknown(t)) { - RETERR(dns_rdatatype_totext(t, target)); - } else { - char buf[sizeof("TYPE65535")]; - sprintf(buf, "TYPE%u", t); - RETERR(str_totext(buf, target)); - } - } - } - } - return (ISC_R_SUCCESS); + return (typemap_totext(&sr, NULL, target)); } static /* inline */ isc_result_t fromwire_nsec(ARGS_FROMWIRE) { isc_region_t sr; dns_name_t name; - unsigned int window, lastwindow = 0; - unsigned int len; - isc_boolean_t first = ISC_TRUE; - unsigned int i; REQUIRE(type == dns_rdatatype_nsec); @@ -151,42 +90,7 @@ fromwire_nsec(ARGS_FROMWIRE) { RETERR(dns_name_fromwire(&name, source, dctx, options, target)); isc_buffer_activeregion(source, &sr); - for (i = 0; i < sr.length; i += len) { - /* - * Check for overflow. - */ - if (i + 2 > sr.length) - RETERR(DNS_R_FORMERR); - window = sr.base[i]; - len = sr.base[i + 1]; - i += 2; - /* - * Check that bitmap windows are in the correct order. - */ - if (!first && window <= lastwindow) - RETERR(DNS_R_FORMERR); - /* - * Check for legal lengths. - */ - if (len < 1 || len > 32) - RETERR(DNS_R_FORMERR); - /* - * Check for overflow. - */ - if (i + len > sr.length) - RETERR(DNS_R_FORMERR); - /* - * The last octet of the bitmap must be non zero. - */ - if (sr.base[i + len - 1] == 0) - RETERR(DNS_R_FORMERR); - lastwindow = window; - first = ISC_FALSE; - } - if (i != sr.length) - return (DNS_R_EXTRADATA); - if (first) - RETERR(DNS_R_FORMERR); + RETERR(typemap_test(&sr, ISC_FALSE)); RETERR(mem_tobuffer(target, sr.base, sr.length)); isc_buffer_forward(source, sr.length); return (ISC_R_SUCCESS); @@ -231,8 +135,6 @@ static inline isc_result_t fromstruct_nsec(ARGS_FROMSTRUCT) { dns_rdata_nsec_t *nsec = source; isc_region_t region; - unsigned int i, len, window, lastwindow = 0; - isc_boolean_t first = ISC_TRUE; REQUIRE(type == dns_rdatatype_nsec); REQUIRE(source != NULL); @@ -245,22 +147,10 @@ fromstruct_nsec(ARGS_FROMSTRUCT) { dns_name_toregion(&nsec->next, ®ion); RETERR(isc_buffer_copyregion(target, ®ion)); - /* - * Perform sanity check. - */ - for (i = 0; i < nsec->len ; i += len) { - INSIST(i + 2 <= nsec->len); - window = nsec->typebits[i]; - len = nsec->typebits[i+1]; - i += 2; - INSIST(first || window > lastwindow); - INSIST(len > 0 && len <= 32); - INSIST(i + len <= nsec->len); - INSIST(nsec->typebits[i + len - 1] != 0); - lastwindow = window; - first = ISC_FALSE; - } - INSIST(!first); + + region.base = nsec->typebits; + region.length = nsec->len; + RETERR(typemap_test(®ion, ISC_FALSE)); return (mem_tobuffer(target, nsec->typebits, nsec->len)); } diff --git a/lib/dns/rdata/generic/nxt_30.c b/lib/dns/rdata/generic/nxt_30.c index fbb34e9818ee..b654611570ea 100644 --- a/lib/dns/rdata/generic/nxt_30.c +++ b/lib/dns/rdata/generic/nxt_30.c @@ -55,7 +55,8 @@ fromtext_nxt(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); memset(bm, 0, sizeof(bm)); diff --git a/lib/dns/rdata/generic/ptr_12.c b/lib/dns/rdata/generic/ptr_12.c index e3f65cf28561..b81bf1f2a8e0 100644 --- a/lib/dns/rdata/generic/ptr_12.c +++ b/lib/dns/rdata/generic/ptr_12.c @@ -41,7 +41,8 @@ fromtext_ptr(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); if (rdclass == dns_rdataclass_in && (options & DNS_RDATA_CHECKNAMES) != 0 && diff --git a/lib/dns/rdata/generic/rkey_57.c b/lib/dns/rdata/generic/rkey_57.c new file mode 100644 index 000000000000..a57d1bc13f8d --- /dev/null +++ b/lib/dns/rdata/generic/rkey_57.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_RKEY_57_C +#define RDATA_GENERIC_RKEY_57_C + +#define RRTYPE_RKEY_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_rkey(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_rkey); + + return (generic_fromtext_key(rdclass, type, lexer, origin, + options, target, callbacks)); +} + +static inline isc_result_t +totext_rkey(ARGS_TOTEXT) { + + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_rkey); + + return (generic_totext_key(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_rkey(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_rkey); + + return (generic_fromwire_key(rdclass, type, source, dctx, + options, target)); +} + +static inline isc_result_t +towire_rkey(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_rkey); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_rkey(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1 != NULL); + REQUIRE(rdata2 != NULL); + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_rkey); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_rkey(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_rkey); + + return (generic_fromstruct_key(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_rkey(ARGS_TOSTRUCT) { + dns_rdata_rkey_t *rkey = target; + + REQUIRE(rkey != NULL); + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_rkey); + + rkey->common.rdclass = rdata->rdclass; + rkey->common.rdtype = rdata->type; + ISC_LINK_INIT(&rkey->common, link); + + return (generic_tostruct_key(rdata, target, mctx)); +} + +static inline void +freestruct_rkey(ARGS_FREESTRUCT) { + dns_rdata_rkey_t *rkey = (dns_rdata_rkey_t *) source; + + REQUIRE(rkey != NULL); + REQUIRE(rkey->common.rdtype == dns_rdatatype_rkey); + + generic_freestruct_key(source); +} + +static inline isc_result_t +additionaldata_rkey(ARGS_ADDLDATA) { + + REQUIRE(rdata->type == dns_rdatatype_rkey); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_rkey(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_rkey); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_rkey(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_rkey); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_rkey(ARGS_CHECKNAMES) { + + REQUIRE(rdata != NULL); + REQUIRE(rdata->type == dns_rdatatype_rkey); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_rkey(ARGS_COMPARE) { + + /* + * Treat ALG 253 (private DNS) subtype name case sensistively. + */ + return (compare_rkey(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_RKEY_57_C */ diff --git a/lib/dns/rdata/generic/rkey_57.h b/lib/dns/rdata/generic/rkey_57.h new file mode 100644 index 000000000000..330b3fbad8e4 --- /dev/null +++ b/lib/dns/rdata/generic/rkey_57.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_RKEY_57_H +#define GENERIC_RKEY_57_H 1 + +typedef struct dns_rdata_key dns_rdata_rkey_t; + +#endif /* GENERIC_RKEY_57_H */ diff --git a/lib/dns/rdata/generic/rp_17.c b/lib/dns/rdata/generic/rp_17.c index e67c25ec7a1e..440a75a140a2 100644 --- a/lib/dns/rdata/generic/rp_17.c +++ b/lib/dns/rdata/generic/rp_17.c @@ -38,7 +38,8 @@ fromtext_rp(ARGS_FROMTEXT) { UNUSED(rdclass); UNUSED(callbacks); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, diff --git a/lib/dns/rdata/generic/rrsig_46.c b/lib/dns/rdata/generic/rrsig_46.c index 8ae9319c5cf0..43ca2d3a51d8 100644 --- a/lib/dns/rdata/generic/rrsig_46.c +++ b/lib/dns/rdata/generic/rrsig_46.c @@ -141,7 +141,8 @@ fromtext_rrsig(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); /* diff --git a/lib/dns/rdata/generic/rt_21.c b/lib/dns/rdata/generic/rt_21.c index a9a89b268f35..ce6e99a0bbff 100644 --- a/lib/dns/rdata/generic/rt_21.c +++ b/lib/dns/rdata/generic/rt_21.c @@ -50,7 +50,8 @@ fromtext_rt(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/rdata/generic/sig_24.c b/lib/dns/rdata/generic/sig_24.c index af9c7daaa498..0dff80af618e 100644 --- a/lib/dns/rdata/generic/sig_24.c +++ b/lib/dns/rdata/generic/sig_24.c @@ -115,7 +115,8 @@ fromtext_sig(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); /* diff --git a/lib/dns/rdata/generic/sink_40.c b/lib/dns/rdata/generic/sink_40.c new file mode 100644 index 000000000000..dafa94bebf28 --- /dev/null +++ b/lib/dns/rdata/generic/sink_40.c @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_SINK_40_C +#define RDATA_GENERIC_SINK_40_C + +#include <dst/dst.h> + +#define RRTYPE_SINK_ATTRIBUTES (0) + +static inline isc_result_t +fromtext_sink(ARGS_FROMTEXT) { + isc_token_t token; + + REQUIRE(type == dns_rdatatype_sink); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* meaning */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + /* coding */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + /* subcoding */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + return(isc_base64_tobuffer(lexer, target, -1)); +} + +static inline isc_result_t +totext_sink(ARGS_TOTEXT) { + isc_region_t sr; + char buf[sizeof("255 255 255")]; + isc_uint8_t meaning, coding, subcoding; + + REQUIRE(rdata->type == dns_rdatatype_sink); + REQUIRE(rdata->length >= 3); + + dns_rdata_toregion(rdata, &sr); + + /* Meaning, Coding and Subcoding */ + meaning = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + coding = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + subcoding = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u %u %u", meaning, coding, subcoding); + RETERR(str_totext(buf, target)); + + if (sr.length == 0U) + return (ISC_R_SUCCESS); + + /* data */ + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" (", target)); + + RETERR(str_totext(tctx->linebreak, target)); + + if (tctx->width == 0) /* No splitting */ + RETERR(isc_base64_totext(&sr, 60, "", target)); + else + RETERR(isc_base64_totext(&sr, tctx->width - 2, + tctx->linebreak, target)); + + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" )", target)); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +fromwire_sink(ARGS_FROMWIRE) { + isc_region_t sr; + + REQUIRE(type == dns_rdatatype_sink); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(dctx); + UNUSED(options); + + isc_buffer_activeregion(source, &sr); + if (sr.length < 3) + return (ISC_R_UNEXPECTEDEND); + + RETERR(mem_tobuffer(target, sr.base, sr.length)); + isc_buffer_forward(source, sr.length); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +towire_sink(ARGS_TOWIRE) { + + REQUIRE(rdata->type == dns_rdatatype_sink); + REQUIRE(rdata->length >= 3); + + UNUSED(cctx); + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static inline int +compare_sink(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_sink); + REQUIRE(rdata1->length >= 3); + REQUIRE(rdata2->length >= 3); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_sink(ARGS_FROMSTRUCT) { + dns_rdata_sink_t *sink = source; + + REQUIRE(type == dns_rdatatype_sink); + REQUIRE(source != NULL); + REQUIRE(sink->common.rdtype == type); + REQUIRE(sink->common.rdclass == rdclass); + + UNUSED(type); + UNUSED(rdclass); + + /* Meaning */ + RETERR(uint8_tobuffer(sink->meaning, target)); + + /* Coding */ + RETERR(uint8_tobuffer(sink->coding, target)); + + /* Subcoding */ + RETERR(uint8_tobuffer(sink->subcoding, target)); + + /* Data */ + return (mem_tobuffer(target, sink->data, sink->datalen)); +} + +static inline isc_result_t +tostruct_sink(ARGS_TOSTRUCT) { + dns_rdata_sink_t *sink = target; + isc_region_t sr; + + REQUIRE(rdata->type == dns_rdatatype_sink); + REQUIRE(target != NULL); + REQUIRE(rdata->length >= 3); + + sink->common.rdclass = rdata->rdclass; + sink->common.rdtype = rdata->type; + ISC_LINK_INIT(&sink->common, link); + + dns_rdata_toregion(rdata, &sr); + + /* Meaning */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + sink->meaning = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* Coding */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + sink->coding = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* Subcoding */ + if (sr.length < 1) + return (ISC_R_UNEXPECTEDEND); + sink->subcoding = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + + /* Data */ + sink->datalen = sr.length; + sink->data = mem_maybedup(mctx, sr.base, sink->datalen); + if (sink->data == NULL) + return (ISC_R_NOMEMORY); + + sink->mctx = mctx; + return (ISC_R_SUCCESS); +} + +static inline void +freestruct_sink(ARGS_FREESTRUCT) { + dns_rdata_sink_t *sink = (dns_rdata_sink_t *) source; + + REQUIRE(source != NULL); + REQUIRE(sink->common.rdtype == dns_rdatatype_sink); + + if (sink->mctx == NULL) + return; + + if (sink->data != NULL) + isc_mem_free(sink->mctx, sink->data); + sink->mctx = NULL; +} + +static inline isc_result_t +additionaldata_sink(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_sink); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_sink(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_sink); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_sink(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_sink); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_sink(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_sink); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_sink(ARGS_COMPARE) { + return (compare_sink(rdata1, rdata2)); +} +#endif /* RDATA_GENERIC_SINK_40_C */ diff --git a/lib/dns/rdata/generic/sink_40.h b/lib/dns/rdata/generic/sink_40.h new file mode 100644 index 000000000000..e6a2400c4668 --- /dev/null +++ b/lib/dns/rdata/generic/sink_40.h @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_SINK_40_H +#define GENERIC_SINK_40_H 1 + +typedef struct dns_rdata_sink_t { + dns_rdatacommon_t common; + isc_mem_t * mctx; + isc_uint8_t meaning; + isc_uint8_t coding; + isc_uint8_t subcoding; + isc_uint16_t datalen; + unsigned char * data; +} dns_rdata_sink_t; + +#endif /* GENERIC_SINK_40_H */ diff --git a/lib/dns/rdata/generic/smimea_53.c b/lib/dns/rdata/generic/smimea_53.c new file mode 100644 index 000000000000..e46655b6c6bc --- /dev/null +++ b/lib/dns/rdata/generic/smimea_53.c @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_SMIMEA_53_C +#define RDATA_GENERIC_SMIMEA_53_C + +#define RRTYPE_SMIMEA_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_smimea(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_smimea); + + return (generic_fromtext_tlsa(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_smimea(ARGS_TOTEXT) { + + REQUIRE(rdata->type == dns_rdatatype_smimea); + + return (generic_totext_tlsa(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_smimea(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_smimea); + + return (generic_fromwire_tlsa(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t +towire_smimea(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata->type == dns_rdatatype_smimea); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_smimea(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_smimea); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_smimea(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_smimea); + + return (generic_fromstruct_tlsa(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_smimea(ARGS_TOSTRUCT) { + dns_rdata_txt_t *txt = target; + + REQUIRE(rdata->type == dns_rdatatype_smimea); + REQUIRE(target != NULL); + + txt->common.rdclass = rdata->rdclass; + txt->common.rdtype = rdata->type; + ISC_LINK_INIT(&txt->common, link); + + return (generic_tostruct_tlsa(rdata, target, mctx)); +} + +static inline void +freestruct_smimea(ARGS_FREESTRUCT) { + dns_rdata_txt_t *txt = source; + + REQUIRE(source != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_smimea); + + generic_freestruct_tlsa(source); +} + +static inline isc_result_t +additionaldata_smimea(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_smimea); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_smimea(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_smimea); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_smimea(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_smimea); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_smimea(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_smimea); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_smimea(ARGS_COMPARE) { + return (compare_smimea(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_SMIMEA_53_C */ diff --git a/lib/dns/rdata/generic/smimea_53.h b/lib/dns/rdata/generic/smimea_53.h new file mode 100644 index 000000000000..9adc988a18bc --- /dev/null +++ b/lib/dns/rdata/generic/smimea_53.h @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_SMIMEA_53_H +#define GENERIC_SMIMEA_53_H 1 + +typedef struct dns_rdata_tlsa dns_rdata_smimea_t; + +#endif /* GENERIC_SMIMEA_53_H */ diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index b407813811a4..ec26a3d5f5eb 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -39,7 +39,8 @@ fromtext_soa(ARGS_FROMTEXT) { UNUSED(rdclass); UNUSED(callbacks); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; for (i = 0; i < 2; i++) { RETERR(isc_lex_getmastertoken(lexer, &token, diff --git a/lib/dns/rdata/generic/spf_99.c b/lib/dns/rdata/generic/spf_99.c index 8ad4f02b9af4..2fa1174d4237 100644 --- a/lib/dns/rdata/generic/spf_99.c +++ b/lib/dns/rdata/generic/spf_99.c @@ -26,8 +26,6 @@ static inline isc_result_t fromtext_spf(ARGS_FROMTEXT) { - isc_token_t token; - int strings; REQUIRE(type == dns_rdatatype_spf); @@ -37,44 +35,22 @@ fromtext_spf(ARGS_FROMTEXT) { UNUSED(options); UNUSED(callbacks); - strings = 0; - for (;;) { - RETERR(isc_lex_getmastertoken(lexer, &token, - isc_tokentype_qstring, - ISC_TRUE)); - if (token.type != isc_tokentype_qstring && - token.type != isc_tokentype_string) - break; - RETTOK(txt_fromtext(&token.value.as_textregion, target)); - strings++; - } - /* Let upper layer handle eol/eof. */ - isc_lex_ungettoken(lexer, &token); - return (strings == 0 ? ISC_R_UNEXPECTEDEND : ISC_R_SUCCESS); + return (generic_fromtext_txt(rdclass, type, lexer, origin, options, + target, callbacks)); } static inline isc_result_t totext_spf(ARGS_TOTEXT) { - isc_region_t region; UNUSED(tctx); REQUIRE(rdata->type == dns_rdatatype_spf); - dns_rdata_toregion(rdata, ®ion); - - while (region.length > 0) { - RETERR(txt_totext(®ion, ISC_TRUE, target)); - if (region.length > 0) - RETERR(str_totext(" ", target)); - } - - return (ISC_R_SUCCESS); + return (generic_totext_txt(rdata, tctx, target)); } static inline isc_result_t fromwire_spf(ARGS_FROMWIRE) { - isc_result_t result; REQUIRE(type == dns_rdatatype_spf); @@ -83,29 +59,18 @@ fromwire_spf(ARGS_FROMWIRE) { UNUSED(rdclass); UNUSED(options); - do { - result = txt_fromwire(source, target); - if (result != ISC_R_SUCCESS) - return (result); - } while (!buffer_empty(source)); - return (ISC_R_SUCCESS); + return (generic_fromwire_txt(rdclass, type, source, dctx, options, + target)); } static inline isc_result_t towire_spf(ARGS_TOWIRE) { - isc_region_t region; REQUIRE(rdata->type == dns_rdatatype_spf); UNUSED(cctx); - isc_buffer_availableregion(target, ®ion); - if (region.length < rdata->length) - return (ISC_R_NOSPACE); - - memmove(region.base, rdata->data, rdata->length); - isc_buffer_add(target, rdata->length); - return (ISC_R_SUCCESS); + return (mem_tobuffer(target, rdata->data, rdata->length)); } static inline int @@ -124,53 +89,24 @@ compare_spf(ARGS_COMPARE) { static inline isc_result_t fromstruct_spf(ARGS_FROMSTRUCT) { - dns_rdata_spf_t *txt = source; - isc_region_t region; - isc_uint8_t length; REQUIRE(type == dns_rdatatype_spf); - REQUIRE(source != NULL); - REQUIRE(txt->common.rdtype == type); - REQUIRE(txt->common.rdclass == rdclass); - REQUIRE(txt->txt != NULL && txt->txt_len != 0); - UNUSED(type); - UNUSED(rdclass); - - region.base = txt->txt; - region.length = txt->txt_len; - while (region.length > 0) { - length = uint8_fromregion(®ion); - isc_region_consume(®ion, 1); - if (region.length <= length) - return (ISC_R_UNEXPECTEDEND); - isc_region_consume(®ion, length); - } - - return (mem_tobuffer(target, txt->txt, txt->txt_len)); + return (generic_fromstruct_txt(rdclass, type, source, target)); } static inline isc_result_t tostruct_spf(ARGS_TOSTRUCT) { - dns_rdata_spf_t *txt = target; - isc_region_t r; + dns_rdata_spf_t *spf = target; REQUIRE(rdata->type == dns_rdatatype_spf); REQUIRE(target != NULL); - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); + spf->common.rdclass = rdata->rdclass; + spf->common.rdtype = rdata->type; + ISC_LINK_INIT(&spf->common, link); - dns_rdata_toregion(rdata, &r); - txt->txt_len = r.length; - txt->txt = mem_maybedup(mctx, r.base, r.length); - if (txt->txt == NULL) - return (ISC_R_NOMEMORY); - - txt->offset = 0; - txt->mctx = mctx; - return (ISC_R_SUCCESS); + return (generic_tostruct_txt(rdata, target, mctx)); } static inline void @@ -180,12 +116,7 @@ freestruct_spf(ARGS_FREESTRUCT) { REQUIRE(source != NULL); REQUIRE(txt->common.rdtype == dns_rdatatype_spf); - if (txt->mctx == NULL) - return; - - if (txt->txt != NULL) - isc_mem_free(txt->mctx, txt->txt); - txt->mctx = NULL; + generic_freestruct_txt(source); } static inline isc_result_t diff --git a/lib/dns/rdata/generic/ta_32768.c b/lib/dns/rdata/generic/ta_32768.c new file mode 100644 index 000000000000..d802211f37fc --- /dev/null +++ b/lib/dns/rdata/generic/ta_32768.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +/* http://www.watson.org/~weiler/INI1999-19.pdf */ + +#ifndef RDATA_GENERIC_TA_32768_C +#define RDATA_GENERIC_TA_32768_C + +#define RRTYPE_TA_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_ta(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_ta); + + return (generic_fromtext_ds(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_ta(ARGS_TOTEXT) { + + REQUIRE(rdata->type == dns_rdatatype_ta); + + return (generic_totext_ds(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_ta(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_ta); + + return (generic_fromwire_ds(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t +towire_ta(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata->type == dns_rdatatype_ta); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_ta(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_ta); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_ta(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_ta); + + return (generic_fromstruct_ds(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_ta(ARGS_TOSTRUCT) { + dns_rdata_ds_t *ds = target; + + REQUIRE(rdata->type == dns_rdatatype_ta); + + /* + * Checked by generic_tostruct_ds(). + */ + ds->common.rdclass = rdata->rdclass; + ds->common.rdtype = rdata->type; + ISC_LINK_INIT(&ds->common, link); + + return (generic_tostruct_ds(rdata, target, mctx)); +} + +static inline void +freestruct_ta(ARGS_FREESTRUCT) { + dns_rdata_ta_t *ds = source; + + REQUIRE(ds != NULL); + REQUIRE(ds->common.rdtype == dns_rdatatype_ta); + + if (ds->mctx == NULL) + return; + + if (ds->digest != NULL) + isc_mem_free(ds->mctx, ds->digest); + ds->mctx = NULL; +} + +static inline isc_result_t +additionaldata_ta(ARGS_ADDLDATA) { + REQUIRE(rdata->type == dns_rdatatype_ta); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_ta(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_ta); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_ta(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_ta); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_ta(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_ta); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_ta(ARGS_COMPARE) { + return (compare_ta(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_TA_32768_C */ diff --git a/lib/dns/rdata/generic/ta_32768.h b/lib/dns/rdata/generic/ta_32768.h new file mode 100644 index 000000000000..3e50ed05c0ed --- /dev/null +++ b/lib/dns/rdata/generic/ta_32768.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef GENERIC_TA_32768_H +#define GENERIC_TA_32768_H 1 + +/* + * TA records are identical to DS records. + */ +typedef struct dns_rdata_ds dns_rdata_ta_t; + +#endif /* GENERIC_TA_32768_H */ diff --git a/lib/dns/rdata/generic/talink_58.c b/lib/dns/rdata/generic/talink_58.c new file mode 100644 index 000000000000..db4662469042 --- /dev/null +++ b/lib/dns/rdata/generic/talink_58.c @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +#ifndef RDATA_GENERIC_TALINK_58_C +#define RDATA_GENERIC_TALINK_58_C + +#define RRTYPE_TALINK_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_talink(ARGS_FROMTEXT) { + isc_token_t token; + dns_name_t name; + isc_buffer_t buffer; + int i; + + REQUIRE(type == dns_rdatatype_talink); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(callbacks); + + if (origin == NULL) + origin = dns_rootname; + + for (i = 0; i < 2; i++) { + RETERR(isc_lex_getmastertoken(lexer, &token, + isc_tokentype_string, + ISC_FALSE)); + + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region); + RETTOK(dns_name_fromtext(&name, &buffer, origin, + options, target)); + } + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +totext_talink(ARGS_TOTEXT) { + isc_region_t dregion; + dns_name_t prev; + dns_name_t next; + dns_name_t prefix; + isc_boolean_t sub; + + REQUIRE(rdata->type == dns_rdatatype_talink); + REQUIRE(rdata->length != 0); + + dns_name_init(&prev, NULL); + dns_name_init(&next, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, &dregion); + + dns_name_fromregion(&prev, &dregion); + isc_region_consume(&dregion, name_length(&prev)); + + dns_name_fromregion(&next, &dregion); + isc_region_consume(&dregion, name_length(&next)); + + sub = name_prefix(&prev, tctx->origin, &prefix); + RETERR(dns_name_totext(&prefix, sub, target)); + + RETERR(str_totext(" ", target)); + + sub = name_prefix(&next, tctx->origin, &prefix); + return(dns_name_totext(&prefix, sub, target)); +} + +static inline isc_result_t +fromwire_talink(ARGS_FROMWIRE) { + dns_name_t prev; + dns_name_t next; + + REQUIRE(type == dns_rdatatype_talink); + + UNUSED(type); + UNUSED(rdclass); + + dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); + + dns_name_init(&prev, NULL); + dns_name_init(&next, NULL); + + RETERR(dns_name_fromwire(&prev, source, dctx, options, target)); + return(dns_name_fromwire(&next, source, dctx, options, target)); +} + +static inline isc_result_t +towire_talink(ARGS_TOWIRE) { + isc_region_t sregion; + dns_name_t prev; + dns_name_t next; + dns_offsets_t moffsets; + dns_offsets_t roffsets; + + REQUIRE(rdata->type == dns_rdatatype_talink); + REQUIRE(rdata->length != 0); + + dns_compress_setmethods(cctx, DNS_COMPRESS_NONE); + + dns_name_init(&prev, moffsets); + dns_name_init(&next, roffsets); + + dns_rdata_toregion(rdata, &sregion); + + dns_name_fromregion(&prev, &sregion); + isc_region_consume(&sregion, name_length(&prev)); + RETERR(dns_name_towire(&prev, cctx, target)); + + dns_name_fromregion(&next, &sregion); + isc_region_consume(&sregion, name_length(&next)); + return(dns_name_towire(&next, cctx, target)); +} + +static inline int +compare_talink(ARGS_COMPARE) { + isc_region_t region1; + isc_region_t region2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == dns_rdatatype_talink); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + return (isc_region_compare(®ion1, ®ion2)); +} + +static inline isc_result_t +fromstruct_talink(ARGS_FROMSTRUCT) { + dns_rdata_talink_t *talink = source; + isc_region_t region; + + REQUIRE(type == dns_rdatatype_talink); + REQUIRE(source != NULL); + REQUIRE(talink->common.rdtype == type); + REQUIRE(talink->common.rdclass == rdclass); + + UNUSED(type); + UNUSED(rdclass); + + dns_name_toregion(&talink->prev, ®ion); + RETERR(isc_buffer_copyregion(target, ®ion)); + dns_name_toregion(&talink->next, ®ion); + return(isc_buffer_copyregion(target, ®ion)); +} + +static inline isc_result_t +tostruct_talink(ARGS_TOSTRUCT) { + isc_region_t region; + dns_rdata_talink_t *talink = target; + dns_name_t name; + isc_result_t result; + + REQUIRE(rdata->type == dns_rdatatype_talink); + REQUIRE(target != NULL); + REQUIRE(rdata->length != 0); + + talink->common.rdclass = rdata->rdclass; + talink->common.rdtype = rdata->type; + ISC_LINK_INIT(&talink->common, link); + + dns_rdata_toregion(rdata, ®ion); + + dns_name_init(&name, NULL); + dns_name_fromregion(&name, ®ion); + isc_region_consume(®ion, name_length(&name)); + dns_name_init(&talink->prev, NULL); + RETERR(name_duporclone(&name, mctx, &talink->prev)); + + dns_name_fromregion(&name, ®ion); + isc_region_consume(®ion, name_length(&name)); + dns_name_init(&talink->next, NULL); + result = name_duporclone(&name, mctx, &talink->next); + if (result != ISC_R_SUCCESS) + goto cleanup; + + talink->mctx = mctx; + return (ISC_R_SUCCESS); + + cleanup: + if (mctx != NULL) + dns_name_free(&talink->prev, mctx); + return (ISC_R_NOMEMORY); +} + +static inline void +freestruct_talink(ARGS_FREESTRUCT) { + dns_rdata_talink_t *talink = source; + + REQUIRE(source != NULL); + REQUIRE(talink->common.rdtype == dns_rdatatype_talink); + + if (talink->mctx == NULL) + return; + + dns_name_free(&talink->prev, talink->mctx); + dns_name_free(&talink->next, talink->mctx); + talink->mctx = NULL; +} + +static inline isc_result_t +additionaldata_talink(ARGS_ADDLDATA) { + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + REQUIRE(rdata->type == dns_rdatatype_talink); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_talink(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == dns_rdatatype_talink); + + dns_rdata_toregion(rdata, &r); + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_talink(ARGS_CHECKOWNER) { + + REQUIRE(type == dns_rdatatype_talink); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_talink(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == dns_rdatatype_talink); + + UNUSED(bad); + UNUSED(owner); + + return (ISC_TRUE); +} + +static inline int +casecompare_talink(ARGS_COMPARE) { + return (compare_talink(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_TALINK_58_C */ diff --git a/lib/dns/rdata/generic/talink_58.h b/lib/dns/rdata/generic/talink_58.h new file mode 100644 index 000000000000..6e52d381818f --- /dev/null +++ b/lib/dns/rdata/generic/talink_58.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or 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. + */ + +/* http://www.iana.org/assignments/dns-parameters/TALINK/talink-completed-template */ + +#ifndef GENERIC_TALINK_58_H +#define GENERIC_TALINK_58_H 1 + +typedef struct dns_rdata_talink { + dns_rdatacommon_t common; + isc_mem_t *mctx; + dns_name_t prev; + dns_name_t next; +} dns_rdata_talink_t; + +#endif /* GENERIC_TALINK_58_H */ diff --git a/lib/dns/rdata/generic/tkey_249.c b/lib/dns/rdata/generic/tkey_249.c index e87b88065c97..3cf702383f2f 100644 --- a/lib/dns/rdata/generic/tkey_249.c +++ b/lib/dns/rdata/generic/tkey_249.c @@ -50,7 +50,8 @@ fromtext_tkey(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); diff --git a/lib/dns/rdata/generic/tlsa_52.c b/lib/dns/rdata/generic/tlsa_52.c index d09a5289a805..cbb73775ebe2 100644 --- a/lib/dns/rdata/generic/tlsa_52.c +++ b/lib/dns/rdata/generic/tlsa_52.c @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /* rfc6698.txt */ #ifndef RDATA_GENERIC_TLSA_52_C @@ -24,11 +22,9 @@ #define RRTYPE_TLSA_ATTRIBUTES 0 static inline isc_result_t -fromtext_tlsa(ARGS_FROMTEXT) { +generic_fromtext_tlsa(ARGS_FROMTEXT) { isc_token_t token; - REQUIRE(type == dns_rdatatype_tlsa); - UNUSED(type); UNUSED(rdclass); UNUSED(origin); @@ -69,12 +65,11 @@ fromtext_tlsa(ARGS_FROMTEXT) { } static inline isc_result_t -totext_tlsa(ARGS_TOTEXT) { +generic_totext_tlsa(ARGS_TOTEXT) { isc_region_t sr; char buf[sizeof("64000 ")]; unsigned int n; - REQUIRE(rdata->type == dns_rdatatype_tlsa); REQUIRE(rdata->length != 0); UNUSED(tctx); @@ -122,11 +117,9 @@ totext_tlsa(ARGS_TOTEXT) { } static inline isc_result_t -fromwire_tlsa(ARGS_FROMWIRE) { +generic_fromwire_tlsa(ARGS_FROMWIRE) { isc_region_t sr; - REQUIRE(type == dns_rdatatype_tlsa); - UNUSED(type); UNUSED(rdclass); UNUSED(dctx); @@ -142,6 +135,32 @@ fromwire_tlsa(ARGS_FROMWIRE) { } static inline isc_result_t +fromtext_tlsa(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_tlsa); + + return (generic_fromtext_tlsa(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_tlsa(ARGS_TOTEXT) { + + REQUIRE(rdata->type == dns_rdatatype_tlsa); + + return (generic_totext_tlsa(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_tlsa(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_tlsa); + + return (generic_fromwire_tlsa(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t towire_tlsa(ARGS_TOWIRE) { isc_region_t sr; @@ -171,10 +190,9 @@ compare_tlsa(ARGS_COMPARE) { } static inline isc_result_t -fromstruct_tlsa(ARGS_FROMSTRUCT) { +generic_fromstruct_tlsa(ARGS_FROMSTRUCT) { dns_rdata_tlsa_t *tlsa = source; - REQUIRE(type == dns_rdatatype_tlsa); REQUIRE(source != NULL); REQUIRE(tlsa->common.rdtype == type); REQUIRE(tlsa->common.rdclass == rdclass); @@ -190,11 +208,10 @@ fromstruct_tlsa(ARGS_FROMSTRUCT) { } static inline isc_result_t -tostruct_tlsa(ARGS_TOSTRUCT) { +generic_tostruct_tlsa(ARGS_TOSTRUCT) { dns_rdata_tlsa_t *tlsa = target; isc_region_t region; - REQUIRE(rdata->type == dns_rdatatype_tlsa); REQUIRE(target != NULL); REQUIRE(rdata->length != 0); @@ -221,11 +238,10 @@ tostruct_tlsa(ARGS_TOSTRUCT) { } static inline void -freestruct_tlsa(ARGS_FREESTRUCT) { +generic_freestruct_tlsa(ARGS_FREESTRUCT) { dns_rdata_tlsa_t *tlsa = source; REQUIRE(tlsa != NULL); - REQUIRE(tlsa->common.rdtype == dns_rdatatype_tlsa); if (tlsa->mctx == NULL) return; @@ -236,6 +252,38 @@ freestruct_tlsa(ARGS_FREESTRUCT) { } static inline isc_result_t +fromstruct_tlsa(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_tlsa); + + return (generic_fromstruct_tlsa(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_tlsa(ARGS_TOSTRUCT) { + dns_rdata_txt_t *txt = target; + + REQUIRE(rdata->type == dns_rdatatype_tlsa); + REQUIRE(target != NULL); + + txt->common.rdclass = rdata->rdclass; + txt->common.rdtype = rdata->type; + ISC_LINK_INIT(&txt->common, link); + + return (generic_tostruct_tlsa(rdata, target, mctx)); +} + +static inline void +freestruct_tlsa(ARGS_FREESTRUCT) { + dns_rdata_txt_t *txt = source; + + REQUIRE(source != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_tlsa); + + generic_freestruct_tlsa(source); +} + +static inline isc_result_t additionaldata_tlsa(ARGS_ADDLDATA) { REQUIRE(rdata->type == dns_rdatatype_tlsa); diff --git a/lib/dns/rdata/generic/txt_16.c b/lib/dns/rdata/generic/txt_16.c index aa7c3a0ab138..2ebd46c3169c 100644 --- a/lib/dns/rdata/generic/txt_16.c +++ b/lib/dns/rdata/generic/txt_16.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: txt_16.c,v 1.47 2009/12/04 22:06:37 tbox Exp $ */ - /* Reviewed: Thu Mar 16 15:40:00 PST 2000 by bwelling */ #ifndef RDATA_GENERIC_TXT_16_C @@ -25,12 +23,10 @@ #define RRTYPE_TXT_ATTRIBUTES (0) static inline isc_result_t -fromtext_txt(ARGS_FROMTEXT) { +generic_fromtext_txt(ARGS_FROMTEXT) { isc_token_t token; int strings; - REQUIRE(type == dns_rdatatype_txt); - UNUSED(type); UNUSED(rdclass); UNUSED(origin); @@ -61,13 +57,11 @@ fromtext_txt(ARGS_FROMTEXT) { } static inline isc_result_t -totext_txt(ARGS_TOTEXT) { +generic_totext_txt(ARGS_TOTEXT) { isc_region_t region; UNUSED(tctx); - REQUIRE(rdata->type == dns_rdatatype_txt); - dns_rdata_toregion(rdata, ®ion); while (region.length > 0) { @@ -80,11 +74,9 @@ totext_txt(ARGS_TOTEXT) { } static inline isc_result_t -fromwire_txt(ARGS_FROMWIRE) { +generic_fromwire_txt(ARGS_FROMWIRE) { isc_result_t result; - REQUIRE(type == dns_rdatatype_txt); - UNUSED(type); UNUSED(dctx); UNUSED(rdclass); @@ -99,20 +91,39 @@ fromwire_txt(ARGS_FROMWIRE) { } static inline isc_result_t +fromtext_txt(ARGS_FROMTEXT) { + + REQUIRE(type == dns_rdatatype_txt); + + return (generic_fromtext_txt(rdclass, type, lexer, origin, options, + target, callbacks)); +} + +static inline isc_result_t +totext_txt(ARGS_TOTEXT) { + + REQUIRE(rdata->type == dns_rdatatype_txt); + + return (generic_totext_txt(rdata, tctx, target)); +} + +static inline isc_result_t +fromwire_txt(ARGS_FROMWIRE) { + + REQUIRE(type == dns_rdatatype_txt); + + return (generic_fromwire_txt(rdclass, type, source, dctx, options, + target)); +} + +static inline isc_result_t towire_txt(ARGS_TOWIRE) { - isc_region_t region; REQUIRE(rdata->type == dns_rdatatype_txt); UNUSED(cctx); - isc_buffer_availableregion(target, ®ion); - if (region.length < rdata->length) - return (ISC_R_NOSPACE); - - memmove(region.base, rdata->data, rdata->length); - isc_buffer_add(target, rdata->length); - return (ISC_R_SUCCESS); + return (mem_tobuffer(target, rdata->data, rdata->length)); } static inline int @@ -130,12 +141,11 @@ compare_txt(ARGS_COMPARE) { } static inline isc_result_t -fromstruct_txt(ARGS_FROMSTRUCT) { +generic_fromstruct_txt(ARGS_FROMSTRUCT) { dns_rdata_txt_t *txt = source; isc_region_t region; isc_uint8_t length; - REQUIRE(type == dns_rdatatype_txt); REQUIRE(source != NULL); REQUIRE(txt->common.rdtype == type); REQUIRE(txt->common.rdclass == rdclass); @@ -158,16 +168,14 @@ fromstruct_txt(ARGS_FROMSTRUCT) { } static inline isc_result_t -tostruct_txt(ARGS_TOSTRUCT) { +generic_tostruct_txt(ARGS_TOSTRUCT) { dns_rdata_txt_t *txt = target; isc_region_t r; - REQUIRE(rdata->type == dns_rdatatype_txt); REQUIRE(target != NULL); - - txt->common.rdclass = rdata->rdclass; - txt->common.rdtype = rdata->type; - ISC_LINK_INIT(&txt->common, link); + REQUIRE(txt->common.rdclass == rdata->rdclass); + REQUIRE(txt->common.rdtype == rdata->type); + REQUIRE(!ISC_LINK_LINKED(&txt->common, link)); dns_rdata_toregion(rdata, &r); txt->txt_len = r.length; @@ -181,11 +189,10 @@ tostruct_txt(ARGS_TOSTRUCT) { } static inline void -freestruct_txt(ARGS_FREESTRUCT) { +generic_freestruct_txt(ARGS_FREESTRUCT) { dns_rdata_txt_t *txt = source; REQUIRE(source != NULL); - REQUIRE(txt->common.rdtype == dns_rdatatype_txt); if (txt->mctx == NULL) return; @@ -196,6 +203,38 @@ freestruct_txt(ARGS_FREESTRUCT) { } static inline isc_result_t +fromstruct_txt(ARGS_FROMSTRUCT) { + + REQUIRE(type == dns_rdatatype_txt); + + return (generic_fromstruct_txt(rdclass, type, source, target)); +} + +static inline isc_result_t +tostruct_txt(ARGS_TOSTRUCT) { + dns_rdata_txt_t *txt = target; + + REQUIRE(rdata->type == dns_rdatatype_txt); + REQUIRE(target != NULL); + + txt->common.rdclass = rdata->rdclass; + txt->common.rdtype = rdata->type; + ISC_LINK_INIT(&txt->common, link); + + return (generic_tostruct_txt(rdata, target, mctx)); +} + +static inline void +freestruct_txt(ARGS_FREESTRUCT) { + dns_rdata_txt_t *txt = source; + + REQUIRE(source != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_txt); + + generic_freestruct_txt(source); +} + +static inline isc_result_t additionaldata_txt(ARGS_ADDLDATA) { REQUIRE(rdata->type == dns_rdatatype_txt); @@ -247,11 +286,10 @@ casecompare_txt(ARGS_COMPARE) { return (compare_txt(rdata1, rdata2)); } -isc_result_t -dns_rdata_txt_first(dns_rdata_txt_t *txt) { +static isc_result_t +generic_txt_first(dns_rdata_txt_t *txt) { REQUIRE(txt != NULL); - REQUIRE(txt->common.rdtype == dns_rdatatype_txt); REQUIRE(txt->txt != NULL || txt->txt_len == 0); if (txt->txt_len == 0) @@ -261,13 +299,12 @@ dns_rdata_txt_first(dns_rdata_txt_t *txt) { return (ISC_R_SUCCESS); } -isc_result_t -dns_rdata_txt_next(dns_rdata_txt_t *txt) { +static isc_result_t +generic_txt_next(dns_rdata_txt_t *txt) { isc_region_t r; isc_uint8_t length; REQUIRE(txt != NULL); - REQUIRE(txt->common.rdtype == dns_rdatatype_txt); REQUIRE(txt->txt != NULL && txt->txt_len != 0); INSIST(txt->offset + 1 <= txt->txt_len); @@ -281,13 +318,12 @@ dns_rdata_txt_next(dns_rdata_txt_t *txt) { return (ISC_R_SUCCESS); } -isc_result_t -dns_rdata_txt_current(dns_rdata_txt_t *txt, dns_rdata_txt_string_t *string) { +static isc_result_t +generic_txt_current(dns_rdata_txt_t *txt, dns_rdata_txt_string_t *string) { isc_region_t r; REQUIRE(txt != NULL); REQUIRE(string != NULL); - REQUIRE(txt->common.rdtype == dns_rdatatype_txt); REQUIRE(txt->txt != NULL); REQUIRE(txt->offset < txt->txt_len); @@ -302,4 +338,31 @@ dns_rdata_txt_current(dns_rdata_txt_t *txt, dns_rdata_txt_string_t *string) { return (ISC_R_SUCCESS); } + +isc_result_t +dns_rdata_txt_first(dns_rdata_txt_t *txt) { + + REQUIRE(txt != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_txt); + + return (generic_txt_first(txt)); +} + +isc_result_t +dns_rdata_txt_next(dns_rdata_txt_t *txt) { + + REQUIRE(txt != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_txt); + + return (generic_txt_next(txt)); +} + +isc_result_t +dns_rdata_txt_current(dns_rdata_txt_t *txt, dns_rdata_txt_string_t *string) { + + REQUIRE(txt != NULL); + REQUIRE(txt->common.rdtype == dns_rdatatype_txt); + + return (generic_txt_current(txt, string)); +} #endif /* RDATA_GENERIC_TXT_16_C */ diff --git a/lib/dns/rdata/in_1/a6_38.c b/lib/dns/rdata/in_1/a6_38.c index 05a21ade89d2..d8b76e54b684 100644 --- a/lib/dns/rdata/in_1/a6_38.c +++ b/lib/dns/rdata/in_1/a6_38.c @@ -83,7 +83,8 @@ fromtext_in_a6(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/rdata/in_1/kx_36.c b/lib/dns/rdata/in_1/kx_36.c index 8b911eb07c2a..9a4130571da2 100644 --- a/lib/dns/rdata/in_1/kx_36.c +++ b/lib/dns/rdata/in_1/kx_36.c @@ -49,7 +49,8 @@ fromtext_in_kx(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/in_1/nsap-ptr_23.c b/lib/dns/rdata/in_1/nsap-ptr_23.c index d8b43f2edca4..764a85c091a9 100644 --- a/lib/dns/rdata/in_1/nsap-ptr_23.c +++ b/lib/dns/rdata/in_1/nsap-ptr_23.c @@ -44,7 +44,8 @@ fromtext_in_nsap_ptr(ARGS_FROMTEXT) { dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/in_1/px_26.c b/lib/dns/rdata/in_1/px_26.c index 4cf0ae418ac0..11d145ae2a86 100644 --- a/lib/dns/rdata/in_1/px_26.c +++ b/lib/dns/rdata/in_1/px_26.c @@ -39,6 +39,9 @@ fromtext_in_px(ARGS_FROMTEXT) { UNUSED(rdclass); UNUSED(callbacks); + if (origin == NULL) + origin = dns_rootname; + /* * Preference. */ @@ -55,7 +58,6 @@ fromtext_in_px(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); /* @@ -65,7 +67,6 @@ fromtext_in_px(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); return (ISC_R_SUCCESS); } diff --git a/lib/dns/rdata/in_1/srv_33.c b/lib/dns/rdata/in_1/srv_33.c index b97d410272f6..15b29d544e8f 100644 --- a/lib/dns/rdata/in_1/srv_33.c +++ b/lib/dns/rdata/in_1/srv_33.c @@ -74,7 +74,8 @@ fromtext_in_srv(ARGS_FROMTEXT) { ISC_FALSE)); dns_name_init(&name, NULL); buffer_fromregion(&buffer, &token.value.as_region); - origin = (origin != NULL) ? origin : dns_rootname; + if (origin == NULL) + origin = dns_rootname; RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target)); ok = ISC_TRUE; if ((options & DNS_RDATA_CHECKNAMES) != 0) diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 30f9be7da52b..5f75bc08396e 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -103,6 +103,13 @@ "fctx %p(%s): [result: %s] %s %s", \ fctx, fctx->info, \ isc_result_totext(res), (m1), (m2)) +#define FCTXTRACE5(m1, m2, v) \ + isc_log_write(dns_lctx, \ + DNS_LOGCATEGORY_RESOLVER, \ + DNS_LOGMODULE_RESOLVER, \ + ISC_LOG_DEBUG(3), \ + "fctx %p(%s): %s %s%u", \ + fctx, fctx->info, (m1), (m2), (v)) #define FTRACE(m) isc_log_write(dns_lctx, \ DNS_LOGCATEGORY_RESOLVER, \ DNS_LOGMODULE_RESOLVER, \ @@ -125,6 +132,8 @@ #define FCTXTRACE3(m1, res) do { UNUSED(m1); UNUSED(res); } while (0) #define FCTXTRACE4(m1, m2, res) \ do { UNUSED(m1); UNUSED(m2); UNUSED(res); } while (0) +#define FCTXTRACE5(m1, m2, v) \ + do { UNUSED(m1); UNUSED(m2); UNUSED(v); } while (0) #define FTRACE(m) do { UNUSED(m); } while (0) #define QTRACE(m) do { UNUSED(m); } while (0) #endif /* WANT_QUERYTRACE */ @@ -866,7 +875,8 @@ resquery_destroy(resquery_t **queryp) { static void fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, - isc_time_t *finish, isc_boolean_t no_response) + isc_time_t *finish, isc_boolean_t no_response, + isc_boolean_t age_untried) { fetchctx_t *fctx; resquery_t *query; @@ -948,14 +958,14 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, * Age RTTs of servers not tried. */ isc_stdtime_get(&now); - if (finish != NULL) + if (finish != NULL || age_untried) for (addrinfo = ISC_LIST_HEAD(fctx->forwaddrs); addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) if (UNMARKED(addrinfo)) dns_adb_agesrtt(fctx->adb, addrinfo, now); - if (finish != NULL && TRIEDFIND(fctx)) + if ((finish != NULL || age_untried) && TRIEDFIND(fctx)) for (find = ISC_LIST_HEAD(fctx->finds); find != NULL; find = ISC_LIST_NEXT(find, publink)) @@ -966,7 +976,7 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, dns_adb_agesrtt(fctx->adb, addrinfo, now); - if (finish != NULL && TRIEDALT(fctx)) { + if ((finish != NULL || age_untried) && TRIEDALT(fctx)) { for (addrinfo = ISC_LIST_HEAD(fctx->altaddrs); addrinfo != NULL; addrinfo = ISC_LIST_NEXT(addrinfo, publink)) @@ -1037,7 +1047,9 @@ fctx_cancelquery(resquery_t **queryp, dns_dispatchevent_t **deventp, } static void -fctx_cancelqueries(fetchctx_t *fctx, isc_boolean_t no_response) { +fctx_cancelqueries(fetchctx_t *fctx, isc_boolean_t no_response, + isc_boolean_t age_untried) +{ resquery_t *query, *next_query; FCTXTRACE("cancelqueries"); @@ -1046,7 +1058,8 @@ fctx_cancelqueries(fetchctx_t *fctx, isc_boolean_t no_response) { query != NULL; query = next_query) { next_query = ISC_LIST_NEXT(query, link); - fctx_cancelquery(&query, NULL, NULL, no_response); + fctx_cancelquery(&query, NULL, NULL, no_response, + age_untried); } } @@ -1113,9 +1126,11 @@ fctx_cleanupaltaddrs(fetchctx_t *fctx) { } static inline void -fctx_stopeverything(fetchctx_t *fctx, isc_boolean_t no_response) { +fctx_stopeverything(fetchctx_t *fctx, isc_boolean_t no_response, + isc_boolean_t age_untried) +{ FCTXTRACE("stopeverything"); - fctx_cancelqueries(fctx, no_response); + fctx_cancelqueries(fctx, no_response, age_untried); fctx_cleanupfinds(fctx); fctx_cleanupaltfinds(fctx); fctx_cleanupforwaddrs(fctx); @@ -1354,7 +1369,8 @@ log_edns(fetchctx_t *fctx) { static void fctx_done(fetchctx_t *fctx, isc_result_t result, int line) { dns_resolver_t *res; - isc_boolean_t no_response; + isc_boolean_t no_response = ISC_FALSE; + isc_boolean_t age_untried = ISC_FALSE; REQUIRE(line >= 0); @@ -1368,11 +1384,11 @@ fctx_done(fetchctx_t *fctx, isc_result_t result, int line) { */ log_edns(fctx); no_response = ISC_TRUE; - } else - no_response = ISC_FALSE; + } else if (result == ISC_R_TIMEDOUT) + age_untried = ISC_TRUE; fctx->reason = NULL; - fctx_stopeverything(fctx, no_response); + fctx_stopeverything(fctx, no_response, age_untried); LOCK(&res->buckets[fctx->bucketnum].lock); @@ -1422,7 +1438,8 @@ process_sendevent(resquery_t *query, isc_event_t *event) { */ add_bad(fctx, query->addrinfo, sevent->result, badns_unreachable); - fctx_cancelquery(&query, NULL, NULL, ISC_TRUE); + fctx_cancelquery(&query, NULL, NULL, ISC_TRUE, + ISC_FALSE); retry = ISC_TRUE; break; @@ -1431,7 +1448,8 @@ process_sendevent(resquery_t *query, isc_event_t *event) { "unexpected event result; responding", sevent->result); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, + ISC_FALSE); break; } } @@ -2327,7 +2345,8 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { FCTXTRACE("query canceled: idle timer failed; " "responding"); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, + ISC_FALSE); fctx_done(fctx, result, __LINE__); break; } @@ -2366,7 +2385,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { FCTXTRACE("query canceled: " "resquery_send() failed; responding"); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, ISC_FALSE); fctx_done(fctx, result, __LINE__); } break; @@ -2385,7 +2404,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { * No route to remote. */ isc_socket_detach(&query->tcpsocket); - fctx_cancelquery(&query, NULL, NULL, ISC_TRUE); + fctx_cancelquery(&query, NULL, NULL, ISC_TRUE, ISC_FALSE); retry = ISC_TRUE; break; @@ -2395,7 +2414,7 @@ resquery_connected(isc_task_t *task, isc_event_t *event) { sevent->result); isc_socket_detach(&query->tcpsocket); - fctx_cancelquery(&query, NULL, NULL, ISC_FALSE); + fctx_cancelquery(&query, NULL, NULL, ISC_FALSE, ISC_FALSE); break; } } @@ -2858,7 +2877,7 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { isc_boolean_t all_spilled = ISC_TRUE; #endif /* ENABLE_FETCHLIMIT */ - FCTXTRACE("getaddresses"); + FCTXTRACE5("getaddresses", "fctx->depth=", fctx->depth); /* * Don't pound on remote servers. (Failsafe!) @@ -2874,8 +2893,9 @@ fctx_getaddresses(fetchctx_t *fctx, isc_boolean_t badcache) { if (fctx->depth > res->maxdepth) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), - "too much NS indirection resolving '%s'", - fctx->info); + "too much NS indirection resolving '%s' " + "(depth=%u, maxdepth=%u)", + fctx->info, fctx->depth, res->maxdepth); return (DNS_R_SERVFAIL); } @@ -3172,6 +3192,9 @@ possibly_mark(fetchctx_t *fctx, dns_adbaddrinfo_t *addr) if (aborted) { addr->flags |= FCTX_ADDRINFO_MARK; msg = "ignoring blackholed / bogus server: "; + } else if (isc_sockaddr_isnetzero(sa)) { + addr->flags |= FCTX_ADDRINFO_MARK; + msg = "ignoring net zero address: "; } else if (isc_sockaddr_ismulticast(sa)) { addr->flags |= FCTX_ADDRINFO_MARK; msg = "ignoring multicast address: "; @@ -3346,7 +3369,7 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { unsigned int bucketnum; isc_boolean_t bucket_empty; - FCTXTRACE("try"); + FCTXTRACE5("try", "fctx->qc=", isc_counter_used(fctx->qc)); REQUIRE(!ADDRWAIT(fctx)); @@ -3356,8 +3379,10 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { if (isc_counter_used(fctx->qc) > res->maxqueries) { isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, DNS_LOGMODULE_RESOLVER, ISC_LOG_DEBUG(3), - "exceeded max queries resolving '%s'", - fctx->info); + "exceeded max queries resolving '%s' " + "(querycount=%u, maxqueries=%u)", + fctx->info, + isc_counter_used(fctx->qc), res->maxqueries); fctx_done(fctx, DNS_R_SERVFAIL, __LINE__); return; } @@ -3371,7 +3396,7 @@ fctx_try(fetchctx_t *fctx, isc_boolean_t retrying, isc_boolean_t badcache) { if (addrinfo == NULL) { /* We have no more addresses. Start over. */ - fctx_cancelqueries(fctx, ISC_TRUE); + fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); fctx_cleanupfinds(fctx); fctx_cleanupaltfinds(fctx); fctx_cleanupforwaddrs(fctx); @@ -3589,7 +3614,7 @@ fctx_timeout(isc_task_t *task, isc_event_t *event) { isc_time_compare(&tevent->due, &query->start) >= 0) { FCTXTRACE("query timed out; no response"); - fctx_cancelquery(&query, NULL, NULL, ISC_TRUE); + fctx_cancelquery(&query, NULL, NULL, ISC_TRUE, ISC_FALSE); } fctx->attributes &= ~FCTX_ATTR_ADDRWAIT; @@ -3683,7 +3708,7 @@ fctx_doshutdown(isc_task_t *task, isc_event_t *event) { * fetch. To avoid deadlock with the ADB, we must do this * before we lock the bucket lock. */ - fctx_stopeverything(fctx, ISC_FALSE); + fctx_stopeverything(fctx, ISC_FALSE, ISC_FALSE); LOCK(&res->buckets[bucketnum].lock); @@ -4025,13 +4050,12 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, &fctx->nameservers, NULL); if (result != ISC_R_SUCCESS) - goto cleanup_name; + goto cleanup_nameservers; result = dns_name_dup(domain, mctx, &fctx->domain); - if (result != ISC_R_SUCCESS) { - dns_rdataset_disassociate(&fctx->nameservers); - goto cleanup_name; - } + if (result != ISC_R_SUCCESS) + goto cleanup_nameservers; + fctx->ns_ttl = fctx->nameservers.ttl; fctx->ns_ttl_ok = ISC_TRUE; } else { @@ -4160,6 +4184,8 @@ fctx_create(dns_resolver_t *res, dns_name_t *name, dns_rdatatype_t type, cleanup_domain: if (dns_name_countlabels(&fctx->domain) > 0) dns_name_free(&fctx->domain, mctx); + + cleanup_nameservers: if (dns_rdataset_isassociated(&fctx->nameservers)) dns_rdataset_disassociate(&fctx->nameservers); @@ -7395,7 +7421,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { } } - dns_message_setclass(message, fctx->res->rdclass); + dns_message_setclass(message, res->rdclass); if ((options & DNS_FETCHOPT_TCP) == 0) dns_adb_plainresponse(fctx->adb, query->addrinfo); @@ -7472,7 +7498,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { */ log_packet(message, ISC_LOG_DEBUG(10), res->mctx); - if (message->rdclass != fctx->res->rdclass) { + if (message->rdclass != res->rdclass) { resend = ISC_TRUE; FCTXTRACE("bad class"); goto done; @@ -7945,7 +7971,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * * XXXRTH Don't cancel the query if waiting for validation? */ - fctx_cancelquery(&query, &devent, finish, no_response); + fctx_cancelquery(&query, &devent, finish, no_response, ISC_FALSE); if (keep_trying) { if (result == DNS_R_FORMERR) @@ -8016,7 +8042,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { fctx->ns_ttl = fctx->nameservers.ttl; fctx->ns_ttl_ok = ISC_TRUE; - fctx_cancelqueries(fctx, ISC_TRUE); + fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); fctx_cleanupfinds(fctx); fctx_cleanupaltfinds(fctx); fctx_cleanupforwaddrs(fctx); @@ -8049,7 +8075,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { * DNSSEC validator to validate the answer. */ FCTXTRACE("wait for validator"); - fctx_cancelqueries(fctx, ISC_TRUE); + fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); /* * We must not retransmit while the validator is working; * it has references to the current rmessage. @@ -8060,7 +8086,7 @@ resquery_response(isc_task_t *task, isc_event_t *event) { } else if (result == DNS_R_CHASEDSSERVERS) { unsigned int n; add_bad(fctx, addrinfo, result, broken_type); - fctx_cancelqueries(fctx, ISC_TRUE); + fctx_cancelqueries(fctx, ISC_TRUE, ISC_FALSE); fctx_cleanupfinds(fctx); fctx_cleanupforwaddrs(fctx); @@ -8586,6 +8612,7 @@ dns_resolver_prime(dns_resolver_t *res) { &res->primefetch); UNLOCK(&res->primelock); if (result != ISC_R_SUCCESS) { + isc_mem_put(res->mctx, rdataset, sizeof(*rdataset)); LOCK(&res->lock); INSIST(res->priming); res->priming = ISC_FALSE; diff --git a/lib/dns/rootns.c b/lib/dns/rootns.c index 97b5101200e2..d395855ea2c5 100644 --- a/lib/dns/rootns.c +++ b/lib/dns/rootns.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -79,7 +79,7 @@ static char root_ns[] = "K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129\n" "K.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7FD::1\n" "L.ROOT-SERVERS.NET. 3600000 IN A 199.7.83.42\n" -"L.ROOT-SERVERS.NET. 604800 IN AAAA 2001:500:3::42\n" +"L.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:9f::42\n" "M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33\n" "M.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:DC3::35\n"; diff --git a/lib/dns/sdlz.c b/lib/dns/sdlz.c index 3b245419d099..e70532021719 100644 --- a/lib/dns/sdlz.c +++ b/lib/dns/sdlz.c @@ -606,7 +606,7 @@ findnodeext(dns_db_t *db, dns_name_t *name, isc_boolean_t create, * if the host (namestr) was not found, try to lookup a * "wildcard" host. */ - if (result != ISC_R_SUCCESS && !create) + if (result == ISC_R_NOTFOUND && !create) result = sdlz->dlzimp->methods->lookup(zonestr, "*", sdlz->dlzimp->driverarg, sdlz->dbdata, node, @@ -614,7 +614,10 @@ findnodeext(dns_db_t *db, dns_name_t *name, isc_boolean_t create, MAYBE_UNLOCK(sdlz->dlzimp); - if (result != ISC_R_SUCCESS && !isorigin && !create) { + if (result == ISC_R_NOTFOUND && (isorigin || create)) + result = ISC_R_SUCCESS; + + if (result != ISC_R_SUCCESS) { destroynode(node); return (result); } @@ -879,10 +882,11 @@ findext(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, dns_name_getlabelsequence(name, nlabels - i, i, xname); result = findnodeext(db, xname, ISC_FALSE, methods, clientinfo, &node); - if (result != ISC_R_SUCCESS) { + if (result == ISC_R_NOTFOUND) { result = DNS_R_NXDOMAIN; continue; - } + } else if (result != ISC_R_SUCCESS) + break; /* * Look for a DNAME at the current label, unless this is diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 0b5440a67d80..0012bbff4464 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -987,7 +987,7 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key, dns_name_t *name, if (nonce != NULL) isc_buffer_usedregion(nonce, &r); else { - r.base = isc_mem_get(msg->mctx, 0); + r.base = NULL; r.length = 0; } tkey.error = 0; @@ -998,9 +998,6 @@ dns_tkey_builddhquery(dns_message_t *msg, dst_key_t *key, dns_name_t *name, RETERR(buildquery(msg, name, &tkey, ISC_FALSE)); - if (nonce == NULL) - isc_mem_put(msg->mctx, r.base, 0); - RETERR(dns_message_gettemprdata(msg, &rdata)); RETERR(isc_buffer_allocate(msg->mctx, &dynbuf, 1024)); RETERR(dst_key_todns(key, dynbuf)); @@ -1231,12 +1228,10 @@ dns_tkey_processdhresponse(dns_message_t *qmsg, dns_message_t *rmsg, if (nonce != NULL) isc_buffer_usedregion(nonce, &r2); else { - r2.base = isc_mem_get(rmsg->mctx, 0); + r2.base = NULL; r2.length = 0; } RETERR(compute_secret(shared, &r2, &r, &secret)); - if (nonce == NULL) - isc_mem_put(rmsg->mctx, r2.base, 0); isc_buffer_usedregion(&secret, &r); result = dns_tsigkey_create(tkeyname, &rtkey.algorithm, diff --git a/lib/dns/update.c b/lib/dns/update.c index 268e25047241..10910ca507fb 100644 --- a/lib/dns/update.c +++ b/lib/dns/update.c @@ -1360,7 +1360,7 @@ struct dns_update_state { unsigned int nkeys; isc_stdtime_t inception, expire; dns_ttl_t nsecttl; - isc_boolean_t check_ksk, keyset_kskonly; + isc_boolean_t check_ksk, keyset_kskonly, build_nsec3; enum { sign_updates, remove_orphaned, build_chain, process_nsec, sign_nsec, update_nsec3, process_nsec3, sign_nsec3 } state; }; @@ -1375,7 +1375,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_update_state_t mystate, *state; dns_difftuple_t *t, *next; - isc_boolean_t flag, build_nsec, build_nsec3; + isc_boolean_t flag, build_nsec; unsigned int i; isc_stdtime_t now; dns_rdata_soa_t soa; @@ -1404,6 +1404,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, dns_diff_init(diff->mctx, &state->nsec_mindiff); dns_diff_init(diff->mctx, &state->work); state->nkeys = 0; + state->build_nsec3 = ISC_FALSE; result = find_zone_keys(zone, db, newver, diff->mctx, DNS_MAXZONEKEYS, state->zone_keys, @@ -1568,7 +1569,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, * See if we need to build NSEC or NSEC3 chains. */ CHECK(dns_private_chains(db, newver, privatetype, &build_nsec, - &build_nsec3)); + &state->build_nsec3)); if (!build_nsec) { state->state = update_nsec3; goto next_state; @@ -1831,7 +1832,7 @@ dns_update_signaturesinc(dns_update_log_t *log, dns_zone_t *zone, dns_db_t *db, INSIST(ISC_LIST_EMPTY(state->nsec_diff.tuples)); INSIST(ISC_LIST_EMPTY(state->nsec_mindiff.tuples)); - if (!build_nsec3) { + if (!state->build_nsec3) { update_log(log, zone, ISC_LOG_DEBUG(3), "no NSEC3 chains to rebuild"); goto failure; diff --git a/lib/dns/view.c b/lib/dns/view.c index da1136c075ac..5876a4b9dfa5 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1846,14 +1846,29 @@ dns_view_untrust(dns_view_t *view, dns_name_t *keyname, isc_buffer_init(&buffer, data, sizeof(data)); dns_rdata_fromstruct(&rdata, dnskey->common.rdclass, dns_rdatatype_dnskey, dnskey, &buffer); + result = dns_dnssec_keyfromrdata(keyname, &rdata, mctx, &key); if (result != ISC_R_SUCCESS) return; + result = dns_view_getsecroots(view, &sr); if (result == ISC_R_SUCCESS) { - dns_keytable_deletekeynode(sr, key); + result = dns_keytable_deletekeynode(sr, key); + + /* + * If key was found in secroots, then it was a + * configured trust anchor, and we want to fail + * secure. If there are no other configured keys, + * then leave a null key so that we can't validate + * anymore. + */ + + if (result == ISC_R_SUCCESS) + dns_keytable_marksecure(sr, keyname); + dns_keytable_detach(&sr); } + dst_key_free(&key); } diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c index a2bc35dc8a55..aec238d3fc1a 100644 --- a/lib/dns/xfrin.c +++ b/lib/dns/xfrin.c @@ -292,6 +292,9 @@ axfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op, dns_difftuple_t *tuple = NULL; + if (rdata->rdclass != xfr->rdclass) + return(DNS_R_BADCLASS); + CHECK(dns_zone_checknames(xfr->zone, name, rdata)); CHECK(dns_difftuple_create(xfr->diff.mctx, op, name, ttl, rdata, &tuple)); @@ -377,8 +380,11 @@ ixfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata) { isc_result_t result; - dns_difftuple_t *tuple = NULL; + + if (rdata->rdclass != xfr->rdclass) + return(DNS_R_BADCLASS); + if (op == DNS_DIFFOP_ADD) CHECK(dns_zone_checknames(xfr->zone, name, rdata)); CHECK(dns_difftuple_create(xfr->diff.mctx, op, @@ -1224,10 +1230,17 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) { DNS_MESSAGEPARSE_PRESERVEORDER); if (result != ISC_R_SUCCESS || msg->rcode != dns_rcode_noerror || + msg->opcode != dns_opcode_query ||msg->rdclass != xfr->rdclass || (xfr->checkid && msg->id != xfr->id)) { - if (result == ISC_R_SUCCESS) + if (result == ISC_R_SUCCESS && msg->rcode != dns_rcode_noerror) result = ISC_RESULTCLASS_DNSRCODE + msg->rcode; /*XXX*/ - if (result == ISC_R_SUCCESS || result == DNS_R_NOERROR) + else if (result == ISC_R_SUCCESS && + msg->opcode != dns_opcode_query) + result = DNS_R_UNEXPECTEDOPCODE; + else if (result == ISC_R_SUCCESS && + msg->rdclass != xfr->rdclass) + result = DNS_R_BADCLASS; + else if (result == ISC_R_SUCCESS || result == DNS_R_NOERROR) result = DNS_R_UNEXPECTEDID; if (xfr->reqtype == dns_rdatatype_axfr || xfr->reqtype == dns_rdatatype_soa) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index d334bebc436c..490248a68910 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1052,6 +1052,8 @@ zone_free(dns_zone_t *zone) { isc_task_detach(&zone->task); if (zone->loadtask != NULL) isc_task_detach(&zone->loadtask); + if (zone->view != NULL) + dns_view_weakdetach(&zone->view); /* Unmanaged objects */ for (signing = ISC_LIST_HEAD(zone->signing); @@ -3408,7 +3410,8 @@ compute_tag(dns_name_t *name, dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx, */ static void trust_key(dns_zone_t *zone, dns_name_t *keyname, - dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx) { + dns_rdata_dnskey_t *dnskey, isc_mem_t *mctx) +{ isc_result_t result; dns_rdata_t rdata = DNS_RDATA_INIT; unsigned char data[4096]; @@ -8540,13 +8543,12 @@ keyfetch_done(isc_task_t *task, isc_event_t *event) { */ deletekey = ISC_TRUE; } else if (keydata.removehd == 0) { - /* Remove from secroots */ + /* + * Remove key from secroots. + */ dns_view_untrust(zone->view, keyname, &dnskey, mctx); - /* But ensure there's a null key */ - fail_secure(zone, keyname); - /* If initializing, delete now */ if (keydata.addhd == 0) deletekey = ISC_TRUE; @@ -8855,7 +8857,8 @@ zone_refreshkeys(dns_zone_t *zone) { result = dns_resolver_createfetch(zone->view->resolver, kname, dns_rdatatype_dnskey, NULL, NULL, NULL, - DNS_FETCHOPT_NOVALIDATE, + DNS_FETCHOPT_NOVALIDATE| + DNS_FETCHOPT_UNSHARED, zone->task, keyfetch_done, kfetch, &kfetch->dnskeyset, @@ -9303,6 +9306,7 @@ static void dump_done(void *arg, isc_result_t result) { const char me[] = "dump_done"; dns_zone_t *zone = arg; + dns_zone_t *secure = NULL; dns_db_t *db; dns_dbversion_t *version; isc_boolean_t again = ISC_FALSE; @@ -9316,30 +9320,54 @@ dump_done(void *arg, isc_result_t result) { if (result == ISC_R_SUCCESS && zone->journal != NULL && zone->journalsize != -1) { - /* * We don't own these, zone->dctx must stay valid. */ db = dns_dumpctx_db(zone->dctx); version = dns_dumpctx_version(zone->dctx); - tresult = dns_db_getsoaserial(db, version, &serial); + + /* + * Handle lock order inversion. + */ + again: + LOCK_ZONE(zone); + if (inline_raw(zone)) { + secure = zone->secure; + INSIST(secure != zone); + TRYLOCK_ZONE(result, secure); + if (result != ISC_R_SUCCESS) { + UNLOCK_ZONE(zone); + secure = NULL; +#if ISC_PLATFORM_USETHREADS + isc_thread_yield(); +#endif + goto again; + } + } + /* * If there is a secure version of this zone * use its serial if it is less than ours. */ - if (tresult == ISC_R_SUCCESS && inline_raw(zone) && - zone->secure->db != NULL) - { + if (tresult == ISC_R_SUCCESS && secure != NULL) { isc_uint32_t sserial; isc_result_t mresult; - mresult = dns_db_getsoaserial(zone->secure->db, - NULL, &sserial); - if (mresult == ISC_R_SUCCESS && - isc_serial_lt(sserial, serial)) - serial = sserial; + ZONEDB_LOCK(&secure->dblock, isc_rwlocktype_read); + if (secure->db != NULL) { + mresult = dns_db_getsoaserial(zone->secure->db, + NULL, &sserial); + if (mresult == ISC_R_SUCCESS && + isc_serial_lt(sserial, serial)) + serial = sserial; + } + ZONEDB_UNLOCK(&secure->dblock, isc_rwlocktype_read); } + if (secure != NULL) + UNLOCK_ZONE(secure); + UNLOCK_ZONE(zone); + /* * Note: we are task locked here so we can test * zone->xfr safely. @@ -10041,6 +10069,9 @@ notify_send(dns_notify_t *notify) { REQUIRE(DNS_NOTIFY_VALID(notify)); REQUIRE(LOCKED_ZONE(notify->zone)); + if (DNS_ZONE_FLAG(notify->zone, DNS_ZONEFLG_EXITING)) + return; + for (ai = ISC_LIST_HEAD(notify->find->list); ai != NULL; ai = ISC_LIST_NEXT(ai, publink)) { @@ -10116,7 +10147,8 @@ zone_notify(dns_zone_t *zone, isc_time_t *now) { DNS_ZONE_TIME_ADD(now, zone->notifydelay, &zone->notifytime); UNLOCK_ZONE(zone); - if (! DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) + if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) || + ! DNS_ZONE_FLAG(zone, DNS_ZONEFLG_LOADED)) return; if (notifytype == dns_notifytype_no) @@ -11644,9 +11676,6 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) { zone->irefs--; } - if (zone->view != NULL) - dns_view_weakdetach(&zone->view); - /* * We have now canceled everything set the flag to allow exit_check() * to succeed. We must not unlock between setting this flag and @@ -17428,7 +17457,7 @@ dns_zone_keydone(dns_zone_t *zone, const char *keystr) { kd->all = ISC_TRUE; else { isc_textregion_t r; - char *algstr; + const char *algstr; dns_keytag_t keyid; dns_secalg_t alg; size_t n; diff --git a/lib/export/dns/Makefile.in b/lib/export/dns/Makefile.in index f575f8673244..033b021fae5f 100644 --- a/lib/export/dns/Makefile.in +++ b/lib/export/dns/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009-2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -22,7 +22,7 @@ export_srcdir = @top_srcdir@/lib/export .NOTPARALLEL: .NO_PARALLEL: -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBDNS_API@ @@ -79,7 +79,7 @@ OPENSSLLINKSRCS = openssl_link.c openssldh_link.c openssldsa_link.c \ DSTSRCS = @OPENSSLLINKSRCS@ \ dst_api.c dst_lib.c dst_parse.c \ dst_result.c gssapi_link.c gssapictx.c \ - hmac_link.c key.c + hmac_link.c key.c DNSSRCS = acl.c adb.c byaddr.c \ cache.c callbacks.c client.c compress.c \ @@ -168,7 +168,8 @@ code.h: gen ./gen -s ${srcdir} > code.h gen: ${srcdir}/gen.c - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS} + ${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \ + ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS} #We don't need rbtdb64 for this library #rbtdb64.@O@: rbtdb.c diff --git a/lib/export/dns/include/dns/Makefile.in b/lib/export/dns/include/dns/Makefile.in index b7f51b4a3be2..29a740bd3e1c 100644 --- a/lib/export/dns/include/dns/Makefile.in +++ b/lib/export/dns/include/dns/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = acl.h adb.h byaddr.h \ cache.h callbacks.h cert.h client.h compress.h \ diff --git a/lib/export/dns/include/dst/Makefile.in b/lib/export/dns/include/dst/Makefile.in index f6f540a2ea82..a565db5b3991 100644 --- a/lib/export/dns/include/dst/Makefile.in +++ b/lib/export/dns/include/dst/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = dst.h gssapi.h lib.h result.h diff --git a/lib/export/irs/Makefile.in b/lib/export/irs/Makefile.in index b2520f9eb76e..0044c5c70b25 100644 --- a/lib/export/irs/Makefile.in +++ b/lib/export/irs/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2011-2013, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ top_srcdir = @top_srcdir@ srcdir = @top_srcdir@/lib/irs export_srcdir = @top_srcdir@/lib/export -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBIRS_API@ diff --git a/lib/export/irs/include/irs/Makefile.in b/lib/export/irs/include/irs/Makefile.in index 530e67c847ef..f31f4e4c7d10 100644 --- a/lib/export/irs/include/irs/Makefile.in +++ b/lib/export/irs/include/irs/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -12,8 +12,6 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - srcdir = @srcdir@ top_srcdir = @top_srcdir@ diff --git a/lib/export/isc/Makefile.in b/lib/export/isc/Makefile.in index c02ce96021e5..a15ea83d84fa 100644 --- a/lib/export/isc/Makefile.in +++ b/lib/export/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2012-2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ top_srcdir = @top_srcdir@ srcdir = @top_srcdir@/lib/isc export_srcdir = @top_srcdir@/lib/export -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBISC_API@ diff --git a/lib/export/isc/include/isc/Makefile.in b/lib/export/isc/include/isc/Makefile.in index 8c7eff8efa24..2d4a1eccee1f 100644 --- a/lib/export/isc/include/isc/Makefile.in +++ b/lib/export/isc/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ export_srcdir = @top_srcdir@/lib/export -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/export/isc/nothreads/include/isc/Makefile.in b/lib/export/isc/nothreads/include/isc/Makefile.in index 9bda987ddcd1..e79943685ba1 100644 --- a/lib/export/isc/nothreads/include/isc/Makefile.in +++ b/lib/export/isc/nothreads/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = condition.h mutex.h once.h thread.h diff --git a/lib/export/isc/pthreads/include/isc/Makefile.in b/lib/export/isc/pthreads/include/isc/Makefile.in index 431976853726..0ccf7be43d37 100644 --- a/lib/export/isc/pthreads/include/isc/Makefile.in +++ b/lib/export/isc/pthreads/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = condition.h mutex.h once.h thread.h diff --git a/lib/export/isc/unix/include/isc/Makefile.in b/lib/export/isc/unix/include/isc/Makefile.in index ebbc97362f03..d40644ce112f 100644 --- a/lib/export/isc/unix/include/isc/Makefile.in +++ b/lib/export/isc/unix/include/isc/Makefile.in @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = dir.h int.h net.h netdb.h offset.h stat.h stdtime.h \ syslog.h time.h diff --git a/lib/export/isccfg/Makefile.in b/lib/export/isccfg/Makefile.in index 2a791a4de6fd..8626d0ba38cb 100644 --- a/lib/export/isccfg/Makefile.in +++ b/lib/export/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2011-2013, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ top_srcdir = @top_srcdir@ srcdir = @top_srcdir@/lib/isccfg export_srcdir = @top_srcdir@/lib/export -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBISCCFG_API@ diff --git a/lib/export/isccfg/include/isccfg/Makefile.in b/lib/export/isccfg/include/isccfg/Makefile.in index 57a344cc24e3..d944f55e6515 100644 --- a/lib/export/isccfg/include/isccfg/Makefile.in +++ b/lib/export/isccfg/include/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/export/samples/Makefile.in b/lib/export/samples/Makefile.in index 194aaeb24a20..601ba77ddb7b 100644 --- a/lib/export/samples/Makefile.in +++ b/lib/export/samples/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2013, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ export_srcdir = @top_srcdir@/lib/export -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @BIND9_MAKE_INCLUDES@ diff --git a/lib/irs/Makefile.in b/lib/irs/Makefile.in index ba802bf47833..4028ff99c032 100644 --- a/lib/irs/Makefile.in +++ b/lib/irs/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2009, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBIRS_API@ diff --git a/lib/irs/resconf.c b/lib/irs/resconf.c index cb2400795549..de953ff62e02 100644 --- a/lib/irs/resconf.c +++ b/lib/irs/resconf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2011, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -170,11 +170,12 @@ eatwhite(FILE *fp) { static int getword(FILE *fp, char *buffer, size_t size) { int ch; - char *p = buffer; + char *p; REQUIRE(buffer != NULL); REQUIRE(size > 0U); + p = buffer; *p = '\0'; ch = eatwhite(fp); diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index 3176a267988d..8b2c0608aced 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -17,7 +17,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBISC_API@ diff --git a/lib/isc/alpha/include/isc/Makefile.in b/lib/isc/alpha/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/alpha/include/isc/Makefile.in +++ b/lib/isc/alpha/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/api b/lib/isc/api index 9a572b2d2e74..7de96ec52e86 100644 --- a/lib/isc/api +++ b/lib/isc/api @@ -4,6 +4,6 @@ # 9.8: 80-89, 120-129 # 9.9: 90-109 # 9.9-sub: 130-139 -LIBINTERFACE = 106 -LIBREVISION = 0 -LIBAGE = 0 +LIBINTERFACE = 107 +LIBREVISION = 1 +LIBAGE = 1 diff --git a/lib/isc/base32.c b/lib/isc/base32.c index 2ee99b182426..e472439eba5e 100644 --- a/lib/isc/base32.c +++ b/lib/isc/base32.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2008, 2009, 2013-2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -170,7 +170,7 @@ base32_decode_init(base32_decode_ctx_t *ctx, int length, const char base[], static inline isc_result_t base32_decode_char(base32_decode_ctx_t *ctx, int c) { - char *s; + const char *s; unsigned int last; if (ctx->seen_end) diff --git a/lib/isc/base64.c b/lib/isc/base64.c index 6b4cb1bf7c63..554097c47eb5 100644 --- a/lib/isc/base64.c +++ b/lib/isc/base64.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2013-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -118,7 +118,7 @@ base64_decode_init(base64_decode_ctx_t *ctx, int length, isc_buffer_t *target) static inline isc_result_t base64_decode_char(base64_decode_ctx_t *ctx, int c) { - char *s; + const char *s; if (ctx->seen_end) return (ISC_R_BADBASE64); diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c index 2d15e248575c..d0f08d767113 100644 --- a/lib/isc/buffer.c +++ b/lib/isc/buffer.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -462,6 +462,8 @@ isc_buffer_allocate(isc_mem_t *mctx, isc_buffer_t **dynbuffer, length); dbuf->mctx = mctx; + ENSURE(ISC_BUFFER_VALID(dbuf)); + *dynbuffer = dbuf; return (ISC_R_SUCCESS); diff --git a/lib/isc/commandline.c b/lib/isc/commandline.c index 416fba1927a6..e58b1b8ceddc 100644 --- a/lib/isc/commandline.c +++ b/lib/isc/commandline.c @@ -95,7 +95,7 @@ static char endopt = '\0'; int isc_commandline_parse(int argc, char * const *argv, const char *options) { static char *place = ENDOPT; - char *option; /* Index into *options of option. */ + const char *option; /* Index into *options of option. */ REQUIRE(argc >= 0 && argv != NULL && options != NULL); diff --git a/lib/isc/hash.c b/lib/isc/hash.c index 6ee8dcf5a1f7..8fd58532838d 100644 --- a/lib/isc/hash.c +++ b/lib/isc/hash.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009, 2013-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2013-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -399,3 +399,152 @@ isc_hash_calc(const unsigned char *key, unsigned int keylen, return (hash_calc(hash, key, keylen, case_sensitive)); } + +static isc_uint32_t fnv_offset_basis; +static isc_once_t fnv_once = ISC_ONCE_INIT; + +static void +fnv_initialize(void) { + /* + * This function should not leave fnv_offset_basis set to + * 0. Also, after this function has been called, if it is called + * again, it should not change fnv_offset_basis. + */ + while (fnv_offset_basis == 0) { + isc_random_get(&fnv_offset_basis); + } +} + +isc_uint32_t +isc_hash_function(const void *data, size_t length, + isc_boolean_t case_sensitive, + const isc_uint32_t *previous_hashp) +{ + isc_uint32_t hval; + const unsigned char *bp; + const unsigned char *be; + + INSIST(data == NULL || length > 0); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + + hval = ISC_UNLIKELY(previous_hashp != NULL) ? + *previous_hashp : fnv_offset_basis; + + if (length == 0) + return (hval); + + bp = (const unsigned char *) data; + be = bp + length; + + /* + * Fowler-Noll-Vo FNV-1a hash function. + * + * NOTE: A random fnv_offset_basis is used by default to avoid + * collision attacks as the hash function is reversible. This + * makes the mapping non-deterministic, but the distribution in + * the domain is still uniform. + */ + + if (case_sensitive) { + while (bp < be - 4) { + hval ^= (isc_uint32_t) bp[0]; + hval *= 16777619; + hval ^= (isc_uint32_t) bp[1]; + hval *= 16777619; + hval ^= (isc_uint32_t) bp[2]; + hval *= 16777619; + hval ^= (isc_uint32_t) bp[3]; + hval *= 16777619; + bp += 4; + } + while (bp < be) { + hval ^= (isc_uint32_t) *bp++; + hval *= 16777619; + } + } else { + while (bp < be - 4) { + hval ^= (isc_uint32_t) maptolower[bp[0]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[bp[1]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[bp[2]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[bp[3]]; + hval *= 16777619; + bp += 4; + } + while (bp < be) { + hval ^= (isc_uint32_t) maptolower[*bp++]; + hval *= 16777619; + } + } + + return (hval); +} + +isc_uint32_t +isc_hash_function_reverse(const void *data, size_t length, + isc_boolean_t case_sensitive, + const isc_uint32_t *previous_hashp) +{ + isc_uint32_t hval; + const unsigned char *bp; + const unsigned char *be; + + INSIST(data == NULL || length > 0); + RUNTIME_CHECK(isc_once_do(&fnv_once, fnv_initialize) == ISC_R_SUCCESS); + + hval = ISC_UNLIKELY(previous_hashp != NULL) ? + *previous_hashp : fnv_offset_basis; + + if (length == 0) + return (hval); + + bp = (const unsigned char *) data; + be = bp + length; + + /* + * Fowler-Noll-Vo FNV-1a hash function. + * + * NOTE: A random fnv_offset_basis is used by default to avoid + * collision attacks as the hash function is reversible. This + * makes the mapping non-deterministic, but the distribution in + * the domain is still uniform. + */ + + if (case_sensitive) { + while (be >= bp + 4) { + be -= 4; + hval ^= (isc_uint32_t) be[3]; + hval *= 16777619; + hval ^= (isc_uint32_t) be[2]; + hval *= 16777619; + hval ^= (isc_uint32_t) be[1]; + hval *= 16777619; + hval ^= (isc_uint32_t) be[0]; + hval *= 16777619; + } + while (--be >= bp) { + hval ^= (isc_uint32_t) *be; + hval *= 16777619; + } + } else { + while (be >= bp + 4) { + be -= 4; + hval ^= (isc_uint32_t) maptolower[be[3]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[be[2]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[be[1]]; + hval *= 16777619; + hval ^= (isc_uint32_t) maptolower[be[0]]; + hval *= 16777619; + } + while (--be >= bp) { + hval ^= (isc_uint32_t) maptolower[*be]; + hval *= 16777619; + } + } + + return (hval); +} diff --git a/lib/isc/hex.c b/lib/isc/hex.c index 00903c7374cf..9e565c8a1c24 100644 --- a/lib/isc/hex.c +++ b/lib/isc/hex.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2008, 2013, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2008, 2013-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -95,7 +95,7 @@ hex_decode_init(hex_decode_ctx_t *ctx, int length, isc_buffer_t *target) static inline isc_result_t hex_decode_char(hex_decode_ctx_t *ctx, int c) { - char *s; + const char *s; if ((s = strchr(hex, toupper(c))) == NULL) return (ISC_R_BADHEX); diff --git a/lib/isc/httpd.c b/lib/isc/httpd.c index 241c1d53a8d5..b33f3577f994 100644 --- a/lib/isc/httpd.c +++ b/lib/isc/httpd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008, 2010-2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2006-2008, 2010-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -360,6 +360,73 @@ httpdmgr_destroy(isc_httpdmgr_t *httpdmgr) { #define LENGTHOK(s) (httpd->recvbuf - (s) < (int)httpd->recvlen) #define BUFLENOK(s) (httpd->recvbuf - (s) < HTTP_RECVLEN) +/* + * Look for the given header in headers. + * If value is specified look for it terminated with a character in eov. + */ +static isc_boolean_t +have_header(isc_httpd_t *httpd, const char *header, const char *value, + const char *eov) +{ + char *cr, *nl, *h; + size_t hlen, vlen = 0; + + h = httpd->headers; + hlen = strlen(header); + if (value != NULL) { + INSIST(eov != NULL); + vlen = strlen(value); + } + + for (;;) { + if (strncasecmp(h, header, hlen) != 0) { + /* + * Skip to next line; + */ + cr = strchr(h, '\r'); + if (cr != NULL && cr[1] == '\n') + cr++; + nl = strchr(h, '\n'); + + /* last header? */ + h = cr; + if (h == NULL || (nl != NULL && nl < h)) + h = nl; + if (h == NULL) + return (ISC_FALSE); + h++; + continue; + } + + if (value == NULL) + return (ISC_TRUE); + + /* + * Skip optional leading white space. + */ + h += hlen; + while (*h == ' ' || *h == '\t') + h++; + /* + * Terminate token search on NULL or EOL. + */ + while (*h != 0 && *h != '\r' && *h != '\n') { + if (strncasecmp(h, value, vlen) == 0) + if (strchr(eov, h[vlen]) != NULL) + return (ISC_TRUE); + /* + * Skip to next token. + */ + h += strcspn(h, eov); + if (h[0] == '\r' && h[1] == '\n') + h++; + if (h[0] != 0) + h++; + } + return (ISC_FALSE); + } +} + static isc_result_t process_request(isc_httpd_t *httpd, int length) { char *s; @@ -378,15 +445,20 @@ process_request(isc_httpd_t *httpd, int length) { * more data. */ s = strstr(httpd->recvbuf, "\r\n\r\n"); - delim = 1; + delim = 2; if (s == NULL) { s = strstr(httpd->recvbuf, "\n\n"); - delim = 2; + delim = 1; } if (s == NULL) return (ISC_R_NOTFOUND); /* + * NUL terminate request at the blank line. + */ + s[delim] = 0; + + /* * Determine if this is a POST or GET method. Any other values will * cause an error to be returned. */ @@ -444,7 +516,7 @@ process_request(isc_httpd_t *httpd, int length) { } httpd->url = p; - p = s + delim; + p = s + 1; s = p; /* @@ -459,7 +531,7 @@ process_request(isc_httpd_t *httpd, int length) { /* * Extract the HTTP/1.X protocol. We will bounce on anything but - * HTTP/1.1 for now. + * HTTP/1.0 or HTTP/1.1 for now. */ while (LENGTHOK(s) && BUFLENOK(s) && (*s != '\n' && *s != '\r' && *s != '\0')) @@ -468,24 +540,30 @@ process_request(isc_httpd_t *httpd, int length) { return (ISC_R_NOTFOUND); if (!BUFLENOK(s)) return (ISC_R_NOMEMORY); + /* + * Check that we have the expected eol delimiter. + */ + if (strncmp(s, delim == 1 ? "\n" : "\r\n", delim) != 0) + return (ISC_R_RANGE); *s = 0; if ((strncmp(p, "HTTP/1.0", 8) != 0) && (strncmp(p, "HTTP/1.1", 8) != 0)) return (ISC_R_RANGE); httpd->protocol = p; - p = s + 1; + p = s + delim; /* skip past eol */ s = p; httpd->headers = s; - if (strstr(s, "Connection: close") != NULL) + if (have_header(httpd, "Connection:", "close", ", \t\r\n")) httpd->flags |= HTTPD_CLOSE; - if (strstr(s, "Host: ") != NULL) + if (have_header(httpd, "Host:", NULL, NULL)) httpd->flags |= HTTPD_FOUNDHOST; if (strncmp(httpd->protocol, "HTTP/1.0", 8) == 0) { - if (strcasestr(s, "Connection: Keep-Alive") != NULL) + if (have_header(httpd, "Connection:", "Keep-Alive", + ", \t\r\n")) httpd->flags |= HTTPD_KEEPALIVE; else httpd->flags |= HTTPD_CLOSE; @@ -838,7 +916,7 @@ isc_httpd_response(isc_httpd_t *httpd) { return (result); } - sprintf(isc_buffer_used(&httpd->headerbuffer), "%s %03d %s\r\n", + sprintf(isc_buffer_used(&httpd->headerbuffer), "%s %03u %s\r\n", httpd->protocol, httpd->retcode, httpd->retmsg); isc_buffer_add(&httpd->headerbuffer, needlen); diff --git a/lib/isc/ia64/include/isc/Makefile.in b/lib/isc/ia64/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/ia64/include/isc/Makefile.in +++ b/lib/isc/ia64/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/include/isc/Makefile.in b/lib/isc/include/isc/Makefile.in index 572bb3e1046b..15b55069b13b 100644 --- a/lib/isc/include/isc/Makefile.in +++ b/lib/isc/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004-2009, 2012-2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004-2009, 2012-2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001, 2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -17,7 +17,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/isc/include/isc/assertions.h b/lib/isc/include/isc/assertions.h index 2c81b1ae9880..ebe96922dcbe 100644 --- a/lib/isc/include/isc/assertions.h +++ b/lib/isc/include/isc/assertions.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1997-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -83,7 +83,7 @@ isc_assertion_typetotext(isc_assertiontype_t type); #if ISC_CHECK_REQUIRE != 0 #define ISC_REQUIRE(cond) \ - ((void) ((cond) || \ + ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_require, \ #cond), 0))) @@ -93,7 +93,7 @@ isc_assertion_typetotext(isc_assertiontype_t type); #if ISC_CHECK_ENSURE != 0 #define ISC_ENSURE(cond) \ - ((void) ((cond) || \ + ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_ensure, \ #cond), 0))) @@ -103,7 +103,7 @@ isc_assertion_typetotext(isc_assertiontype_t type); #if ISC_CHECK_INSIST != 0 #define ISC_INSIST(cond) \ - ((void) ((cond) || \ + ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_insist, \ #cond), 0))) @@ -113,7 +113,7 @@ isc_assertion_typetotext(isc_assertiontype_t type); #if ISC_CHECK_INVARIANT != 0 #define ISC_INVARIANT(cond) \ - ((void) ((cond) || \ + ((void) (ISC_LIKELY(cond) || \ ((isc_assertion_failed)(__FILE__, __LINE__, \ isc_assertiontype_invariant, \ #cond), 0))) diff --git a/lib/isc/include/isc/error.h b/lib/isc/include/isc/error.h index e0cdfa83e7cb..b6cac178e3d0 100644 --- a/lib/isc/include/isc/error.h +++ b/lib/isc/include/isc/error.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -55,7 +55,7 @@ void isc_error_runtimecheck(const char *, int, const char *); #define ISC_ERROR_RUNTIMECHECK(cond) \ - ((void) ((cond) || \ + ((void) (ISC_LIKELY(cond) || \ ((isc_error_runtimecheck)(__FILE__, __LINE__, #cond), 0))) ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/file.h b/lib/isc/include/isc/file.h index 7137410b613d..97e4fd323e02 100644 --- a/lib/isc/include/isc/file.h +++ b/lib/isc/include/isc/file.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2011-2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -312,8 +312,8 @@ isc_file_safecreate(const char *filename, FILE **fp); */ isc_result_t -isc_file_splitpath(isc_mem_t *mctx, char *path, - char **dirname, char **basename); +isc_file_splitpath(isc_mem_t *mctx, const char *path, + char **dirname, char const **basename); /*%< * Split a path into dirname and basename. If 'path' contains no slash * (or, on windows, backslash), then '*dirname' is set to ".". diff --git a/lib/isc/include/isc/hash.h b/lib/isc/include/isc/hash.h index 0bfe936d7f95..46cdf78b4923 100644 --- a/lib/isc/include/isc/hash.h +++ b/lib/isc/include/isc/hash.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009, 2013 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2013, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -180,6 +180,45 @@ isc_hash_calc(const unsigned char *key, unsigned int keylen, */ /*@}*/ +isc_uint32_t +isc_hash_function(const void *data, size_t length, + isc_boolean_t case_sensitive, + const isc_uint32_t *previous_hashp); +isc_uint32_t +isc_hash_function_reverse(const void *data, size_t length, + isc_boolean_t case_sensitive, + const isc_uint32_t *previous_hashp); +/*!< + * \brief Calculate a hash over data. + * + * This hash function is useful for hashtables. The hash function is + * opaque and not important to the caller. The returned hash values are + * non-deterministic and will have different mapping every time a + * process using this library is run, but will have uniform + * distribution. + * + * isc_hash_function() calculates the hash from start to end over the + * input data. isc_hash_function_reverse() calculates the hash from the + * end to the start over the input data. The difference in order is + * useful in incremental hashing; for example, a previously hashed + * value for 'com' can be used as input when hashing 'example.com'. + * + * This is a new variant of isc_hash_calc() and will supercede + * isc_hash_calc() eventually. + * + * 'data' is the data to be hashed. + * + * 'length' is the size of the data to be hashed. + * + * 'case_sensitive' specifies whether the hash key should be treated as + * case_sensitive values. It should typically be ISC_FALSE if the hash key + * is a DNS name. + * + * 'previous_hashp' is a pointer to a previous hash value returned by + * this function. It can be used to perform incremental hashing. NULL + * must be passed during first calls. + */ + ISC_LANG_ENDDECLS #endif /* ISC_HASH_H */ diff --git a/lib/isc/include/isc/magic.h b/lib/isc/include/isc/magic.h index 073de90dcc92..679d9d9233fb 100644 --- a/lib/isc/include/isc/magic.h +++ b/lib/isc/include/isc/magic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -20,6 +20,8 @@ #ifndef ISC_MAGIC_H #define ISC_MAGIC_H 1 +#include <isc/util.h> + /*! \file isc/magic.h */ typedef struct { @@ -33,8 +35,8 @@ typedef struct { * The intent of this is to allow magic numbers to be checked even though * the object is otherwise opaque. */ -#define ISC_MAGIC_VALID(a,b) (((a) != NULL) && \ - (((const isc__magic_t *)(a))->magic == (b))) +#define ISC_MAGIC_VALID(a,b) (ISC_LIKELY((a) != NULL) && \ + ISC_LIKELY(((const isc__magic_t *)(a))->magic == (b))) #define ISC_MAGIC(a, b, c, d) ((a) << 24 | (b) << 16 | (c) << 8 | (d)) diff --git a/lib/isc/include/isc/netaddr.h b/lib/isc/include/isc/netaddr.h index 954d77019b69..140d11826dd9 100644 --- a/lib/isc/include/isc/netaddr.h +++ b/lib/isc/include/isc/netaddr.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -155,6 +155,12 @@ isc_netaddr_issitelocal(isc_netaddr_t *na); * Returns #ISC_TRUE if the address is a site local address. */ +isc_boolean_t +isc_netaddr_isnetzero(isc_netaddr_t *na); +/*%< + * Returns #ISC_TRUE if the address is in net zero. + */ + void isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s); /*%< diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 667a1454a4cd..ae2af287c338 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -288,12 +288,18 @@ @ISC_PLATFORM_HAVEXADDQ@ /* - * If the "atomic swap" operation is available on this architecture, - * ISC_PLATFORM_HAVEATOMICSTORE" will be defined. + * If the 32-bit "atomic swap" operation is available on this + * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. */ @ISC_PLATFORM_HAVEATOMICSTORE@ /* + * If the 64-bit "atomic swap" operation is available on this + * architecture, ISC_PLATFORM_HAVEATOMICSTORE" will be defined. + */ +@ISC_PLATFORM_HAVEATOMICSTOREQ@ + +/* * If the "compare-and-exchange" operation is available on this architecture, * ISC_PLATFORM_HAVECMPXCHG will be defined. */ diff --git a/lib/isc/include/isc/result.h b/lib/isc/include/isc/result.h index ed1bc63e7364..ce881e1a2388 100644 --- a/lib/isc/include/isc/result.h +++ b/lib/isc/include/isc/result.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -89,9 +89,10 @@ #define ISC_R_BADBASE32 60 /*%< bad base32 encoding */ #define ISC_R_UNSET 61 /*%< unset */ #define ISC_R_MULTIPLE 62 /*%< multiple */ +#define ISC_R_WOULDBLOCK 63 /*%< would block */ /*% Not a result code: the number of results. */ -#define ISC_R_NRESULTS 63 +#define ISC_R_NRESULTS 64 ISC_LANG_BEGINDECLS diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h index 4d811dd64971..5dfc3d23f512 100644 --- a/lib/isc/include/isc/sockaddr.h +++ b/lib/isc/include/isc/sockaddr.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2009, 2012 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2009, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -220,6 +220,12 @@ isc_sockaddr_issitelocal(const isc_sockaddr_t *sa); * Returns ISC_TRUE if the address is a sitelocal address. */ +isc_boolean_t +isc_sockaddr_isnetzero(const isc_sockaddr_t *sa); +/*%< + * Returns ISC_TRUE if the address is in net zero. + */ + isc_result_t isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path); /* diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 97e2f7605b9c..0ee305c894b4 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009, 2011-2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2009, 2011-2014, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -370,7 +370,8 @@ isc_socket_fdwatchcreate(isc_socketmgr_t *manager, * * Note: * - *\li 'fd' is the already-opened file descriptor. + *\li 'fd' is the already-opened file descriptor (must be less + * than maxsockets). *\li This function is not available on Windows. *\li The callback function is called "in-line" - this means the function * needs to return as fast as possible, as all other I/O will be suspended @@ -394,6 +395,7 @@ isc_socket_fdwatchcreate(isc_socketmgr_t *manager, *\li #ISC_R_NOMEMORY *\li #ISC_R_NORESOURCES *\li #ISC_R_UNEXPECTED + *\li #ISC_R_RANGE */ isc_result_t diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h index 6baf786bdeab..fc2e1882641a 100644 --- a/lib/isc/include/isc/util.h +++ b/lib/isc/include/isc/util.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2010-2012, 2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2010-2012, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -206,6 +206,17 @@ #define INSERTAFTER(li, a, e, ln) ISC_LIST_INSERTAFTER(li, a, e, ln) #define APPENDLIST(list1, list2, link) ISC_LIST_APPENDLIST(list1, list2, link) +/*% + * Performance + */ +#ifdef HAVE_BUILTIN_EXPECT +#define ISC_LIKELY(x) __builtin_expect(!!(x), 1) +#define ISC_UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define ISC_LIKELY(x) (x) +#define ISC_UNLIKELY(x) (x) +#endif + /* * Assertions */ diff --git a/lib/isc/md5.c b/lib/isc/md5.c index 579d61c20b2a..55d56195f48e 100644 --- a/lib/isc/md5.c +++ b/lib/isc/md5.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2009, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2009, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -57,6 +57,8 @@ isc_md5_invalidate(isc_md5_t *ctx) { void isc_md5_update(isc_md5_t *ctx, const unsigned char *buf, unsigned int len) { + if (len == 0U) + return; RUNTIME_CHECK(EVP_DigestUpdate(ctx, (const void *) buf, (size_t) len) == 1); diff --git a/lib/isc/mem.c b/lib/isc/mem.c index 854425750bcd..dfa5e572770b 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2010, 2012-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1997-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -1987,53 +1987,43 @@ isc___mempool_get(isc_mempool_t *mpctx0 FLARG) { /* * Don't let the caller go over quota */ - if (mpctx->allocated >= mpctx->maxalloc) { + if (ISC_UNLIKELY(mpctx->allocated >= mpctx->maxalloc)) { item = NULL; goto out; } - /* - * if we have a free list item, return the first here - */ - item = mpctx->items; - if (item != NULL) { - mpctx->items = item->next; - INSIST(mpctx->freecount > 0); - mpctx->freecount--; - mpctx->gets++; - mpctx->allocated++; - goto out; - } - - /* - * We need to dip into the well. Lock the memory context here and - * fill up our free list. - */ - MCTXLOCK(mctx, &mctx->lock); - for (i = 0; i < mpctx->fillcount; i++) { - if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) { - item = mem_getunlocked(mctx, mpctx->size); - } else { - item = mem_get(mctx, mpctx->size); - if (item != NULL) - mem_getstats(mctx, mpctx->size); + if (ISC_UNLIKELY(mpctx->items == NULL)) { + /* + * We need to dip into the well. Lock the memory context + * here and fill up our free list. + */ + MCTXLOCK(mctx, &mctx->lock); + for (i = 0; i < mpctx->fillcount; i++) { + if ((mctx->flags & ISC_MEMFLAG_INTERNAL) != 0) { + item = mem_getunlocked(mctx, mpctx->size); + } else { + item = mem_get(mctx, mpctx->size); + if (item != NULL) + mem_getstats(mctx, mpctx->size); + } + if (ISC_UNLIKELY(item == NULL)) + break; + item->next = mpctx->items; + mpctx->items = item; + mpctx->freecount++; } - if (item == NULL) - break; - item->next = mpctx->items; - mpctx->items = item; - mpctx->freecount++; + MCTXUNLOCK(mctx, &mctx->lock); } - MCTXUNLOCK(mctx, &mctx->lock); /* * If we didn't get any items, return NULL. */ item = mpctx->items; - if (item == NULL) + if (ISC_UNLIKELY(item == NULL)) goto out; mpctx->items = item->next; + INSIST(mpctx->freecount > 0); mpctx->freecount--; mpctx->gets++; mpctx->allocated++; diff --git a/lib/isc/mips/include/isc/Makefile.in b/lib/isc/mips/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/mips/include/isc/Makefile.in +++ b/lib/isc/mips/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index dcbfba42eae8..2178c7a2a7b5 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2005, 2007, 2010-2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004, 2005, 2007, 2010-2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -419,6 +419,22 @@ isc_netaddr_issitelocal(isc_netaddr_t *na) { } } +#ifndef IN_ZERONET +#define IN_ZERONET(x) (((x) & htonl(0xff000000U)) == 0) +#endif + +isc_boolean_t +isc_netaddr_isnetzero(isc_netaddr_t *na) { + switch (na->family) { + case AF_INET: + return (ISC_TF(IN_ZERONET(na->type.in.s_addr))); + case AF_INET6: + return (ISC_FALSE); + default: + return (ISC_FALSE); + } +} + void isc_netaddr_fromv4mapped(isc_netaddr_t *t, const isc_netaddr_t *s) { isc_netaddr_t *src; diff --git a/lib/isc/noatomic/include/isc/Makefile.in b/lib/isc/noatomic/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/noatomic/include/isc/Makefile.in +++ b/lib/isc/noatomic/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/nothreads/include/isc/Makefile.in b/lib/isc/nothreads/include/isc/Makefile.in index a2c347eaa253..f32180f3a783 100644 --- a/lib/isc/nothreads/include/isc/Makefile.in +++ b/lib/isc/nothreads/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = condition.h mutex.h once.h thread.h diff --git a/lib/isc/powerpc/include/isc/Makefile.in b/lib/isc/powerpc/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/powerpc/include/isc/Makefile.in +++ b/lib/isc/powerpc/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/pthreads/include/isc/Makefile.in b/lib/isc/pthreads/include/isc/Makefile.in index 7cadcf4b6f3d..68e6c76b8d6b 100644 --- a/lib/isc/pthreads/include/isc/Makefile.in +++ b/lib/isc/pthreads/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = condition.h mutex.h once.h thread.h diff --git a/lib/isc/result.c b/lib/isc/result.c index 6cbd8b4722a1..27927e8f25d2 100644 --- a/lib/isc/result.c +++ b/lib/isc/result.c @@ -104,6 +104,7 @@ static const char *description[ISC_R_NRESULTS] = { "bad base32 encoding", /*%< 60 */ "unset", /*%< 61 */ "multiple", /*%< 62 */ + "would block", /*%< 63 */ }; #define ISC_RESULT_RESULTSET 2 diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index cee6d700c02e..195f1c1c739d 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2010-2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2010-2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -205,7 +205,6 @@ 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; @@ -239,12 +238,9 @@ isc_sockaddr_hash(const isc_sockaddr_t *sockaddr, isc_boolean_t address_only) { 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 */ - } + h = isc_hash_function(s, length, ISC_TRUE, NULL); + if (!address_only) + h = isc_hash_function(&p, sizeof(p), ISC_TRUE, &h); return (h); } @@ -368,7 +364,7 @@ isc_sockaddr_pf(const isc_sockaddr_t *sockaddr) { void isc_sockaddr_fromnetaddr(isc_sockaddr_t *sockaddr, const isc_netaddr_t *na, - in_port_t port) + in_port_t port) { memset(sockaddr, 0, sizeof(*sockaddr)); sockaddr->type.sin.sin_family = na->family; @@ -483,6 +479,17 @@ isc_sockaddr_islinklocal(const isc_sockaddr_t *sockaddr) { return (ISC_FALSE); } +isc_boolean_t +isc_sockaddr_isnetzero(const isc_sockaddr_t *sockaddr) { + isc_netaddr_t netaddr; + + if (sockaddr->type.sa.sa_family == AF_INET) { + isc_netaddr_fromsockaddr(&netaddr, sockaddr); + return (isc_netaddr_isnetzero(&netaddr)); + } + return (ISC_FALSE); +} + isc_result_t isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path) { #ifdef ISC_PLATFORM_HAVESYSUNH diff --git a/lib/isc/sparc64/include/isc/Makefile.in b/lib/isc/sparc64/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/sparc64/include/isc/Makefile.in +++ b/lib/isc/sparc64/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/stats.c b/lib/isc/stats.c index 03d2a8a7d103..368dadfc323e 100644 --- a/lib/isc/stats.c +++ b/lib/isc/stats.c @@ -35,13 +35,45 @@ #define ISC_STATS_MAGIC ISC_MAGIC('S', 't', 'a', 't') #define ISC_STATS_VALID(x) ISC_MAGIC_VALID(x, ISC_STATS_MAGIC) -#ifndef ISC_STATS_USEMULTIFIELDS -#if defined(ISC_RWLOCK_USEATOMIC) && defined(ISC_PLATFORM_HAVEXADD) && !defined(ISC_PLATFORM_HAVEXADDQ) +/*% + * Local macro confirming prescence of 64-bit + * increment and store operations, just to make + * the later macros simpler + */ +#if defined(ISC_PLATFORM_HAVEXADDQ) && defined(ISC_PLATFORM_HAVEATOMICSTOREQ) +#define ISC_STATS_HAVEATOMICQ 1 +#else +#define ISC_STATS_HAVEATOMICQ 0 +#endif + +/*% + * Only lock the counters if 64-bit atomic operations are + * not available but cheap atomic lock operations are. + * On a modern 64-bit system this should never be the case. + * + * Normal locks are too expensive to be used whenever a counter + * is updated. + */ +#if !ISC_STATS_HAVEATOMICQ && defined(ISC_RWLOCK_HAVEATOMIC) +#define ISC_STATS_LOCKCOUNTERS 1 +#else +#define ISC_STATS_LOCKCOUNTERS 0 +#endif + +/*% + * If 64-bit atomic operations are not available but + * 32-bit operations are then split the counter into two, + * using the atomic operations to try to ensure that any carry + * from the low word is correctly carried into the high word. + * + * Otherwise, just rely on standard 64-bit data types + * and operations + */ +#if !ISC_STATS_HAVEATOMICQ && defined(ISC_PLATFORM_HAVEXADD) #define ISC_STATS_USEMULTIFIELDS 1 #else #define ISC_STATS_USEMULTIFIELDS 0 #endif -#endif /* ISC_STATS_USEMULTIFIELDS */ #if ISC_STATS_USEMULTIFIELDS typedef struct { @@ -65,7 +97,7 @@ struct isc_stats { * Locked by counterlock or unlocked if efficient rwlock is not * available. */ -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_t counterlock; #endif isc_stat_t *counters; @@ -111,7 +143,7 @@ create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) { goto clean_counters; } -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS result = isc_rwlock_init(&stats->counterlock, 0, 0); if (result != ISC_R_SUCCESS) goto clean_copiedcounters; @@ -131,7 +163,7 @@ create_stats(isc_mem_t *mctx, int ncounters, isc_stats_t **statsp) { clean_counters: isc_mem_put(mctx, stats->counters, sizeof(isc_stat_t) * ncounters); -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS clean_copiedcounters: isc_mem_put(mctx, stats->copiedcounters, sizeof(isc_stat_t) * ncounters); @@ -177,7 +209,7 @@ isc_stats_detach(isc_stats_t **statsp) { sizeof(isc_stat_t) * stats->ncounters); UNLOCK(&stats->lock); DESTROYLOCK(&stats->lock); -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_destroy(&stats->counterlock); #endif isc_mem_putanddetach(&stats->mctx, stats, sizeof(*stats)); @@ -198,7 +230,7 @@ static inline void incrementcounter(isc_stats_t *stats, int counter) { isc_int32_t prev; -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS /* * We use a "read" lock to prevent other threads from reading the * counter while we "writing" a counter field. The write access itself @@ -219,7 +251,7 @@ incrementcounter(isc_stats_t *stats, int counter) { */ if (prev == (isc_int32_t)0xffffffff) isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].hi, 1); -#elif defined(ISC_PLATFORM_HAVEXADDQ) +#elif ISC_STATS_HAVEATOMICQ UNUSED(prev); isc_atomic_xaddq((isc_int64_t *)&stats->counters[counter], 1); #else @@ -227,7 +259,7 @@ incrementcounter(isc_stats_t *stats, int counter) { stats->counters[counter]++; #endif -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_read); #endif } @@ -236,7 +268,7 @@ static inline void decrementcounter(isc_stats_t *stats, int counter) { isc_int32_t prev; -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_read); #endif @@ -245,7 +277,7 @@ decrementcounter(isc_stats_t *stats, int counter) { if (prev == 0) isc_atomic_xadd((isc_int32_t *)&stats->counters[counter].hi, -1); -#elif defined(ISC_PLATFORM_HAVEXADDQ) +#elif ISC_STATS_HAVEATOMICQ UNUSED(prev); isc_atomic_xaddq((isc_int64_t *)&stats->counters[counter], -1); #else @@ -253,7 +285,7 @@ decrementcounter(isc_stats_t *stats, int counter) { stats->counters[counter]--; #endif -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_read); #endif } @@ -262,7 +294,7 @@ static void copy_counters(isc_stats_t *stats) { int i; -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS /* * We use a "write" lock before "reading" the statistics counters as * an exclusive lock. @@ -270,19 +302,21 @@ copy_counters(isc_stats_t *stats) { isc_rwlock_lock(&stats->counterlock, isc_rwlocktype_write); #endif -#if ISC_STATS_USEMULTIFIELDS for (i = 0; i < stats->ncounters; i++) { +#if ISC_STATS_USEMULTIFIELDS stats->copiedcounters[i] = - (isc_uint64_t)(stats->counters[i].hi) << 32 | - stats->counters[i].lo; - } + (isc_uint64_t)(stats->counters[i].hi) << 32 | + stats->counters[i].lo; +#elif ISC_STATS_HAVEATOMICQ + /* use xaddq(..., 0) as an atomic load */ + stats->copiedcounters[i] = + (isc_uint64_t)isc_atomic_xaddq((isc_int64_t *)&stats->counters[i], 0); #else - UNUSED(i); - memmove(stats->copiedcounters, stats->counters, - stats->ncounters * sizeof(isc_stat_t)); + stats->copiedcounters[i] = stats->counters[i]; #endif + } -#ifdef ISC_RWLOCK_USEATOMIC +#if ISC_STATS_LOCKCOUNTERS isc_rwlock_unlock(&stats->counterlock, isc_rwlocktype_write); #endif } diff --git a/lib/isc/string.c b/lib/isc/string.c index 56ec444bffaa..04a25943734d 100644 --- a/lib/isc/string.c +++ b/lib/isc/string.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2007, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2007, 2011, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2001, 2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -56,14 +56,14 @@ #include <isc/string.h> #include <isc/util.h> -static char digits[] = "0123456789abcdefghijklmnoprstuvwxyz"; +static const char digits[] = "0123456789abcdefghijklmnoprstuvwxyz"; isc_uint64_t isc_string_touint64(char *source, char **end, int base) { isc_uint64_t tmp; isc_uint64_t overflow; char *s = source; - char *o; + const char *o; char c; if ((base < 0) || (base == 1) || (base > 36)) { diff --git a/lib/isc/task.c b/lib/isc/task.c index 3503801e4517..81785e9a835b 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -15,8 +15,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id$ */ - /*! \file * \author Principal Author: Bob Halley */ @@ -1638,11 +1636,11 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) { ISC_TASKFUNC_SCOPE void isc__taskmgr_pause(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; + manager->pause_requested = ISC_TRUE; LOCK(&manager->lock); while (manager->tasks_running > 0) { WAIT(&manager->paused, &manager->lock); } - manager->pause_requested = ISC_TRUE; UNLOCK(&manager->lock); } diff --git a/lib/isc/unix/file.c b/lib/isc/unix/file.c index c2abd440e18c..3fc2a29125c4 100644 --- a/lib/isc/unix/file.c +++ b/lib/isc/unix/file.c @@ -204,8 +204,9 @@ isc_file_mktemplate(const char *path, char *buf, size_t buflen) { isc_result_t isc_file_template(const char *path, const char *templet, char *buf, - size_t buflen) { - char *s; + size_t buflen) +{ + const char *s; REQUIRE(path != NULL); REQUIRE(templet != NULL); @@ -262,7 +263,7 @@ isc_file_renameunique(const char *file, char *templet) { if (errno != EEXIST) return (isc__errno2result(errno)); for (cp = x;;) { - char *t; + const char *t; if (*cp == '\0') return (ISC_R_FAILURE); t = strchr(alphnum, *cp); @@ -461,7 +462,7 @@ isc_file_ischdiridempotent(const char *filename) { const char * isc_file_basename(const char *filename) { - char *s; + const char *s; REQUIRE(filename != NULL); @@ -579,9 +580,11 @@ isc_file_safecreate(const char *filename, FILE **fp) { } isc_result_t -isc_file_splitpath(isc_mem_t *mctx, char *path, char **dirname, char **basename) +isc_file_splitpath(isc_mem_t *mctx, const char *path, char **dirname, + char const **basename) { - char *dir, *file, *slash; + char *dir; + const char *file, *slash; if (path == NULL) return (ISC_R_INVALIDFILE); diff --git a/lib/isc/unix/include/isc/Makefile.in b/lib/isc/unix/include/isc/Makefile.in index 9cd96d71b750..f37036ac10ff 100644 --- a/lib/isc/unix/include/isc/Makefile.in +++ b/lib/isc/unix/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012-2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012-2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 1998-2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = dir.h int.h keyboard.h net.h netdb.h offset.h stat.h \ stdtime.h strerror.h syslog.h time.h diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index c811d1ba4194..7ed73aad5b4f 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -103,10 +103,10 @@ const struct in6_addr isc_net_in6addrloop = IN6ADDR_LOOPBACK_INIT; # if defined(WANT_IPV6) static isc_once_t once_ipv6only = ISC_ONCE_INIT; -# endif -# if defined(ISC_PLATFORM_HAVEIN6PKTINFO) +# if defined(ISC_PLATFORM_HAVEIN6PKTINFO) static isc_once_t once_ipv6pktinfo = ISC_ONCE_INIT; +# endif # endif #endif /* ISC_PLATFORM_HAVEIPV6 */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 5e6320d821c6..42fc47f6deaa 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2015 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -394,6 +394,9 @@ struct isc__socketmgr { /* Locked by fdlock. */ isc__socket_t **fds; int *fdstate; +#if defined(USE_EPOLL) + uint32_t *epoll_events; +#endif #ifdef USE_DEVPOLL pollinfo_t *fdpollinfo; #endif @@ -835,15 +838,27 @@ watch_fd(isc__socketmgr_t *manager, int fd, int msg) { return (result); #elif defined(USE_EPOLL) struct epoll_event event; + uint32_t oldevents; + int ret; + int op; + oldevents = manager->epoll_events[fd]; if (msg == SELECT_POKE_READ) - event.events = EPOLLIN; + manager->epoll_events[fd] |= EPOLLIN; else - event.events = EPOLLOUT; + manager->epoll_events[fd] |= EPOLLOUT; + + event.events = manager->epoll_events[fd]; memset(&event.data, 0, sizeof(event.data)); event.data.fd = fd; - if (epoll_ctl(manager->epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1 && - errno != EEXIST) { + + op = (oldevents == 0U) ? EPOLL_CTL_ADD : EPOLL_CTL_MOD; + ret = epoll_ctl(manager->epoll_fd, op, fd, &event); + if (ret == -1) { + if (errno == EEXIST) + UNEXPECTED_ERROR(__FILE__, __LINE__, + "epoll_ctl(ADD/MOD) returned " + "EEXIST for fd %d", fd); result = isc__errno2result(errno); } @@ -903,15 +918,21 @@ unwatch_fd(isc__socketmgr_t *manager, int fd, int msg) { return (result); #elif defined(USE_EPOLL) struct epoll_event event; + int ret; + int op; if (msg == SELECT_POKE_READ) - event.events = EPOLLIN; + manager->epoll_events[fd] &= ~(EPOLLIN); else - event.events = EPOLLOUT; + manager->epoll_events[fd] &= ~(EPOLLOUT); + + event.events = manager->epoll_events[fd]; memset(&event.data, 0, sizeof(event.data)); event.data.fd = fd; - if (epoll_ctl(manager->epoll_fd, EPOLL_CTL_DEL, fd, &event) == -1 && - errno != ENOENT) { + + op = (event.events == 0U) ? EPOLL_CTL_DEL : EPOLL_CTL_MOD; + ret = epoll_ctl(manager->epoll_fd, op, fd, &event); + if (ret == -1 && errno != ENOENT) { char strbuf[ISC_STRERRORSIZE]; isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, @@ -1553,15 +1574,19 @@ build_msghdr_recv(isc__socket_t *sock, isc_socketevent_t *dev, msg->msg_iovlen = iovcount; #ifdef ISC_NET_BSD44MSGHDR - msg->msg_control = NULL; - msg->msg_controllen = 0; - msg->msg_flags = 0; #if defined(USE_CMSG) if (sock->type == isc_sockettype_udp) { msg->msg_control = sock->recvcmsgbuf; msg->msg_controllen = sock->recvcmsgbuflen; + } else { + msg->msg_control = NULL; + msg->msg_controllen = 0; } +#else + msg->msg_control = NULL; + msg->msg_controllen = 0; #endif /* USE_CMSG */ + msg->msg_flags = 0; #else /* ISC_NET_BSD44MSGHDR */ msg->msg_accrights = NULL; msg->msg_accrightslen = 0; @@ -1872,8 +1897,11 @@ doio_send(isc__socket_t *sock, isc_socketevent_t *dev) { if (send_errno == EINTR && ++attempts < NRETRIES) goto resend; - if (SOFT_ERROR(send_errno)) + if (SOFT_ERROR(send_errno)) { + if (errno == EWOULDBLOCK || errno == EAGAIN) + dev->result = ISC_R_WOULDBLOCK; return (DOIO_SOFT); + } #define SOFT_OR_HARD(_system, _isc) \ if (send_errno == _system) { \ @@ -2035,7 +2063,7 @@ destroy(isc__socket_t **sockp) { INSIST(ISC_LIST_EMPTY(sock->recv_list)); INSIST(ISC_LIST_EMPTY(sock->send_list)); INSIST(sock->connect_ev == NULL); - REQUIRE(sock->fd == -1 || sock->fd < (int)manager->maxsocks); + INSIST(sock->fd >= -1 && sock->fd < (int)manager->maxsocks); if (sock->fd >= 0) { fd = sock->fd; @@ -2192,8 +2220,8 @@ static void free_socket(isc__socket_t **socketp) { isc__socket_t *sock = *socketp; - INSIST(sock->references == 0); INSIST(VALID_SOCKET(sock)); + INSIST(sock->references == 0); INSIST(!sock->connecting); INSIST(!sock->pending_recv); INSIST(!sock->pending_send); @@ -2633,6 +2661,9 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, LOCK(&manager->fdlock[lockid]); manager->fds[sock->fd] = sock; manager->fdstate[sock->fd] = MANAGED; +#if defined(USE_EPOLL) + manager->epoll_events[sock->fd] = 0; +#endif #ifdef USE_DEVPOLL INSIST(sock->manager->fdpollinfo[sock->fd].want_read == 0 && sock->manager->fdpollinfo[sock->fd].want_write == 0); @@ -2710,6 +2741,9 @@ isc__socket_open(isc_socket_t *sock0) { LOCK(&sock->manager->fdlock[lockid]); sock->manager->fds[sock->fd] = sock; sock->manager->fdstate[sock->fd] = MANAGED; +#if defined(USE_EPOLL) + sock->manager->epoll_events[sock->fd] = 0; +#endif #ifdef USE_DEVPOLL INSIST(sock->manager->fdpollinfo[sock->fd].want_read == 0 && sock->manager->fdpollinfo[sock->fd].want_write == 0); @@ -2747,6 +2781,9 @@ isc__socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags, REQUIRE(VALID_MANAGER(manager)); REQUIRE(socketp != NULL && *socketp == NULL); + if (fd < 0 || (unsigned int)fd >= manager->maxsocks) + return (ISC_R_RANGE); + result = allocate_socket(manager, isc_sockettype_fdwatch, &sock); if (result != ISC_R_SUCCESS) return (result); @@ -2771,6 +2808,9 @@ isc__socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags, LOCK(&manager->fdlock[lockid]); manager->fds[sock->fd] = sock; manager->fdstate[sock->fd] = MANAGED; +#if defined(USE_EPOLL) + manager->epoll_events[sock->fd] = 0; +#endif UNLOCK(&manager->fdlock[lockid]); LOCK(&manager->lock); @@ -3310,6 +3350,9 @@ internal_accept(isc_task_t *me, isc_event_t *ev) { LOCK(&manager->fdlock[lockid]); manager->fds[fd] = NEWCONNSOCK(dev); manager->fdstate[fd] = MANAGED; +#if defined(USE_EPOLL) + manager->epoll_events[fd] = 0; +#endif UNLOCK(&manager->fdlock[lockid]); LOCK(&manager->lock); @@ -4260,6 +4303,15 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, result = ISC_R_NOMEMORY; goto free_manager; } +#if defined(USE_EPOLL) + manager->epoll_events = isc_mem_get(mctx, (manager->maxsocks * + sizeof(uint32_t))); + if (manager->epoll_events == NULL) { + result = ISC_R_NOMEMORY; + goto free_manager; + } + memset(manager->epoll_events, 0, manager->maxsocks * sizeof(uint32_t)); +#endif manager->stats = NULL; manager->common.methods = &socketmgrmethods; @@ -4329,7 +4381,9 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, result = setup_watcher(mctx, manager); if (result != ISC_R_SUCCESS) goto cleanup; + memset(manager->fdstate, 0, manager->maxsocks * sizeof(int)); + #ifdef USE_WATCHER_THREAD /* * Start up the select/poll thread. @@ -4378,6 +4432,12 @@ free_manager: isc_mem_put(mctx, manager->fdlock, FDLOCK_COUNT * sizeof(isc_mutex_t)); } +#if defined(USE_EPOLL) + if (manager->epoll_events != NULL) { + isc_mem_put(mctx, manager->epoll_events, + manager->maxsocks * sizeof(uint32_t)); + } +#endif if (manager->fdstate != NULL) { isc_mem_put(mctx, manager->fdstate, manager->maxsocks * sizeof(int)); @@ -4493,6 +4553,10 @@ isc__socketmgr_destroy(isc_socketmgr_t **managerp) { if (manager->fdstate[i] == CLOSE_PENDING) /* no need to lock */ (void)close(i); +#if defined(USE_EPOLL) + isc_mem_put(manager->mctx, manager->epoll_events, + manager->maxsocks * sizeof(uint32_t)); +#endif isc_mem_put(manager->mctx, manager->fds, manager->maxsocks * sizeof(isc__socket_t *)); isc_mem_put(manager->mctx, manager->fdstate, diff --git a/lib/isc/x86_32/include/isc/Makefile.in b/lib/isc/x86_32/include/isc/Makefile.in index 4927e210f38e..df7561585b0a 100644 --- a/lib/isc/x86_32/include/isc/Makefile.in +++ b/lib/isc/x86_32/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/x86_32/include/isc/atomic.h b/lib/isc/x86_32/include/isc/atomic.h index bf2148cb33f5..36088e4d53ae 100644 --- a/lib/isc/x86_32/include/isc/atomic.h +++ b/lib/isc/x86_32/include/isc/atomic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2005, 2007, 2008, 2015 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -62,7 +62,7 @@ isc_atomic_xaddq(isc_int64_t *p, isc_int64_t val) { #endif /* ISC_PLATFORM_HAVEXADDQ */ /* - * This routine atomically stores the value 'val' in 'p'. + * This routine atomically stores the value 'val' in 'p' (32-bit version). */ static __inline__ void isc_atomic_store(isc_int32_t *p, isc_int32_t val) { @@ -81,6 +81,28 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) { : "memory"); } +#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ +/* + * This routine atomically stores the value 'val' in 'p' (64-bit version). + */ +static __inline__ void +isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { + __asm__ volatile( +#ifdef ISC_PLATFORM_USETHREADS + /* + * xchg should automatically lock memory, but we add it + * explicitly just in case (it at least doesn't harm) + */ + "lock;" +#endif + + "xchgq %1, %0" + : + : "r"(val), "m"(*p) + : "memory"); +} +#endif /* ISC_PLATFORM_HAVEATOMICSTOREQ */ + /* * This routine atomically replaces the value in 'p' with 'val', if the * original value is equal to 'cmpval'. The original value is returned in any diff --git a/lib/isc/x86_64/include/isc/Makefile.in b/lib/isc/x86_64/include/isc/Makefile.in index 9a988bb76159..74b7f95cf3ec 100644 --- a/lib/isc/x86_64/include/isc/Makefile.in +++ b/lib/isc/x86_64/include/isc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -18,7 +18,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ HEADERS = atomic.h diff --git a/lib/isc/x86_64/include/isc/atomic.h b/lib/isc/x86_64/include/isc/atomic.h index f57bd2a78672..431600b73c33 100644 --- a/lib/isc/x86_64/include/isc/atomic.h +++ b/lib/isc/x86_64/include/isc/atomic.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2007, 2008 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2005, 2007, 2008, 2015, 2016 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -87,12 +87,26 @@ isc_atomic_store(isc_int32_t *p, isc_int32_t val) { "lock;" #endif "xchgl (%rax), %edx\n" - /* - * XXX: assume %rax will be used as the return value. - */ ); } +#ifdef ISC_PLATFORM_HAVEATOMICSTOREQ +static void +isc_atomic_storeq(isc_int64_t *p, isc_int64_t val) { + UNUSED(p); + UNUSED(val); + + __asm ( + "movq %rdi, %rax\n" + "movq %rsi, %rdx\n" +#ifdef ISC_PLATFORM_USETHREADS + "lock;" +#endif + "xchgq (%rax), %rdx\n" + ); +} +#endif + static isc_int32_t isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { UNUSED(p); @@ -100,6 +114,9 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { UNUSED(val); __asm ( + /* + * p is %rdi, cmpval is %esi, val is %edx. + */ "movl %edx, %ecx\n" "movl %esi, %eax\n" "movq %rdi, %rdx\n" @@ -108,8 +125,12 @@ isc_atomic_cmpxchg(isc_int32_t *p, isc_int32_t cmpval, isc_int32_t val) { "lock;" #endif /* - * If (%rdi) == %eax then (%rdi) := %edx. - * %eax is set to old (%ecx), which will be the return value. + * If [%rdi] == %eax then [%rdi] := %ecx (equal to %edx + * from above), and %eax is untouched (equal to %esi) + * from above. + * + * Else if [%rdi] != %eax then [%rdi] := [%rdi] + * (rewritten in write cycle) and %eax := [%rdi]. */ "cmpxchgl %ecx, (%rdx)" ); diff --git a/lib/isccc/Makefile.in b/lib/isccc/Makefile.in index 843e510a6f06..b9561fbf7efa 100644 --- a/lib/isccc/Makefile.in +++ b/lib/isccc/Makefile.in @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBISCCC_API@ diff --git a/lib/isccc/cc.c b/lib/isccc/cc.c index f98b72ae6798..88a7231280c0 100644 --- a/lib/isccc/cc.c +++ b/lib/isccc/cc.c @@ -29,8 +29,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cc.c,v 1.18 2007/08/28 07:20:43 tbox Exp $ */ - /*! \file */ #include <config.h> @@ -85,8 +83,7 @@ static isc_result_t list_towire(isccc_sexpr_t *alist, isccc_region_t *target); static isc_result_t -value_towire(isccc_sexpr_t *elt, isccc_region_t *target) -{ +value_towire(isccc_sexpr_t *elt, isccc_region_t *target) { unsigned int len; unsigned char *lenp; isccc_region_t *vr; @@ -328,8 +325,7 @@ static isc_result_t list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp); static isc_result_t -value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) -{ +value_fromwire(isccc_region_t *source, isccc_sexpr_t **valuep) { unsigned int msgtype; isc_uint32_t len; isccc_sexpr_t *value; @@ -423,8 +419,7 @@ table_fromwire(isccc_region_t *source, isccc_region_t *secret, } static isc_result_t -list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) -{ +list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) { isccc_sexpr_t *list, *value; isc_result_t result; @@ -439,7 +434,7 @@ list_fromwire(isccc_region_t *source, isccc_sexpr_t **listp) if (isccc_sexpr_addtolist(&list, value) == NULL) { isccc_sexpr_free(&value); isccc_sexpr_free(&list); - return (result); + return (ISC_R_NOMEMORY); } } @@ -585,8 +580,7 @@ isccc_cc_createack(isccc_sexpr_t *message, isc_boolean_t ok, } isc_boolean_t -isccc_cc_isack(isccc_sexpr_t *message) -{ +isccc_cc_isack(isccc_sexpr_t *message) { isccc_sexpr_t *_ctrl; _ctrl = isccc_alist_lookup(message, "_ctrl"); @@ -598,8 +592,7 @@ isccc_cc_isack(isccc_sexpr_t *message) } isc_boolean_t -isccc_cc_isreply(isccc_sexpr_t *message) -{ +isccc_cc_isreply(isccc_sexpr_t *message) { isccc_sexpr_t *_ctrl; _ctrl = isccc_alist_lookup(message, "_ctrl"); @@ -672,8 +665,7 @@ isccc_cc_createresponse(isccc_sexpr_t *message, isccc_time_t now, } isccc_sexpr_t * -isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str) -{ +isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str) { size_t len; isccc_region_t r; @@ -685,8 +677,7 @@ isccc_cc_definestring(isccc_sexpr_t *alist, const char *key, const char *str) } isccc_sexpr_t * -isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i) -{ +isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i) { char b[100]; size_t len; isccc_region_t r; @@ -700,8 +691,7 @@ isccc_cc_defineuint32(isccc_sexpr_t *alist, const char *key, isc_uint32_t i) } isc_result_t -isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) -{ +isccc_cc_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp) { isccc_sexpr_t *kv, *v; REQUIRE(strp == NULL || *strp == NULL); @@ -754,9 +744,7 @@ symtab_undefine(char *key, unsigned int type, isccc_symvalue_t value, } static isc_boolean_t -symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, - void *arg) -{ +symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, void *arg) { isccc_time_t *now; UNUSED(key); @@ -772,21 +760,18 @@ symtab_clean(char *key, unsigned int type, isccc_symvalue_t value, } isc_result_t -isccc_cc_createsymtab(isccc_symtab_t **symtabp) -{ +isccc_cc_createsymtab(isccc_symtab_t **symtabp) { return (isccc_symtab_create(11897, symtab_undefine, NULL, ISC_FALSE, symtabp)); } void -isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now) -{ +isccc_cc_cleansymtab(isccc_symtab_t *symtab, isccc_time_t now) { isccc_symtab_foreach(symtab, symtab_clean, &now); } static isc_boolean_t -has_whitespace(const char *str) -{ +has_whitespace(const char *str) { char c; if (str == NULL) diff --git a/lib/isccc/include/isccc/Makefile.in b/lib/isccc/include/isccc/Makefile.in index c4af19a74968..98a99616ec14 100644 --- a/lib/isccc/include/isccc/Makefile.in +++ b/lib/isccc/include/isccc/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/isccc/sexpr.c b/lib/isccc/sexpr.c index 9b7d5d7f3749..adf27bde79d6 100644 --- a/lib/isccc/sexpr.c +++ b/lib/isccc/sexpr.c @@ -29,8 +29,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sexpr.c,v 1.9 2007/08/28 07:20:43 tbox Exp $ */ - /*! \file */ #include <config.h> @@ -50,8 +48,7 @@ static isccc_sexpr_t sexpr_t = { ISCCC_SEXPRTYPE_T, { NULL } }; #define CDR(s) (s)->value.as_dottedpair.cdr isccc_sexpr_t * -isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr) -{ +isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr) { isccc_sexpr_t *sexpr; sexpr = malloc(sizeof(*sexpr)); @@ -65,14 +62,12 @@ isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr) } isccc_sexpr_t * -isccc_sexpr_tconst(void) -{ +isccc_sexpr_tconst(void) { return (&sexpr_t); } isccc_sexpr_t * -isccc_sexpr_fromstring(const char *str) -{ +isccc_sexpr_fromstring(const char *str) { isccc_sexpr_t *sexpr; sexpr = malloc(sizeof(*sexpr)); @@ -89,8 +84,7 @@ isccc_sexpr_fromstring(const char *str) } isccc_sexpr_t * -isccc_sexpr_frombinary(const isccc_region_t *region) -{ +isccc_sexpr_frombinary(const isccc_region_t *region) { isccc_sexpr_t *sexpr; unsigned int region_size; @@ -123,8 +117,7 @@ isccc_sexpr_frombinary(const isccc_region_t *region) } void -isccc_sexpr_free(isccc_sexpr_t **sexprp) -{ +isccc_sexpr_free(isccc_sexpr_t **sexprp) { isccc_sexpr_t *sexpr; isccc_sexpr_t *item; @@ -153,8 +146,7 @@ isccc_sexpr_free(isccc_sexpr_t **sexprp) } static isc_boolean_t -printable(isccc_region_t *r) -{ +printable(isccc_region_t *r) { unsigned char *curr; curr = r->rstart; @@ -168,8 +160,7 @@ printable(isccc_region_t *r) } void -isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) -{ +isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) { isccc_sexpr_t *cdr; unsigned int size, i; unsigned char *curr; @@ -220,40 +211,35 @@ isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream) } isccc_sexpr_t * -isccc_sexpr_car(isccc_sexpr_t *list) -{ +isccc_sexpr_car(isccc_sexpr_t *list) { REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); return (CAR(list)); } isccc_sexpr_t * -isccc_sexpr_cdr(isccc_sexpr_t *list) -{ +isccc_sexpr_cdr(isccc_sexpr_t *list) { REQUIRE(list->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); return (CDR(list)); } void -isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car) -{ +isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car) { REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); CAR(pair) = car; } void -isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr) -{ +isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr) { REQUIRE(pair->type == ISCCC_SEXPRTYPE_DOTTEDPAIR); CDR(pair) = cdr; } isccc_sexpr_t * -isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) -{ +isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) { isccc_sexpr_t *last, *elt, *l1; REQUIRE(l1p != NULL); @@ -275,40 +261,35 @@ isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2) } isc_boolean_t -isccc_sexpr_listp(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_listp(isccc_sexpr_t *sexpr) { if (sexpr == NULL || sexpr->type == ISCCC_SEXPRTYPE_DOTTEDPAIR) return (ISC_TRUE); return (ISC_FALSE); } isc_boolean_t -isccc_sexpr_emptyp(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_emptyp(isccc_sexpr_t *sexpr) { if (sexpr == NULL) return (ISC_TRUE); return (ISC_FALSE); } isc_boolean_t -isccc_sexpr_stringp(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_stringp(isccc_sexpr_t *sexpr) { if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_STRING) return (ISC_TRUE); return (ISC_FALSE); } isc_boolean_t -isccc_sexpr_binaryp(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_binaryp(isccc_sexpr_t *sexpr) { if (sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY) return (ISC_TRUE); return (ISC_FALSE); } char * -isccc_sexpr_tostring(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_tostring(isccc_sexpr_t *sexpr) { REQUIRE(sexpr != NULL && (sexpr->type == ISCCC_SEXPRTYPE_STRING || sexpr->type == ISCCC_SEXPRTYPE_BINARY)); @@ -319,8 +300,7 @@ isccc_sexpr_tostring(isccc_sexpr_t *sexpr) } isccc_region_t * -isccc_sexpr_tobinary(isccc_sexpr_t *sexpr) -{ +isccc_sexpr_tobinary(isccc_sexpr_t *sexpr) { REQUIRE(sexpr != NULL && sexpr->type == ISCCC_SEXPRTYPE_BINARY); return (&sexpr->value.as_region); } diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index 6e07da3dcedd..db4577bfb153 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2009, 2011, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2009, 2011, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001-2003 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBISCCFG_API@ diff --git a/lib/isccfg/aclconf.c b/lib/isccfg/aclconf.c index e1b68971738a..38fef0f57755 100644 --- a/lib/isccfg/aclconf.c +++ b/lib/isccfg/aclconf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2012, 2014 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2012, 2014, 2016 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1999-2002 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -254,10 +254,11 @@ count_acl_elements(const cfg_obj_t *caml, const cfg_obj_t *cctx, } else if (cfg_obj_isstring(ce)) { const char *name = cfg_obj_asstring(ce); if (strcasecmp(name, "localhost") == 0 || - strcasecmp(name, "localnets") == 0) { + strcasecmp(name, "localnets") == 0 || + strcasecmp(name, "none") == 0) + { n++; - } else if (strcasecmp(name, "any") != 0 && - strcasecmp(name, "none") != 0) { + } else if (strcasecmp(name, "any") != 0) { dns_acl_t *inneracl = NULL; /* * Convert any named acls we reference now if diff --git a/lib/isccfg/api b/lib/isccfg/api index bb8c0f039480..6bcfb1bc37d0 100644 --- a/lib/isccfg/api +++ b/lib/isccfg/api @@ -5,5 +5,5 @@ # 9.9: 90-109 # 9.9-sub: 130-139 LIBINTERFACE = 93 -LIBREVISION = 0 +LIBREVISION = 1 LIBAGE = 3 diff --git a/lib/isccfg/include/isccfg/Makefile.in b/lib/isccfg/include/isccfg/Makefile.in index d6f395ca72b0..84911c6f14c3 100644 --- a/lib/isccfg/include/isccfg/Makefile.in +++ b/lib/isccfg/include/isccfg/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001, 2002 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ # # Only list headers that are to be installed and are not diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index 0787ec5e0ddc..d95a03a61433 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -53,7 +53,8 @@ parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, const cfg_type_t *othertype, cfg_obj_t **ret); static void -doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type); +doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, + const cfg_type_t *othertype); static isc_result_t parse_keyvalue(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); @@ -553,8 +554,12 @@ static isc_result_t parse_zonestat(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_zonestat(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_zonestat = { - "zonestat", parse_zonestat, cfg_print_ustring, doc_enum_or_other, + "zonestat", parse_zonestat, cfg_print_ustring, doc_zonestat, &cfg_rep_string, zonestat_enums }; @@ -769,13 +774,18 @@ static cfg_type_t cfg_type_serverid = { /*% * Port list. */ +static void +print_porttuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { + cfg_print_cstr(pctx, "range "); + cfg_print_tuple(pctx, obj); +} static cfg_tuplefielddef_t porttuple_fields[] = { { "loport", &cfg_type_uint32, 0 }, { "hiport", &cfg_type_uint32, 0 }, { NULL, NULL, 0 } }; static cfg_type_t cfg_type_porttuple = { - "porttuple", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, + "porttuple", cfg_parse_tuple, print_porttuple, cfg_doc_tuple, &cfg_rep_tuple, porttuple_fields }; @@ -845,7 +855,6 @@ static cfg_type_t cfg_type_bracketed_portlist = { &cfg_rep_list, &cfg_type_portrange }; -#ifdef ENABLE_FETCHLIMIT /*% * fetch-quota-params */ @@ -876,8 +885,7 @@ parse_optional_response(cfg_parser_t *pctx, const cfg_type_t *type, static void doc_optional_response(cfg_printer_t *pctx, const cfg_type_t *type) { - UNUSED(type); - cfg_print_cstr(pctx, "[ ( drop | fail ) ]"); + doc_enum_or_other(pctx, type, &cfg_type_void); } static cfg_type_t cfg_type_responsetype = { @@ -895,7 +903,6 @@ static cfg_type_t cfg_type_fetchesper = { "fetchesper", cfg_parse_tuple, cfg_print_tuple, cfg_doc_tuple, &cfg_rep_tuple, fetchesper_fields }; -#endif /* ENABLE_FETCHLIMIT */ /*% * Clauses that can be found within the top level of the named.conf @@ -1001,7 +1008,7 @@ options_clauses[] = { { "transfers-out", &cfg_type_uint32, 0 }, { "treat-cr-as-space", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "use-id-pool", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, - { "use-ixfr", &cfg_type_boolean, 0 }, + { "use-ixfr", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "use-v4-udp-ports", &cfg_type_bracketed_portlist, 0 }, { "use-v6-udp-ports", &cfg_type_bracketed_portlist, 0 }, { "version", &cfg_type_qstringornone, 0 }, @@ -1443,6 +1450,10 @@ view_clauses[] = { { "fetch-quota-params", &cfg_type_fetchquota, 0 }, { "fetches-per-server", &cfg_type_fetchesper, 0 }, { "fetches-per-zone", &cfg_type_fetchesper, 0 }, +#else + { "fetch-quota-params", &cfg_type_fetchquota, CFG_CLAUSEFLAG_NOTCONFIGURED }, + { "fetches-per-server", &cfg_type_fetchesper, CFG_CLAUSEFLAG_NOTCONFIGURED }, + { "fetches-per-zone", &cfg_type_fetchesper, CFG_CLAUSEFLAG_NOTCONFIGURED }, #endif /* ENABLE_FETCHLIMIT */ { "ixfr-from-differences", &cfg_type_ixfrdifftype, 0 }, { "lame-ttl", &cfg_type_uint32, 0 }, @@ -1964,9 +1975,14 @@ parse_size(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_sizeval, ret)); } +static void +doc_size(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_sizeval); +} + static const char *size_enums[] = { "unlimited", "default", NULL }; static cfg_type_t cfg_type_size = { - "size", parse_size, cfg_print_ustring, cfg_doc_terminal, + "size", parse_size, cfg_print_ustring, doc_size, &cfg_rep_string, size_enums }; @@ -2028,12 +2044,34 @@ parse_enum_or_other(cfg_parser_t *pctx, const cfg_type_t *enumtype, } static void -doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *type) { - cfg_doc_terminal(pctx, type); -#if 0 /* XXX */ - cfg_print_chars(pctx, "( ", 2);... -#endif +doc_enum_or_other(cfg_printer_t *pctx, const cfg_type_t *enumtype, + const cfg_type_t *othertype) +{ + const char * const *p; + isc_boolean_t first = ISC_TRUE; + /* + * If othertype is cfg_type_void, it means that enumtype is + * optional. + */ + + if (othertype == &cfg_type_void) + cfg_print_cstr(pctx, "[ "); + cfg_print_cstr(pctx, "( "); + for (p = enumtype->of; *p != NULL; p++) { + if (!first) + cfg_print_cstr(pctx, " | "); + first = ISC_FALSE; + cfg_print_cstr(pctx, *p); + } + if (othertype != &cfg_type_void) { + if (!first) + cfg_print_cstr(pctx, " | "); + cfg_doc_terminal(pctx, othertype); + } + cfg_print_cstr(pctx, " )"); + if (othertype == &cfg_type_void) + cfg_print_cstr(pctx, " ]"); } static isc_result_t @@ -2078,8 +2116,12 @@ static isc_result_t parse_dialup_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_dialup_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_dialuptype = { - "dialuptype", parse_dialup_type, cfg_print_ustring, doc_enum_or_other, + "dialuptype", parse_dialup_type, cfg_print_ustring, doc_dialup_type, &cfg_rep_string, dialup_enums }; @@ -2088,18 +2130,28 @@ static isc_result_t parse_notify_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_notify_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_notifytype = { - "notifytype", parse_notify_type, cfg_print_ustring, doc_enum_or_other, + "notifytype", parse_notify_type, cfg_print_ustring, doc_notify_type, &cfg_rep_string, notify_enums, }; static const char *ixfrdiff_enums[] = { "master", "slave", NULL }; static isc_result_t -parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { +parse_ixfrdiff_type(cfg_parser_t *pctx, const cfg_type_t *type, + cfg_obj_t **ret) +{ return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_ixfrdiff_type(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_ixfrdifftype = { - "ixfrdiff", parse_ixfrdiff_type, cfg_print_ustring, doc_enum_or_other, + "ixfrdiff", parse_ixfrdiff_type, cfg_print_ustring, doc_ixfrdiff_type, &cfg_rep_string, ixfrdiff_enums, }; @@ -2109,9 +2161,13 @@ parse_v4_aaaa(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_boolean, ret)); } +static void +doc_v4_aaaa(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_boolean); +} static cfg_type_t cfg_type_v4_aaaa = { "v4_aaaa", parse_v4_aaaa, cfg_print_ustring, - doc_enum_or_other, &cfg_rep_string, v4_aaaa_enums, + doc_v4_aaaa, &cfg_rep_string, v4_aaaa_enums, }; static keyword_type_t key_kw = { "key", &cfg_type_astring }; @@ -2281,8 +2337,14 @@ parse_optional_class(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret return (result); } +static void +doc_optional_class(cfg_printer_t *pctx, const cfg_type_t *type) { + UNUSED(type); + cfg_print_cstr(pctx, "[ <class> ]"); +} + static cfg_type_t cfg_type_optional_class = { - "optional_class", parse_optional_class, NULL, cfg_doc_terminal, + "optional_class", parse_optional_class, NULL, doc_optional_class, NULL, NULL }; @@ -2531,9 +2593,15 @@ parse_optional_facility(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t ** return (result); } +static void +doc_optional_facility(cfg_printer_t *pctx, const cfg_type_t *type) { + UNUSED(type); + cfg_print_cstr(pctx, "[ <syslog_facility> ]"); +} + static cfg_type_t cfg_type_optional_facility = { - "optional_facility", parse_optional_facility, NULL, cfg_doc_terminal, - NULL, NULL }; + "optional_facility", parse_optional_facility, NULL, + doc_optional_facility, NULL, NULL }; /*% @@ -2592,8 +2660,13 @@ parse_logversions(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) { return (parse_enum_or_other(pctx, type, &cfg_type_uint32, ret)); } +static void +doc_logversions(cfg_printer_t *pctx, const cfg_type_t *type) { + doc_enum_or_other(pctx, type, &cfg_type_uint32); +} + static cfg_type_t cfg_type_logversions = { - "logversions", parse_logversions, cfg_print_ustring, cfg_doc_terminal, + "logversions", parse_logversions, cfg_print_ustring, doc_logversions, &cfg_rep_string, logversions_enums }; diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 7c969961f4ca..c3eb5b105b3e 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -262,10 +262,11 @@ cfg_print_tuple(cfg_printer_t *pctx, const cfg_obj_t *obj) { for (f = fields, i = 0; f->name != NULL; f++, i++) { const cfg_obj_t *fieldobj = obj->value.tuple[i]; - if (need_space) - cfg_print_chars(pctx, " ", 1); + if (need_space && fieldobj->type->rep != &cfg_rep_void) + cfg_print_cstr(pctx, " "); cfg_print_obj(pctx, fieldobj); - need_space = ISC_TF(fieldobj->type->print != cfg_print_void); + need_space = ISC_TF(need_space || + fieldobj->type->print != cfg_print_void); } } @@ -277,7 +278,7 @@ cfg_doc_tuple(cfg_printer_t *pctx, const cfg_type_t *type) { for (f = fields; f->name != NULL; f++) { if (need_space) - cfg_print_chars(pctx, " ", 1); + cfg_print_cstr(pctx, " "); cfg_doc_obj(pctx, f->type); need_space = ISC_TF(f->type->print != cfg_print_void); } diff --git a/lib/lwres/Makefile.in b/lib/lwres/Makefile.in index dd8eb65eed5f..e0d1ec6ba04e 100644 --- a/lib/lwres/Makefile.in +++ b/lib/lwres/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2005, 2007, 2012, 2014 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2005, 2007, 2012, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2000, 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @LIBLWRES_API@ diff --git a/lib/lwres/man/Makefile.in b/lib/lwres/man/Makefile.in index 80db9f2ff5dd..f8446fed69d1 100644 --- a/lib/lwres/man/Makefile.in +++ b/lib/lwres/man/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2004, 2007, 2012 Internet Systems Consortium, Inc. ("ISC") +# Copyright (C) 2004, 2007, 2012, 2015 Internet Systems Consortium, Inc. ("ISC") # Copyright (C) 2001 Internet Software Consortium. # # Permission to use, copy, modify, and/or distribute this software for any @@ -19,7 +19,7 @@ srcdir = @srcdir@ VPATH = @srcdir@ top_srcdir = @top_srcdir@ -@BIND9_VERSION@ +VERSION=@BIND9_VERSION@ @BIND9_MAKE_RULES@ diff --git a/lib/lwres/man/lwres.3 b/lib/lwres/man/lwres.3 index 2c03e3ae9ff1..4d1eec7e67b0 100644 --- a/lib/lwres/man/lwres.3 +++ b/lib/lwres/man/lwres.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,36 +13,54 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres \- introduction to the lightweight resolver library .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi +.ft .SH "DESCRIPTION" .PP -The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library. It provides hostname\-to\-address and address\-to\-hostname lookup services to applications by transmitting lookup requests to a resolver daemon +The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library\&. It provides hostname\-to\-address and address\-to\-hostname lookup services to applications by transmitting lookup requests to a resolver daemon \fBlwresd\fR -running on the local host. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. The library and resolver daemon communicate using a simple UDP\-based protocol. +running on the local host\&. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library\&. The library and resolver daemon communicate using a simple UDP\-based protocol\&. .SH "OVERVIEW" .PP -The lwresd library implements multiple name service APIs. The standard +The lwresd library implements multiple name service APIs\&. The standard \fBgethostbyname()\fR, \fBgethostbyaddr()\fR, \fBgethostbyname_r()\fR, @@ -50,66 +68,66 @@ The lwresd library implements multiple name service APIs. The standard \fBgetaddrinfo()\fR, \fBgetipnodebyname()\fR, and \fBgetipnodebyaddr()\fR -functions are all supported. To allow the lwres library to coexist with system libraries that define functions of the same name, the library defines these functions with names prefixed by -lwres_. To define the standard names, applications must include the header file -\fI<lwres/netdb.h>\fR +functions are all supported\&. To allow the lwres library to coexist with system libraries that define functions of the same name, the library defines these functions with names prefixed by +lwres_\&. To define the standard names, applications must include the header file +<lwres/netdb\&.h> which contains macro definitions mapping the standard function names into lwres_ -prefixed ones. Operating system vendors who integrate the lwres library into their base distributions should rename the functions in the library proper so that the renaming macros are not needed. +prefixed ones\&. Operating system vendors who integrate the lwres library into their base distributions should rename the functions in the library proper so that the renaming macros are not needed\&. .PP The library also provides a native API consisting of the functions \fBlwres_getaddrsbyname()\fR and -\fBlwres_getnamebyaddr()\fR. These may be called by applications that require more detailed control over the lookup process than the standard functions provide. +\fBlwres_getnamebyaddr()\fR\&. These may be called by applications that require more detailed control over the lookup process than the standard functions provide\&. .PP In addition to these name service independent address lookup functions, the library implements a new, experimental API for looking up arbitrary DNS resource records, using the \fBlwres_getaddrsbyname()\fR -function. +function\&. .PP -Finally, there is a low\-level API for converting lookup requests and responses to and from raw lwres protocol packets. This API can be used by clients requiring nonblocking operation, and is also used when implementing the server side of the lwres protocol, for example in the +Finally, there is a low\-level API for converting lookup requests and responses to and from raw lwres protocol packets\&. This API can be used by clients requiring nonblocking operation, and is also used when implementing the server side of the lwres protocol, for example in the \fBlwresd\fR -resolver daemon. The use of this low\-level API in clients and servers is outlined in the following sections. -.SH "CLIENT\-SIDE LOW\-LEVEL API CALL FLOW" +resolver daemon\&. The use of this low\-level API in clients and servers is outlined in the following sections\&. +.SH "CLIENT-SIDE LOW-LEVEL API CALL FLOW" .PP -When a client program wishes to make an lwres request using the native low\-level API, it typically performs the following sequence of actions. +When a client program wishes to make an lwres request using the native low\-level API, it typically performs the following sequence of actions\&. .PP (1) Allocate or use an existing \fBlwres_packet_t\fR, called \fIpkt\fR -below. +below\&. .PP (2) Set -pkt.recvlength -to the maximum length we will accept. This is done so the receiver of our packets knows how large our receive buffer is. The "default" is a constant in -\fIlwres.h\fR: -\fBLWRES_RECVLENGTH = 4096\fR. +\fIpkt\&.recvlength\fR +to the maximum length we will accept\&. This is done so the receiver of our packets knows how large our receive buffer is\&. The "default" is a constant in +lwres\&.h: +\fBLWRES_RECVLENGTH = 4096\fR\&. .PP (3) Set -pkt.serial -to a unique serial number. This value is echoed back to the application by the remote server. +\fIpkt\&.serial\fR +to a unique serial number\&. This value is echoed back to the application by the remote server\&. .PP (4) Set -pkt.pktflags. Usually this is set to 0. +\fIpkt\&.pktflags\fR\&. Usually this is set to 0\&. .PP (5) Set -pkt.result -to 0. +\fIpkt\&.result\fR +to 0\&. .PP (6) Call \fBlwres_*request_render()\fR, or marshall in the data using the primitives such as \fBlwres_packet_render()\fR -and storing the packet data. +and storing the packet data\&. .PP -(7) Transmit the resulting buffer. +(7) Transmit the resulting buffer\&. .PP (8) Call \fBlwres_*response_parse()\fR -to parse any packets received. +to parse any packets received\&. .PP -(9) Verify that the opcode and serial match a request, and process the packet specific information contained in the body. -.SH "SERVER\-SIDE LOW\-LEVEL API CALL FLOW" +(9) Verify that the opcode and serial match a request, and process the packet specific information contained in the body\&. +.SH "SERVER-SIDE LOW-LEVEL API CALL FLOW" .PP -When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the following is typically involved in processing each request packet. +When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the following is typically involved in processing each request packet\&. .PP Note that the same \fBlwres_packet_t\fR @@ -117,34 +135,34 @@ is used in both the \fB_parse()\fR and \fB_render()\fR -calls, with only a few modifications made to the packet header's contents between uses. This method is recommended as it keeps the serial, opcode, and other fields correct. +calls, with only a few modifications made to the packet header\*(Aqs contents between uses\&. This method is recommended as it keeps the serial, opcode, and other fields correct\&. .PP (1) When a packet is received, call \fBlwres_*request_parse()\fR -to unmarshall it. This returns a +to unmarshall it\&. This returns a \fBlwres_packet_t\fR (also called \fIpkt\fR, below) as well as a data specific type, such as -\fBlwres_gabnrequest_t\fR. +\fBlwres_gabnrequest_t\fR\&. .PP -(2) Process the request in the data specific type. +(2) Process the request in the data specific type\&. .PP (3) Set the -pkt.result, -pkt.recvlength -as above. All other fields can be left untouched since they were filled in by the +\fIpkt\&.result\fR, +\fIpkt\&.recvlength\fR +as above\&. All other fields can be left untouched since they were filled in by the \fB*_parse()\fR -call above. If using +call above\&. If using \fBlwres_*response_render()\fR, -pkt.pktflags -will be set up properly. Otherwise, the +\fIpkt\&.pktflags\fR +will be set up properly\&. Otherwise, the \fBLWRES_LWPACKETFLAG_RESPONSE\fR -bit should be set. +bit should be set\&. .PP (4) Call the data specific rendering function, such as -\fBlwres_gabnresponse_render()\fR. +\fBlwres_gabnresponse_render()\fR\&. .PP -(5) Send the resulting packet to the client. +(5) Send the resulting packet to the client\&. .PP .SH "SEE ALSO" .PP @@ -157,9 +175,13 @@ bit should be set. \fBlwres_context\fR(3), \fBlwres_config\fR(3), \fBresolver\fR(5), -\fBlwresd\fR(8). +\fBlwresd\fR(8)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres.docbook b/lib/lwres/man/lwres.docbook index 26723e5f0cab..5e84ee970d23 100644 --- a/lib/lwres/man/lwres.docbook +++ b/lib/lwres/man/lwres.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -40,6 +41,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -55,8 +57,8 @@ </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library. It provides hostname-to-address @@ -69,10 +71,10 @@ The library and resolver daemon communicate using a simple UDP-based protocol. </para> - </refsect1> + </refsection> + + <refsection><info><title>OVERVIEW</title></info> - <refsect1> - <title>OVERVIEW</title> <para> The lwresd library implements multiple name service APIs. The standard @@ -124,9 +126,9 @@ resolver daemon. The use of this low-level API in clients and servers is outlined in the following sections. </para> - </refsect1> - <refsect1> - <title>CLIENT-SIDE LOW-LEVEL API CALL FLOW</title> + </refsection> + <refsection><info><title>CLIENT-SIDE LOW-LEVEL API CALL FLOW</title></info> + <para> When a client program wishes to make an lwres request using the native low-level API, it typically performs the following @@ -137,23 +139,23 @@ called <varname>pkt</varname> below. </para> <para> - (2) Set <structfield>pkt.recvlength</structfield> to the maximum length + (2) Set <varname remap="structfield">pkt.recvlength</varname> to the maximum length we will accept. This is done so the receiver of our packets knows how large our receive buffer is. The "default" is a constant in <filename>lwres.h</filename>: <constant>LWRES_RECVLENGTH = 4096</constant>. </para> <para> - (3) Set <structfield>pkt.serial</structfield> + (3) Set <varname remap="structfield">pkt.serial</varname> to a unique serial number. This value is echoed back to the application by the remote server. </para> <para> - (4) Set <structfield>pkt.pktflags</structfield>. Usually this is set to + (4) Set <varname remap="structfield">pkt.pktflags</varname>. Usually this is set to 0. </para> <para> - (5) Set <structfield>pkt.result</structfield> to 0. + (5) Set <varname remap="structfield">pkt.result</varname> to 0. </para> <para> (6) Call <function>lwres_*request_render()</function>, @@ -172,9 +174,9 @@ (9) Verify that the opcode and serial match a request, and process the packet specific information contained in the body. </para> - </refsect1> - <refsect1> - <title>SERVER-SIDE LOW-LEVEL API CALL FLOW</title> + </refsection> + <refsection><info><title>SERVER-SIDE LOW-LEVEL API CALL FLOW</title></info> + <para> When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the @@ -197,12 +199,12 @@ (2) Process the request in the data specific type. </para> <para> - (3) Set the <structfield>pkt.result</structfield>, - <structfield>pkt.recvlength</structfield> as above. All other fields + (3) Set the <varname remap="structfield">pkt.result</varname>, + <varname remap="structfield">pkt.recvlength</varname> as above. All other fields can be left untouched since they were filled in by the <function>*_parse()</function> call above. If using <function>lwres_*response_render()</function>, - <structfield>pkt.pktflags</structfield> will be set up + <varname remap="structfield">pkt.pktflags</varname> will be set up properly. Otherwise, the <constant>LWRES_LWPACKETFLAG_RESPONSE</constant> bit should be set. </para> @@ -213,10 +215,10 @@ <para> (5) Send the resulting packet to the client. </para> - <para></para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + <para/> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_gethostent</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -258,9 +260,5 @@ </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres.html b/lib/lwres/man/lwres.html index cb8a0776af48..aa405a4f5e0b 100644 --- a/lib/lwres/man/lwres.html +++ b/lib/lwres/man/lwres.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres — introduction to the lightweight resolver library</p> @@ -31,14 +30,14 @@ <h2>Synopsis</h2> <div class="funcsynopsis"><pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre></div> </div> -<div class="refsect1" lang="en"> -<a name="id2543357"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> The BIND 9 lightweight resolver library is a simple, name service independent stub resolver library. It provides hostname-to-address and address-to-hostname lookup services to applications by transmitting lookup requests to a resolver daemon - <span><strong class="command">lwresd</strong></span> + <span class="command"><strong>lwresd</strong></span> running on the local host. The resolver daemon performs the lookup using the DNS or possibly other name service protocols, and returns the results to the application through the library. @@ -46,8 +45,8 @@ UDP-based protocol. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543370"></a><h2>OVERVIEW</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>OVERVIEW</h2> <p> The lwresd library implements multiple name service APIs. The standard @@ -95,13 +94,13 @@ This API can be used by clients requiring nonblocking operation, and is also used when implementing the server side of the lwres protocol, for example in the - <span><strong class="command">lwresd</strong></span> + <span class="command"><strong>lwresd</strong></span> resolver daemon. The use of this low-level API in clients and servers is outlined in the following sections. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543434"></a><h2>CLIENT-SIDE LOW-LEVEL API CALL FLOW</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>CLIENT-SIDE LOW-LEVEL API CALL FLOW</h2> <p> When a client program wishes to make an lwres request using the native low-level API, it typically performs the following @@ -112,23 +111,23 @@ called <code class="varname">pkt</code> below. </p> <p> - (2) Set <em class="structfield"><code>pkt.recvlength</code></em> to the maximum length + (2) Set <code class="varname">pkt.recvlength</code> to the maximum length we will accept. This is done so the receiver of our packets knows how large our receive buffer is. The "default" is a constant in <code class="filename">lwres.h</code>: <code class="constant">LWRES_RECVLENGTH = 4096</code>. </p> <p> - (3) Set <em class="structfield"><code>pkt.serial</code></em> + (3) Set <code class="varname">pkt.serial</code> to a unique serial number. This value is echoed back to the application by the remote server. </p> <p> - (4) Set <em class="structfield"><code>pkt.pktflags</code></em>. Usually this is set to + (4) Set <code class="varname">pkt.pktflags</code>. Usually this is set to 0. </p> <p> - (5) Set <em class="structfield"><code>pkt.result</code></em> to 0. + (5) Set <code class="varname">pkt.result</code> to 0. </p> <p> (6) Call <code class="function">lwres_*request_render()</code>, @@ -148,8 +147,8 @@ packet specific information contained in the body. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543582"></a><h2>SERVER-SIDE LOW-LEVEL API CALL FLOW</h2> +<div class="refsection"> +<a name="id-1.10"></a><h2>SERVER-SIDE LOW-LEVEL API CALL FLOW</h2> <p> When implementing the server side of the lightweight resolver protocol using the lwres library, a sequence of actions like the @@ -172,12 +171,12 @@ (2) Process the request in the data specific type. </p> <p> - (3) Set the <em class="structfield"><code>pkt.result</code></em>, - <em class="structfield"><code>pkt.recvlength</code></em> as above. All other fields + (3) Set the <code class="varname">pkt.result</code>, + <code class="varname">pkt.recvlength</code> as above. All other fields can be left untouched since they were filled in by the <code class="function">*_parse()</code> call above. If using <code class="function">lwres_*response_render()</code>, - <em class="structfield"><code>pkt.pktflags</code></em> will be set up + <code class="varname">pkt.pktflags</code> will be set up properly. Otherwise, the <code class="constant">LWRES_LWPACKETFLAG_RESPONSE</code> bit should be set. </p> @@ -190,8 +189,8 @@ </p> <p></p> </div> -<div class="refsect1" lang="en"> -<a name="id2543666"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.11"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_gethostent</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getipnode</span>(3)</span>, diff --git a/lib/lwres/man/lwres_buffer.3 b/lib/lwres/man/lwres_buffer.3 index 22b14ab2e68c..363c0da6d073 100644 --- a/lib/lwres/man/lwres_buffer.3 +++ b/lib/lwres/man/lwres_buffer.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,132 +13,158 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_buffer .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_BUFFER" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_BUFFER" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem \- lightweight resolver buffer management .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwbuffer.h> +#include <lwres/lwbuffer\&.h> .fi -.HP 23 +.ft +.HP \w'void\ lwres_buffer_init('u .BI "void lwres_buffer_init(lwres_buffer_t\ *" "b" ", void\ *" "base" ", unsigned\ int\ " "length" ");" -.HP 29 +.HP \w'void\ lwres_buffer_invalidate('u .BI "void lwres_buffer_invalidate(lwres_buffer_t\ *" "b" ");" -.HP 22 +.HP \w'void\ lwres_buffer_add('u .BI "void lwres_buffer_add(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");" -.HP 27 +.HP \w'void\ lwres_buffer_subtract('u .BI "void lwres_buffer_subtract(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");" -.HP 24 +.HP \w'void\ lwres_buffer_clear('u .BI "void lwres_buffer_clear(lwres_buffer_t\ *" "b" ");" -.HP 24 +.HP \w'void\ lwres_buffer_first('u .BI "void lwres_buffer_first(lwres_buffer_t\ *" "b" ");" -.HP 26 +.HP \w'void\ lwres_buffer_forward('u .BI "void lwres_buffer_forward(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");" -.HP 23 +.HP \w'void\ lwres_buffer_back('u .BI "void lwres_buffer_back(lwres_buffer_t\ *" "b" ", unsigned\ int\ " "n" ");" -.HP 36 +.HP \w'lwres_uint8_t\ lwres_buffer_getuint8('u .BI "lwres_uint8_t lwres_buffer_getuint8(lwres_buffer_t\ *" "b" ");" -.HP 27 +.HP \w'void\ lwres_buffer_putuint8('u .BI "void lwres_buffer_putuint8(lwres_buffer_t\ *" "b" ", lwres_uint8_t\ " "val" ");" -.HP 38 +.HP \w'lwres_uint16_t\ lwres_buffer_getuint16('u .BI "lwres_uint16_t lwres_buffer_getuint16(lwres_buffer_t\ *" "b" ");" -.HP 28 +.HP \w'void\ lwres_buffer_putuint16('u .BI "void lwres_buffer_putuint16(lwres_buffer_t\ *" "b" ", lwres_uint16_t\ " "val" ");" -.HP 38 +.HP \w'lwres_uint32_t\ lwres_buffer_getuint32('u .BI "lwres_uint32_t lwres_buffer_getuint32(lwres_buffer_t\ *" "b" ");" -.HP 28 +.HP \w'void\ lwres_buffer_putuint32('u .BI "void lwres_buffer_putuint32(lwres_buffer_t\ *" "b" ", lwres_uint32_t\ " "val" ");" -.HP 25 +.HP \w'void\ lwres_buffer_putmem('u .BI "void lwres_buffer_putmem(lwres_buffer_t\ *" "b" ", const\ unsigned\ char\ *" "base" ", unsigned\ int\ " "length" ");" -.HP 25 +.HP \w'void\ lwres_buffer_getmem('u .BI "void lwres_buffer_getmem(lwres_buffer_t\ *" "b" ", unsigned\ char\ *" "base" ", unsigned\ int\ " "length" ");" .SH "DESCRIPTION" .PP -These functions provide bounds checked access to a region of memory where data is being read or written. They are based on, and similar to, the +These functions provide bounds checked access to a region of memory where data is being read or written\&. They are based on, and similar to, the isc_buffer_ -functions in the ISC library. +functions in the ISC library\&. .PP -A buffer is a region of memory, together with a set of related subregions. The +A buffer is a region of memory, together with a set of related subregions\&. The \fIused region\fR and the \fIavailable\fR -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. +region are disjoint, and their union is the buffer\*(Aqs 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\*(Aqs region\&. The size of the used region can be changed using various buffer commands\&. Initially, the used region is empty\&. .PP The used region is further subdivided into two disjoint regions: the \fIconsumed region\fR and the -\fIremaining region\fR. 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 +\fIremaining region\fR\&. 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 \fIcurrent\fR -offset (if any). The +offset (if any)\&. The \fIremaining\fR -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. +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\&. .PP The \fIactive region\fR -is an (optional) subregion of the remaining region. It extends from the current offset to an offset in the remaining region. Initially, the active region is empty. If the current offset advances beyond the chosen offset, the active region will also be empty. +is an (optional) subregion of the remaining region\&. It extends from the current offset to an offset in the remaining region\&. Initially, the active region is empty\&. If the current offset advances beyond the chosen offset, the active region will also be empty\&. .PP +.if n \{\ .RS 4 +.\} .nf - /\-\-\-\-\-\-\-\-\-\-\-\-entire length\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\\\\ - /\-\-\-\-\- used region \-\-\-\-\-\\\\/\-\- available \-\-\\\\ + /\-\-\-\-\-\-\-\-\-\-\-\-entire length\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\e\e + /\-\-\-\-\- used region \-\-\-\-\-\e\e/\-\- available \-\-\e\e +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | consumed | remaining | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ a b c d e .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf - 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 == 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\&. .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf - a\-e == entire length of buffer. - a\-d == used region. - a\-b == consumed region. - b\-d == remaining region. - b\-c == optional active region. + a\-e == entire length of buffer\&. + a\-d == used region\&. + a\-b == consumed region\&. + b\-d == remaining region\&. + b\-c == optional active region\&. .fi +.if n \{\ .RE -.sp +.\} .PP \fBlwres_buffer_init()\fR initializes the -\fBlwres_buffer_t\fR -\fI*b\fR +\fBlwres_buffer_t\fR\fI*b\fR and assocates it with the memory region of size \fIlength\fR bytes starting at location -\fIbase.\fR +\fIbase\&.\fR .PP \fBlwres_buffer_invalidate()\fR marks the buffer \fI*b\fR -as invalid. Invalidating a buffer after use is not required, but makes it possible to catch its possible accidental use. +as invalid\&. Invalidating a buffer after use is not required, but makes it possible to catch its possible accidental use\&. .PP The functions \fBlwres_buffer_add()\fR @@ -148,49 +174,49 @@ respectively increase and decrease the used space in buffer \fI*b\fR by \fIn\fR -bytes. +bytes\&. \fBlwres_buffer_add()\fR checks for buffer overflow and \fBlwres_buffer_subtract()\fR -checks for underflow. These functions do not allocate or deallocate memory. They just change the value of -used. +checks for underflow\&. These functions do not allocate or deallocate memory\&. They just change the value of +\fIused\fR\&. .PP A buffer is re\-initialised by -\fBlwres_buffer_clear()\fR. The function sets -used, -current +\fBlwres_buffer_clear()\fR\&. The function sets +\fIused\fR, +\fIcurrent\fR and -active -to zero. +\fIactive\fR +to zero\&. .PP \fBlwres_buffer_first\fR makes the consumed region of buffer \fI*p\fR empty by setting -current -to zero (the start of the buffer). +\fIcurrent\fR +to zero (the start of the buffer)\&. .PP \fBlwres_buffer_forward()\fR increases the consumed region of buffer \fI*b\fR by \fIn\fR -bytes, checking for overflow. Similarly, +bytes, checking for overflow\&. Similarly, \fBlwres_buffer_back()\fR decreases buffer -\fIb\fR's consumed region by +\fIb\fR\*(Aqs consumed region by \fIn\fR -bytes and checks for underflow. +bytes and checks for underflow\&. .PP \fBlwres_buffer_getuint8()\fR reads an unsigned 8\-bit integer from \fI*b\fR -and returns it. +and returns it\&. \fBlwres_buffer_putuint8()\fR writes the unsigned 8\-bit integer \fIval\fR to buffer -\fI*b\fR. +\fI*b\fR\&. .PP \fBlwres_buffer_getuint16()\fR and @@ -198,36 +224,40 @@ and are identical to \fBlwres_buffer_putuint8()\fR except that they respectively read an unsigned 16\-bit or 32\-bit integer in network byte order from -\fIb\fR. Similarly, +\fIb\fR\&. Similarly, \fBlwres_buffer_putuint16()\fR and \fBlwres_buffer_putuint32()\fR writes the unsigned 16\-bit or 32\-bit integer \fIval\fR to buffer -\fIb\fR, in network byte order. +\fIb\fR, in network byte order\&. .PP Arbitrary amounts of data are read or written from a lightweight resolver buffer with \fBlwres_buffer_getmem()\fR and \fBlwres_buffer_putmem()\fR -respectively. +respectively\&. \fBlwres_buffer_putmem()\fR copies \fIlength\fR bytes of memory at \fIbase\fR to -\fIb\fR. Conversely, +\fIb\fR\&. Conversely, \fBlwres_buffer_getmem()\fR copies \fIlength\fR bytes of memory from \fIb\fR to -\fIbase\fR. +\fIbase\fR\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_buffer.docbook b/lib/lwres/man/lwres_buffer.docbook index 17ccbf549f4a..532a09c2390a 100644 --- a/lib/lwres/man/lwres_buffer.docbook +++ b/lib/lwres/man/lwres_buffer.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,9 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -35,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -199,9 +202,9 @@ void </funcsynopsis> </refsynopsisdiv> - <refsect1> + <refsection><info><title>DESCRIPTION</title></info> + - <title>DESCRIPTION</title> <para> These functions provide bounds checked access to a region of memory where data is being read or written. @@ -302,23 +305,23 @@ void checks for underflow. These functions do not allocate or deallocate memory. They just change the value of - <structfield>used</structfield>. + <varname remap="structfield">used</varname>. </para> <para> A buffer is re-initialised by <function>lwres_buffer_clear()</function>. The function sets - <structfield>used</structfield>, - <structfield>current</structfield> + <varname remap="structfield">used</varname>, + <varname remap="structfield">current</varname> and - <structfield>active</structfield> + <varname remap="structfield">active</varname> to zero. </para> <para><function>lwres_buffer_first</function> makes the consumed region of buffer <parameter>*p</parameter> empty by setting - <structfield>current</structfield> + <varname remap="structfield">current</varname> to zero (the start of the buffer). </para> <para><function>lwres_buffer_forward()</function> @@ -386,9 +389,5 @@ void to <parameter>base</parameter>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_buffer.html b/lib/lwres/man/lwres_buffer.html index 4e7735ef8169..05c3eead7320 100644 --- a/lib/lwres/man/lwres_buffer.html +++ b/lib/lwres/man/lwres_buffer.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_buffer</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_buffer_init, lwres_buffer_invalidate, lwres_buffer_add, lwres_buffer_subtract, lwres_buffer_clear, lwres_buffer_first, lwres_buffer_forward, lwres_buffer_back, lwres_buffer_getuint8, lwres_buffer_putuint8, lwres_buffer_getuint16, lwres_buffer_putuint16, lwres_buffer_getuint32, lwres_buffer_putuint32, lwres_buffer_putmem, lwres_buffer_getmem — lightweight resolver buffer management</p> @@ -33,236 +32,194 @@ <pre class="funcsynopsisinfo"> #include <lwres/lwbuffer.h> </pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_init</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>void * </td> -<td> -<var class="pdparam">base</var>, </td> +<td>void *<var class="pdparam">base</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">length</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_invalidate</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_add</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">n</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_subtract</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">n</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_clear</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_first</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_forward</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">n</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_back</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">n</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">n</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_uint8_t <b class="fsfunc">lwres_buffer_getuint8</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_putuint8</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint8_t </td> -<td> -<var class="pdparam">val</var><code>)</code>;</td> +<td>lwres_uint8_t <var class="pdparam">val</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_uint16_t <b class="fsfunc">lwres_buffer_getuint16</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_putuint16</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint16_t </td> -<td> -<var class="pdparam">val</var><code>)</code>;</td> +<td>lwres_uint16_t <var class="pdparam">val</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_uint32_t <b class="fsfunc">lwres_buffer_getuint32</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_putuint32</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint32_t </td> -<td> -<var class="pdparam">val</var><code>)</code>;</td> +<td>lwres_uint32_t <var class="pdparam">val</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_putmem</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>const unsigned char * </td> -<td> -<var class="pdparam">base</var>, </td> +<td>const unsigned char *<var class="pdparam">base</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">length</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_buffer_getmem</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>unsigned char * </td> -<td> -<var class="pdparam">base</var>, </td> +<td>unsigned char *<var class="pdparam">base</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">length</var><code>)</code>;</td> +<td>unsigned int <var class="pdparam">length</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543901"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These functions provide bounds checked access to a region of memory where data is being read or written. @@ -366,23 +323,23 @@ void checks for underflow. These functions do not allocate or deallocate memory. They just change the value of - <em class="structfield"><code>used</code></em>. + <code class="varname">used</code>. </p> <p> A buffer is re-initialised by <code class="function">lwres_buffer_clear()</code>. The function sets - <em class="structfield"><code>used</code></em>, - <em class="structfield"><code>current</code></em> + <code class="varname">used</code>, + <code class="varname">current</code> and - <em class="structfield"><code>active</code></em> + <code class="varname">active</code> to zero. </p> <p><code class="function">lwres_buffer_first</code> makes the consumed region of buffer <em class="parameter"><code>*p</code></em> empty by setting - <em class="structfield"><code>current</code></em> + <code class="varname">current</code> to zero (the start of the buffer). </p> <p><code class="function">lwres_buffer_forward()</code> diff --git a/lib/lwres/man/lwres_config.3 b/lib/lwres/man/lwres_config.3 index 25b11810051f..aff3233b8e9f 100644 --- a/lib/lwres/man/lwres_config.3 +++ b/lib/lwres/man/lwres_config.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,37 +13,55 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_config .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_CONFIG" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_CONFIG" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_conf_get \- lightweight resolver configuration .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 21 +.ft +.HP \w'void\ lwres_conf_init('u .BI "void lwres_conf_init(lwres_context_t\ *" "ctx" ");" -.HP 22 +.HP \w'void\ lwres_conf_clear('u .BI "void lwres_conf_clear(lwres_context_t\ *" "ctx" ");" -.HP 32 +.HP \w'lwres_result_t\ lwres_conf_parse('u .BI "lwres_result_t lwres_conf_parse(lwres_context_t\ *" "ctx" ", const\ char\ *" "filename" ");" -.HP 32 +.HP \w'lwres_result_t\ lwres_conf_print('u .BI "lwres_result_t lwres_conf_print(lwres_context_t\ *" "ctx" ", FILE\ *" "fp" ");" -.HP 30 +.HP \w'lwres_conf_t\ *\ lwres_conf_get('u .BI "lwres_conf_t * lwres_conf_get(lwres_context_t\ *" "ctx" ");" .SH "DESCRIPTION" .PP @@ -51,21 +69,21 @@ lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_con creates an empty \fBlwres_conf_t\fR structure for lightweight resolver context -\fIctx\fR. +\fIctx\fR\&. .PP \fBlwres_conf_clear()\fR frees up all the internal memory used by that \fBlwres_conf_t\fR structure in resolver context -\fIctx\fR. +\fIctx\fR\&. .PP \fBlwres_conf_parse()\fR opens the file \fIfilename\fR and parses it to initialise the resolver context -\fIctx\fR's +\fIctx\fR\*(Aqs \fBlwres_conf_t\fR -structure. +structure\&. .PP \fBlwres_conf_print()\fR prints the @@ -73,34 +91,37 @@ prints the structure for resolver context \fIctx\fR to the -\fBFILE\fR -\fIfp\fR. +\fBFILE\fR\fIfp\fR\&. .SH "RETURN VALUES" .PP \fBlwres_conf_parse()\fR returns \fBLWRES_R_SUCCESS\fR if it successfully read and parsed -\fIfilename\fR. It returns +\fIfilename\fR\&. It returns \fBLWRES_R_FAILURE\fR if \fIfilename\fR -could not be opened or contained incorrect resolver statements. +could not be opened or contained incorrect resolver statements\&. .PP \fBlwres_conf_print()\fR returns \fBLWRES_R_SUCCESS\fR -unless an error occurred when converting the network addresses to a numeric host address string. If this happens, the function returns -\fBLWRES_R_FAILURE\fR. +unless an error occurred when converting the network addresses to a numeric host address string\&. If this happens, the function returns +\fBLWRES_R_FAILURE\fR\&. .SH "SEE ALSO" .PP \fBstdio\fR(3), -\fBresolver\fR(5). +\fBresolver\fR(5)\&. .SH "FILES" .PP -\fI/etc/resolv.conf\fR +/etc/resolv\&.conf +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_config.docbook b/lib/lwres/man/lwres_config.docbook index 5af37eaf7cea..0a40ee5f44f0 100644 --- a/lib/lwres/man/lwres_config.docbook +++ b/lib/lwres/man/lwres_config.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -92,8 +94,8 @@ lwres_conf_t * </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_conf_init()</function> creates an empty @@ -128,10 +130,10 @@ lwres_conf_t * <type>FILE</type> <parameter>fp</parameter>. </para> - </refsect1> - <refsect1> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + - <title>RETURN VALUES</title> <para><function>lwres_conf_parse()</function> returns <errorcode>LWRES_R_SUCCESS</errorcode> @@ -150,9 +152,9 @@ lwres_conf_t * If this happens, the function returns <errorcode>LWRES_R_FAILURE</errorcode>. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>stdio</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -160,14 +162,10 @@ lwres_conf_t * <refentrytitle>resolver</refentrytitle><manvolnum>5</manvolnum> </citerefentry>. </para> - </refsect1> - <refsect1> - <title>FILES</title> + </refsection> + <refsection><info><title>FILES</title></info> + <para><filename>/etc/resolv.conf</filename> </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_config.html b/lib/lwres/man/lwres_config.html index b3b81f7a8288..f6337bb9e6cd 100644 --- a/lib/lwres/man/lwres_config.html +++ b/lib/lwres/man/lwres_config.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_config</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_conf_init, lwres_conf_clear, lwres_conf_parse, lwres_conf_print, lwres_conf_get — lightweight resolver configuration</p> @@ -31,66 +30,57 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_conf_init</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var><code>)</code>;</td> +<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_conf_clear</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var><code>)</code>;</td> +<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_conf_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>const char * </td> -<td> -<var class="pdparam">filename</var><code>)</code>;</td> +<td>const char *<var class="pdparam">filename</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_conf_print</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>FILE * </td> -<td> -<var class="pdparam">fp</var><code>)</code>;</td> +<td>FILE *<var class="pdparam">fp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_conf_t * <b class="fsfunc">lwres_conf_get</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var><code>)</code>;</td> +<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543450"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_conf_init()</code> creates an empty <span class="type">lwres_conf_t</span> @@ -122,8 +112,8 @@ lwres_conf_t * <em class="parameter"><code>fp</code></em>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543517"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_conf_parse()</code> returns <span class="errorcode">LWRES_R_SUCCESS</span> if it successfully read and parsed @@ -141,14 +131,14 @@ lwres_conf_t * <span class="errorcode">LWRES_R_FAILURE</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543555"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">stdio</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">resolver</span>(5)</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543580"></a><h2>FILES</h2> +<div class="refsection"> +<a name="id-1.10"></a><h2>FILES</h2> <p><code class="filename">/etc/resolv.conf</code> </p> </div> diff --git a/lib/lwres/man/lwres_context.3 b/lib/lwres/man/lwres_context.3 index d544a3c39819..77c1342b8cf7 100644 --- a/lib/lwres/man/lwres_context.3 +++ b/lib/lwres/man/lwres_context.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,126 +13,144 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_context .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_CONTEXT" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_CONTEXT" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_context_initserial, lwres_context_freemem, lwres_context_allocmem, lwres_context_sendrecv \- lightweight resolver context management .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 36 +.ft +.HP \w'lwres_result_t\ lwres_context_create('u .BI "lwres_result_t lwres_context_create(lwres_context_t\ **" "contextp" ", void\ *" "arg" ", lwres_malloc_t\ " "malloc_function" ", lwres_free_t\ " "free_function" ");" -.HP 37 +.HP \w'lwres_result_t\ lwres_context_destroy('u .BI "lwres_result_t lwres_context_destroy(lwres_context_t\ **" "contextp" ");" -.HP 30 +.HP \w'void\ lwres_context_initserial('u .BI "void lwres_context_initserial(lwres_context_t\ *" "ctx" ", lwres_uint32_t\ " "serial" ");" -.HP 40 +.HP \w'lwres_uint32_t\ lwres_context_nextserial('u .BI "lwres_uint32_t lwres_context_nextserial(lwres_context_t\ *" "ctx" ");" -.HP 27 +.HP \w'void\ lwres_context_freemem('u .BI "void lwres_context_freemem(lwres_context_t\ *" "ctx" ", void\ *" "mem" ", size_t\ " "len" ");" -.HP 28 +.HP \w'void\ lwres_context_allocmem('u .BI "void lwres_context_allocmem(lwres_context_t\ *" "ctx" ", size_t\ " "len" ");" -.HP 30 +.HP \w'void\ *\ lwres_context_sendrecv('u .BI "void * lwres_context_sendrecv(lwres_context_t\ *" "ctx" ", void\ *" "sendbase" ", int\ " "sendlen" ", void\ *" "recvbase" ", int\ " "recvlen" ", int\ *" "recvd_len" ");" .SH "DESCRIPTION" .PP \fBlwres_context_create()\fR creates a \fBlwres_context_t\fR -structure for use in lightweight resolver operations. It holds a socket and other data needed for communicating with a resolver daemon. The new +structure for use in lightweight resolver operations\&. It holds a socket and other data needed for communicating with a resolver daemon\&. The new \fBlwres_context_t\fR is returned through \fIcontextp\fR, a pointer to a \fBlwres_context_t\fR -pointer. This +pointer\&. This \fBlwres_context_t\fR pointer must initially be NULL, and is modified to point to the newly created -\fBlwres_context_t\fR. +\fBlwres_context_t\fR\&. .PP When the lightweight resolver needs to perform dynamic memory allocation, it will call \fImalloc_function\fR to allocate memory and \fIfree_function\fR -to free it. If +to free it\&. If \fImalloc_function\fR and \fIfree_function\fR are NULL, memory is allocated using -\fBmalloc\fR(3). and -\fBfree\fR(3). It is not permitted to have a NULL +\fBmalloc\fR(3)\&. and +\fBfree\fR(3)\&. It is not permitted to have a NULL \fImalloc_function\fR and a non\-NULL \fIfree_function\fR -or vice versa. +or vice versa\&. \fIarg\fR -is passed as the first parameter to the memory allocation functions. If +is passed as the first parameter to the memory allocation functions\&. If \fImalloc_function\fR and \fIfree_function\fR are NULL, \fIarg\fR -is unused and should be passed as NULL. +is unused and should be passed as NULL\&. .PP Once memory for the structure has been allocated, it is initialized using \fBlwres_conf_init\fR(3) and returned via -\fI*contextp\fR. +\fI*contextp\fR\&. .PP \fBlwres_context_destroy()\fR destroys a -\fBlwres_context_t\fR, closing its socket. +\fBlwres_context_t\fR, closing its socket\&. \fIcontextp\fR -is a pointer to a pointer to the context that is to be destroyed. The pointer will be set to NULL when the context has been destroyed. +is a pointer to a pointer to the context that is to be destroyed\&. The pointer will be set to NULL when the context has been destroyed\&. .PP -The context holds a serial number that is used to identify resolver request packets and associate responses with the corresponding requests. This serial number is controlled using +The context holds a serial number that is used to identify resolver request packets and associate responses with the corresponding requests\&. This serial number is controlled using \fBlwres_context_initserial()\fR and -\fBlwres_context_nextserial()\fR. +\fBlwres_context_nextserial()\fR\&. \fBlwres_context_initserial()\fR sets the serial number for context \fI*ctx\fR to -\fIserial\fR. +\fIserial\fR\&. \fBlwres_context_nextserial()\fR -increments the serial number and returns the previous value. +increments the serial number and returns the previous value\&. .PP Memory for a lightweight resolver context is allocated and freed using \fBlwres_context_allocmem()\fR and -\fBlwres_context_freemem()\fR. These use whatever allocations were defined when the context was created with -\fBlwres_context_create()\fR. +\fBlwres_context_freemem()\fR\&. These use whatever allocations were defined when the context was created with +\fBlwres_context_create()\fR\&. \fBlwres_context_allocmem()\fR allocates \fIlen\fR -bytes of memory and if successful returns a pointer to the allocated storage. +bytes of memory and if successful returns a pointer to the allocated storage\&. \fBlwres_context_freemem()\fR frees \fIlen\fR bytes of space starting at location -\fImem\fR. +\fImem\fR\&. .PP \fBlwres_context_sendrecv()\fR performs I/O for the context -\fIctx\fR. Data are read and written from the context's socket. It writes data from +\fIctx\fR\&. Data are read and written from the context\*(Aqs socket\&. It writes data from \fIsendbase\fR \(em typically a lightweight resolver query packet \(em and waits for a reply which is copied to the receive buffer at -\fIrecvbase\fR. The number of bytes that were written to this receive buffer is returned in -\fI*recvd_len\fR. +\fIrecvbase\fR\&. The number of bytes that were written to this receive buffer is returned in +\fI*recvd_len\fR\&. .SH "RETURN VALUES" .PP \fBlwres_context_create()\fR @@ -142,29 +160,33 @@ if memory for the \fBstruct lwres_context\fR could not be allocated, \fBLWRES_R_SUCCESS\fR -otherwise. +otherwise\&. .PP Successful calls to the memory allocator \fBlwres_context_allocmem()\fR -return a pointer to the start of the allocated space. It returns NULL if memory could not be allocated. +return a pointer to the start of the allocated space\&. It returns NULL if memory could not be allocated\&. .PP \fBLWRES_R_SUCCESS\fR is returned when \fBlwres_context_sendrecv()\fR -completes successfully. +completes successfully\&. \fBLWRES_R_IOERROR\fR is returned if an I/O error occurs and \fBLWRES_R_TIMEOUT\fR is returned if \fBlwres_context_sendrecv()\fR -times out waiting for a response. +times out waiting for a response\&. .SH "SEE ALSO" .PP \fBlwres_conf_init\fR(3), \fBmalloc\fR(3), -\fBfree\fR(3). +\fBfree\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_context.docbook b/lib/lwres/man/lwres_context.docbook index e0a45eecf31d..edfdde68e6b2 100644 --- a/lib/lwres/man/lwres_context.docbook +++ b/lib/lwres/man/lwres_context.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -115,8 +119,8 @@ void * </funcprototype> </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_context_create()</function> creates a <type>lwres_context_t</type> structure for use in @@ -212,10 +216,10 @@ void * written to this receive buffer is returned in <parameter>*recvd_len</parameter>. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para><function>lwres_context_create()</function> returns <errorcode>LWRES_R_NOMEMORY</errorcode> if memory for @@ -239,9 +243,9 @@ void * <function>lwres_context_sendrecv()</function> times out waiting for a response. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_conf_init</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -254,9 +258,5 @@ void * <refentrytitle>free</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_context.html b/lib/lwres/man/lwres_context.html index ba6b858a4d32..919dff77f25a 100644 --- a/lib/lwres/man/lwres_context.html +++ b/lib/lwres/man/lwres_context.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_context</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_context_create, lwres_context_destroy, lwres_context_nextserial, lwres_context_initserial, lwres_context_freemem, lwres_context_allocmem, lwres_context_sendrecv — lightweight resolver context management</p> @@ -31,148 +30,117 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_context_create</b>(</code></td> -<td>lwres_context_t ** </td> -<td> -<var class="pdparam">contextp</var>, </td> +<td>lwres_context_t **<var class="pdparam">contextp</var>, </td> </tr> <tr> <td> </td> -<td>void * </td> -<td> -<var class="pdparam">arg</var>, </td> +<td>void *<var class="pdparam">arg</var>, </td> </tr> <tr> <td> </td> -<td>lwres_malloc_t </td> -<td> -<var class="pdparam">malloc_function</var>, </td> +<td>lwres_malloc_t <var class="pdparam">malloc_function</var>, </td> </tr> <tr> <td> </td> -<td>lwres_free_t </td> -<td> -<var class="pdparam">free_function</var><code>)</code>;</td> +<td>lwres_free_t <var class="pdparam">free_function</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_context_destroy</b>(</code></td> -<td>lwres_context_t ** </td> -<td> -<var class="pdparam">contextp</var><code>)</code>;</td> +<td>lwres_context_t **<var class="pdparam">contextp</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_context_initserial</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint32_t </td> -<td> -<var class="pdparam">serial</var><code>)</code>;</td> +<td>lwres_uint32_t <var class="pdparam">serial</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> lwres_uint32_t <b class="fsfunc">lwres_context_nextserial</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var><code>)</code>;</td> +<td>lwres_context_t *<var class="pdparam">ctx</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_context_freemem</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>void * </td> -<td> -<var class="pdparam">mem</var>, </td> +<td>void *<var class="pdparam">mem</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">len</var><code>)</code>;</td> +<td>size_t <var class="pdparam">len</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_context_allocmem</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">len</var><code>)</code>;</td> +<td>size_t <var class="pdparam">len</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void * <b class="fsfunc">lwres_context_sendrecv</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>void * </td> -<td> -<var class="pdparam">sendbase</var>, </td> +<td>void *<var class="pdparam">sendbase</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">sendlen</var>, </td> +<td>int <var class="pdparam">sendlen</var>, </td> </tr> <tr> <td> </td> -<td>void * </td> -<td> -<var class="pdparam">recvbase</var>, </td> +<td>void *<var class="pdparam">recvbase</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">recvlen</var>, </td> +<td>int <var class="pdparam">recvlen</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">recvd_len</var><code>)</code>;</td> +<td>int *<var class="pdparam">recvd_len</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543541"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_context_create()</code> creates a <span class="type">lwres_context_t</span> structure for use in lightweight resolver operations. It holds a socket and other @@ -257,8 +225,8 @@ void * <em class="parameter"><code>*recvd_len</code></em>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543729"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_context_create()</code> returns <span class="errorcode">LWRES_R_NOMEMORY</span> if memory for the <span class="type">struct lwres_context</span> could not be allocated, @@ -282,8 +250,8 @@ void * times out waiting for a response. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543779"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_conf_init</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">malloc</span>(3)</span>, diff --git a/lib/lwres/man/lwres_gabn.3 b/lib/lwres/man/lwres_gabn.3 index f67126eb5459..2e5b8f7b43c1 100644 --- a/lib/lwres/man/lwres_gabn.3 +++ b/lib/lwres/man/lwres_gabn.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,69 +13,95 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_gabn .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GABN" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GABN" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free \- lightweight resolver getaddrbyname message handling .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 40 +.ft +.HP \w'lwres_result_t\ lwres_gabnrequest_render('u .BI "lwres_result_t lwres_gabnrequest_render(lwres_context_t\ *" "ctx" ", lwres_gabnrequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 41 +.HP \w'lwres_result_t\ lwres_gabnresponse_render('u .BI "lwres_result_t lwres_gabnresponse_render(lwres_context_t\ *" "ctx" ", lwres_gabnresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 39 +.HP \w'lwres_result_t\ lwres_gabnrequest_parse('u .BI "lwres_result_t lwres_gabnrequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gabnrequest_t\ **" "structp" ");" -.HP 40 +.HP \w'lwres_result_t\ lwres_gabnresponse_parse('u .BI "lwres_result_t lwres_gabnresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gabnresponse_t\ **" "structp" ");" -.HP 29 +.HP \w'void\ lwres_gabnresponse_free('u .BI "void lwres_gabnresponse_free(lwres_context_t\ *" "ctx" ", lwres_gabnresponse_t\ **" "structp" ");" -.HP 28 +.HP \w'void\ lwres_gabnrequest_free('u .BI "void lwres_gabnrequest_free(lwres_context_t\ *" "ctx" ", lwres_gabnrequest_t\ **" "structp" ");" .SH "DESCRIPTION" .PP -These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages. +These are low\-level routines for creating and parsing lightweight resolver name\-to\-address lookup request and response messages\&. .PP -There are four main functions for the getaddrbyname opcode. One render function converts a getaddrbyname request structure \(em +There are four main functions for the getaddrbyname opcode\&. One render function converts a getaddrbyname request structure \(em \fBlwres_gabnrequest_t\fR -\(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure. Another render function converts the getaddrbyname response structure \(em +\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a getaddrbyname request structure\&. Another render function converts the getaddrbyname response structure \(em \fBlwres_gabnresponse_t\fR -\(em to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure. +\(em to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a getaddrbyname response structure\&. .PP These structures are defined in -\fI<lwres/lwres.h>\fR. They are shown below. +<lwres/lwres\&.h>\&. They are shown below\&. .PP +.if n \{\ .RS 4 +.\} .nf #define LWRES_OPCODE_GETADDRSBYNAME 0x00010001U .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct lwres_addr lwres_addr_t; typedef LWRES_LIST(lwres_addr_t) lwres_addrlist_t; .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint32_t flags; @@ -84,10 +110,13 @@ typedef struct { char *name; } lwres_gabnrequest_t; .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint32_t flags; @@ -102,24 +131,25 @@ typedef struct { size_t baselen; } lwres_gabnresponse_t; .fi +.if n \{\ .RE -.sp +.\} .PP \fBlwres_gabnrequest_render()\fR uses resolver context \fIctx\fR to convert getaddrbyname request structure \fIreq\fR -to canonical format. The packet header structure +to canonical format\&. The packet header structure \fIpkt\fR is initialised and transferred to buffer -\fIb\fR. The contents of +\fIb\fR\&. The contents of \fI*req\fR -are then appended to the buffer in canonical format. +are then appended to the buffer in canonical format\&. \fBlwres_gabnresponse_render()\fR performs the same task, except it converts a getaddrbyname response structure \fBlwres_gabnresponse_t\fR -to the lightweight resolver's canonical format. +to the lightweight resolver\*(Aqs canonical format\&. .PP \fBlwres_gabnrequest_parse()\fR uses context @@ -128,18 +158,18 @@ to convert the contents of packet \fIpkt\fR to a \fBlwres_gabnrequest_t\fR -structure. Buffer +structure\&. Buffer \fIb\fR -provides space to be used for storing this structure. When the function succeeds, the resulting +provides space to be used for storing this structure\&. When the function succeeds, the resulting \fBlwres_gabnrequest_t\fR is made available through -\fI*structp\fR. +\fI*structp\fR\&. \fBlwres_gabnresponse_parse()\fR offers the same semantics as \fBlwres_gabnrequest_parse()\fR except it yields a \fBlwres_gabnresponse_t\fR -structure. +structure\&. .PP \fBlwres_gabnresponse_free()\fR and @@ -151,20 +181,19 @@ that was allocated to the or \fBlwres_gabnrequest_t\fR structures referenced via -\fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded. +\fIstructp\fR\&. Any memory associated with ancillary buffers and strings for those structures is also discarded\&. .SH "RETURN VALUES" .PP The getaddrbyname opcode functions \fBlwres_gabnrequest_render()\fR, -\fBlwres_gabnresponse_render()\fR -\fBlwres_gabnrequest_parse()\fR +\fBlwres_gabnresponse_render()\fR\fBlwres_gabnrequest_parse()\fR and \fBlwres_gabnresponse_parse()\fR all return \fBLWRES_R_SUCCESS\fR -on success. They return +on success\&. They return \fBLWRES_R_NOMEMORY\fR -if memory allocation fails. +if memory allocation fails\&. \fBLWRES_R_UNEXPECTEDEND\fR is returned if the available space in the buffer \fIb\fR @@ -172,24 +201,28 @@ is too small to accommodate the packet header or the \fBlwres_gabnrequest_t\fR and \fBlwres_gabnresponse_t\fR -structures. +structures\&. \fBlwres_gabnrequest_parse()\fR and \fBlwres_gabnresponse_parse()\fR will return \fBLWRES_R_UNEXPECTEDEND\fR -if the buffer is not empty after decoding the received packet. These functions will return +if the buffer is not empty after decoding the received packet\&. These functions will return \fBLWRES_R_FAILURE\fR if -pktflags +\fIpktflags\fR in the packet header structure \fBlwres_lwpacket_t\fR -indicate that the packet is not a response to an earlier query. +indicate that the packet is not a response to an earlier query\&. .SH "SEE ALSO" .PP \fBlwres_packet\fR(3) +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gabn.docbook b/lib/lwres/man/lwres_gabn.docbook index 8743696c123e..8c6382375ff7 100644 --- a/lib/lwres/man/lwres_gabn.docbook +++ b/lib/lwres/man/lwres_gabn.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -109,8 +113,8 @@ void </funcprototype> </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These are low-level routines for creating and parsing lightweight resolver name-to-address lookup request and @@ -207,9 +211,9 @@ typedef struct { Any memory associated with ancillary buffers and strings for those structures is also discarded. </para> - </refsect1> - <refsect1> - <title>RETURN VALUES</title> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + <para> The getaddrbyname opcode functions <function>lwres_gabnrequest_render()</function>, @@ -240,21 +244,17 @@ typedef struct { These functions will return <errorcode>LWRES_R_FAILURE</errorcode> if - <structfield>pktflags</structfield> + <varname remap="structfield">pktflags</varname> in the packet header structure <type>lwres_lwpacket_t</type> indicate that the packet is not a response to an earlier query. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum> </citerefentry> </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_gabn.html b/lib/lwres/man/lwres_gabn.html index a00f82d3acaa..949d6d28a7ff 100644 --- a/lib/lwres/man/lwres_gabn.html +++ b/lib/lwres/man/lwres_gabn.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_gabn</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gabnrequest_render, lwres_gabnresponse_render, lwres_gabnrequest_parse, lwres_gabnresponse_parse, lwres_gabnresponse_free, lwres_gabnrequest_free — lightweight resolver getaddrbyname message handling</p> @@ -31,154 +30,120 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gabnrequest_render</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnrequest_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_gabnrequest_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gabnresponse_render</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnresponse_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_gabnresponse_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gabnrequest_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnrequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gabnrequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gabnresponse_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_gabnresponse_free</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_gabnrequest_free</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnrequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gabnrequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543531"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver name-to-address lookup request and @@ -277,8 +242,8 @@ typedef struct { those structures is also discarded. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543676"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> The getaddrbyname opcode functions <code class="function">lwres_gabnrequest_render()</code>, @@ -309,14 +274,14 @@ typedef struct { These functions will return <span class="errorcode">LWRES_R_FAILURE</span> if - <em class="structfield"><code>pktflags</code></em> + <code class="varname">pktflags</code> in the packet header structure <span class="type">lwres_lwpacket_t</span> indicate that the packet is not a response to an earlier query. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543742"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span> </p> </div> diff --git a/lib/lwres/man/lwres_gai_strerror.3 b/lib/lwres/man/lwres_gai_strerror.3 index 8da3828f9144..feb7c38a9069 100644 --- a/lib/lwres/man/lwres_gai_strerror.3 +++ b/lib/lwres/man/lwres_gai_strerror.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,36 +13,54 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_gai_strerror .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GAI_STRERROR" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GAI_STRERROR" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_gai_strerror \- print suitable error string .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 20 +.ft +.HP \w'char\ *\ gai_strerror('u .BI "char * gai_strerror(int\ " "ecode" ");" .SH "DESCRIPTION" .PP \fBlwres_gai_strerror()\fR returns an error message corresponding to an error code returned by -\fBgetaddrinfo()\fR. The following error codes and their meaning are defined in -\fIinclude/lwres/netdb.h\fR. +\fBgetaddrinfo()\fR\&. The following error codes and their meaning are defined in +include/lwres/netdb\&.h\&. .PP \fBEAI_ADDRFAMILY\fR .RS 4 @@ -106,7 +124,7 @@ The message invalid error code is returned if \fIecode\fR -is out of range. +is out of range\&. .PP \fBai_flags\fR, \fBai_family\fR @@ -115,15 +133,19 @@ and are elements of the \fBstruct addrinfo\fR used by -\fBlwres_getaddrinfo()\fR. +\fBlwres_getaddrinfo()\fR\&. .SH "SEE ALSO" .PP \fBstrerror\fR(3), \fBlwres_getaddrinfo\fR(3), \fBgetaddrinfo\fR(3), -\fBRFC2133\fR(). +\fBRFC2133\fR()\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gai_strerror.docbook b/lib/lwres/man/lwres_gai_strerror.docbook index a9314d31998e..f6e04e7ecc3e 100644 --- a/lib/lwres/man/lwres_gai_strerror.docbook +++ b/lib/lwres/man/lwres_gai_strerror.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -62,8 +64,8 @@ char * </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_gai_strerror()</function> returns an error message corresponding to an error code returned by @@ -172,10 +174,10 @@ char * used by <function>lwres_getaddrinfo()</function>. </para> - </refsect1> + </refsection> + + <refsection><info><title>SEE ALSO</title></info> - <refsect1> - <title>SEE ALSO</title> <para><citerefentry> <refentrytitle>strerror</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -192,9 +194,5 @@ char * <refentrytitle>RFC2133</refentrytitle> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_gai_strerror.html b/lib/lwres/man/lwres_gai_strerror.html index 85d228ec1544..ce452128a7cf 100644 --- a/lib/lwres/man/lwres_gai_strerror.html +++ b/lib/lwres/man/lwres_gai_strerror.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_gai_strerror</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gai_strerror — print suitable error string</p> @@ -31,25 +30,24 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> char * <b class="fsfunc">gai_strerror</b>(</code></td> -<td>int </td> -<td> -<var class="pdparam">ecode</var><code>)</code>;</td> +<td>int <var class="pdparam">ecode</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543370"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_gai_strerror()</code> returns an error message corresponding to an error code returned by <code class="function">getaddrinfo()</code>. The following error codes and their meaning are defined in <code class="filename">include/lwres/netdb.h</code>. </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><span class="errorcode">EAI_ADDRFAMILY</span></span></dt> <dd><p> address family for hostname not supported @@ -109,8 +107,8 @@ char * <code class="function">lwres_getaddrinfo()</code>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543586"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">strerror</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getaddrinfo</span>(3)</span>, diff --git a/lib/lwres/man/lwres_getaddrinfo.3 b/lib/lwres/man/lwres_getaddrinfo.3 index 88b4beabd2ce..af5454365214 100644 --- a/lib/lwres/man/lwres_getaddrinfo.3 +++ b/lib/lwres/man/lwres_getaddrinfo.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,37 +13,54 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_getaddrinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GETADDRINFO" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GETADDRINFO" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_getaddrinfo, lwres_freeaddrinfo \- socket address structure to host and service name .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 22 +.ft +.HP \w'int\ lwres_getaddrinfo('u .BI "int lwres_getaddrinfo(const\ char\ *" "hostname" ", const\ char\ *" "servname" ", const\ struct\ addrinfo\ *" "hints" ", struct\ addrinfo\ **" "res" ");" -.HP 24 +.HP \w'void\ lwres_freeaddrinfo('u .BI "void lwres_freeaddrinfo(struct\ addrinfo\ *" "ai" ");" .PP If the operating system does not provide a \fBstruct addrinfo\fR, the following structure is used: .PP -.RS 4 .nf struct addrinfo { int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ @@ -56,7 +73,6 @@ struct addrinfo { struct addrinfo *ai_next; /* next structure in linked list */ }; .fi -.RE .sp .SH "DESCRIPTION" .PP @@ -64,31 +80,31 @@ struct addrinfo { is used to get a list of IP addresses and port numbers for host \fIhostname\fR and service -\fIservname\fR. The function is the lightweight resolver's implementation of +\fIservname\fR\&. The function is the lightweight resolver\*(Aqs implementation of \fBgetaddrinfo()\fR -as defined in RFC2133. +as defined in RFC2133\&. \fIhostname\fR and \fIservname\fR are pointers to null\-terminated strings or -\fBNULL\fR. +\fBNULL\fR\&. \fIhostname\fR -is either a host name or a numeric host address string: a dotted decimal IPv4 address or an IPv6 address. +is either a host name or a numeric host address string: a dotted decimal IPv4 address or an IPv6 address\&. \fIservname\fR is either a decimal port number or a service name as listed in -\fI/etc/services\fR. +/etc/services\&. .PP \fIhints\fR is an optional pointer to a -\fBstruct addrinfo\fR. This structure can be used to provide hints concerning the type of socket that the caller supports or wishes to use. The caller can supply the following structure elements in +\fBstruct addrinfo\fR\&. This structure can be used to provide hints concerning the type of socket that the caller supports or wishes to use\&. The caller can supply the following structure elements in \fI*hints\fR: .PP \fBai_family\fR .RS 4 -The protocol family that should be used. When +The protocol family that should be used\&. When \fBai_family\fR is set to -\fBPF_UNSPEC\fR, it means the caller will accept any protocol family supported by the operating system. +\fBPF_UNSPEC\fR, it means the caller will accept any protocol family supported by the operating system\&. .RE .PP \fBai_socktype\fR @@ -98,21 +114,21 @@ denotes the type of socket \(em \fBSOCK_DGRAM\fR or \fBSOCK_RAW\fR -\(em that is wanted. When +\(em that is wanted\&. When \fBai_socktype\fR -is zero the caller will accept any socket type. +is zero the caller will accept any socket type\&. .RE .PP \fBai_protocol\fR .RS 4 -indicates which transport protocol is wanted: IPPROTO_UDP or IPPROTO_TCP. If +indicates which transport protocol is wanted: IPPROTO_UDP or IPPROTO_TCP\&. If \fBai_protocol\fR -is zero the caller will accept any protocol. +is zero the caller will accept any protocol\&. .RE .PP \fBai_flags\fR .RS 4 -Flag bits. If the +Flag bits\&. If the \fBAI_CANONNAME\fR bit is set, a successful call to \fBlwres_getaddrinfo()\fR @@ -120,16 +136,16 @@ will return a null\-terminated string containing the canonical name of the speci \fBai_canonname\fR of the first \fBaddrinfo\fR -structure returned. Setting the +structure returned\&. Setting the \fBAI_PASSIVE\fR bit indicates that the returned socket address structure is intended for used in a call to -\fBbind\fR(2). In this case, if the hostname argument is a +\fBbind\fR(2)\&. In this case, if the hostname argument is a \fBNULL\fR pointer, then the IP address portion of the socket address structure will be set to \fBINADDR_ANY\fR for an IPv4 address or \fBIN6ADDR_ANY_INIT\fR -for an IPv6 address. +for an IPv6 address\&. .sp When \fBai_flags\fR @@ -141,14 +157,14 @@ for a connection\-oriented protocol or \fBconnect\fR(2), \fBsendto\fR(2), or \fBsendmsg\fR(2) -if a connectionless protocol was chosen. The IP address portion of the socket address structure will be set to the loopback address if +if a connectionless protocol was chosen\&. The IP address portion of the socket address structure will be set to the loopback address if \fIhostname\fR is a \fBNULL\fR pointer and \fBAI_PASSIVE\fR is not set in -\fBai_flags\fR. +\fBai_flags\fR\&. .sp If \fBai_flags\fR @@ -156,14 +172,14 @@ is set to \fBAI_NUMERICHOST\fR it indicates that \fIhostname\fR -should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted. +should be treated as a numeric string defining an IPv4 or IPv6 address and no name resolution should be attempted\&. .RE .PP All other elements of the \fBstruct addrinfo\fR passed via \fIhints\fR -must be zero. +must be zero\&. .PP A \fIhints\fR @@ -173,59 +189,58 @@ is treated as if the caller provided a \fBstruct addrinfo\fR initialized to zero with \fBai_family\fRset to -\fBPF_UNSPEC\fR. +\fBPF_UNSPEC\fR\&. .PP After a successful call to \fBlwres_getaddrinfo()\fR, \fI*res\fR is a pointer to a linked list of one or more \fBaddrinfo\fR -structures. Each +structures\&. Each \fBstruct addrinfo\fR in this list cn be processed by following the \fBai_next\fR pointer, until a \fBNULL\fR -pointer is encountered. The three members +pointer is encountered\&. The three members \fBai_family\fR, \fBai_socktype\fR, and \fBai_protocol\fR in each returned \fBaddrinfo\fR structure contain the corresponding arguments for a call to -\fBsocket\fR(2). For each +\fBsocket\fR(2)\&. For each \fBaddrinfo\fR structure in the list, the \fBai_addr\fR member points to a filled\-in socket address structure of length -\fBai_addrlen\fR. +\fBai_addrlen\fR\&. .PP All of the information returned by \fBlwres_getaddrinfo()\fR is dynamically allocated: the addrinfo structures, and the socket address structures and canonical host name strings pointed to by the -\fBaddrinfo\fRstructures. Memory allocated for the dynamically allocated structures created by a successful call to +\fBaddrinfo\fRstructures\&. Memory allocated for the dynamically allocated structures created by a successful call to \fBlwres_getaddrinfo()\fR is released by -\fBlwres_freeaddrinfo()\fR. +\fBlwres_freeaddrinfo()\fR\&. \fIai\fR is a pointer to a \fBstruct addrinfo\fR created by a call to -\fBlwres_getaddrinfo()\fR. +\fBlwres_getaddrinfo()\fR\&. .SH "RETURN VALUES" .PP \fBlwres_getaddrinfo()\fR returns zero on success or one of the error codes listed in \fBgai_strerror\fR(3) -if an error occurs. If both +if an error occurs\&. If both \fIhostname\fR and \fIservname\fR are -\fBNULL\fR -\fBlwres_getaddrinfo()\fR +\fBNULL\fR\fBlwres_getaddrinfo()\fR returns -\fBEAI_NONAME\fR. +\fBEAI_NONAME\fR\&. .SH "SEE ALSO" .PP \fBlwres\fR(3), @@ -238,9 +253,13 @@ returns \fBconnect\fR(2), \fBsendto\fR(2), \fBsendmsg\fR(2), -\fBsocket\fR(2). +\fBsocket\fR(2)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getaddrinfo.docbook b/lib/lwres/man/lwres_getaddrinfo.docbook index 76927fd82250..2517b15970b8 100644 --- a/lib/lwres/man/lwres_getaddrinfo.docbook +++ b/lib/lwres/man/lwres_getaddrinfo.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -92,8 +96,8 @@ struct addrinfo { </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_getaddrinfo()</function> is used to get a list of IP addresses and port numbers for host @@ -316,10 +320,10 @@ struct addrinfo { <function>lwres_getaddrinfo()</function>. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para><function>lwres_getaddrinfo()</function> returns zero on success or one of the error codes listed in @@ -331,9 +335,9 @@ struct addrinfo { <function>lwres_getaddrinfo()</function> returns <errorcode>EAI_NONAME</errorcode>. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -379,9 +383,5 @@ struct addrinfo { </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_getaddrinfo.html b/lib/lwres/man/lwres_getaddrinfo.html index b4845f56b440..b65488464d50 100644 --- a/lib/lwres/man/lwres_getaddrinfo.html +++ b/lib/lwres/man/lwres_getaddrinfo.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_getaddrinfo</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_getaddrinfo, lwres_freeaddrinfo — socket address structure to host and service name</p> @@ -31,42 +30,34 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> int <b class="fsfunc">lwres_getaddrinfo</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">hostname</var>, </td> +<td>const char *<var class="pdparam">hostname</var>, </td> </tr> <tr> <td> </td> -<td>const char * </td> -<td> -<var class="pdparam">servname</var>, </td> +<td>const char *<var class="pdparam">servname</var>, </td> </tr> <tr> <td> </td> -<td>const struct addrinfo * </td> -<td> -<var class="pdparam">hints</var>, </td> +<td>const struct addrinfo *<var class="pdparam">hints</var>, </td> </tr> <tr> <td> </td> -<td>struct addrinfo ** </td> -<td> -<var class="pdparam">res</var><code>)</code>;</td> +<td>struct addrinfo **<var class="pdparam">res</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_freeaddrinfo</b>(</code></td> -<td>struct addrinfo * </td> -<td> -<var class="pdparam">ai</var><code>)</code>;</td> +<td>struct addrinfo *<var class="pdparam">ai</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> <p> If the operating system does not provide a @@ -88,8 +79,8 @@ struct addrinfo { <p> </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543421"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_getaddrinfo()</code> is used to get a list of IP addresses and port numbers for host <em class="parameter"><code>hostname</code></em> and service @@ -117,7 +108,7 @@ struct addrinfo { <em class="parameter"><code>*hints</code></em>: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">ai_family</code></span></dt> <dd><p> The protocol family that should be used. @@ -282,8 +273,8 @@ struct addrinfo { <code class="function">lwres_getaddrinfo()</code>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543799"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getaddrinfo()</code> returns zero on success or one of the error codes listed in <span class="citerefentry"><span class="refentrytitle">gai_strerror</span>(3)</span> @@ -293,8 +284,8 @@ struct addrinfo { <span class="errorcode">EAI_NONAME</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543836"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getaddrinfo</span>(3)</span>, diff --git a/lib/lwres/man/lwres_gethostent.3 b/lib/lwres/man/lwres_gethostent.3 index e53aa33c1755..36e249431fae 100644 --- a/lib/lwres/man/lwres_gethostent.3 +++ b/lib/lwres/man/lwres_gethostent.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,60 +13,80 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_gethostent .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GETHOSTENT" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GETHOSTENT" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_gethostbyname, lwres_gethostbyname2, lwres_gethostbyaddr, lwres_gethostent, lwres_sethostent, lwres_endhostent, lwres_gethostbyname_r, lwres_gethostbyaddr_r, lwres_gethostent_r, lwres_sethostent_r, lwres_endhostent_r \- lightweight resolver get network host entry .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 37 +.ft +.HP \w'struct\ hostent\ *\ lwres_gethostbyname('u .BI "struct hostent * lwres_gethostbyname(const\ char\ *" "name" ");" -.HP 38 +.HP \w'struct\ hostent\ *\ lwres_gethostbyname2('u .BI "struct hostent * lwres_gethostbyname2(const\ char\ *" "name" ", int\ " "af" ");" -.HP 37 +.HP \w'struct\ hostent\ *\ lwres_gethostbyaddr('u .BI "struct hostent * lwres_gethostbyaddr(const\ char\ *" "addr" ", int\ " "len" ", int\ " "type" ");" -.HP 34 +.HP \w'struct\ hostent\ *\ lwres_gethostent('u .BI "struct hostent * lwres_gethostent(void);" -.HP 22 +.HP \w'void\ lwres_sethostent('u .BI "void lwres_sethostent(int\ " "stayopen" ");" -.HP 22 +.HP \w'void\ lwres_endhostent('u .BI "void lwres_endhostent(void);" -.HP 39 +.HP \w'struct\ hostent\ *\ lwres_gethostbyname_r('u .BI "struct hostent * lwres_gethostbyname_r(const\ char\ *" "name" ", struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");" -.HP 39 +.HP \w'struct\ hostent\ *\ lwres_gethostbyaddr_r('u .BI "struct hostent * lwres_gethostbyaddr_r(const\ char\ *" "addr" ", int\ " "len" ", int\ " "type" ", struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");" -.HP 36 +.HP \w'struct\ hostent\ *\ lwres_gethostent_r('u .BI "struct hostent * lwres_gethostent_r(struct\ hostent\ *" "resbuf" ", char\ *" "buf" ", int\ " "buflen" ", int\ *" "error" ");" -.HP 24 +.HP \w'void\ lwres_sethostent_r('u .BI "void lwres_sethostent_r(int\ " "stayopen" ");" -.HP 24 +.HP \w'void\ lwres_endhostent_r('u .BI "void lwres_endhostent_r(void);" .SH "DESCRIPTION" .PP -These functions provide hostname\-to\-address and address\-to\-hostname lookups by means of the lightweight resolver. They are similar to the standard +These functions provide hostname\-to\-address and address\-to\-hostname lookups by means of the lightweight resolver\&. They are similar to the standard \fBgethostent\fR(3) -functions provided by most operating systems. They use a +functions provided by most operating systems\&. They use a \fBstruct hostent\fR which is usually defined in -\fI<namedb.h>\fR. +<namedb\&.h>\&. .PP +.if n \{\ .RS 4 +.\} .nf struct hostent { char *h_name; /* official name of host */ @@ -77,19 +97,20 @@ struct hostent { }; #define h_addr h_addr_list[0] /* address, for backward compatibility */ .fi +.if n \{\ .RE -.sp +.\} .PP The members of this structure are: .PP \fBh_name\fR .RS 4 -The official (canonical) name of the host. +The official (canonical) name of the host\&. .RE .PP \fBh_aliases\fR .RS 4 -A NULL\-terminated array of alternate names (nicknames) for the host. +A NULL\-terminated array of alternate names (nicknames) for the host\&. .RE .PP \fBh_addrtype\fR @@ -97,25 +118,25 @@ A NULL\-terminated array of alternate names (nicknames) for the host. The type of address being returned \(em \fBPF_INET\fR or -\fBPF_INET6\fR. +\fBPF_INET6\fR\&. .RE .PP \fBh_length\fR .RS 4 -The length of the address in bytes. +The length of the address in bytes\&. .RE .PP \fBh_addr_list\fR .RS 4 A \fBNULL\fR -terminated array of network addresses for the host. Host addresses are returned in network byte order. +terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&. .RE .PP For backward compatibility with very old software, \fBh_addr\fR is the first address in -\fBh_addr_list.\fR +\fBh_addr_list\&.\fR .PP \fBlwres_gethostent()\fR, \fBlwres_sethostent()\fR, @@ -125,14 +146,14 @@ is the first address in and \fBlwres_endhostent_r()\fR provide iteration over the known host entries on systems that provide such functionality through facilities like -\fI/etc/hosts\fR -or NIS. The lightweight resolver does not currently implement these functions; it only provides them as stub functions that always return failure. +/etc/hosts +or NIS\&. The lightweight resolver does not currently implement these functions; it only provides them as stub functions that always return failure\&. .PP \fBlwres_gethostbyname()\fR and \fBlwres_gethostbyname2()\fR look up the hostname -\fIname\fR. +\fIname\fR\&. \fBlwres_gethostbyname()\fR always looks for an IPv4 address while \fBlwres_gethostbyname2()\fR @@ -141,17 +162,17 @@ looks for an address of protocol family \fBPF_INET\fR or \fBPF_INET6\fR -\(em IPv4 or IPV6 addresses respectively. Successful calls of the functions return a -\fBstruct hostent\fRfor the name that was looked up. +\(em IPv4 or IPV6 addresses respectively\&. Successful calls of the functions return a +\fBstruct hostent\fRfor the name that was looked up\&. \fBNULL\fR is returned if the lookups by \fBlwres_gethostbyname()\fR or \fBlwres_gethostbyname2()\fR -fail. +fail\&. .PP Reverse lookups of addresses are performed by -\fBlwres_gethostbyaddr()\fR. +\fBlwres_gethostbyaddr()\fR\&. \fIaddr\fR is an address of length \fIlen\fR @@ -160,15 +181,15 @@ bytes and protocol family \(em \fBPF_INET\fR or -\fBPF_INET6\fR. +\fBPF_INET6\fR\&. \fBlwres_gethostbyname_r()\fR -is a thread\-safe function for forward lookups. If an error occurs, an error code is returned in -\fI*error\fR. +is a thread\-safe function for forward lookups\&. If an error occurs, an error code is returned in +\fI*error\fR\&. \fIresbuf\fR is a pointer to a \fBstruct hostent\fR which is initialised by a successful call to -\fBlwres_gethostbyname_r()\fR. +\fBlwres_gethostbyname_r()\fR\&. \fIbuf\fR is a buffer of length \fIlen\fR @@ -179,12 +200,12 @@ bytes which is used to store the elements of the \fBstruct hostent\fR returned in -\fIresbuf\fR. Successful calls to +\fIresbuf\fR\&. Successful calls to \fBlwres_gethostbyname_r()\fR return \fIresbuf\fR, which is a pointer to the \fBstruct hostent\fR -it created. +it created\&. .PP \fBlwres_gethostbyaddr_r()\fR is a thread\-safe function that performs a reverse lookup of address @@ -196,14 +217,14 @@ bytes long and is of protocol family \(em \fBPF_INET\fR or -\fBPF_INET6\fR. If an error occurs, the error code is returned in -\fI*error\fR. The other function parameters are identical to those in -\fBlwres_gethostbyname_r()\fR. +\fBPF_INET6\fR\&. If an error occurs, the error code is returned in +\fI*error\fR\&. The other function parameters are identical to those in +\fBlwres_gethostbyname_r()\fR\&. \fIresbuf\fR is a pointer to a \fBstruct hostent\fR which is initialised by a successful call to -\fBlwres_gethostbyaddr_r()\fR. +\fBlwres_gethostbyaddr_r()\fR\&. \fIbuf\fR is a buffer of length \fIlen\fR @@ -214,12 +235,12 @@ bytes which is used to store the elements of the \fBstruct hostent\fR returned in -\fIresbuf\fR. Successful calls to +\fIresbuf\fR\&. Successful calls to \fBlwres_gethostbyaddr_r()\fR return \fIresbuf\fR, which is a pointer to the \fBstruct hostent()\fR -it created. +it created\&. .SH "RETURN VALUES" .PP The functions @@ -227,39 +248,39 @@ The functions \fBlwres_gethostbyname2()\fR, \fBlwres_gethostbyaddr()\fR, and \fBlwres_gethostent()\fR -return NULL to indicate an error. In this case the global variable +return NULL to indicate an error\&. In this case the global variable \fBlwres_h_errno\fR will contain one of the following error codes defined in -\fI<lwres/netdb.h>\fR: +<lwres/netdb\&.h>: .PP \fBHOST_NOT_FOUND\fR .RS 4 -The host or address was not found. +The host or address was not found\&. .RE .PP \fBTRY_AGAIN\fR .RS 4 -A recoverable error occurred, e.g., a timeout. Retrying the lookup may succeed. +A recoverable error occurred, e\&.g\&., a timeout\&. Retrying the lookup may succeed\&. .RE .PP \fBNO_RECOVERY\fR .RS 4 -A non\-recoverable error occurred. +A non\-recoverable error occurred\&. .RE .PP \fBNO_DATA\fR .RS 4 -The name exists, but has no address information associated with it (or vice versa in the case of a reverse lookup). The code NO_ADDRESS is accepted as a synonym for NO_DATA for backwards compatibility. +The name exists, but has no address information associated with it (or vice versa in the case of a reverse lookup)\&. The code NO_ADDRESS is accepted as a synonym for NO_DATA for backwards compatibility\&. .RE .PP \fBlwres_hstrerror\fR(3) -translates these error codes to suitable error messages. +translates these error codes to suitable error messages\&. .PP \fBlwres_gethostent()\fR and \fBlwres_gethostent_r()\fR always return -\fBNULL\fR. +\fBNULL\fR\&. .PP Successful calls to \fBlwres_gethostbyname_r()\fR @@ -268,7 +289,7 @@ and return \fIresbuf\fR, a pointer to the \fBstruct hostent\fR -that was initialised by these functions. They return +that was initialised by these functions\&. They return \fBNULL\fR if the lookups fail or if \fIbuf\fR @@ -277,7 +298,7 @@ was too small to hold the list of addresses and names referenced by the \fBh_aliases\fR, and \fBh_addr_list\fR elements of the -\fBstruct hostent\fR. If +\fBstruct hostent\fR\&. If \fIbuf\fR was too small, both \fBlwres_gethostbyname_r()\fR @@ -286,7 +307,7 @@ and set the global variable \fBerrno\fR to -\fBERANGE\fR. +\fBERANGE\fR\&. .SH "SEE ALSO" .PP \fBgethostent\fR(3), @@ -299,17 +320,21 @@ to \fBlwres_gethostbyaddr()\fR and \fBlwres_endhostent()\fR -are not thread safe; they return pointers to static data and provide error codes through a global variable. Thread\-safe versions for name and address lookup are provided by +are not thread safe; they return pointers to static data and provide error codes through a global variable\&. Thread\-safe versions for name and address lookup are provided by \fBlwres_gethostbyname_r()\fR, and \fBlwres_gethostbyaddr_r()\fR -respectively. +respectively\&. .PP The resolver daemon does not currently support any non\-DNS name services such as -\fI/etc/hosts\fR +/etc/hosts or -\fBNIS\fR, consequently the above functions don't, either. +\fBNIS\fR, consequently the above functions don\*(Aqt, either\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gethostent.docbook b/lib/lwres/man/lwres_gethostent.docbook index 487fb7f9ea18..cf68feb21307 100644 --- a/lib/lwres/man/lwres_gethostent.docbook +++ b/lib/lwres/man/lwres_gethostent.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -146,8 +150,8 @@ void </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These functions provide hostname-to-address and address-to-hostname lookups by means of the lightweight resolver. @@ -306,10 +310,10 @@ struct hostent { <function>struct hostent()</function> it created. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para> The functions <function>lwres_gethostbyname()</function>, @@ -391,9 +395,9 @@ struct hostent { <type>errno</type> to <errorcode>ERANGE</errorcode>. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>gethostent</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -406,10 +410,10 @@ struct hostent { <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum> </citerefentry> </para> - </refsect1> + </refsection> + + <refsection><info><title>BUGS</title></info> - <refsect1> - <title>BUGS</title> <para><function>lwres_gethostbyname()</function>, <function>lwres_gethostbyname2()</function>, <function>lwres_gethostbyaddr()</function> @@ -431,9 +435,5 @@ struct hostent { <type>NIS</type>, consequently the above functions don't, either. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_gethostent.html b/lib/lwres/man/lwres_gethostent.html index 3435f1c18078..ef0a5f382070 100644 --- a/lib/lwres/man/lwres_gethostent.html +++ b/lib/lwres/man/lwres_gethostent.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_gethostent</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gethostbyname, lwres_gethostbyname2, lwres_gethostbyaddr, lwres_gethostent, lwres_sethostent, lwres_endhostent, lwres_gethostbyname_r, lwres_gethostbyaddr_r, lwres_gethostent_r, lwres_sethostent_r, lwres_endhostent_r — lightweight resolver get network host entry</p> @@ -31,204 +30,161 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostbyname</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">name</var><code>)</code>;</td> +<td>const char *<var class="pdparam">name</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostbyname2</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">name</var>, </td> +<td>const char *<var class="pdparam">name</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">af</var><code>)</code>;</td> +<td>int <var class="pdparam">af</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostbyaddr</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">addr</var>, </td> +<td>const char *<var class="pdparam">addr</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">len</var>, </td> +<td>int <var class="pdparam">len</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">type</var><code>)</code>;</td> +<td>int <var class="pdparam">type</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostent</b>(</code></td> -<td> </td> -<td> -<code>)</code>;</td> +<td>void<code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_sethostent</b>(</code></td> -<td>int </td> -<td> -<var class="pdparam">stayopen</var><code>)</code>;</td> +<td>int <var class="pdparam">stayopen</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_endhostent</b>(</code></td> -<td> </td> -<td> -<code>)</code>;</td> +<td>void<code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostbyname_r</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">name</var>, </td> +<td>const char *<var class="pdparam">name</var>, </td> </tr> <tr> <td> </td> -<td>struct hostent * </td> -<td> -<var class="pdparam">resbuf</var>, </td> +<td>struct hostent *<var class="pdparam">resbuf</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">buf</var>, </td> +<td>char *<var class="pdparam">buf</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">buflen</var>, </td> +<td>int <var class="pdparam">buflen</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">error</var><code>)</code>;</td> +<td>int *<var class="pdparam">error</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostbyaddr_r</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">addr</var>, </td> +<td>const char *<var class="pdparam">addr</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">len</var>, </td> +<td>int <var class="pdparam">len</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">type</var>, </td> +<td>int <var class="pdparam">type</var>, </td> </tr> <tr> <td> </td> -<td>struct hostent * </td> -<td> -<var class="pdparam">resbuf</var>, </td> +<td>struct hostent *<var class="pdparam">resbuf</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">buf</var>, </td> +<td>char *<var class="pdparam">buf</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">buflen</var>, </td> +<td>int <var class="pdparam">buflen</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">error</var><code>)</code>;</td> +<td>int *<var class="pdparam">error</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_gethostent_r</b>(</code></td> -<td>struct hostent * </td> -<td> -<var class="pdparam">resbuf</var>, </td> +<td>struct hostent *<var class="pdparam">resbuf</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">buf</var>, </td> +<td>char *<var class="pdparam">buf</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">buflen</var>, </td> +<td>int <var class="pdparam">buflen</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">error</var><code>)</code>;</td> +<td>int *<var class="pdparam">error</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_sethostent_r</b>(</code></td> -<td>int </td> -<td> -<var class="pdparam">stayopen</var><code>)</code>;</td> +<td>int <var class="pdparam">stayopen</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_endhostent_r</b>(</code></td> -<td> </td> -<td> -<code>)</code>;</td> +<td>void<code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543618"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These functions provide hostname-to-address and address-to-hostname lookups by means of the lightweight resolver. @@ -255,7 +211,7 @@ struct hostent { <p> The members of this structure are: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">h_name</code></span></dt> <dd><p> The official (canonical) name of the host. @@ -365,8 +321,8 @@ struct hostent { <code class="function">struct hostent()</code> it created. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543969"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> The functions <code class="function">lwres_gethostbyname()</code>, @@ -380,7 +336,7 @@ struct hostent { <code class="filename"><lwres/netdb.h></code>: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">HOST_NOT_FOUND</code></span></dt> <dd><p> The host or address was not found. @@ -429,8 +385,8 @@ struct hostent { <span class="type">errno</span> to <span class="errorcode">ERANGE</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2544202"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">gethostent</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_getipnode</span>(3)</span>, @@ -438,8 +394,8 @@ struct hostent { <span class="citerefentry"><span class="refentrytitle">lwres_hstrerror</span>(3)</span> </p> </div> -<div class="refsect1" lang="en"> -<a name="id2544236"></a><h2>BUGS</h2> +<div class="refsection"> +<a name="id-1.10"></a><h2>BUGS</h2> <p><code class="function">lwres_gethostbyname()</code>, <code class="function">lwres_gethostbyname2()</code>, <code class="function">lwres_gethostbyaddr()</code> diff --git a/lib/lwres/man/lwres_getipnode.3 b/lib/lwres/man/lwres_getipnode.3 index 4eb58cc2b147..ab8f0b5a6e49 100644 --- a/lib/lwres/man/lwres_getipnode.3 +++ b/lib/lwres/man/lwres_getipnode.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001, 2003 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,44 +13,64 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_getipnode .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GETIPNODE" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GETIPNODE" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent \- lightweight resolver nodename / address translation API .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 39 +.ft +.HP \w'struct\ hostent\ *\ lwres_getipnodebyname('u .BI "struct hostent * lwres_getipnodebyname(const\ char\ *" "name" ", int\ " "af" ", int\ " "flags" ", int\ *" "error_num" ");" -.HP 39 +.HP \w'struct\ hostent\ *\ lwres_getipnodebyaddr('u .BI "struct hostent * lwres_getipnodebyaddr(const\ void\ *" "src" ", size_t\ " "len" ", int\ " "af" ", int\ *" "error_num" ");" -.HP 23 +.HP \w'void\ lwres_freehostent('u .BI "void lwres_freehostent(struct\ hostent\ *" "he" ");" .SH "DESCRIPTION" .PP -These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553. +These functions perform thread safe, protocol independent nodename\-to\-address and address\-to\-nodename translation as defined in RFC2553\&. .PP They use a \fBstruct hostent\fR which is defined in -\fInamedb.h\fR: +namedb\&.h: .PP +.if n \{\ .RS 4 +.\} .nf struct hostent { char *h_name; /* official name of host */ @@ -61,19 +81,20 @@ struct hostent { }; #define h_addr h_addr_list[0] /* address, for backward compatibility */ .fi +.if n \{\ .RE -.sp +.\} .PP The members of this structure are: .PP \fBh_name\fR .RS 4 -The official (canonical) name of the host. +The official (canonical) name of the host\&. .RE .PP \fBh_aliases\fR .RS 4 -A NULL\-terminated array of alternate names (nicknames) for the host. +A NULL\-terminated array of alternate names (nicknames) for the host\&. .RE .PP \fBh_addrtype\fR @@ -81,46 +102,46 @@ A NULL\-terminated array of alternate names (nicknames) for the host. The type of address being returned \- usually \fBPF_INET\fR or -\fBPF_INET6\fR. +\fBPF_INET6\fR\&. .RE .PP \fBh_length\fR .RS 4 -The length of the address in bytes. +The length of the address in bytes\&. .RE .PP \fBh_addr_list\fR .RS 4 A \fBNULL\fR -terminated array of network addresses for the host. Host addresses are returned in network byte order. +terminated array of network addresses for the host\&. Host addresses are returned in network byte order\&. .RE .PP \fBlwres_getipnodebyname()\fR looks up addresses of protocol family \fIaf\fR for the hostname -\fIname\fR. The +\fIname\fR\&. The \fIflags\fR -parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned. The flag bits are: +parameter contains ORed flag bits to specify the types of addresses that are searched for, and the types of addresses that are returned\&. The flag bits are: .PP \fBAI_V4MAPPED\fR .RS 4 This is used with an \fIaf\fR -of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses. +of AF_INET6, and causes IPv4 addresses to be returned as IPv4\-mapped IPv6 addresses\&. .RE .PP \fBAI_ALL\fR .RS 4 This is used with an \fIaf\fR -of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses. +of AF_INET6, and causes all known addresses (IPv6 and IPv4) to be returned\&. If AI_V4MAPPED is also set, the IPv4 addresses are return as mapped IPv6 addresses\&. .RE .PP \fBAI_ADDRCONFIG\fR .RS 4 -Only return an IPv6 or IPv4 address if here is an active network interface of that type. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored. +Only return an IPv6 or IPv4 address if here is an active network interface of that type\&. This is not currently implemented in the BIND 9 lightweight resolver, and the flag is ignored\&. .RE .PP \fBAI_DEFAULT\fR @@ -129,7 +150,7 @@ This default sets the \fBAI_V4MAPPED\fR and \fBAI_ADDRCONFIG\fR -flag bits. +flag bits\&. .RE .PP \fBlwres_getipnodebyaddr()\fR @@ -137,25 +158,25 @@ performs a reverse lookup of address \fIsrc\fR which is \fIlen\fR -bytes long. +bytes long\&. \fIaf\fR denotes the protocol family, typically \fBPF_INET\fR or -\fBPF_INET6\fR. +\fBPF_INET6\fR\&. .PP \fBlwres_freehostent()\fR releases all the memory associated with the \fBstruct hostent\fR pointer -\fIhe\fR. Any memory allocated for the +\fIhe\fR\&. Any memory allocated for the \fBh_name\fR, \fBh_addr_list\fR and \fBh_aliases\fR is freed, as is the memory for the \fBhostent\fR -structure itself. +structure itself\&. .SH "RETURN VALUES" .PP If an error occurs, @@ -166,31 +187,31 @@ set \fI*error_num\fR to an appropriate error code and the function returns a \fBNULL\fR -pointer. The error codes and their meanings are defined in -\fI<lwres/netdb.h>\fR: +pointer\&. The error codes and their meanings are defined in +<lwres/netdb\&.h>: .PP \fBHOST_NOT_FOUND\fR .RS 4 -No such host is known. +No such host is known\&. .RE .PP \fBNO_ADDRESS\fR .RS 4 -The server recognised the request and the name but no address is available. Another type of request to the name server for the domain might return an answer. +The server recognised the request and the name but no address is available\&. Another type of request to the name server for the domain might return an answer\&. .RE .PP \fBTRY_AGAIN\fR .RS 4 -A temporary and possibly transient error occurred, such as a failure of a server to respond. The request may succeed if retried. +A temporary and possibly transient error occurred, such as a failure of a server to respond\&. The request may succeed if retried\&. .RE .PP \fBNO_RECOVERY\fR .RS 4 -An unexpected failure occurred, and retrying the request is pointless. +An unexpected failure occurred, and retrying the request is pointless\&. .RE .PP \fBlwres_hstrerror\fR(3) -translates these error codes to suitable error messages. +translates these error codes to suitable error messages\&. .SH "SEE ALSO" .PP \fBRFC2553\fR(), @@ -198,9 +219,13 @@ translates these error codes to suitable error messages. \fBlwres_gethostent\fR(3), \fBlwres_getaddrinfo\fR(3), \fBlwres_getnameinfo\fR(3), -\fBlwres_hstrerror\fR(3). +\fBlwres_hstrerror\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001, 2003 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getipnode.docbook b/lib/lwres/man/lwres_getipnode.docbook index 44b628b5582f..14e14aaa3dff 100644 --- a/lib/lwres/man/lwres_getipnode.docbook +++ b/lib/lwres/man/lwres_getipnode.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -82,8 +84,8 @@ void </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These functions perform thread safe, protocol independent @@ -236,9 +238,9 @@ struct hostent { <constant>h_aliases</constant> is freed, as is the memory for the <type>hostent</type> structure itself. </para> - </refsect1> - <refsect1> - <title>RETURN VALUES</title> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + <para> If an error occurs, <function>lwres_getipnodebyname()</function> @@ -296,9 +298,9 @@ struct hostent { </citerefentry> translates these error codes to suitable error messages. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>RFC2553</refentrytitle> </citerefentry>, @@ -323,9 +325,5 @@ struct hostent { <refentrytitle>lwres_hstrerror</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_getipnode.html b/lib/lwres/man/lwres_getipnode.html index 6fe0ec64750a..a27b3994cb46 100644 --- a/lib/lwres/man/lwres_getipnode.html +++ b/lib/lwres/man/lwres_getipnode.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001, 2003 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_getipnode</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_getipnodebyname, lwres_getipnodebyaddr, lwres_freehostent — lightweight resolver nodename / address translation API</p> @@ -31,74 +30,59 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_getipnodebyname</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">name</var>, </td> +<td>const char *<var class="pdparam">name</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">af</var>, </td> +<td>int <var class="pdparam">af</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">flags</var>, </td> +<td>int <var class="pdparam">flags</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">error_num</var><code>)</code>;</td> +<td>int *<var class="pdparam">error_num</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> struct hostent * <b class="fsfunc">lwres_getipnodebyaddr</b>(</code></td> -<td>const void * </td> -<td> -<var class="pdparam">src</var>, </td> +<td>const void *<var class="pdparam">src</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">len</var>, </td> +<td>size_t <var class="pdparam">len</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">af</var>, </td> +<td>int <var class="pdparam">af</var>, </td> </tr> <tr> <td> </td> -<td>int * </td> -<td> -<var class="pdparam">error_num</var><code>)</code>;</td> +<td>int *<var class="pdparam">error_num</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_freehostent</b>(</code></td> -<td>struct hostent * </td> -<td> -<var class="pdparam">he</var><code>)</code>;</td> +<td>struct hostent *<var class="pdparam">he</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543441"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These functions perform thread safe, protocol independent nodename-to-address and address-to-nodename @@ -125,7 +109,7 @@ struct hostent { <p> The members of this structure are: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">h_name</code></span></dt> <dd><p> The official (canonical) name of the host. @@ -165,7 +149,7 @@ struct hostent { types of addresses that are returned. The flag bits are: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">AI_V4MAPPED</code></span></dt> <dd><p> This is used with an @@ -216,8 +200,8 @@ struct hostent { the <span class="type">hostent</span> structure itself. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543699"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> If an error occurs, <code class="function">lwres_getipnodebyname()</code> @@ -231,7 +215,7 @@ struct hostent { The error codes and their meanings are defined in <code class="filename"><lwres/netdb.h></code>: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">HOST_NOT_FOUND</code></span></dt> <dd><p> No such host is known. @@ -260,8 +244,8 @@ struct hostent { translates these error codes to suitable error messages. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543796"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC2553</span></span>, <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, diff --git a/lib/lwres/man/lwres_getnameinfo.3 b/lib/lwres/man/lwres_getnameinfo.3 index 993b172144b7..c0c4ff4cf97d 100644 --- a/lib/lwres/man/lwres_getnameinfo.3 +++ b/lib/lwres/man/lwres_getnameinfo.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,57 +13,74 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_getnameinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GETNAMEINFO" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GETNAMEINFO" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_getnameinfo \- lightweight resolver socket address structure to hostname and service name .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 22 +.ft +.HP \w'int\ lwres_getnameinfo('u .BI "int lwres_getnameinfo(const\ struct\ sockaddr\ *" "sa" ", size_t\ " "salen" ", char\ *" "host" ", size_t\ " "hostlen" ", char\ *" "serv" ", size_t\ " "servlen" ", int\ " "flags" ");" .SH "DESCRIPTION" .PP This function is equivalent to the \fBgetnameinfo\fR(3) -function defined in RFC2133. +function defined in RFC2133\&. \fBlwres_getnameinfo()\fR returns the hostname for the -\fBstruct sockaddr\fR -\fIsa\fR +\fBstruct sockaddr\fR\fIsa\fR which is \fIsalen\fR -bytes long. The hostname is of length +bytes long\&. The hostname is of length \fIhostlen\fR and is returned via -\fI*host.\fR +\fI*host\&.\fR The maximum length of the hostname is 1025 bytes: -\fBNI_MAXHOST\fR. +\fBNI_MAXHOST\fR\&. .PP The name of the service associated with the port number in \fIsa\fR is returned in -\fI*serv.\fR +\fI*serv\&.\fR It is \fIservlen\fR -bytes long. The maximum length of the service name is +bytes long\&. The maximum length of the service name is \fBNI_MAXSERV\fR -\- 32 bytes. +\- 32 bytes\&. .PP The \fIflags\fR @@ -71,47 +88,51 @@ argument sets the following bits: .PP \fBNI_NOFQDN\fR .RS 4 -A fully qualified domain name is not required for local hosts. The local part of the fully qualified domain name is returned instead. +A fully qualified domain name is not required for local hosts\&. The local part of the fully qualified domain name is returned instead\&. .RE .PP \fBNI_NUMERICHOST\fR .RS 4 -Return the address in numeric form, as if calling inet_ntop(), instead of a host name. +Return the address in numeric form, as if calling inet_ntop(), instead of a host name\&. .RE .PP \fBNI_NAMEREQD\fR .RS 4 -A name is required. If the hostname cannot be found in the DNS and this flag is set, a non\-zero error code is returned. If the hostname is not found and the flag is not set, the address is returned in numeric form. +A name is required\&. If the hostname cannot be found in the DNS and this flag is set, a non\-zero error code is returned\&. If the hostname is not found and the flag is not set, the address is returned in numeric form\&. .RE .PP \fBNI_NUMERICSERV\fR .RS 4 -The service name is returned as a digit string representing the port number. +The service name is returned as a digit string representing the port number\&. .RE .PP \fBNI_DGRAM\fR .RS 4 -Specifies that the service being looked up is a datagram service, and causes getservbyport() to be called with a second argument of "udp" instead of its default of "tcp". This is required for the few ports (512\-514) that have different services for UDP and TCP. +Specifies that the service being looked up is a datagram service, and causes getservbyport() to be called with a second argument of "udp" instead of its default of "tcp"\&. This is required for the few ports (512\-514) that have different services for UDP and TCP\&. .RE .SH "RETURN VALUES" .PP \fBlwres_getnameinfo()\fR -returns 0 on success or a non\-zero error code if an error occurs. +returns 0 on success or a non\-zero error code if an error occurs\&. .SH "SEE ALSO" .PP \fBRFC2133\fR(), \fBgetservbyport\fR(3), \fBlwres\fR(3), \fBlwres_getnameinfo\fR(3), -\fBlwres_getnamebyaddr\fR(3). -\fBlwres_net_ntop\fR(3). +\fBlwres_getnamebyaddr\fR(3)\&. +\fBlwres_net_ntop\fR(3)\&. .SH "BUGS" .PP RFC2133 fails to define what the nonzero return values of \fBgetnameinfo\fR(3) -are. +are\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getnameinfo.docbook b/lib/lwres/man/lwres_getnameinfo.docbook index 34a72cb884ae..371b6f882d0b 100644 --- a/lib/lwres/man/lwres_getnameinfo.docbook +++ b/lib/lwres/man/lwres_getnameinfo.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -69,8 +71,8 @@ int </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> This function is equivalent to the @@ -158,16 +160,16 @@ int </varlistentry> </variablelist> </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para><function>lwres_getnameinfo()</function> returns 0 on success or a non-zero error code if an error occurs. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>RFC2133</refentrytitle> </citerefentry>, @@ -187,9 +189,9 @@ int <refentrytitle>lwres_net_ntop</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> - <refsect1> - <title>BUGS</title> + </refsection> + <refsection><info><title>BUGS</title></info> + <para> RFC2133 fails to define what the nonzero return values of <citerefentry> @@ -197,9 +199,5 @@ int </citerefentry> are. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_getnameinfo.html b/lib/lwres/man/lwres_getnameinfo.html index 6153e3b372c1..3b3d10f3adc9 100644 --- a/lib/lwres/man/lwres_getnameinfo.html +++ b/lib/lwres/man/lwres_getnameinfo.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_getnameinfo</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_getnameinfo — lightweight resolver socket address structure to hostname and @@ -33,56 +32,43 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> int <b class="fsfunc">lwres_getnameinfo</b>(</code></td> -<td>const struct sockaddr * </td> -<td> -<var class="pdparam">sa</var>, </td> +<td>const struct sockaddr *<var class="pdparam">sa</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">salen</var>, </td> +<td>size_t <var class="pdparam">salen</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">host</var>, </td> +<td>char *<var class="pdparam">host</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">hostlen</var>, </td> +<td>size_t <var class="pdparam">hostlen</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">serv</var>, </td> +<td>char *<var class="pdparam">serv</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">servlen</var>, </td> +<td>size_t <var class="pdparam">servlen</var>, </td> </tr> <tr> <td> </td> -<td>int </td> -<td> -<var class="pdparam">flags</var><code>)</code>;</td> +<td>int <var class="pdparam">flags</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543402"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> This function is equivalent to the <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> function defined in RFC2133. @@ -109,7 +95,7 @@ int following bits: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">NI_NOFQDN</code></span></dt> <dd><p> A fully qualified domain name is not required for local hosts. @@ -148,14 +134,14 @@ int <p> </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543544"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getnameinfo()</code> returns 0 on success or a non-zero error code if an error occurs. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543556"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC2133</span></span>, <span class="citerefentry"><span class="refentrytitle">getservbyport</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>, @@ -164,8 +150,8 @@ int <span class="citerefentry"><span class="refentrytitle">lwres_net_ntop</span>(3)</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543613"></a><h2>BUGS</h2> +<div class="refsection"> +<a name="id-1.10"></a><h2>BUGS</h2> <p> RFC2133 fails to define what the nonzero return values of <span class="citerefentry"><span class="refentrytitle">getnameinfo</span>(3)</span> diff --git a/lib/lwres/man/lwres_getrrsetbyname.3 b/lib/lwres/man/lwres_getrrsetbyname.3 index 6397a6e0fe74..ac724c02495d 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.3 +++ b/lib/lwres/man/lwres_getrrsetbyname.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,49 +13,63 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_getrrsetbyname .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GETRRSETBYNAME" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GETRRSETBYNAME" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_getrrsetbyname, lwres_freerrset \- retrieve DNS records .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 25 +.ft +.HP \w'int\ lwres_getrrsetbyname('u .BI "int lwres_getrrsetbyname(const\ char\ *" "hostname" ", unsigned\ int\ " "rdclass" ", unsigned\ int\ " "rdtype" ", unsigned\ int\ " "flags" ", struct\ rrsetinfo\ **" "res" ");" -.HP 21 +.HP \w'void\ lwres_freerrset('u .BI "void lwres_freerrset(struct\ rrsetinfo\ *" "rrset" ");" .PP The following structures are used: .PP -.RS 4 .nf struct rdatainfo { unsigned int rdi_length; /* length of data */ unsigned char *rdi_data; /* record data */ }; .fi -.RE -.sp .PP -.RS 4 .nf struct rrsetinfo { - unsigned int rri_flags; /* RRSET_VALIDATED... */ + unsigned int rri_flags; /* RRSET_VALIDATED\&.\&.\&. */ unsigned int rri_rdclass; /* class number */ unsigned int rri_rdtype; /* RR type number */ unsigned int rri_ttl; /* time to live */ @@ -66,7 +80,6 @@ struct rrsetinfo { struct rdatainfo *rri_sigs; /* individual signatures */ }; .fi -.RE .sp .SH "DESCRIPTION" .PP @@ -74,11 +87,11 @@ struct rrsetinfo { gets a set of resource records associated with a \fIhostname\fR, \fIclass\fR, and -\fItype\fR. +\fItype\fR\&. \fIhostname\fR -is a pointer a to null\-terminated string. The +is a pointer a to null\-terminated string\&. The \fIflags\fR -field is currently unused and must be zero. +field is currently unused and must be zero\&. .PP After a successful call to \fBlwres_getrrsetbyname()\fR, @@ -89,21 +102,21 @@ structure, containing a list of one or more \fBrdatainfo\fR structures containing resource records and potentially another list of \fBrdatainfo\fR -structures containing SIG resource records associated with those records. The members +structures containing SIG resource records associated with those records\&. The members \fBrri_rdclass\fR and \fBrri_rdtype\fR -are copied from the parameters. +are copied from the parameters\&. \fBrri_ttl\fR and \fBrri_name\fR -are properties of the obtained rrset. The resource records contained in +are properties of the obtained rrset\&. The resource records contained in \fBrri_rdatas\fR and \fBrri_sigs\fR -are in uncompressed DNS wire format. Properties of the rdataset are represented in the +are in uncompressed DNS wire format\&. Properties of the rdataset are represented in the \fBrri_flags\fR -bitfield. If the RRSET_VALIDATED bit is set, the data has been DNSSEC validated and the signatures verified. +bitfield\&. If the RRSET_VALIDATED bit is set, the data has been DNSSEC validated and the signatures verified\&. .PP All of the information returned by \fBlwres_getrrsetbyname()\fR @@ -112,15 +125,15 @@ is dynamically allocated: the and \fBrdatainfo\fR structures, and the canonical host name strings pointed to by the -\fBrrsetinfo\fRstructure. Memory allocated for the dynamically allocated structures created by a successful call to +\fBrrsetinfo\fRstructure\&. Memory allocated for the dynamically allocated structures created by a successful call to \fBlwres_getrrsetbyname()\fR is released by -\fBlwres_freerrset()\fR. +\fBlwres_freerrset()\fR\&. \fIrrset\fR is a pointer to a \fBstruct rrset\fR created by a call to -\fBlwres_getrrsetbyname()\fR. +\fBlwres_getrrsetbyname()\fR\&. .PP .SH "RETURN VALUES" .PP @@ -156,9 +169,13 @@ other failure .RE .SH "SEE ALSO" .PP -\fBlwres\fR(3). +\fBlwres\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_getrrsetbyname.docbook b/lib/lwres/man/lwres_getrrsetbyname.docbook index aceb5a1f9f34..c8de98e91103 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.docbook +++ b/lib/lwres/man/lwres_getrrsetbyname.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -97,8 +99,8 @@ struct rrsetinfo { </para> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_getrrsetbyname()</function> gets a set of resource records associated with a <parameter>hostname</parameter>, <parameter>class</parameter>, @@ -143,10 +145,10 @@ struct rrsetinfo { rrset</type> created by a call to <function>lwres_getrrsetbyname()</function>. </para> - <para></para> - </refsect1> - <refsect1> - <title>RETURN VALUES</title> + <para/> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + <para><function>lwres_getrrsetbyname()</function> returns zero on success, and one of the following error codes if an error occurred: @@ -200,24 +202,20 @@ struct rrsetinfo { <varlistentry> <term><constant/></term> <listitem> - <para></para> + <para/> </listitem> </varlistentry> </variablelist> </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_getrrsetbyname.html b/lib/lwres/man/lwres_getrrsetbyname.html index ad56c485b10d..33c718547a3b 100644 --- a/lib/lwres/man/lwres_getrrsetbyname.html +++ b/lib/lwres/man/lwres_getrrsetbyname.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_getrrsetbyname</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_getrrsetbyname, lwres_freerrset — retrieve DNS records</p> @@ -31,48 +30,38 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> int <b class="fsfunc">lwres_getrrsetbyname</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">hostname</var>, </td> +<td>const char *<var class="pdparam">hostname</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">rdclass</var>, </td> +<td>unsigned int <var class="pdparam">rdclass</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">rdtype</var>, </td> +<td>unsigned int <var class="pdparam">rdtype</var>, </td> </tr> <tr> <td> </td> -<td>unsigned int </td> -<td> -<var class="pdparam">flags</var>, </td> +<td>unsigned int <var class="pdparam">flags</var>, </td> </tr> <tr> <td> </td> -<td>struct rrsetinfo ** </td> -<td> -<var class="pdparam">res</var><code>)</code>;</td> +<td>struct rrsetinfo **<var class="pdparam">res</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_freerrset</b>(</code></td> -<td>struct rrsetinfo * </td> -<td> -<var class="pdparam">rrset</var><code>)</code>;</td> +<td>struct rrsetinfo *<var class="pdparam">rrset</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> <p> The following structures are used: @@ -101,8 +90,8 @@ struct rrsetinfo { <p> </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543424"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_getrrsetbyname()</code> gets a set of resource records associated with a <em class="parameter"><code>hostname</code></em>, <em class="parameter"><code>class</code></em>, @@ -149,13 +138,13 @@ struct rrsetinfo { </p> <p></p> </div> -<div class="refsect1" lang="en"> -<a name="id2543536"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p><code class="function">lwres_getrrsetbyname()</code> returns zero on success, and one of the following error codes if an error occurred: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">ERRSET_NONAME</code></span></dt> <dd><p> the name does not exist @@ -183,8 +172,8 @@ struct rrsetinfo { </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543636"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres</span>(3)</span>. </p> </div> diff --git a/lib/lwres/man/lwres_gnba.3 b/lib/lwres/man/lwres_gnba.3 index 5c64f0714291..4f652685555b 100644 --- a/lib/lwres/man/lwres_gnba.3 +++ b/lib/lwres/man/lwres_gnba.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,71 +13,97 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_gnba .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_GNBA" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_GNBA" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free \- lightweight resolver getnamebyaddress message handling .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 40 +.ft +.HP \w'lwres_result_t\ lwres_gnbarequest_render('u .BI "lwres_result_t lwres_gnbarequest_render(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 41 +.HP \w'lwres_result_t\ lwres_gnbaresponse_render('u .BI "lwres_result_t lwres_gnbaresponse_render(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 39 +.HP \w'lwres_result_t\ lwres_gnbarequest_parse('u .BI "lwres_result_t lwres_gnbarequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbarequest_t\ **" "structp" ");" -.HP 40 +.HP \w'lwres_result_t\ lwres_gnbaresponse_parse('u .BI "lwres_result_t lwres_gnbaresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_gnbaresponse_t\ **" "structp" ");" -.HP 29 +.HP \w'void\ lwres_gnbaresponse_free('u .BI "void lwres_gnbaresponse_free(lwres_context_t\ *" "ctx" ", lwres_gnbaresponse_t\ **" "structp" ");" -.HP 28 +.HP \w'void\ lwres_gnbarequest_free('u .BI "void lwres_gnbarequest_free(lwres_context_t\ *" "ctx" ", lwres_gnbarequest_t\ **" "structp" ");" .SH "DESCRIPTION" .PP -These are low\-level routines for creating and parsing lightweight resolver address\-to\-name lookup request and response messages. +These are low\-level routines for creating and parsing lightweight resolver address\-to\-name lookup request and response messages\&. .PP -There are four main functions for the getnamebyaddr opcode. One render function converts a getnamebyaddr request structure \(em +There are four main functions for the getnamebyaddr opcode\&. One render function converts a getnamebyaddr request structure \(em \fBlwres_gnbarequest_t\fR -\(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a getnamebyaddr request structure. Another render function converts the getnamebyaddr response structure \(em +\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a getnamebyaddr request structure\&. Another render function converts the getnamebyaddr response structure \(em \fBlwres_gnbaresponse_t\fR -to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure. +to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a getnamebyaddr response structure\&. .PP These structures are defined in -\fIlwres/lwres.h\fR. They are shown below. +lwres/lwres\&.h\&. They are shown below\&. .PP +.if n \{\ .RS 4 +.\} .nf #define LWRES_OPCODE_GETNAMEBYADDR 0x00010002U .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint32_t flags; lwres_addr_t addr; } lwres_gnbarequest_t; .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint32_t flags; @@ -90,24 +116,25 @@ typedef struct { size_t baselen; } lwres_gnbaresponse_t; .fi +.if n \{\ .RE -.sp +.\} .PP \fBlwres_gnbarequest_render()\fR uses resolver context \fIctx\fR to convert getnamebyaddr request structure \fIreq\fR -to canonical format. The packet header structure +to canonical format\&. The packet header structure \fIpkt\fR is initialised and transferred to buffer -\fIb\fR. The contents of +\fIb\fR\&. The contents of \fI*req\fR -are then appended to the buffer in canonical format. +are then appended to the buffer in canonical format\&. \fBlwres_gnbaresponse_render()\fR performs the same task, except it converts a getnamebyaddr response structure \fBlwres_gnbaresponse_t\fR -to the lightweight resolver's canonical format. +to the lightweight resolver\*(Aqs canonical format\&. .PP \fBlwres_gnbarequest_parse()\fR uses context @@ -116,18 +143,18 @@ to convert the contents of packet \fIpkt\fR to a \fBlwres_gnbarequest_t\fR -structure. Buffer +structure\&. Buffer \fIb\fR -provides space to be used for storing this structure. When the function succeeds, the resulting +provides space to be used for storing this structure\&. When the function succeeds, the resulting \fBlwres_gnbarequest_t\fR is made available through -\fI*structp\fR. +\fI*structp\fR\&. \fBlwres_gnbaresponse_parse()\fR offers the same semantics as \fBlwres_gnbarequest_parse()\fR except it yields a \fBlwres_gnbaresponse_t\fR -structure. +structure\&. .PP \fBlwres_gnbaresponse_free()\fR and @@ -139,20 +166,19 @@ that was allocated to the or \fBlwres_gnbarequest_t\fR structures referenced via -\fIstructp\fR. Any memory associated with ancillary buffers and strings for those structures is also discarded. +\fIstructp\fR\&. Any memory associated with ancillary buffers and strings for those structures is also discarded\&. .SH "RETURN VALUES" .PP The getnamebyaddr opcode functions \fBlwres_gnbarequest_render()\fR, -\fBlwres_gnbaresponse_render()\fR -\fBlwres_gnbarequest_parse()\fR +\fBlwres_gnbaresponse_render()\fR\fBlwres_gnbarequest_parse()\fR and \fBlwres_gnbaresponse_parse()\fR all return \fBLWRES_R_SUCCESS\fR -on success. They return +on success\&. They return \fBLWRES_R_NOMEMORY\fR -if memory allocation fails. +if memory allocation fails\&. \fBLWRES_R_UNEXPECTEDEND\fR is returned if the available space in the buffer \fIb\fR @@ -160,24 +186,28 @@ is too small to accommodate the packet header or the \fBlwres_gnbarequest_t\fR and \fBlwres_gnbaresponse_t\fR -structures. +structures\&. \fBlwres_gnbarequest_parse()\fR and \fBlwres_gnbaresponse_parse()\fR will return \fBLWRES_R_UNEXPECTEDEND\fR -if the buffer is not empty after decoding the received packet. These functions will return +if the buffer is not empty after decoding the received packet\&. These functions will return \fBLWRES_R_FAILURE\fR if -pktflags +\fIpktflags\fR in the packet header structure \fBlwres_lwpacket_t\fR -indicate that the packet is not a response to an earlier query. +indicate that the packet is not a response to an earlier query\&. .SH "SEE ALSO" .PP -\fBlwres_packet\fR(3). +\fBlwres_packet\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_gnba.docbook b/lib/lwres/man/lwres_gnba.docbook index ebb7487b031e..da6d3a8e546c 100644 --- a/lib/lwres/man/lwres_gnba.docbook +++ b/lib/lwres/man/lwres_gnba.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -121,8 +125,8 @@ void </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These are low-level routines for creating and parsing lightweight resolver address-to-name lookup request and @@ -207,10 +211,10 @@ typedef struct { ancillary buffers and strings for those structures is also discarded. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para> The getnamebyaddr opcode functions <function>lwres_gnbarequest_render()</function>, @@ -241,21 +245,17 @@ typedef struct { These functions will return <errorcode>LWRES_R_FAILURE</errorcode> if - <structfield>pktflags</structfield> + <varname remap="structfield">pktflags</varname> in the packet header structure <type>lwres_lwpacket_t</type> indicate that the packet is not a response to an earlier query. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_gnba.html b/lib/lwres/man/lwres_gnba.html index f05c05b36d85..4b8e7d910f60 100644 --- a/lib/lwres/man/lwres_gnba.html +++ b/lib/lwres/man/lwres_gnba.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_gnba</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_gnbarequest_render, lwres_gnbaresponse_render, lwres_gnbarequest_parse, lwres_gnbaresponse_parse, lwres_gnbaresponse_free, lwres_gnbarequest_free — lightweight resolver getnamebyaddress message handling</p> @@ -33,157 +32,123 @@ <pre class="funcsynopsisinfo"> #include <lwres/lwres.h> </pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gnbarequest_render</b> (</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbarequest_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_gnbarequest_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gnbaresponse_render</b> (</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbaresponse_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_gnbaresponse_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gnbarequest_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbarequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_gnbaresponse_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbaresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_gnbaresponse_free</b> (</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbaresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_gnbarequest_free</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbarequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gnbarequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543534"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver address-to-name lookup request and @@ -269,8 +234,8 @@ typedef struct { discarded. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543674"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> The getnamebyaddr opcode functions <code class="function">lwres_gnbarequest_render()</code>, @@ -301,14 +266,14 @@ typedef struct { These functions will return <span class="errorcode">LWRES_R_FAILURE</span> if - <em class="structfield"><code>pktflags</code></em> + <code class="varname">pktflags</code> in the packet header structure <span class="type">lwres_lwpacket_t</span> indicate that the packet is not a response to an earlier query. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543740"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span>. </p> </div> diff --git a/lib/lwres/man/lwres_hstrerror.3 b/lib/lwres/man/lwres_hstrerror.3 index a8fa9788b4c4..ec71b3e0c5ec 100644 --- a/lib/lwres/man/lwres_hstrerror.3 +++ b/lib/lwres/man/lwres_hstrerror.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,31 +13,49 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_hstrerror .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_HSTRERROR" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_HSTRERROR" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_herror, lwres_hstrerror \- lightweight resolver error message generation .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/netdb.h> +#include <lwres/netdb\&.h> .fi -.HP 18 +.ft +.HP \w'void\ lwres_herror('u .BI "void lwres_herror(const\ char\ *" "s" ");" -.HP 29 +.HP \w'const\ char\ *\ lwres_hstrerror('u .BI "const char * lwres_hstrerror(int\ " "err" ");" .SH "DESCRIPTION" .PP @@ -49,11 +67,11 @@ on followed by the string generated by \fBlwres_hstrerror()\fR for the error code stored in the global variable -\fBlwres_h_errno\fR. +\fBlwres_h_errno\fR\&. .PP \fBlwres_hstrerror()\fR returns an appropriate string for the error code gievn by -\fIerr\fR. The values of the error codes and messages are as follows: +\fIerr\fR\&. The values of the error codes and messages are as follows: .PP \fBNETDB_SUCCESS\fR .RS 4 @@ -87,13 +105,17 @@ is returned by \fBlwres_hstrerror()\fR when the value of \fBlwres_h_errno\fR -is not a valid error code. +is not a valid error code\&. .SH "SEE ALSO" .PP \fBherror\fR(3), -\fBlwres_hstrerror\fR(3). +\fBlwres_hstrerror\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_hstrerror.docbook b/lib/lwres/man/lwres_hstrerror.docbook index d091b347dac5..59a2f268c1f9 100644 --- a/lib/lwres/man/lwres_hstrerror.docbook +++ b/lib/lwres/man/lwres_hstrerror.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -68,8 +70,8 @@ const char * </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_herror()</function> prints the string <parameter>s</parameter> on @@ -121,10 +123,10 @@ const char * </varlistentry> </variablelist> </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para> The string <errorname>Unknown resolver error</errorname> is returned by <function>lwres_hstrerror()</function> @@ -132,9 +134,9 @@ const char * <constant>lwres_h_errno</constant> is not a valid error code. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>herror</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -144,9 +146,5 @@ const char * </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_hstrerror.html b/lib/lwres/man/lwres_hstrerror.html index 654e73f12d8e..0f4dbe831cf9 100644 --- a/lib/lwres/man/lwres_hstrerror.html +++ b/lib/lwres/man/lwres_hstrerror.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_hstrerror</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_herror, lwres_hstrerror — lightweight resolver error message generation</p> @@ -31,26 +30,24 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/netdb.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_herror</b>(</code></td> -<td>const char * </td> -<td> -<var class="pdparam">s</var><code>)</code>;</td> +<td>const char *<var class="pdparam">s</var><code>)</code>;</td> </tr></table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr> <td><code class="funcdef"> const char * <b class="fsfunc">lwres_hstrerror</b>(</code></td> -<td>int </td> -<td> -<var class="pdparam">err</var><code>)</code>;</td> +<td>int <var class="pdparam">err</var><code>)</code>;</td> </tr></table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543388"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_herror()</code> prints the string <em class="parameter"><code>s</code></em> on <span class="type">stderr</span> followed by the string generated by @@ -63,7 +60,7 @@ const char * messages are as follows: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><span class="errorcode">NETDB_SUCCESS</span></span></dt> <dd><p><span class="errorname">Resolver Error 0 (no error)</span> </p></dd> @@ -83,8 +80,8 @@ const char * <p> </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543507"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> The string <span class="errorname">Unknown resolver error</span> is returned by <code class="function">lwres_hstrerror()</code> @@ -93,8 +90,8 @@ const char * is not a valid error code. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543527"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">herror</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_hstrerror</span>(3)</span>. diff --git a/lib/lwres/man/lwres_inetntop.3 b/lib/lwres/man/lwres_inetntop.3 index c27b25e3d54c..077bbf609bea 100644 --- a/lib/lwres/man/lwres_inetntop.3 +++ b/lib/lwres/man/lwres_inetntop.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,29 +13,47 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_inetntop .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_INETNTOP" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_INETNTOP" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_net_ntop \- lightweight resolver IP address presentation .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/net.h> +#include <lwres/net\&.h> .fi -.HP 28 +.ft +.HP \w'const\ char\ *\ lwres_net_ntop('u .BI "const char * lwres_net_ntop(int\ " "af" ", const\ void\ *" "src" ", char\ *" "dst" ", size_t\ " "size" ");" .SH "DESCRIPTION" .PP @@ -44,17 +62,17 @@ converts an IP address of protocol family \fIaf\fR \(em IPv4 or IPv6 \(em at location \fIsrc\fR -from network format to its conventional representation as a string. For IPv4 addresses, that string would be a dotted\-decimal. An IPv6 address would be represented in colon notation as described in RFC1884. +from network format to its conventional representation as a string\&. For IPv4 addresses, that string would be a dotted\-decimal\&. An IPv6 address would be represented in colon notation as described in RFC1884\&. .PP The generated string is copied to \fIdst\fR provided \fIsize\fR -indicates it is long enough to store the ASCII representation of the address. +indicates it is long enough to store the ASCII representation of the address\&. .SH "RETURN VALUES" .PP If successful, the function returns -\fIdst\fR: a pointer to a string containing the presentation format of the address. +\fIdst\fR: a pointer to a string containing the presentation format of the address\&. \fBlwres_net_ntop()\fR returns \fBNULL\fR @@ -64,14 +82,18 @@ to \fBEAFNOSUPPORT\fR if the protocol family given in \fIaf\fR -is not supported. +is not supported\&. .SH "SEE ALSO" .PP \fBRFC1884\fR(), \fBinet_ntop\fR(3), -\fBerrno\fR(3). +\fBerrno\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_inetntop.docbook b/lib/lwres/man/lwres_inetntop.docbook index b2d170f29706..cf32a54b4a56 100644 --- a/lib/lwres/man/lwres_inetntop.docbook +++ b/lib/lwres/man/lwres_inetntop.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -64,8 +68,8 @@ const char * </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_net_ntop()</function> converts an IP address of protocol family @@ -84,9 +88,9 @@ const char * ASCII representation of the address. </para> - </refsect1> - <refsect1> - <title>RETURN VALUES</title> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + <para> If successful, the function returns <parameter>dst</parameter>: @@ -99,9 +103,9 @@ const char * supported. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>RFC1884</refentrytitle> </citerefentry>, @@ -112,9 +116,5 @@ const char * <refentrytitle>errno</refentrytitle><manvolnum>3</manvolnum> </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_inetntop.html b/lib/lwres/man/lwres_inetntop.html index 99cad662b090..1e08e7a7687b 100644 --- a/lib/lwres/man/lwres_inetntop.html +++ b/lib/lwres/man/lwres_inetntop.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_inetntop</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_net_ntop — lightweight resolver IP address presentation</p> @@ -31,38 +30,31 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/net.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> const char * <b class="fsfunc">lwres_net_ntop</b>(</code></td> -<td>int </td> -<td> -<var class="pdparam">af</var>, </td> +<td>int <var class="pdparam">af</var>, </td> </tr> <tr> <td> </td> -<td>const void * </td> -<td> -<var class="pdparam">src</var>, </td> +<td>const void *<var class="pdparam">src</var>, </td> </tr> <tr> <td> </td> -<td>char * </td> -<td> -<var class="pdparam">dst</var>, </td> +<td>char *<var class="pdparam">dst</var>, </td> </tr> <tr> <td> </td> -<td>size_t </td> -<td> -<var class="pdparam">size</var><code>)</code>;</td> +<td>size_t <var class="pdparam">size</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543388"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_net_ntop()</code> converts an IP address of protocol family <em class="parameter"><code>af</code></em> — IPv4 or IPv6 — at @@ -79,8 +71,8 @@ const char * ASCII representation of the address. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543420"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> If successful, the function returns <em class="parameter"><code>dst</code></em>: a pointer to a string containing the presentation format of the @@ -92,8 +84,8 @@ const char * supported. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543453"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">RFC1884</span></span>, <span class="citerefentry"><span class="refentrytitle">inet_ntop</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">errno</span>(3)</span>. diff --git a/lib/lwres/man/lwres_noop.3 b/lib/lwres/man/lwres_noop.3 index cacbd4b6a4cd..423cdd301df5 100644 --- a/lib/lwres/man/lwres_noop.3 +++ b/lib/lwres/man/lwres_noop.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,101 +13,128 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_noop .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_NOOP" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_NOOP" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free \- lightweight resolver no\-op message handling .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 40 +.ft +.HP \w'lwres_result_t\ lwres_nooprequest_render('u .BI "lwres_result_t lwres_nooprequest_render(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 41 +.HP \w'lwres_result_t\ lwres_noopresponse_render('u .BI "lwres_result_t lwres_noopresponse_render(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ *" "req" ", lwres_lwpacket_t\ *" "pkt" ", lwres_buffer_t\ *" "b" ");" -.HP 39 +.HP \w'lwres_result_t\ lwres_nooprequest_parse('u .BI "lwres_result_t lwres_nooprequest_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_nooprequest_t\ **" "structp" ");" -.HP 40 +.HP \w'lwres_result_t\ lwres_noopresponse_parse('u .BI "lwres_result_t lwres_noopresponse_parse(lwres_context_t\ *" "ctx" ", lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ", lwres_noopresponse_t\ **" "structp" ");" -.HP 29 +.HP \w'void\ lwres_noopresponse_free('u .BI "void lwres_noopresponse_free(lwres_context_t\ *" "ctx" ", lwres_noopresponse_t\ **" "structp" ");" -.HP 28 +.HP \w'void\ lwres_nooprequest_free('u .BI "void lwres_nooprequest_free(lwres_context_t\ *" "ctx" ", lwres_nooprequest_t\ **" "structp" ");" .SH "DESCRIPTION" .PP -These are low\-level routines for creating and parsing lightweight resolver no\-op request and response messages. +These are low\-level routines for creating and parsing lightweight resolver no\-op request and response messages\&. .PP The no\-op message is analogous to a \fBping\fR -packet: a packet is sent to the resolver daemon and is simply echoed back. The opcode is intended to allow a client to determine if the server is operational or not. +packet: a packet is sent to the resolver daemon and is simply echoed back\&. The opcode is intended to allow a client to determine if the server is operational or not\&. .PP -There are four main functions for the no\-op opcode. One render function converts a no\-op request structure \(em +There are four main functions for the no\-op opcode\&. One render function converts a no\-op request structure \(em \fBlwres_nooprequest_t\fR -\(em to the lightweight resolver's canonical format. It is complemented by a parse function that converts a packet in this canonical format to a no\-op request structure. Another render function converts the no\-op response structure \(em +\(em to the lightweight resolver\*(Aqs canonical format\&. It is complemented by a parse function that converts a packet in this canonical format to a no\-op request structure\&. Another render function converts the no\-op response structure \(em \fBlwres_noopresponse_t\fR -to the canonical format. This is complemented by a parse function which converts a packet in canonical format to a no\-op response structure. +to the canonical format\&. This is complemented by a parse function which converts a packet in canonical format to a no\-op response structure\&. .PP These structures are defined in -\fIlwres/lwres.h\fR. They are shown below. +lwres/lwres\&.h\&. They are shown below\&. .PP +.if n \{\ .RS 4 +.\} .nf #define LWRES_OPCODE_NOOP 0x00000000U .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint16_t datalength; unsigned char *data; } lwres_nooprequest_t; .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint16_t datalength; unsigned char *data; } lwres_noopresponse_t; .fi +.if n \{\ .RE -.sp +.\} .PP -Although the structures have different types, they are identical. This is because the no\-op opcode simply echos whatever data was sent: the response is therefore identical to the request. +Although the structures have different types, they are identical\&. This is because the no\-op opcode simply echos whatever data was sent: the response is therefore identical to the request\&. .PP \fBlwres_nooprequest_render()\fR uses resolver context \fIctx\fR to convert no\-op request structure \fIreq\fR -to canonical format. The packet header structure +to canonical format\&. The packet header structure \fIpkt\fR is initialised and transferred to buffer -\fIb\fR. The contents of +\fIb\fR\&. The contents of \fI*req\fR -are then appended to the buffer in canonical format. +are then appended to the buffer in canonical format\&. \fBlwres_noopresponse_render()\fR performs the same task, except it converts a no\-op response structure \fBlwres_noopresponse_t\fR -to the lightweight resolver's canonical format. +to the lightweight resolver\*(Aqs canonical format\&. .PP \fBlwres_nooprequest_parse()\fR uses context @@ -116,18 +143,18 @@ to convert the contents of packet \fIpkt\fR to a \fBlwres_nooprequest_t\fR -structure. Buffer +structure\&. Buffer \fIb\fR -provides space to be used for storing this structure. When the function succeeds, the resulting +provides space to be used for storing this structure\&. When the function succeeds, the resulting \fBlwres_nooprequest_t\fR is made available through -\fI*structp\fR. +\fI*structp\fR\&. \fBlwres_noopresponse_parse()\fR offers the same semantics as \fBlwres_nooprequest_parse()\fR except it yields a \fBlwres_noopresponse_t\fR -structure. +structure\&. .PP \fBlwres_noopresponse_free()\fR and @@ -139,20 +166,19 @@ that was allocated to the or \fBlwres_nooprequest_t\fR structures referenced via -\fIstructp\fR. +\fIstructp\fR\&. .SH "RETURN VALUES" .PP The no\-op opcode functions \fBlwres_nooprequest_render()\fR, -\fBlwres_noopresponse_render()\fR -\fBlwres_nooprequest_parse()\fR +\fBlwres_noopresponse_render()\fR\fBlwres_nooprequest_parse()\fR and \fBlwres_noopresponse_parse()\fR all return \fBLWRES_R_SUCCESS\fR -on success. They return +on success\&. They return \fBLWRES_R_NOMEMORY\fR -if memory allocation fails. +if memory allocation fails\&. \fBLWRES_R_UNEXPECTEDEND\fR is returned if the available space in the buffer \fIb\fR @@ -160,24 +186,28 @@ is too small to accommodate the packet header or the \fBlwres_nooprequest_t\fR and \fBlwres_noopresponse_t\fR -structures. +structures\&. \fBlwres_nooprequest_parse()\fR and \fBlwres_noopresponse_parse()\fR will return \fBLWRES_R_UNEXPECTEDEND\fR -if the buffer is not empty after decoding the received packet. These functions will return +if the buffer is not empty after decoding the received packet\&. These functions will return \fBLWRES_R_FAILURE\fR if \fBpktflags\fR in the packet header structure \fBlwres_lwpacket_t\fR -indicate that the packet is not a response to an earlier query. +indicate that the packet is not a response to an earlier query\&. .SH "SEE ALSO" .PP \fBlwres_packet\fR(3) +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_noop.docbook b/lib/lwres/man/lwres_noop.docbook index 8f40990b478f..b482c1a3643d 100644 --- a/lib/lwres/man/lwres_noop.docbook +++ b/lib/lwres/man/lwres_noop.docbook @@ -1,8 +1,7 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> +<!DOCTYPE book [ +<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +17,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +39,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -110,8 +114,8 @@ void </funcprototype> </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These are low-level routines for creating and parsing lightweight resolver no-op request and response messages. @@ -201,9 +205,9 @@ typedef struct { <parameter>structp</parameter>. </para> - </refsect1> - <refsect1> - <title>RETURN VALUES</title> + </refsection> + <refsection><info><title>RETURN VALUES</title></info> + <para> The no-op opcode functions <function>lwres_nooprequest_render()</function>, @@ -240,16 +244,12 @@ typedef struct { <type>lwres_lwpacket_t</type> indicate that the packet is not a response to an earlier query. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_packet</refentrytitle><manvolnum>3</manvolnum> </citerefentry> </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_noop.html b/lib/lwres/man/lwres_noop.html index e1d499cff704..6f67cab98497 100644 --- a/lib/lwres/man/lwres_noop.html +++ b/lib/lwres/man/lwres_noop.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_noop</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_nooprequest_render, lwres_noopresponse_render, lwres_nooprequest_parse, lwres_noopresponse_parse, lwres_noopresponse_free, lwres_nooprequest_free — lightweight resolver no-op message handling</p> @@ -32,160 +31,126 @@ <div class="funcsynopsis"> <pre class="funcsynopsisinfo"> #include <lwres/lwres.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_nooprequest_render</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_nooprequest_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_nooprequest_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_noopresponse_render</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_noopresponse_t * </td> -<td> -<var class="pdparam">req</var>, </td> +<td>lwres_noopresponse_t *<var class="pdparam">req</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var><code>)</code>;</td> +<td>lwres_buffer_t *<var class="pdparam">b</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_nooprequest_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_nooprequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_nooprequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_noopresponse_parse</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var>, </td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var>, </td> </tr> <tr> <td> </td> -<td>lwres_noopresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_noopresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_noopresponse_free</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_noopresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_noopresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> void <b class="fsfunc">lwres_nooprequest_free</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_nooprequest_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_nooprequest_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543531"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These are low-level routines for creating and parsing lightweight resolver no-op request and response messages. </p> <p> - The no-op message is analogous to a <span><strong class="command">ping</strong></span> + The no-op message is analogous to a <span class="command"><strong>ping</strong></span> packet: a packet is sent to the resolver daemon and is simply echoed back. The opcode is intended to allow a client to determine if the server is @@ -269,8 +234,8 @@ typedef struct { <em class="parameter"><code>structp</code></em>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543682"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> The no-op opcode functions <code class="function">lwres_nooprequest_render()</code>, @@ -308,8 +273,8 @@ typedef struct { indicate that the packet is not a response to an earlier query. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543748"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_packet</span>(3)</span> </p> </div> diff --git a/lib/lwres/man/lwres_packet.3 b/lib/lwres/man/lwres_packet.3 index a33990fc3de9..8f5c020534e4 100644 --- a/lib/lwres/man/lwres_packet.3 +++ b/lib/lwres/man/lwres_packet.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,47 +13,70 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_packet .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_PACKET" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_PACKET" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_lwpacket_renderheader, lwres_lwpacket_parseheader \- lightweight resolver packet handling functions .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwpacket.h> +#include <lwres/lwpacket\&.h> .fi -.HP 43 +.ft +.HP \w'lwres_result_t\ lwres_lwpacket_renderheader('u .BI "lwres_result_t lwres_lwpacket_renderheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");" -.HP 42 +.HP \w'lwres_result_t\ lwres_lwpacket_parseheader('u .BI "lwres_result_t lwres_lwpacket_parseheader(lwres_buffer_t\ *" "b" ", lwres_lwpacket_t\ *" "pkt" ");" .SH "DESCRIPTION" .PP These functions rely on a \fBstruct lwres_lwpacket\fR which is defined in -\fIlwres/lwpacket.h\fR. +lwres/lwpacket\&.h\&. .PP +.if n \{\ .RS 4 +.\} .nf typedef struct lwres_lwpacket lwres_lwpacket_t; .fi +.if n \{\ .RE -.sp +.\} .PP +.if n \{\ .RS 4 +.\} .nf struct lwres_lwpacket { lwres_uint32_t length; @@ -67,89 +90,89 @@ struct lwres_lwpacket { lwres_uint16_t authlength; }; .fi +.if n \{\ .RE -.sp +.\} .PP The elements of this structure are: .PP \fBlength\fR .RS 4 -the overall packet length, including the entire packet header. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. +the overall packet length, including the entire packet header\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&. .RE .PP \fBversion\fR .RS 4 -the header format. There is currently only one format, -\fBLWRES_LWPACKETVERSION_0\fR. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. +the header format\&. There is currently only one format, +\fBLWRES_LWPACKETVERSION_0\fR\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&. .RE .PP \fBpktflags\fR .RS 4 -library\-defined flags for this packet: for instance whether the packet is a request or a reply. Flag values can be set, but not defined by the caller. This field is filled in by the application wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the lwres_gabn_*() and lwres_gnba_*() calls. +library\-defined flags for this packet: for instance whether the packet is a request or a reply\&. Flag values can be set, but not defined by the caller\&. This field is filled in by the application wit the exception of the LWRES_LWPACKETFLAG_RESPONSE bit, which is set by the library in the lwres_gabn_*() and lwres_gnba_*() calls\&. .RE .PP \fBserial\fR .RS 4 -is set by the requestor and is returned in all replies. If two or more packets from the same source have the same serial number and are from the same source, they are assumed to be duplicates and the latter ones may be dropped. This field must be set by the application. +is set by the requestor and is returned in all replies\&. If two or more packets from the same source have the same serial number and are from the same source, they are assumed to be duplicates and the latter ones may be dropped\&. This field must be set by the application\&. .RE .PP \fBopcode\fR .RS 4 -indicates the operation. Opcodes between 0x00000000 and 0x03ffffff are reserved for use by the lightweight resolver library. Opcodes between 0x04000000 and 0xffffffff are application defined. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. +indicates the operation\&. Opcodes between 0x00000000 and 0x03ffffff are reserved for use by the lightweight resolver library\&. Opcodes between 0x04000000 and 0xffffffff are application defined\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&. .RE .PP \fBresult\fR .RS 4 -is only valid for replies. Results between 0x04000000 and 0xffffffff are application defined. Results between 0x00000000 and 0x03ffffff are reserved for library use. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls. +is only valid for replies\&. Results between 0x04000000 and 0xffffffff are application defined\&. Results between 0x00000000 and 0x03ffffff are reserved for library use\&. This field is filled in by the lwres_gabn_*() and lwres_gnba_*() calls\&. .RE .PP \fBrecvlength\fR .RS 4 -is the maximum buffer size that the receiver can handle on requests and the size of the buffer needed to satisfy a request when the buffer is too large for replies. This field is supplied by the application. +is the maximum buffer size that the receiver can handle on requests and the size of the buffer needed to satisfy a request when the buffer is too large for replies\&. This field is supplied by the application\&. .RE .PP \fBauthtype\fR .RS 4 -defines the packet level authentication that is used. Authorisation types between 0x1000 and 0xffff are application defined and types between 0x0000 and 0x0fff are reserved for library use. Currently these are not used and must be zero. +defines the packet level authentication that is used\&. Authorisation types between 0x1000 and 0xffff are application defined and types between 0x0000 and 0x0fff are reserved for library use\&. Currently these are not used and must be zero\&. .RE .PP \fBauthlen\fR .RS 4 -gives the length of the authentication data. Since packet authentication is currently not used, this must be zero. +gives the length of the authentication data\&. Since packet authentication is currently not used, this must be zero\&. .RE .PP The following opcodes are currently defined: .PP \fBNOOP\fR .RS 4 -Success is always returned and the packet contents are echoed. The lwres_noop_*() functions should be used for this type. +Success is always returned and the packet contents are echoed\&. The lwres_noop_*() functions should be used for this type\&. .RE .PP \fBGETADDRSBYNAME\fR .RS 4 -returns all known addresses for a given name. The lwres_gabn_*() functions should be used for this type. +returns all known addresses for a given name\&. The lwres_gabn_*() functions should be used for this type\&. .RE .PP \fBGETNAMEBYADDR\fR .RS 4 -return the hostname for the given address. The lwres_gnba_*() functions should be used for this type. +return the hostname for the given address\&. The lwres_gnba_*() functions should be used for this type\&. .RE .PP \fBlwres_lwpacket_renderheader()\fR transfers the contents of lightweight resolver packet structure -\fBlwres_lwpacket_t\fR -\fI*pkt\fR +\fBlwres_lwpacket_t\fR\fI*pkt\fR in network byte order to the lightweight resolver buffer, -\fI*b\fR. +\fI*b\fR\&. .PP \fBlwres_lwpacket_parseheader()\fR -performs the converse operation. It transfers data in network byte order from buffer +performs the converse operation\&. It transfers data in network byte order from buffer \fI*b\fR to resolver packet -\fI*pkt\fR. The contents of the buffer +\fI*pkt\fR\&. The contents of the buffer \fIb\fR should correspond to a -\fBlwres_lwpacket_t\fR. +\fBlwres_lwpacket_t\fR\&. .SH "RETURN VALUES" .PP Successful calls to @@ -157,14 +180,18 @@ Successful calls to and \fBlwres_lwpacket_parseheader()\fR return -\fBLWRES_R_SUCCESS\fR. If there is insufficient space to copy data between the buffer +\fBLWRES_R_SUCCESS\fR\&. If there is insufficient space to copy data between the buffer \fI*b\fR and lightweight resolver packet \fI*pkt\fR both functions return -\fBLWRES_R_UNEXPECTEDEND\fR. +\fBLWRES_R_UNEXPECTEDEND\fR\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_packet.docbook b/lib/lwres/man/lwres_packet.docbook index b9462635023b..321248b2ca4e 100644 --- a/lib/lwres/man/lwres_packet.docbook +++ b/lib/lwres/man/lwres_packet.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -69,8 +71,8 @@ lwres_result_t </funcprototype> </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para> These functions rely on a <type>struct lwres_lwpacket</type> @@ -268,10 +270,10 @@ struct lwres_lwpacket { <type>lwres_lwpacket_t</type>. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para> Successful calls to <function>lwres_lwpacket_renderheader()</function> and @@ -283,9 +285,5 @@ struct lwres_lwpacket { return <errorcode>LWRES_R_UNEXPECTEDEND</errorcode>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_packet.html b/lib/lwres/man/lwres_packet.html index d0542daa72db..411644310848 100644 --- a/lib/lwres/man/lwres_packet.html +++ b/lib/lwres/man/lwres_packet.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_packet</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_lwpacket_renderheader, lwres_lwpacket_parseheader — lightweight resolver packet handling functions</p> @@ -31,42 +30,36 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/lwpacket.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_lwpacket_renderheader</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var><code>)</code>;</td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_lwpacket_parseheader</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_lwpacket_t * </td> -<td> -<var class="pdparam">pkt</var><code>)</code>;</td> +<td>lwres_lwpacket_t *<var class="pdparam">pkt</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543399"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p> These functions rely on a <span class="type">struct lwres_lwpacket</span> @@ -96,7 +89,7 @@ struct lwres_lwpacket { <p> The elements of this structure are: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">length</code></span></dt> <dd><p> the overall packet length, including the entire packet header. @@ -185,7 +178,7 @@ struct lwres_lwpacket { <p> The following opcodes are currently defined: </p> -<div class="variablelist"><dl> +<div class="variablelist"><dl class="variablelist"> <dt><span class="term"><code class="constant">NOOP</code></span></dt> <dd><p> Success is always returned and the packet contents are echoed. @@ -218,8 +211,8 @@ struct lwres_lwpacket { <span class="type">lwres_lwpacket_t</span>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543716"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> Successful calls to <code class="function">lwres_lwpacket_renderheader()</code> and diff --git a/lib/lwres/man/lwres_resutil.3 b/lib/lwres/man/lwres_resutil.3 index 0125c788d13c..991fb05ca406 100644 --- a/lib/lwres/man/lwres_resutil.3 +++ b/lib/lwres/man/lwres_resutil.3 @@ -1,4 +1,4 @@ -.\" Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.\" Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .\" Copyright (C) 2000, 2001 Internet Software Consortium. .\" .\" Permission to use, copy, modify, and/or distribute this software for any @@ -13,59 +13,77 @@ .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR .\" PERFORMANCE OF THIS SOFTWARE. .\" -.\" $Id$ -.\" .hy 0 .ad l +'\" t .\" Title: lwres_resutil .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/> -.\" Date: June 18, 2007 +.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/> +.\" Date: 2007-06-18 .\" Manual: BIND9 -.\" Source: BIND9 +.\" Source: ISC +.\" Language: English .\" -.TH "LWRES_RESUTIL" "3" "June 18, 2007" "BIND9" "BIND9" +.TH "LWRES_RESUTIL" "3" "2007\-06\-18" "ISC" "BIND9" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- .SH "NAME" lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr \- lightweight resolver utility functions .SH "SYNOPSIS" +.sp +.ft B .nf -#include <lwres/lwres.h> +#include <lwres/lwres\&.h> .fi -.HP 34 +.ft +.HP \w'lwres_result_t\ lwres_string_parse('u .BI "lwres_result_t lwres_string_parse(lwres_buffer_t\ *" "b" ", char\ **" "c" ", lwres_uint16_t\ *" "len" ");" -.HP 32 +.HP \w'lwres_result_t\ lwres_addr_parse('u .BI "lwres_result_t lwres_addr_parse(lwres_buffer_t\ *" "b" ", lwres_addr_t\ *" "addr" ");" -.HP 36 +.HP \w'lwres_result_t\ lwres_getaddrsbyname('u .BI "lwres_result_t lwres_getaddrsbyname(lwres_context_t\ *" "ctx" ", const\ char\ *" "name" ", lwres_uint32_t\ " "addrtypes" ", lwres_gabnresponse_t\ **" "structp" ");" -.HP 35 +.HP \w'lwres_result_t\ lwres_getnamebyaddr('u .BI "lwres_result_t lwres_getnamebyaddr(lwres_context_t\ *" "ctx" ", lwres_uint32_t\ " "addrtype" ", lwres_uint16_t\ " "addrlen" ", const\ unsigned\ char\ *" "addr" ", lwres_gnbaresponse_t\ **" "structp" ");" .SH "DESCRIPTION" .PP \fBlwres_string_parse()\fR retrieves a DNS\-encoded string starting the current pointer of lightweight resolver buffer -\fIb\fR: i.e. -\fBb\->current\fR. When the function returns, the address of the first byte of the encoded string is returned via +\fIb\fR: i\&.e\&. +\fBb\->current\fR\&. When the function returns, the address of the first byte of the encoded string is returned via \fI*c\fR and the length of that string is given by -\fI*len\fR. The buffer's current pointer is advanced to point at the character following the string length, the encoded string, and the trailing +\fI*len\fR\&. The buffer\*(Aqs current pointer is advanced to point at the character following the string length, the encoded string, and the trailing \fBNULL\fR -character. +character\&. .PP \fBlwres_addr_parse()\fR extracts an address from the buffer -\fIb\fR. The buffer's current pointer +\fIb\fR\&. The buffer\*(Aqs current pointer \fBb\->current\fR -is presumed to point at an encoded address: the address preceded by a 32\-bit protocol family identifier and a 16\-bit length field. The encoded address is copied to +is presumed to point at an encoded address: the address preceded by a 32\-bit protocol family identifier and a 16\-bit length field\&. The encoded address is copied to \fBaddr\->address\fR and \fBaddr\->length\fR -indicates the size in bytes of the address that was copied. +indicates the size in bytes of the address that was copied\&. \fBb\->current\fR -is advanced to point at the next byte of available data in the buffer following the encoded address. +is advanced to point at the next byte of available data in the buffer following the encoded address\&. .PP \fBlwres_getaddrsbyname()\fR and @@ -74,7 +92,9 @@ use the \fBlwres_gnbaresponse_t\fR structure defined below: .PP +.if n \{\ .RS 4 +.\} .nf typedef struct { lwres_uint32_t flags; @@ -89,40 +109,42 @@ typedef struct { size_t baselen; } lwres_gabnresponse_t; .fi +.if n \{\ .RE +.\} .PP The contents of this structure are not manipulated directly but they are controlled through the \fBlwres_gabn\fR(3) -functions. +functions\&. .PP The lightweight resolver uses \fBlwres_getaddrsbyname()\fR -to perform forward lookups. Hostname +to perform forward lookups\&. Hostname \fIname\fR is looked up using the resolver context \fIctx\fR -for memory allocation. +for memory allocation\&. \fIaddrtypes\fR -is a bitmask indicating which type of addresses are to be looked up. Current values for this bitmask are +is a bitmask indicating which type of addresses are to be looked up\&. Current values for this bitmask are \fBLWRES_ADDRTYPE_V4\fR for IPv4 addresses and \fBLWRES_ADDRTYPE_V6\fR -for IPv6 addresses. Results of the lookup are returned in -\fI*structp\fR. +for IPv6 addresses\&. Results of the lookup are returned in +\fI*structp\fR\&. .PP \fBlwres_getnamebyaddr()\fR -performs reverse lookups. Resolver context +performs reverse lookups\&. Resolver context \fIctx\fR -is used for memory allocation. The address type is indicated by +is used for memory allocation\&. The address type is indicated by \fIaddrtype\fR: \fBLWRES_ADDRTYPE_V4\fR or -\fBLWRES_ADDRTYPE_V6\fR. The address to be looked up is given by +\fBLWRES_ADDRTYPE_V6\fR\&. The address to be looked up is given by \fIaddr\fR and its length is \fIaddrlen\fR -bytes. The result of the function call is made available through -\fI*structp\fR. +bytes\&. The result of the function call is made available through +\fI*structp\fR\&. .SH "RETURN VALUES" .PP Successful calls to @@ -130,12 +152,12 @@ Successful calls to and \fBlwres_addr_parse()\fR return -\fBLWRES_R_SUCCESS.\fR +\fBLWRES_R_SUCCESS\&.\fR Both functions return \fBLWRES_R_FAILURE\fR if the buffer is corrupt or \fBLWRES_R_UNEXPECTEDEND\fR -if the buffer has less space than expected for the components of the encoded string or address. +if the buffer has less space than expected for the components of the encoded string or address\&. .PP \fBlwres_getaddrsbyname()\fR returns @@ -144,11 +166,11 @@ on success and it returns \fBLWRES_R_NOTFOUND\fR if the hostname \fIname\fR -could not be found. +could not be found\&. .PP \fBLWRES_R_SUCCESS\fR is returned by a successful call to -\fBlwres_getnamebyaddr()\fR. +\fBlwres_getnamebyaddr()\fR\&. .PP Both \fBlwres_getaddrsbyname()\fR @@ -158,13 +180,17 @@ return \fBLWRES_R_NOMEMORY\fR when memory allocation requests fail and \fBLWRES_R_UNEXPECTEDEND\fR -if the buffers used for sending queries and receiving replies are too small. +if the buffers used for sending queries and receiving replies are too small\&. .SH "SEE ALSO" .PP \fBlwres_buffer\fR(3), -\fBlwres_gabn\fR(3). +\fBlwres_gabn\fR(3)\&. +.SH "AUTHOR" +.PP +\fBInternet Systems Consortium, Inc\&.\fR .SH "COPYRIGHT" -Copyright \(co 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") +.br +Copyright \(co 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") .br Copyright \(co 2000, 2001 Internet Software Consortium. .br diff --git a/lib/lwres/man/lwres_resutil.docbook b/lib/lwres/man/lwres_resutil.docbook index 0a0c4704aa2d..802483d075b7 100644 --- a/lib/lwres/man/lwres_resutil.docbook +++ b/lib/lwres/man/lwres_resutil.docbook @@ -1,8 +1,5 @@ -<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" - [<!ENTITY mdash "—">]> <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -18,10 +15,14 @@ - PERFORMANCE OF THIS SOFTWARE. --> -<refentry> - +<!-- Converted by db4-upgrade version 1.0 --> +<refentry xmlns="http://docbook.org/ns/docbook" version="5.0"> + <info> + <date>2007-06-18</date> + </info> <refentryinfo> - <date>June 18, 2007</date> + <corpname>ISC</corpname> + <corpauthor>Internet Systems Consortium, Inc.</corpauthor> </refentryinfo> <refmeta> @@ -36,6 +37,7 @@ <year>2005</year> <year>2007</year> <year>2014</year> + <year>2015</year> <holder>Internet Systems Consortium, Inc. ("ISC")</holder> </copyright> <copyright> @@ -92,8 +94,8 @@ lwres_result_t </funcsynopsis> </refsynopsisdiv> - <refsect1> - <title>DESCRIPTION</title> + <refsection><info><title>DESCRIPTION</title></info> + <para><function>lwres_string_parse()</function> retrieves a DNS-encoded string starting the current pointer of @@ -176,10 +178,10 @@ typedef struct { function call is made available through <parameter>*structp</parameter>. </para> - </refsect1> + </refsection> + + <refsection><info><title>RETURN VALUES</title></info> - <refsect1> - <title>RETURN VALUES</title> <para> Successful calls to <function>lwres_string_parse()</function> @@ -218,9 +220,9 @@ typedef struct { small. </para> - </refsect1> - <refsect1> - <title>SEE ALSO</title> + </refsection> + <refsection><info><title>SEE ALSO</title></info> + <para><citerefentry> <refentrytitle>lwres_buffer</refentrytitle><manvolnum>3</manvolnum> </citerefentry>, @@ -230,9 +232,5 @@ typedef struct { </citerefentry>. </para> - </refsect1> -</refentry><!-- - - Local variables: - - mode: sgml - - End: ---> + </refsection> +</refentry> diff --git a/lib/lwres/man/lwres_resutil.html b/lib/lwres/man/lwres_resutil.html index 28e571b4aec0..5855978c2f9a 100644 --- a/lib/lwres/man/lwres_resutil.html +++ b/lib/lwres/man/lwres_resutil.html @@ -1,5 +1,5 @@ <!-- - - Copyright (C) 2004, 2005, 2007, 2014 Internet Systems Consortium, Inc. ("ISC") + - Copyright (C) 2004, 2005, 2007, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") - Copyright (C) 2000, 2001 Internet Software Consortium. - - Permission to use, copy, modify, and/or distribute this software for any @@ -14,15 +14,14 @@ - OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - PERFORMANCE OF THIS SOFTWARE. --> -<!-- $Id$ --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>lwres_resutil</title> -<meta name="generator" content="DocBook XSL Stylesheets V1.71.1"> +<meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> </head> -<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"> -<a name="id2476275"></a><div class="titlepage"></div> +<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry"> +<a name="id-1"></a><div class="titlepage"></div> <div class="refnamediv"> <h2>Name</h2> <p>lwres_string_parse, lwres_addr_parse, lwres_getaddrsbyname, lwres_getnamebyaddr — lightweight resolver utility functions</p> @@ -31,110 +30,86 @@ <h2>Synopsis</h2> <div class="funcsynopsis"> <pre class="funcsynopsisinfo">#include <lwres/lwres.h></pre> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_string_parse</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>char ** </td> -<td> -<var class="pdparam">c</var>, </td> +<td>char **<var class="pdparam">c</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint16_t * </td> -<td> -<var class="pdparam">len</var><code>)</code>;</td> +<td>lwres_uint16_t *<var class="pdparam">len</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_addr_parse</b>(</code></td> -<td>lwres_buffer_t * </td> -<td> -<var class="pdparam">b</var>, </td> +<td>lwres_buffer_t *<var class="pdparam">b</var>, </td> </tr> <tr> <td> </td> -<td>lwres_addr_t * </td> -<td> -<var class="pdparam">addr</var><code>)</code>;</td> +<td>lwres_addr_t *<var class="pdparam">addr</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_getaddrsbyname</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>const char * </td> -<td> -<var class="pdparam">name</var>, </td> +<td>const char *<var class="pdparam">name</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint32_t </td> -<td> -<var class="pdparam">addrtypes</var>, </td> +<td>lwres_uint32_t <var class="pdparam">addrtypes</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gabnresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gabnresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> -<table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"> +<div class="funcprototype-spacer"> </div> +<table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"> <tr> <td><code class="funcdef"> lwres_result_t <b class="fsfunc">lwres_getnamebyaddr</b>(</code></td> -<td>lwres_context_t * </td> -<td> -<var class="pdparam">ctx</var>, </td> +<td>lwres_context_t *<var class="pdparam">ctx</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint32_t </td> -<td> -<var class="pdparam">addrtype</var>, </td> +<td>lwres_uint32_t <var class="pdparam">addrtype</var>, </td> </tr> <tr> <td> </td> -<td>lwres_uint16_t </td> -<td> -<var class="pdparam">addrlen</var>, </td> +<td>lwres_uint16_t <var class="pdparam">addrlen</var>, </td> </tr> <tr> <td> </td> -<td>const unsigned char * </td> -<td> -<var class="pdparam">addr</var>, </td> +<td>const unsigned char *<var class="pdparam">addr</var>, </td> </tr> <tr> <td> </td> -<td>lwres_gnbaresponse_t ** </td> -<td> -<var class="pdparam">structp</var><code>)</code>;</td> +<td>lwres_gnbaresponse_t **<var class="pdparam">structp</var><code>)</code>;</td> </tr> </table> +<div class="funcprototype-spacer"> </div> </div> </div> -<div class="refsect1" lang="en"> -<a name="id2543476"></a><h2>DESCRIPTION</h2> +<div class="refsection"> +<a name="id-1.7"></a><h2>DESCRIPTION</h2> <p><code class="function">lwres_string_parse()</code> retrieves a DNS-encoded string starting the current pointer of lightweight resolver buffer <em class="parameter"><code>b</code></em>: i.e. @@ -209,8 +184,8 @@ typedef struct { <em class="parameter"><code>*structp</code></em>. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543614"></a><h2>RETURN VALUES</h2> +<div class="refsection"> +<a name="id-1.8"></a><h2>RETURN VALUES</h2> <p> Successful calls to <code class="function">lwres_string_parse()</code> @@ -247,8 +222,8 @@ typedef struct { small. </p> </div> -<div class="refsect1" lang="en"> -<a name="id2543686"></a><h2>SEE ALSO</h2> +<div class="refsection"> +<a name="id-1.9"></a><h2>SEE ALSO</h2> <p><span class="citerefentry"><span class="refentrytitle">lwres_buffer</span>(3)</span>, <span class="citerefentry"><span class="refentrytitle">lwres_gabn</span>(3)</span>. |