From 54e24e1768ce076fdc53025917a38b5ec2075b35 Mon Sep 17 00:00:00 2001 From: Jan Vcelak <jan.vcelak@nic.cz> Date: Thu, 3 Apr 2014 12:33:07 +0200 Subject: [PATCH] strip trailing whitespaces --- src/knot/ctl/remote.h | 1 - src/knot/dnssec/nsec-chain.c | 1 - src/knot/dnssec/nsec-chain.h | 1 - src/knot/dnssec/nsec3-chain.c | 1 - src/knot/dnssec/zone-nsec.c | 1 - src/knot/dnssec/zone-sign.c | 1 - src/knot/modules/synth_record.c | 4 +-- src/knot/nameserver/axfr.c | 3 +- src/knot/nameserver/internet.c | 12 +++---- src/knot/nameserver/ixfr.c | 1 - src/knot/nameserver/nsec_proofs.c | 3 +- src/knot/nameserver/update.c | 1 - src/knot/server/zones.c | 2 -- src/knot/updates/changesets.h | 1 - src/knot/updates/ddns.c | 2 +- src/knot/updates/xfr-in.c | 5 ++- src/knot/zone/node.c | 4 +-- src/knot/zone/node.h | 2 +- src/knot/zone/semantic-check.c | 51 +++++++++++++++--------------- src/knot/zone/zone-contents.c | 6 ++-- src/knot/zone/zone-diff.c | 2 -- src/knot/zone/zone-dump.c | 2 +- src/libknot/dnssec/nsec3.h | 1 - src/libknot/dnssec/rrset-sign.c | 1 - src/libknot/edns.c | 1 - src/libknot/packet/pkt.c | 11 +++---- src/libknot/packet/pkt.h | 12 +++---- src/libknot/rr.c | 11 +++---- src/libknot/rr.h | 2 -- src/libknot/rrset-dump.c | 1 - src/libknot/rrset.c | 7 ++-- src/libknot/tsig-op.c | 3 -- src/libknot/tsig.c | 1 - src/utils/dig/dig_exec.c | 1 - src/utils/nsupdate/nsupdate_exec.c | 2 -- tests/pkt.c | 2 +- 36 files changed, 61 insertions(+), 102 deletions(-) diff --git a/src/knot/ctl/remote.h b/src/knot/ctl/remote.h index 7cd2514949..bf198e19d5 100644 --- a/src/knot/ctl/remote.h +++ b/src/knot/ctl/remote.h @@ -171,7 +171,6 @@ int remote_build_rr(knot_rrset_t *rr, const char *k, uint16_t t); */ int remote_create_txt(knot_rrset_t *rr, const char *v, size_t v_len); - /*! * \brief Create a CNAME rdata. * \param d Domain name as a string. diff --git a/src/knot/dnssec/nsec-chain.c b/src/knot/dnssec/nsec-chain.c index 1249bdca2c..2713c43995 100644 --- a/src/knot/dnssec/nsec-chain.c +++ b/src/knot/dnssec/nsec-chain.c @@ -305,4 +305,3 @@ int knot_nsec_create_chain(const knot_zone_contents_t *zone, uint32_t ttl, return knot_nsec_chain_iterate_create(zone->nodes, connect_nsec_nodes, &data); } - diff --git a/src/knot/dnssec/nsec-chain.h b/src/knot/dnssec/nsec-chain.h index e1f300ab3d..ab43995f88 100644 --- a/src/knot/dnssec/nsec-chain.h +++ b/src/knot/dnssec/nsec-chain.h @@ -56,7 +56,6 @@ enum { typedef int (*chain_iterate_create_cb)(knot_node_t *, knot_node_t *, nsec_chain_iterate_data_t *); - /*! * \brief Add all RR types from a node into the bitmap. */ diff --git a/src/knot/dnssec/nsec3-chain.c b/src/knot/dnssec/nsec3-chain.c index 2285eb203c..ee3517a727 100644 --- a/src/knot/dnssec/nsec3-chain.c +++ b/src/knot/dnssec/nsec3-chain.c @@ -631,4 +631,3 @@ int knot_nsec3_create_chain(const knot_zone_contents_t *zone, uint32_t ttl, return result; } - diff --git a/src/knot/dnssec/zone-nsec.c b/src/knot/dnssec/zone-nsec.c index 0f25fe4763..ade08a681e 100644 --- a/src/knot/dnssec/zone-nsec.c +++ b/src/knot/dnssec/zone-nsec.c @@ -284,4 +284,3 @@ int knot_zone_create_nsec_chain(const knot_zone_contents_t *zone, // Sign newly created records right away return knot_zone_sign_nsecs_in_changeset(zone_keys, policy, changeset); } - diff --git a/src/knot/dnssec/zone-sign.c b/src/knot/dnssec/zone-sign.c index adaaa6c40e..021c3538c7 100644 --- a/src/knot/dnssec/zone-sign.c +++ b/src/knot/dnssec/zone-sign.c @@ -1500,4 +1500,3 @@ int knot_zone_sign_rr_should_be_signed(const knot_node_t *node, *should_sign = true; return KNOT_EOK; } - diff --git a/src/knot/modules/synth_record.c b/src/knot/modules/synth_record.c index 55ef3eee29..9ed91f2fe3 100644 --- a/src/knot/modules/synth_record.c +++ b/src/knot/modules/synth_record.c @@ -128,10 +128,10 @@ static int forward_addr_parse(struct query_data *qdata, synth_template_t *tpl, c if (addr_label == NULL || addr_label[0] <= prefix_len) { return KNOT_EINVAL; } - + int addr_len = *addr_label - prefix_len; memcpy(addr_str, addr_label + 1 + prefix_len, addr_len); - + /* Restore correct address format. */ char sep = str_separator(tpl->subnet.ss.ss_family); str_subst(addr_str, addr_len, '-', sep); diff --git a/src/knot/nameserver/axfr.c b/src/knot/nameserver/axfr.c index c35251f295..e111730862 100644 --- a/src/knot/nameserver/axfr.c +++ b/src/knot/nameserver/axfr.c @@ -14,7 +14,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ - #include "knot/nameserver/axfr.h" #include "knot/nameserver/internet.h" #include "knot/nameserver/process_query.h" @@ -36,7 +35,7 @@ static int put_rrsets(knot_pkt_t *pkt, knot_node_t *node, struct axfr_proc *stat int i = state->cur_rrset; int rrset_count = knot_node_rrset_count(node); unsigned flags = KNOT_PF_NOTRUNC; - + /* Append all RRs. */ for (;i < rrset_count; ++i) { knot_rrset_t rrset = NODE_RR_INIT_N(node, i); diff --git a/src/knot/nameserver/internet.c b/src/knot/nameserver/internet.c index 7626b8e932..fc468c21c1 100644 --- a/src/knot/nameserver/internet.c +++ b/src/knot/nameserver/internet.c @@ -1,4 +1,3 @@ - #include "knot/nameserver/internet.h" #include "knot/nameserver/nsec_proofs.h" #include "knot/nameserver/process_query.h" @@ -50,7 +49,7 @@ static int dname_cname_synth(const knot_rrset_t *dname_rr, return KNOT_EINVAL; } dbg_ns("%s(%p, %p)\n", __func__, dname_rr, qname); - + cname_rrset->owner = knot_dname_copy(qname, mm); if (cname_rrset->owner == NULL) { return KNOT_ENOMEM; @@ -236,7 +235,7 @@ static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata, return ret; } knot_rrset_rr_set_ttl(&soa_rrset, 0, min); - + flags |= KNOT_PF_FREE; soa_rrset = copy; } @@ -283,12 +282,12 @@ static int put_additional(knot_pkt_t *pkt, const knot_rrset_t *rr, for (uint16_t i = 0; i < rr_rdata_count; i++) { hint = knot_pkt_compr_hint(info, COMPR_HINT_RDATA + i); node = rr->additional[i]; - + /* No additional node for this record. */ if (node == NULL) { continue; } - + knot_rrset_t rrsigs = NODE_RR_INIT(node, KNOT_RRTYPE_RRSIG); for (int k = 0; k < ar_type_count; ++k) { knot_rrset_t additional = NODE_RR_INIT(node, ar_type_list[k]); @@ -328,7 +327,7 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda case KNOT_ESPACE: return TRUNC; default: return ERROR; } - + /* Check if RR count increased. */ if (pkt->rrset_count <= rr_count_before) { dbg_ns("%s: RR %p already inserted => CNAME loop\n", @@ -576,7 +575,6 @@ static int solve_authority_dnssec(int state, knot_pkt_t *pkt, struct query_data int ret = KNOT_ERROR; - /* Authenticated denial of existence. */ switch (state) { case HIT: ret = KNOT_EOK; break; diff --git a/src/knot/nameserver/ixfr.c b/src/knot/nameserver/ixfr.c index 48255f7601..196cc0de2e 100644 --- a/src/knot/nameserver/ixfr.c +++ b/src/knot/nameserver/ixfr.c @@ -1,4 +1,3 @@ - #include "knot/nameserver/ixfr.h" #include "knot/nameserver/axfr.h" #include "knot/nameserver/internet.h" diff --git a/src/knot/nameserver/nsec_proofs.c b/src/knot/nameserver/nsec_proofs.c index d1107752e5..17512838dc 100644 --- a/src/knot/nameserver/nsec_proofs.c +++ b/src/knot/nameserver/nsec_proofs.c @@ -1,4 +1,3 @@ - #include "knot/nameserver/nsec_proofs.h" #include "knot/nameserver/process_query.h" #include "knot/nameserver/internet.h" @@ -791,7 +790,7 @@ int nsec_append_rrsigs(knot_pkt_t *pkt, struct query_data *qdata, bool optional) break; } /* RRSIG is owned by packet now. */ - knot_rrs_init(&info->synth_rrsig.rrs); + knot_rrs_init(&info->synth_rrsig.rrs); }; /* Clear the list. */ diff --git a/src/knot/nameserver/update.c b/src/knot/nameserver/update.c index ad51099aad..26a29d9aed 100644 --- a/src/knot/nameserver/update.c +++ b/src/knot/nameserver/update.c @@ -1,4 +1,3 @@ - #include "knot/nameserver/update.h" #include "knot/nameserver/internet.h" #include "knot/nameserver/process_query.h" diff --git a/src/knot/server/zones.c b/src/knot/server/zones.c index f9f6ec9b00..b130177d62 100644 --- a/src/knot/server/zones.c +++ b/src/knot/server/zones.c @@ -847,8 +847,6 @@ bool zones_nsec3param_changed(const knot_zone_contents_t *old_contents, return apex_rr_changed(old_contents, new_contents, KNOT_RRTYPE_NSEC3PARAM); } - - /*----------------------------------------------------------------------------*/ static int zones_open_free_filename(const char *old_name, char **new_name) diff --git a/src/knot/updates/changesets.h b/src/knot/updates/changesets.h index 423c987376..e17819a8e3 100644 --- a/src/knot/updates/changesets.h +++ b/src/knot/updates/changesets.h @@ -41,7 +41,6 @@ typedef enum { KNOT_CHANGESET_TYPE_DNSSEC = 1 << 2 } knot_changeset_flag_t; - /*! \brief One changeset received from wire, with parsed RRs. */ typedef struct knot_changeset { node_t n; /*!< List node. */ diff --git a/src/knot/updates/ddns.c b/src/knot/updates/ddns.c index 47e4d2edf8..5a6c9ec169 100644 --- a/src/knot/updates/ddns.c +++ b/src/knot/updates/ddns.c @@ -592,7 +592,7 @@ static int process_add_cname(const knot_node_t *node, if (knot_rrset_equal(&cname, rr, KNOT_RRSET_COMPARE_WHOLE)) { return KNOT_EOK; } - + int ret = rem_rr_to_chgset(&cname, changeset, NULL); if (ret != KNOT_EOK) { return ret; diff --git a/src/knot/updates/xfr-in.c b/src/knot/updates/xfr-in.c index 78a62a7af6..562ded32ba 100644 --- a/src/knot/updates/xfr-in.c +++ b/src/knot/updates/xfr-in.c @@ -276,7 +276,6 @@ int xfrin_process_axfr_packet(knot_pkt_t *pkt, knot_ns_xfr_t *xfr, knot_zone_con // Init zone creator zcreator_t zc = {.z = *zone, .ret = KNOT_EOK }; - while (ret == KNOT_EOK && rr) { if (rr->type == KNOT_RRTYPE_SOA && knot_node_rrtype_exists(zc.z->apex, KNOT_RRTYPE_SOA)) { @@ -513,7 +512,7 @@ dbg_xfrin_exec_verb( ret = KNOT_ENOMEM; goto cleanup; } - + knot_changeset_add_soa(chset, soa, KNOT_CHANGESET_REMOVE); // change state to REMOVE @@ -1291,7 +1290,7 @@ int xfrin_apply_changesets(zone_t *zone, || new_contents == NULL) { return KNOT_EINVAL; } - + knot_zone_contents_t *old_contents = zone->contents; if (!old_contents) { dbg_xfrin("Cannot apply changesets to empty zone.\n"); diff --git a/src/knot/zone/node.c b/src/knot/zone/node.c index 6fd84319f9..ab29eeff5c 100644 --- a/src/knot/zone/node.c +++ b/src/knot/zone/node.c @@ -133,7 +133,7 @@ static int knot_node_add_rrset_no_merge(knot_node_t *node, const knot_rrset_t *r if (node == NULL) { return KNOT_EINVAL; } - + const size_t nlen = (node->rrset_count + 1) * sizeof(struct rr_data); void *p = realloc(node->rrs, nlen); if (p == NULL) { @@ -597,7 +597,6 @@ int knot_node_is_apex(const knot_node_t *node) return knot_node_flags_get(node, KNOT_NODE_FLAGS_APEX); } - /*----------------------------------------------------------------------------*/ void knot_node_free_rrsets(knot_node_t *node) @@ -743,4 +742,3 @@ void knot_node_fill_rrset_pos(const knot_node_t *node, size_t pos, rrset->rrs = rr_data->rrs; rrset->additional = rr_data->additional; } - diff --git a/src/knot/zone/node.h b/src/knot/zone/node.h index 07e3d6ea57..28f9a60e98 100644 --- a/src/knot/zone/node.h +++ b/src/knot/zone/node.h @@ -461,7 +461,7 @@ static inline struct rr_data *knot_node_rr_data_n(const knot_node_t *node, if (node == NULL || pos >= node->rrset_count) { return &NODE_EMPTY_DATA; } - + return &node->rrs[pos]; } diff --git a/src/knot/zone/semantic-check.c b/src/knot/zone/semantic-check.c index e8883f2bea..0d2ada9b79 100644 --- a/src/knot/zone/semantic-check.c +++ b/src/knot/zone/semantic-check.c @@ -18,7 +18,7 @@ #include <stdint.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> +#include <netinet/in.h> #include <arpa/inet.h> #include "knot/knot.h" @@ -110,7 +110,6 @@ static char *error_messages[(-ZC_ERR_UNKNOWN) + 1] = { /* ^ | Important errors (to be logged on first occurence and counted) */ - /* Below are errors of lesser importance, to be counted unless specified otherwise */ @@ -165,7 +164,7 @@ static void log_error_from_node(err_handler_t *handler, log_zone_warning("Unknown error.\n"); return; } - + if (node == NULL) { log_zone_warning("Total number of warnings is: %d for error: %s\n", handler->errors[-error], error_messages[-error]); @@ -195,8 +194,8 @@ int err_handler_handle_error(err_handler_t *handler, const knot_node_t *node, return KNOT_EINVAL; } - /* - * A missing SOA can only occur once, so there needn't be + /* + * A missing SOA can only occur once, so there needn't be * an option for it. */ @@ -413,7 +412,7 @@ static int check_rrsig_rdata(err_handler_t *handler, /* Compare algorithm, key tag and signer's name with DNSKEY rrset * one of the records has to match. Signer name has been checked * before */ - + int match = 0; uint8_t rrsig_alg = knot_rrs_rrsig_algorithm(rrsig, rr_pos); uint16_t key_tag_rrsig = knot_rrs_rrsig_key_tag(rrsig, rr_pos); @@ -424,7 +423,7 @@ static int check_rrsig_rdata(err_handler_t *handler, if (rrsig_alg != dnskey_alg) { continue; } - + /* Calculate keytag. */ uint16_t dnskey_key_tag = knot_keytag(knot_rrset_rr_rdata(dnskey_rrset, i), @@ -432,7 +431,7 @@ static int check_rrsig_rdata(err_handler_t *handler, if (key_tag_rrsig != dnskey_key_tag) { continue; } - + /* Final step - check DNSKEY validity. */ if (check_dnskey_rdata(dnskey_rrset, i) == KNOT_EOK) { match = 1; @@ -442,7 +441,7 @@ static int check_rrsig_rdata(err_handler_t *handler, "DNSKEY RDATA not matching."); } } - + if (!match) { err_handler_handle_error(handler, node, ZC_ERR_RRSIG_NO_DNSKEY, info_str); @@ -503,7 +502,7 @@ static int check_rrsig_in_rrset(err_handler_t *handler, info_str); /* Safe to continue, nothing is malformed. */ } - + const knot_rr_t *sig_rr = knot_rrs_rr(&rrsigs, 0); if (knot_rrset_rr_ttl(rrset, 0) != knot_rr_ttl(sig_rr)) { err_handler_handle_error(handler, node, @@ -556,7 +555,7 @@ static int rdata_nsec_to_type_array(const knot_rrs_t *rrs, uint16_t type, size_t pos, uint16_t **array, size_t *count) { assert(*array == NULL); - + uint8_t *data = NULL; uint16_t rr_bitmap_size = 0; if (type == KNOT_RRTYPE_NSEC) { @@ -567,7 +566,7 @@ static int rdata_nsec_to_type_array(const knot_rrs_t *rrs, uint16_t type, if (data == NULL) { return KNOT_EMALF; } - + *count = 0; int increment = 0; for (int i = 0; i < rr_bitmap_size; i += increment) { @@ -715,7 +714,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, } knot_dname_free(&next_dname, NULL); - + size_t arr_size; uint16_t *array = NULL; /* TODO only works for one NSEC3 RR. */ @@ -725,7 +724,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, if (ret != KNOT_EOK) { return ret; } - + uint16_t type = 0; for (int j = 0; j < arr_size; j++) { /* test for each type's presence */ @@ -733,14 +732,14 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, if (type == KNOT_RRTYPE_RRSIG) { continue; } - + if (!knot_node_rrtype_exists(node, type)) { err_handler_handle_error(handler, node, ZC_ERR_NSEC3_RDATA_BITMAP, NULL); } } - + /* Check that the node only contains NSEC3 and RRSIG. */ for (int i = 0; i < knot_node_rrset_count(nsec3_node); i++) { uint16_t type = nsec3_node->rrs[i].type; @@ -787,7 +786,7 @@ static int sem_check_node_mandatory(const knot_node_t *node, ZC_ERR_CNAME_EXTRA_RECORDS, NULL); } - + if (node->children != 0) { *fatal_error = true; err_handler_handle_error(handler, node, @@ -795,14 +794,14 @@ static int sem_check_node_mandatory(const knot_node_t *node, "Error triggered by parent node."); } } - + if (node->parent && knot_node_rrtype_exists(node->parent, KNOT_RRTYPE_DNAME)) { *fatal_error = true; err_handler_handle_error(handler, node, ZC_ERR_DNAME_CHILDREN, "Error triggered by child node."); } - + return KNOT_EOK; } @@ -827,7 +826,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone, knot_rrs_ns_name(ns_rrs, i); const knot_node_t *glue_node = knot_zone_contents_find_node(zone, ns_dname); - + if (knot_dname_is_sub(ns_dname, knot_node_owner(knot_zone_contents_apex(zone)))) { if (glue_node == NULL) { @@ -837,7 +836,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone, knot_dname_to_wire(wildcard + 2, knot_wire_next_label(ns_dname, NULL), sizeof(wildcard)); - const knot_node_t *wildcard_node = + const knot_node_t *wildcard_node = knot_zone_contents_find_node(zone, wildcard); if (wildcard_node == NULL) { @@ -857,7 +856,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone, } } } - + return KNOT_EOK; } @@ -953,7 +952,7 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone, ZC_ERR_NO_NSEC, NULL); return KNOT_EOK; } - + /* check NSEC/NSEC3 bitmap */ size_t count; uint16_t *array = NULL; @@ -1051,7 +1050,7 @@ static int do_checks_in_tree(knot_node_t *node, void *data) knot_node_t **last_node = (knot_node_t **)args->arg5; err_handler_t *handler = (err_handler_t *)args->arg6; - + char do_checks = *((char *)(args->arg3)); if (do_checks) { @@ -1100,10 +1099,10 @@ int zone_do_sem_checks(knot_zone_contents_t *zone, int do_checks, if (fatal_error) { return KNOT_ERROR; } - + log_cyclic_errors_in_zone(handler, zone, last_node, first_nsec3_node, last_nsec3_node, do_checks); - + return KNOT_EOK; } diff --git a/src/knot/zone/zone-contents.c b/src/knot/zone/zone-contents.c index 80457c936f..467e12de19 100644 --- a/src/knot/zone/zone-contents.c +++ b/src/knot/zone/zone-contents.c @@ -178,7 +178,7 @@ static int discover_additionals(struct rr_data *rr_data, if (node == NULL && encloser && encloser->wildcard_child) { node = encloser->wildcard_child; } - + rr_data->additional[i] = (knot_node_t *)node; } @@ -330,7 +330,7 @@ static int adjust_additional(knot_node_t **tnode, void *data) int ret = KNOT_EOK; knot_zone_adjust_arg_t *args = (knot_zone_adjust_arg_t *)data; knot_node_t *node = *tnode; - + /* Lookup additional records for specific nodes. */ for(uint16_t i = 0; i < node->rrset_count; ++i) { struct rr_data *rr_data = &node->rrs[i]; @@ -599,7 +599,6 @@ dbg_zone_exec_detail( /*----------------------------------------------------------------------------*/ - int knot_zone_contents_add_nsec3_node(knot_zone_contents_t *zone, knot_node_t *node, int create_parents, uint8_t flags) @@ -893,7 +892,6 @@ int knot_zone_contents_find_nsec3_for_name(const knot_zone_contents_t *zone, return KNOT_EINVAL; } - // check if the NSEC3 tree is not empty if (knot_zone_tree_is_empty(zone->nsec3_nodes)) { dbg_zone("NSEC3 tree is empty.\n"); diff --git a/src/knot/zone/zone-diff.c b/src/knot/zone/zone-diff.c index be3e174613..c1b554ec2a 100644 --- a/src/knot/zone/zone-diff.c +++ b/src/knot/zone/zone-diff.c @@ -540,7 +540,6 @@ static int knot_zone_diff_load_trees(knot_zone_tree_t *nodes1, return result; } - static int knot_zone_diff_load_content(const knot_zone_contents_t *zone1, const knot_zone_contents_t *zone2, knot_changeset_t *changeset) @@ -557,7 +556,6 @@ static int knot_zone_diff_load_content(const knot_zone_contents_t *zone1, return result; } - static int knot_zone_contents_diff(const knot_zone_contents_t *zone1, const knot_zone_contents_t *zone2, knot_changeset_t *changeset) diff --git a/src/knot/zone/zone-dump.c b/src/knot/zone/zone-dump.c index 8d9526349a..ff4dab77ab 100644 --- a/src/knot/zone/zone-dump.c +++ b/src/knot/zone/zone-dump.c @@ -77,7 +77,7 @@ static int apex_node_dump_text(knot_node_t *node, dump_params_t *params) fprintf(params->file, "%s", params->buf); params->buf[0] = '\0'; } - + return KNOT_EOK; } diff --git a/src/libknot/dnssec/nsec3.h b/src/libknot/dnssec/nsec3.h index 7c0aa76938..533adee112 100644 --- a/src/libknot/dnssec/nsec3.h +++ b/src/libknot/dnssec/nsec3.h @@ -37,7 +37,6 @@ /*---------------------------------------------------------------------------*/ - /*! * \brief Get length of the raw NSEC3 hash. * diff --git a/src/libknot/dnssec/rrset-sign.c b/src/libknot/dnssec/rrset-sign.c index 8c0ecc244c..fc153b9e5c 100644 --- a/src/libknot/dnssec/rrset-sign.c +++ b/src/libknot/dnssec/rrset-sign.c @@ -242,7 +242,6 @@ static int rrsigs_create_rdata(knot_rrset_t *rrsigs, return res; } - return knot_rrset_add_rr(rrsigs, result, size, knot_rrset_rr_ttl(covered, 0), NULL); } diff --git a/src/libknot/edns.c b/src/libknot/edns.c index b7abda05f3..b9d4eb744a 100644 --- a/src/libknot/edns.c +++ b/src/libknot/edns.c @@ -118,7 +118,6 @@ int knot_edns_new_from_rr(knot_opt_rr_t *opt_rr, const knot_rrset_t *rrset) } } - dbg_edns_verb("EDNS created.\n"); return KNOT_EOK; diff --git a/src/libknot/packet/pkt.c b/src/libknot/packet/pkt.c index 399fca4f18..6620dbfb83 100644 --- a/src/libknot/packet/pkt.c +++ b/src/libknot/packet/pkt.c @@ -50,7 +50,6 @@ static bool pkt_contains(const knot_pkt_t *packet, return false; } - /*! \brief Free all RRSets and reset RRSet count. */ static void pkt_free_data(knot_pkt_t *pkt) { @@ -590,7 +589,7 @@ int knot_pkt_parse_question(knot_pkt_t *pkt) if (pkt == NULL) { return KNOT_EINVAL; } - + /* Check at least header size. */ if (pkt->size < KNOT_WIRE_HEADER_SIZE) { dbg_packet("%s: smaller than DNS header, NOREPLY\n", __func__); @@ -620,7 +619,7 @@ int knot_pkt_parse_question(knot_pkt_t *pkt) if (len <= 0) { return KNOT_EMALF; } - + /* Check QCLASS/QTYPE size. */ uint16_t question_size = len + 2 * sizeof(uint16_t); /* QCLASS + QTYPE */ if (pkt->parsed + question_size > pkt->size) { @@ -628,7 +627,7 @@ int knot_pkt_parse_question(knot_pkt_t *pkt) return KNOT_EMALF; } - pkt->parsed += question_size; + pkt->parsed += question_size; pkt->qname_size = len; return KNOT_EOK; @@ -666,7 +665,7 @@ static int knot_pkt_rr_from_wire(const uint8_t *wire, size_t *pos, rrset->type = type; rrset->rclass = rclass; rrset->additional = NULL; - + *pos += KNOT_RR_HEADER_SIZE; dbg_packet_verb("%s: read type %u, class %u, ttl %u, rdlength %u\n", @@ -720,7 +719,7 @@ int knot_pkt_parse_rr(knot_pkt_t *pkt, unsigned flags) dbg_packet("%s: failed to parse RR\n", __func__); return ret; } - + /* Calculate parsed RR size from before/after parsing. */ rr_size = (pkt->parsed - rr_size); diff --git a/src/libknot/packet/pkt.h b/src/libknot/packet/pkt.h index 0c327f9839..b5aefa0de3 100644 --- a/src/libknot/packet/pkt.h +++ b/src/libknot/packet/pkt.h @@ -106,13 +106,13 @@ typedef struct knot_pkt { /* Packet sections. */ knot_section_t current; knot_pktsection_t sections[KNOT_PKT_SECTIONS]; - + /*! \note <== Memory below this point is not cleared on init for performance reasons. */ - + /* Packet RRSet (meta)data. */ knot_rrinfo_t rr_info[KNOT_PKT_MAX_RRS]; knot_rrset_t rr[KNOT_PKT_MAX_RRS]; - + mm_ctx_t mm; /*!< Memory allocation context. */ } knot_pkt_t; @@ -154,7 +154,6 @@ void knot_pkt_free(knot_pkt_t **pkt); */ int knot_pkt_reserve(knot_pkt_t *pkt, uint16_t size); - /*! \brief Classify packet according to the question. * \return see enum knot_pkt_type_t */ @@ -174,7 +173,7 @@ uint16_t knot_pkt_qclass(const knot_pkt_t *pkt); /*! * \brief Begin reading/writing packet section. - * + * * \note You must proceed in the natural order (ANSWER, AUTHORITY, ADDITIONAL). * * \param pkt @@ -211,7 +210,7 @@ int knot_pkt_opt_set(knot_pkt_t *pkt, unsigned opt, const void *data, uint16_t l */ int knot_pkt_put_question(knot_pkt_t *pkt, const knot_dname_t *qname, uint16_t qclass, uint16_t qtype); -/*! \brief Write OPT RR to wireformat. +/*! \brief Write OPT RR to wireformat. * \note Legacy API. */ int knot_pkt_put_opt(knot_pkt_t *pkt); @@ -333,7 +332,6 @@ int knot_pkt_add_opt(knot_pkt_t *resp, /*----------------------------------------------------------------------------*/ /*** >>> #190 DEPRECATED */ - #endif /* _KNOT_PACKET_H_ */ /*! @} */ diff --git a/src/libknot/rr.c b/src/libknot/rr.c index 962e47b74c..a3b2ed3ab1 100644 --- a/src/libknot/rr.c +++ b/src/libknot/rr.c @@ -118,7 +118,6 @@ static int knot_rrs_add_rr_at_pos(knot_rrs_t *rrs, const knot_rr_t *rr, return KNOT_EOK; } - uint16_t knot_rr_size(const knot_rr_t *rr) { return *((uint16_t *)rr); @@ -228,7 +227,7 @@ const uint8_t *knot_rrs_rr_rdata(const knot_rrs_t *rrs, size_t pos) if (rrs == NULL || pos >= rrs->rr_count) { return NULL; } - + return knot_rr_rdata(knot_rrs_rr(rrs, pos)); } @@ -242,7 +241,7 @@ uint16_t knot_rrs_rr_size(const knot_rrs_t *rrs, size_t pos) if (rrs == NULL || pos >= rrs->rr_count) { return 0; } - + return knot_rr_size(knot_rrs_rr(rrs, pos)); } @@ -251,7 +250,7 @@ uint32_t knot_rrs_rr_ttl(const knot_rrs_t *rrs, size_t pos) if (rrs == NULL || pos >= rrs->rr_count) { return 0; } - + return knot_rr_ttl(knot_rrs_rr(rrs, pos)); } @@ -323,7 +322,7 @@ bool knot_rrs_eq(const knot_rrs_t *rrs1, const knot_rrs_t *rrs2) if (rrs1->rr_count != rrs2->rr_count) { return false; } - + for (uint16_t i = 0; i < rrs1->rr_count; ++i) { const knot_rr_t *rr1 = knot_rrs_rr(rrs1, i); const knot_rr_t *rr2 = knot_rrs_rr(rrs2, i); @@ -331,7 +330,7 @@ bool knot_rrs_eq(const knot_rrs_t *rrs1, const knot_rrs_t *rrs2) return false; } } - + return true; } diff --git a/src/libknot/rr.h b/src/libknot/rr.h index ab02754a09..be71697398 100644 --- a/src/libknot/rr.h +++ b/src/libknot/rr.h @@ -1,4 +1,3 @@ - #pragma once #include <stdlib.h> @@ -208,4 +207,3 @@ int knot_rrs_synth_rrsig(uint16_t type, const knot_rrs_t *rrsig_rrs, * \return KNOT_E* */ int knot_rrs_merge(knot_rrs_t *rrs1, const knot_rrs_t *rrs2, mm_ctx_t *mm); - diff --git a/src/libknot/rrset-dump.c b/src/libknot/rrset-dump.c index 1d821c9a8f..ab98d68f2c 100644 --- a/src/libknot/rrset-dump.c +++ b/src/libknot/rrset-dump.c @@ -316,7 +316,6 @@ static void wire_type_to_str(rrset_dump_params_t *p) p->ret = 0; } - static int hex_encode(const uint8_t *in, const uint32_t in_len, uint8_t *out, diff --git a/src/libknot/rrset.c b/src/libknot/rrset.c index ba1e7223d7..efd4779a1d 100644 --- a/src/libknot/rrset.c +++ b/src/libknot/rrset.c @@ -1090,11 +1090,11 @@ int knot_rrset_copy_int(knot_rrset_t *dst, const knot_rrset_t *src, mm_ctx_t *mm if (dst == NULL || src == NULL) { return KNOT_EINVAL; } - + dst->type = src->type; dst->additional = src->additional; dst->rclass = src->rclass; - + dst->owner = knot_dname_copy(src->owner, mm); if (dst->owner == NULL) { return KNOT_ENOMEM; @@ -1105,7 +1105,7 @@ int knot_rrset_copy_int(knot_rrset_t *dst, const knot_rrset_t *src, mm_ctx_t *mm knot_dname_free(&dst->owner, mm); return ret; } - + return KNOT_EOK; } @@ -1129,4 +1129,3 @@ knot_rrset_t *knot_rrset_copy(const knot_rrset_t *src, mm_ctx_t *mm) rrset->additional = NULL; return rrset; } - diff --git a/src/libknot/tsig-op.c b/src/libknot/tsig-op.c index 7fc982a62c..0b54853824 100644 --- a/src/libknot/tsig-op.c +++ b/src/libknot/tsig-op.c @@ -711,7 +711,6 @@ static int knot_tsig_check_digest(const knot_rrset_t *tsig_rr, memset(wire_to_sign, 0, sizeof(uint8_t) * size); memcpy(wire_to_sign, wire, size); - uint8_t digest_tmp[KNOT_TSIG_MAX_DIGEST_SIZE]; size_t digest_tmp_len = 0; assert(knot_rrset_rr_count(tsig_rr) > 0); @@ -842,11 +841,9 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len, /* Set original ID */ tsig_rdata_set_orig_id(tmp_tsig, knot_wire_get_id(msg)); - /* Set other len. */ tsig_rdata_set_other_data(tmp_tsig, 0, 0); - /* Append TSIG RR. */ int ret = knot_tsig_append(msg, msg_len, msg_max_len, tsig_rr); diff --git a/src/libknot/tsig.c b/src/libknot/tsig.c index c527d23f94..c7c8ae7516 100644 --- a/src/libknot/tsig.c +++ b/src/libknot/tsig.c @@ -379,7 +379,6 @@ size_t tsig_rdata_tsig_timers_length() return KNOT_TSIG_TIMERS_LENGTH; } - int tsig_rdata_store_current_time(knot_rrset_t *tsig) { if (!tsig) { diff --git a/src/utils/dig/dig_exec.c b/src/utils/dig/dig_exec.c index c454818866..9113999bc4 100644 --- a/src/utils/dig/dig_exec.c +++ b/src/utils/dig/dig_exec.c @@ -509,7 +509,6 @@ static int process_packet_xfr(const knot_pkt_t *query, // Get stop query time and start reply time. gettimeofday(&t_query, NULL); - // Print query packet if required. if (style->show_query) { print_packet(query, net, diff --git a/src/utils/nsupdate/nsupdate_exec.c b/src/utils/nsupdate/nsupdate_exec.c index 44c8c0f531..c30583a36a 100644 --- a/src/utils/nsupdate/nsupdate_exec.c +++ b/src/utils/nsupdate/nsupdate_exec.c @@ -383,7 +383,6 @@ static int build_query(nsupdate_params_t *params) return rr_list_to_packet(query, ¶ms->update_list); } - static int pkt_sendrecv(nsupdate_params_t *params) { net_t net; @@ -524,7 +523,6 @@ int cmd_update(const char* lp, nsupdate_params_t *params) return h[bp](tok_skipspace(lp + TOK_L(cmd_array[bp])), params); } - int cmd_add(const char* lp, nsupdate_params_t *params) { DBG("%s: lp='%s'\n", __func__, lp); diff --git a/tests/pkt.c b/tests/pkt.c index 040403565e..df563b18a6 100644 --- a/tests/pkt.c +++ b/tests/pkt.c @@ -34,7 +34,7 @@ knot_rrset_t *copy; remove t_rrset_free(©, NULL) knot_rrset_copy(cname_rr, ©, NULL)e_rr = copy; - + "ns2.example.com" }; -- GitLab