Commit 1b000b4b authored by Lubos Slovak's avatar Lubos Slovak

Code cleanup in libknot

refs #1927 @1h
parent d911d6e7
......@@ -7,7 +7,6 @@ configure.ac
KNOWN_ISSUES
README
tests/querytcp.c
src/libknot/Makefile.am
src/libknot/libknot.h
src/libknot/common.h
src/libknot/dname.h
......
......@@ -492,8 +492,6 @@ knot_dname_t *knot_dname_parse_from_wire(const uint8_t *wire,
if (knot_wire_is_pointer(wire + p)) {
// pointer.
// printf("Pointer.\n");
size_t ptr = knot_wire_get_pointer(wire + p);
/* Check that the pointer points backwards
......
......@@ -937,8 +937,6 @@ void ck_destroy_table(ck_hash_table_t **table, void (*dtor_value)(void *value),
for (uint t = 0; t < (*table)->table_count; ++t) {
free((*table)->tables[t]);
}
// destroy stash
// da_destroy(&(*table)->stash);
pthread_mutex_unlock(&(*table)->mtx_table);
// destroy mutex, assuming that here noone will lock the mutex again
......@@ -1043,7 +1041,6 @@ int ck_resize_table(ck_hash_table_t *table)
}
return ck_rehash(table);
//return 0;
}
int ck_insert_item(ck_hash_table_t *table, const char *key,
......@@ -1075,9 +1072,6 @@ int ck_insert_item(ck_hash_table_t *table, const char *key,
}
}
// there should be at least 2 free places
//assert(da_try_reserve(&table->stash, 2) == 0);
//da_reserve(&table->stash, 1);
ck_hash_table_item_t *free_place = NULL;
if (ck_hash_item(table, &new_item, &free_place,
table->generation) != 0) {
......@@ -1602,7 +1596,6 @@ int ck_rehash(ck_hash_table_t *table)
// which will be put to the stash
ck_hash_table_item_t *free = NULL;
assert(table->hashed == NULL);
// ck_hash_table_item_t *old = table->hashed;
for (uint t = 0; t < table->table_count; ++t) {
uint rehashed = 0;
......
This diff is collapsed.
......@@ -115,8 +115,6 @@ typedef struct knot_ns_xfr {
*/
uint8_t *tsig_data;
size_t tsig_data_size; /*!< Size of the message(s) in bytes */
// const knot_rrset_t *tsig; /*!< Response TSIG.
// \todo [TSIG] Replace with separate data. */
size_t tsig_size; /*!< Size of the TSIG RR wireformat in bytes.*/
knot_key_t *tsig_key; /*!< Associated TSIG key for signing. */
......@@ -127,13 +125,6 @@ typedef struct knot_ns_xfr {
uint16_t tsig_rcode;
uint64_t tsig_prev_time_signed;
/*! \brief Previous digest or request digest.
*
* Should be allocated before the transfer (known size).
*/
// uint8_t *prev_digest;
// size_t prev_digest_size; /*!< Size of previous digest in bytes. */
/*!
* \brief Number of the packet currently assembled.
*
......
......@@ -158,8 +158,6 @@ static void knot_packet_init_pointers_query(knot_packet_t *pkt)
pkt->question.qname->labels = (uint8_t *)pos;
pos += PREALLOC_QNAME_LABELS;
// pkt->owner_tmp = (uint8_t *)((char *)pkt->question.qname->labels
// + PREALLOC_QNAME_LABELS);
// then answer, authority and additional sections
if (DEFAULT_ANCOUNT_QUERY == 0) {
......@@ -198,10 +196,6 @@ static void knot_packet_init_pointers_query(knot_packet_t *pkt)
pkt->tmp_rrsets_max = DEFAULT_TMP_RRSETS_QUERY;
// dbg_packet("End of data: %p (%zu after start of packet)\n",
// pkt->tmp_rrsets + DEFAULT_TMP_RRSETS_QUERY,
// (void *)(pkt->tmp_rrsets + DEFAULT_TMP_RRSETS_QUERY)
// - (void *)pkt);
dbg_packet_detail("Allocated total: %u\n", PREALLOC_QUERY);
assert(pos == (char *)pkt + PREALLOC_QUERY);
......@@ -238,10 +232,8 @@ static int knot_packet_parse_header(const uint8_t *wire, size_t *pos,
// copy some of the flags: OPCODE and RD
// do this by copying flags1 and setting QR to 1, AA to 0 and TC to 0
header->flags1 = knot_wire_get_flags1(wire);
// knot_wire_flags_set_qr(&header->flags1);
// knot_wire_flags_clear_aa(&header->flags1);
// knot_wire_flags_clear_tc(&header->flags1);
// do not copy flags2 (all set by server)
header->qdcount = knot_wire_get_qdcount(wire);
header->ancount = knot_wire_get_ancount(wire);
header->nscount = knot_wire_get_nscount(wire);
......@@ -313,10 +305,7 @@ static int knot_packet_parse_question(const uint8_t *wire, size_t *pos,
*pos = i + 1;
question->qtype = knot_wire_read_u16(wire + i + 1);
//*pos += 2;
question->qclass = knot_wire_read_u16(wire + i + 3);
//*pos += 2;
*pos += 4;
return KNOT_EOK;
......@@ -482,7 +471,6 @@ static int knot_packet_add_rrset(knot_rrset_t *rrset,
const knot_packet_t *packet,
knot_packet_duplicate_handling_t dupl)
{
assert(rrset != NULL);
assert(rrsets != NULL);
assert(rrset_count != NULL);
......@@ -770,9 +758,7 @@ int knot_packet_parse_from_wire(knot_packet_t *packet,
return KNOT_EMALF;
}
//uint8_t *pos = wireformat;
size_t pos = 0;
//size_t remaining = size;
dbg_packet_verb("Parsing wire format of packet (size %zu).\nHeader\n",
size);
......
......@@ -209,7 +209,7 @@ int knot_query_add_rrset_authority(knot_packet_t *query,
// reserve space for OPT RR
/*! \todo Why here??? */
endp -= query->opt_rr.size;
/*! \note [TSIG] reserve space for TSIG RR */
/* Reserve space for TSIG RR */
endp -= query->tsig_size;
uint8_t *pos = startp;
......
......@@ -61,12 +61,6 @@ int knot_query_nsid_requested(const knot_packet_t *query);
int knot_query_edns_supported(const knot_packet_t *query);
//int knot_query_set_qname(knot_packet_t *query, const knot_dname_t *qname);
//int knot_query_set_qtype(knot_packet_t *query, uint16_t qtype);
//int knot_query_set_qclass(knot_packet_t *query, uint16_t qclass);
int knot_query_init(knot_packet_t *query);
int knot_query_set_question(knot_packet_t *query,
......
......@@ -180,11 +180,6 @@ dbg_response_exec(
return KNOT_ENOMEM;
}
// store the position of the name
// table->dnames[table->count] = dname;
// table->offsets[table->count] = pos;
// ++table->count;
/*
* Store positions of ancestors if more than 1 label was not matched.
*
......@@ -338,15 +333,9 @@ static int knot_response_compress_dname(const knot_dname_t *dname,
knot_compr_t *compr, uint8_t *dname_wire, size_t max, int compr_cs)
{
int size = 0;
/*!
* \todo Compress!!
*
* if pos == 0, do not store the position!
*/
// try to find the name or one of its ancestors in the compr. table
#ifdef COMPRESSION_PEDANTIC
//knot_dname_t *to_find = knot_dname_copy(dname);
knot_dname_t *to_find = (knot_dname_t *)dname;
int copied = 0;
#else
......@@ -645,10 +634,6 @@ dbg_response_exec_verb(
return KNOT_EOK;
}
//uint8_t *rrset_wire = (uint8_t *)malloc(PREALLOC_RRSET_WIRE);
//short rrset_size = 0;
//uint8_t *owner_wire = (uint8_t *)malloc(rrset->owner->size);
/*
* We may pass the current position to the compression function
* because if the owner will be put somewhere, it will be on the
......@@ -658,7 +643,6 @@ dbg_response_exec_verb(
*/
knot_compr_t compr_info;
//compr_info.new_entries = 0;
compr_info.table = compr;
compr_info.wire_pos = wire_pos;
compr_info.owner.pos = 0;
......@@ -696,9 +680,6 @@ dbg_response_exec_verb(
++rrs;
} while ((rdata = knot_rrset_rdata_next(rrset, rdata)) != NULL);
//memcpy(*pos, rrset_wire, rrset_size);
//*size += rrset_size;
//*pos += rrset_size;
// the whole RRSet did fit in
assert (rrset_size <= max_size);
......
......@@ -249,7 +249,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
return KNOT_ERROR;
}
items[i].dname = dname;
//*pos += dname->size;
parsed += pos2 - *pos;
*pos = pos2;
dname = 0;
......@@ -309,7 +308,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
break;
case 3:
pos2 = *pos;
//fprintf(stderr, "reading dname from pos: %zu\n", pos2);
dname = knot_dname_parse_from_wire(
wire, &pos2, total_size, NULL);
if (dname == NULL) {
......@@ -331,12 +329,9 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
memcpy((uint8_t *)(items[i].raw_data + 1),
knot_dname_name(dname),
knot_dname_size(dname));
// items[i].dname = dname;
//*pos += dname->size;
parsed += pos2 - *pos;
//fprintf(stderr, "read %zu bytes.\n", parsed);
*pos = pos2;
knot_dname_free(&dname);
......@@ -374,9 +369,7 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
memcpy(items[i].raw_data + 1, wire + *pos, item_size);
*pos += item_size;
parsed += item_size;
} else if (item_type == KNOT_RDATA_WF_BINARY/*
|| item_type == KNOT_RDATA_WF_IPSECGATEWAY*/) {
// fprintf(stderr, "item_size was 0, creating empty rdata item.\n");
} else if (item_type == KNOT_RDATA_WF_BINARY) {
// in this case we are at the end of the RDATA
// and should create an empty RDATA item
items[i].raw_data = (uint16_t *)malloc(2);
......@@ -389,8 +382,6 @@ int knot_rdata_from_wire(knot_rdata_t *rdata, const uint8_t *wire,
} else if (item_type != KNOT_RDATA_WF_COMPRESSED_DNAME
&& item_type != KNOT_RDATA_WF_UNCOMPRESSED_DNAME
&& item_type != KNOT_RDATA_WF_LITERAL_DNAME) {
// fprintf(stderr, "RDATA item not set (i: %d), type: %u"
// " RDATA item type: %d\n", i, desc->type ,item_type);
assert(0);
}
......@@ -548,126 +539,6 @@ void knot_rdata_deep_free(knot_rdata_t **rdata, uint type,
*rdata = NULL;
}
/*----------------------------------------------------------------------------*/
/* CLEANUP */
//uint knot_rdata_wire_size(const knot_rdata_t *rdata,
// const uint8_t *format)
//{
// uint size = 0;
// for (int i = 0; i < rdata->count; ++i) {
// switch (format[i]) {
// case KNOT_RDATA_WF_COMPRESSED_DNAME:
// case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
// case KNOT_RDATA_WF_LITERAL_DNAME:
// size += knot_dname_size(rdata->items[i].dname);
// break;
// case KNOT_RDATA_WF_BYTE:
// size += 1;
// break;
// case KNOT_RDATA_WF_SHORT:
// size += 2;
// break;
// case KNOT_RDATA_WF_LONG:
// size += 4;
// break;
// case KNOT_RDATA_WF_A:
// size += 4;
// break;
// case KNOT_RDATA_WF_AAAA:
// size += 16;
// break;
// case KNOT_RDATA_WF_BINARY:
// case KNOT_RDATA_WF_APL: // saved as binary
// case KNOT_RDATA_WF_IPSECGATEWAY: // saved as binary
// size += rdata->items[i].raw_data[0];
// break;
// case KNOT_RDATA_WF_TEXT:
// case KNOT_RDATA_WF_BINARYWITHLENGTH:
// size += rdata->items[i].raw_data[0] + 1;
// break;
// default:
// assert(0);
// }
// }
// return size;
//}
/*----------------------------------------------------------------------------*/
//int knot_rdata_to_wire(const knot_rdata_t *rdata, const uint8_t *format,
// uint8_t *buffer, uint buf_size)
//{
// uint copied = 0;
// uint8_t tmp[KNOT_MAX_RDATA_WIRE_SIZE];
// uint8_t *to = tmp;
// for (int i = 0; i < rdata->count; ++i) {
// assert(copied < KNOT_MAX_RDATA_WIRE_SIZE);
// const uint8_t *from = (uint8_t *)rdata->items[i].raw_data;
// uint size = 0;
// switch (format[i]) {
// case KNOT_RDATA_WF_COMPRESSED_DNAME:
// case KNOT_RDATA_WF_UNCOMPRESSED_DNAME:
// case KNOT_RDATA_WF_LITERAL_DNAME:
// size = knot_dname_size(rdata->items[i].dname);
// from = knot_dname_name(rdata->items[i].dname);
// break;
// case KNOT_RDATA_WF_BYTE:
// size = 1;
// break;
// case KNOT_RDATA_WF_SHORT:
// size = 2;
// break;
// case KNOT_RDATA_WF_LONG:
// size = 4;
// break;
// case KNOT_RDATA_WF_A:
// size = 4;
// break;
// case KNOT_RDATA_WF_AAAA:
// size = 16;
// break;
// case KNOT_RDATA_WF_TEXT:
// case KNOT_RDATA_WF_BINARYWITHLENGTH:
// // size stored in the first two bytes, but in little
// // endian and we need only the lower byte from it
// *to = *from; // lower byte is the first in little endian
// to += 1;
// case KNOT_RDATA_WF_BINARY:
// case KNOT_RDATA_WF_APL: // saved as binary
// case KNOT_RDATA_WF_IPSECGATEWAY: // saved as binary
// // size stored in the first two bytes, those bytes
// // must not be copied
// size = rdata->items[i].raw_data[0];
// from += 2; // skip the first two bytes
// break;
// default:
// assert(0);
// }
// assert(size != 0);
// assert(copied + size < KNOT_MAX_RDATA_WIRE_SIZE);
// memcpy(to, from, size);
// to += size;
// copied += size;
// }
// if (copied > buf_size) {
// dbg_rdata("Not enough place allocated for function "
// "knot_rdata_to_wire(). Allocated %u, need %u\n",
// buf_size, copied);
// return -1;
// }
// memcpy(buffer, tmp, copied);
// return 0;
//}
/*----------------------------------------------------------------------------*/
knot_rdata_t *knot_rdata_deep_copy(const knot_rdata_t *rdata,
......
......@@ -487,7 +487,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
*pos += 2;
size += 10;
// compr->wire_pos += size;
dbg_rrset_detail("Max size: %zu, size: %d\n", max_size, size);
......@@ -518,7 +517,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
knot_dname_size(dname));
*pos += knot_dname_size(dname);
rdlength += knot_dname_size(dname);
// compr->wire_pos += dname->size;
break;
}
default: {
......@@ -534,7 +532,6 @@ static int knot_rrset_rr_to_wire(const knot_rrset_t *rrset,
dbg_rrset_detail("Raw data size: %d\n", raw_data[0]);
*pos += raw_data[0];
rdlength += raw_data[0];
// compr->wire_pos += raw_data[0];
break;
}
}
......@@ -635,7 +632,6 @@ int knot_rrset_deep_copy(const knot_rrset_t *from, knot_rrset_t **to)
*to = (knot_rrset_t *)calloc(1, sizeof(knot_rrset_t));
CHECK_ALLOC_LOG(*to, KNOT_ENOMEM);
//(*to)->owner = knot_dname_deep_copy(from->owner);
(*to)->owner = from->owner;
knot_dname_retain((*to)->owner);
(*to)->rclass = from->rclass;
......@@ -685,6 +681,7 @@ int knot_rrset_shallow_copy(const knot_rrset_t *from, knot_rrset_t **to)
void knot_rrset_rotate(knot_rrset_t *rrset)
{
/*! \todo Maybe implement properly one day. */
//rrset->rdata = rrset->rdata->next;
}
......@@ -739,10 +736,7 @@ void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
free_rdata_dnames);
}
/*! \todo Release owner every time? */
//if (free_owner) {
knot_dname_release((*rrset)->owner);
//}
knot_dname_release((*rrset)->owner);
free(*rrset);
*rrset = NULL;
......
......@@ -95,13 +95,6 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
return KNOT_TSIG_EBADSIG;
}
/* Create digest, using length of the algorithm. */
// *digest = malloc(sizeof(uint8_t) * tsig_alg_digest_length(tsig_alg));
// if (!digest) {
// ERR_ALLOC_FAILED;
// return KNOT_ENOMEM;
// }
/* Decode key from Base64. */
char decoded_key[B64BUFSIZE];
......@@ -114,9 +107,6 @@ static int knot_tsig_compute_digest(const uint8_t *wire, size_t wire_len,
dbg_tsig_detail("TSIG: decoded key size: %d\n", decoded_key_size);
dbg_tsig_detail("TSIG: decoded key: '%*s'\n", decoded_key_size, decoded_key);
// dbg_tsig_detail("TSIG: using this wire for digest calculation\n");
// dbg_tsig_hex_detail(wire, wire_len);
dbg_tsig_detail("Wire for signing is %zu bytes long.\n", wire_len);
/* Compute digest. */
......@@ -212,7 +202,6 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
memcpy(wire + offset, knot_dname_name(tsig_owner),
sizeof(uint8_t) * knot_dname_size(tsig_owner));
dbg_tsig_verb("TSIG: write variables: written owner (tsig alg): \n");
/*knot_rrset_class(tsig_rr));*/
dbg_tsig_hex_verb(wire + offset, knot_dname_size(tsig_owner));
offset += knot_dname_size(tsig_owner);
......@@ -238,9 +227,6 @@ static int knot_tsig_write_tsig_variables(uint8_t *wire,
dbg_tsig("TSIG: write variables: no algorithm name.\n");
return KNOT_EBADARG;
}
// alg_name = knot_dname_new_from_str("HMAC-MD5.SIG-ALG.REG.INT.",
//strlen("HMAC-MD5.SIG-ALG.REG.INT."),
//NULL);
memcpy(wire + offset, knot_dname_name(alg_name),
sizeof(uint8_t) * knot_dname_size(alg_name));
......@@ -309,13 +295,6 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
/* Create tmp TSIG. */
int ret = KNOT_EOK;
// knot_rrset_t *tmp_tsig =
// knot_rrset_new(key->name, KNOT_RRTYPE_TSIG, KNOT_CLASS_ANY, 0);
// if (!tmp_tsig) {
// return KNOT_ENOMEM;
// }
// tsig_rdata_store_current_time(tmp_tsig);
/*
* Create tmp wire, it should contain message
......@@ -352,8 +331,6 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
/* Copy the original message. */
dbg_tsig_verb("Copying original message.\n");
memcpy(pos, msg, msg_len);
// dbg_tsig_detail("TSIG: create wire: original message: \n");
//dbg_tsig_hex_detail(pos, msg_len);
pos += msg_len;
/* Copy TSIG variables. */
dbg_tsig_verb("Writing TSIG variables.\n");
......@@ -376,20 +353,8 @@ static int knot_tsig_create_sign_wire(const uint8_t *msg, size_t msg_len,
return ret;
}
// assert(digest_tmp_len > 0);
free(wire);
// if (digest_tmp_len > *digest_len) {
// *digest_len = 0;
// return KNOT_ESPACE;
// }
// knot_rrset_deep_free(&tmp_tsig, 1, 1, 1);
// everything went ok, save the digest to the output parameter
// memcpy(digest, digest_tmp, digest_tmp_len);
// *digest_len = digest_tmp_len;
return KNOT_EOK;
}
......@@ -436,15 +401,11 @@ static int knot_tsig_create_sign_wire_next(const uint8_t *msg, size_t msg_len,
/* Copy the original message. */
dbg_tsig_verb("Copying original message.\n");
memcpy(wire + prev_mac_len + 2, msg, msg_len);
// dbg_tsig_detail("TSIG: create wire: original message: \n");
//dbg_tsig_hex_detail(wire + prev_mac_len, msg_len);
/* Copy TSIG variables. */
dbg_tsig_verb("Writing TSIG timers.\n");
ret = knot_tsig_write_tsig_timers(wire + prev_mac_len + msg_len + 2,
tmp_tsig);
// ret = knot_tsig_write_tsig_variables(wire + prev_mac_len + msg_len,
// tmp_tsig);
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: create wire: failed to write TSIG "
"timers: %s\n", knot_strerror(ret));
......@@ -585,8 +546,6 @@ int knot_tsig_sign(uint8_t *msg, size_t *msg_len,
int rr_count = 0;
tsig_rdata_set_mac(tmp_tsig, digest_tmp_len, digest_tmp);
//knot_rrset_dump(tmp_tsig, 1);
/* Write RRSet to wire */
ret = knot_rrset_to_wire(tmp_tsig, msg + *msg_len,
&tsig_wire_len, &rr_count);
......@@ -813,16 +772,9 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
/* Calculate the size of TSIG RR. */
size_t tsig_len = tsig_wire_actsize(tsig_rr);
// dbg_tsig_detail("TSIG: check digest: wire before strip: \n");
//dbg_tsig_hex_detail(wire, size);
/* Strip the TSIG. */
size -= tsig_len;
// dbg_tsig_detail("TSIG: check digest: wire after strip (stripped %zu):\n",
// tsig_len);
//dbg_tsig_hex_detail(wire, size);
uint8_t *wire_to_sign = malloc(sizeof(uint8_t) * size);
if (!wire_to_sign) {
ERR_ALLOC_FAILED;
......@@ -861,15 +813,6 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
return ret;
}
// uint8_t digest_tmp[KNOT_TSIG_MAX_DIGEST_SIZE];
// size_t digest_tmp_len = 0;
// ret = knot_tsig_compute_digest(wire, size, digest_tmp,
// &digest_tmp_len, tsig_key);
// if (ret != KNOT_EOK) {
// dbg_tsig("TSIG: digest could not be calculated\n");
// return ret;
// }
dbg_tsig_verb("TSIG: digest calculated\n");
/* Compare MAC from TSIG RR RDATA with just computed digest. */
......@@ -888,8 +831,6 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr,
return KNOT_TSIG_EBADSIG;
}
// assert(tsig_alg_digest_length(alg) == mac_length);
dbg_tsig_verb("TSIG: calc digest : ");
dbg_tsig_hex_verb(digest_tmp, digest_tmp_len);
......@@ -932,8 +873,6 @@ int knot_tsig_client_check_next(const knot_rrset_t *tsig_rr,
const knot_key_t *tsig_key,
uint64_t prev_time_signed)
{
// return knot_tsig_client_check(tsig_rr, wire, size, prev_digest,
// prev_digest_len, tsig_key);
dbg_tsig("tsig_client_check_next()\n");
return knot_tsig_check_digest(tsig_rr, wire, size, prev_digest,
prev_digest_len, tsig_key,
......
......@@ -342,7 +342,7 @@ tsig_algorithm_t tsig_rdata_alg(const knot_rrset_t *tsig)
uint64_t tsig_rdata_time_signed(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -366,7 +366,7 @@ uint64_t tsig_rdata_time_signed(const knot_rrset_t *tsig)
uint16_t tsig_rdata_fudge(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -390,7 +390,7 @@ uint16_t tsig_rdata_fudge(const knot_rrset_t *tsig)
const uint8_t *tsig_rdata_mac(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -424,7 +424,7 @@ size_t tsig_rdata_mac_length(const knot_rrset_t *tsig)
uint16_t tsig_rdata_orig_id(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -448,7 +448,7 @@ uint16_t tsig_rdata_orig_id(const knot_rrset_t *tsig)
uint16_t tsig_rdata_error(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -472,7 +472,7 @@ uint16_t tsig_rdata_error(const knot_rrset_t *tsig)
const uint8_t *tsig_rdata_other_data(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -491,7 +491,7 @@ const uint8_t *tsig_rdata_other_data(const knot_rrset_t *tsig)
uint16_t tsig_rdata_other_data_length(const knot_rrset_t *tsig)
{
/*!< \note How about assert. Or maybe change API??? */
/*! \note How about assert. Or maybe change API??? */
if (!tsig) {
return 0;
}
......@@ -587,7 +587,7 @@ int tsig_rdata_store_current_time(knot_rrset_t *tsig)
return KNOT_EBADARG;
}
time_t curr_time = time(NULL);
/*!< \todo bleeding eyes. */
/*! \todo bleeding eyes. */
tsig_rdata_set_time_signed(tsig, (uint64_t)curr_time);
return KNOT_EOK;
}
......
......@@ -115,11 +115,6 @@ int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
// try to find the RRSet in the list of RRSets, but search backwards
// as it is probable that the last RRSet is the one to which the RR
// belongs
// int i = *count - 1;
// while (i >= 0 && !knot_changeset_rrsets_match((*rrsets)[i], rr)) {
// --i;
// }
// Just check the last RRSet. If the RR belongs to it, merge it,
// otherwise just add the RR to the end of the list
......@@ -136,24 +131,6 @@ int knot_changeset_add_rr(knot_rrset_t ***rrsets, size_t *count,
} else {
return knot_changeset_add_rrset(rrsets, count, allocated, rr);
}
// if (i >= 0) {
// // found RRSet to merge the new one into
// if (knot_rrset_merge((void **)&(*rrsets)[i],
// (void **)&rr) != KNOT_EOK) {
// return KNOT_ERROR;
// }
// // remove the RR
// /*! \todo does this make sense? */
// knot_rrset_free(&rr); // used to be deep free with all 1's
// return KNOT_EOK;
// } else {
// return knot_changeset_add_rrset(rrsets, count, allocated, rr);
// }
}
/*----------------------------------------------------------------------------*/
......@@ -261,7 +238,6 @@ int knot_changesets_check_size(knot_changesets_t *changesets)
void knot_free_changeset(knot_changeset_t **changeset)
{
/* XXX XXX investigate wrong frees. */
assert((*changeset)->add_allocated >= (*changeset)->add_count);
assert((*changeset)->remove_allocated >= (*changeset)->remove_count);
assert((*changeset)->allocated >= (*changeset)->size);
......@@ -310,7 +286,3 @@ void knot_free_changesets(knot_changesets_t **changesets)
free(*changesets);
*changesets = NULL;
}
/*---------------------------------------------------------------------------*/
......@@ -90,9 +90,9 @@ typedef struct {
int new_rdata_count;
int new_rdata_allocated;
// /*!
// * Deleted (without contents) after successful update.
// */
/*!
* Deleted (without contents) after successful update.
*/
knot_node_t **old_nodes;
int old_nodes_count;
int old_nodes_allocated;
......
......@@ -341,7 +341,7 @@ void xfrin_free_orphan_rrsigs(xfrin_orphan_rrsig_t **rrsigs)
}
/*----------------------------------------------------------------------------*/
/*! \note [TSIG] */
static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
int tsig_req)
{
......@@ -400,8 +400,8 @@ static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
}
if (ret != KNOT_EOK) {
/*! \note [TSIG] No need to check TSIG error
* here, propagate and check elsewhere.*/
/* No need to check TSIG error
* here, propagate and check elsewhere.*/
knot_rrset_deep_free(&tsig, 1, 1, 1);
return ret;
}
......@@ -425,9 +425,7 @@ static int xfrin_check_tsig(knot_packet_t *packet, knot_ns_xfr_t *xfr,
tsig_rdata_time_signed(tsig);
}/* else { // TSIG not required and not there
}*/
}
} else if (tsig != NULL) {
// TSIG where it should not be
knot_rrset_deep_free(&tsig, 1, 1, 1);
......@@ -506,10 +504,8 @@ int xfrin_process_axfr_packet(knot_ns_xfr_t *xfr)
if (*constr == NULL) {