* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.h,v 1.47 2003/02/26 23:52:30 marka Exp $ */
+/* $Id: rdataset.h,v 1.48 2004/01/12 04:19:42 marka Exp $ */
#ifndef DNS_RDATASET_H
#define DNS_RDATASET_H 1
* attributes
*/
unsigned int attributes;
+ /*
+ * the counter provides the starting point in the "cyclic" order.
+ * The value ISC_UINT32_MAX has a special meaning of "picking up a
+ * random value." in order to take care of databases that do not
+ * increment the counter.
+ */
+ isc_uint32_t count;
/*
* These are for use by the rdataset implementation, and MUST NOT
* be changed by clients.
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rbtdb.c,v 1.190 2003/10/17 05:31:05 marka Exp $ */
+/* $Id: rbtdb.c,v 1.191 2004/01/12 04:19:42 marka Exp $ */
/*
* Principal Author: Bob Halley
* this rdataset.
*/
+ isc_uint32_t count;
+ /*
+ * Monotonously increased every time this rdataset is bound so that
+ * it is used as the base of the starting point in DNS responses
+ * when the "cyclic" rrset-order is required. Since the ordering
+ * should not be so crucial, no lock is set for the counter for
+ * performance reasons.
+ */
} rdatasetheader_t;
#define RDATASET_ATTR_NONEXISTENT 0x0001
rdataset->private2 = node;
raw = (unsigned char *)header + sizeof(*header);
rdataset->private3 = raw;
-
+ rdataset->count = header->count++;
+ if (header->count == ISC_UINT32_MAX)
+ header->count = 0;
+
/*
* Reset iterator state.
*/
newheader->type = RBTDB_RDATATYPE_VALUE(rdataset->type,
rdataset->covers);
newheader->attributes = 0;
+ newheader->count = 0;
if (rbtversion != NULL) {
newheader->serial = rbtversion->serial;
newheader->trust = 0;
newheader->attributes = 0;
newheader->serial = rbtversion->serial;
newheader->trust = 0;
+ newheader->count = 0;
LOCK(&rbtdb->node_locks[rbtnode->locknum].lock);
newheader->attributes = RDATASET_ATTR_NONEXISTENT;
newheader->trust = 0;
newheader->serial = rbtversion->serial;
+ newheader->count = 0;
} else {
free_rdataset(rbtdb->common.mctx, newheader);
goto unlock;
newheader->serial = rbtversion->serial;
else
newheader->serial = 0;
+ newheader->count = 0;
LOCK(&rbtdb->node_locks[rbtnode->locknum].lock);
newheader->attributes = 0;
newheader->trust = rdataset->trust;
newheader->serial = 1;
+ newheader->count = 0;
result = add(rbtdb, node, rbtdb->current_version, newheader,
DNS_DBADD_MERGE, ISC_TRUE, NULL, 0);
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: rdataset.c,v 1.68 2003/09/30 05:56:12 marka Exp $ */
+/* $Id: rdataset.c,v 1.69 2004/01/12 04:19:42 marka Exp $ */
#include <config.h>
rdataset->trust = 0;
rdataset->covers = 0;
rdataset->attributes = 0;
+ rdataset->count = ISC_UINT32_MAX;
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
rdataset->trust = 0;
rdataset->covers = 0;
rdataset->attributes = 0;
+ rdataset->count = ISC_UINT32_MAX;
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
rdataset->trust = 0;
rdataset->covers = 0;
rdataset->attributes = 0;
+ rdataset->count = ISC_UINT32_MAX;
rdataset->private1 = NULL;
rdataset->private2 = NULL;
rdataset->private3 = NULL;
isc_uint32_t val;
unsigned int j;
- isc_random_get(&val);
+ val = rdataset->count;
+ if (val == ISC_UINT32_MAX)
+ isc_random_get(&val);
j = val % count;
for (i = 0; i < count; i++) {
if (order != NULL)