summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorOto Šťáva <oto.stava@nic.cz>2024-05-14 12:05:01 +0200
committerOto Šťáva <oto.stava@nic.cz>2024-05-14 12:05:01 +0200
commit2905edac512ebe123fc445e8f20e3bc82ce6c9df (patch)
tree8538f086c902b1e975607a2ec49f4a11a246cb09 /modules
parentMerge branch 'knot_wire-6.0' into '6.0' (diff)
parent.gitlab-ci: remove SonarCloud Scanner (diff)
downloadknot-resolver-2905edac512ebe123fc445e8f20e3bc82ce6c9df.tar.xz
knot-resolver-2905edac512ebe123fc445e8f20e3bc82ce6c9df.zip
Merge 'origin/master' into 6.0 - last merge before rename
This is the last commit in `6.0` before it is shifted into `master`, with 5.x support being moved to `master-5`.
Diffstat (limited to 'modules')
-rw-r--r--modules/dnstap/dnstap.c1
-rw-r--r--modules/hints/meson.build2
-rw-r--r--modules/http/meson.build2
-rw-r--r--modules/stats/stats.c32
4 files changed, 19 insertions, 18 deletions
diff --git a/modules/dnstap/dnstap.c b/modules/dnstap/dnstap.c
index ab52bca3..6fcc192c 100644
--- a/modules/dnstap/dnstap.c
+++ b/modules/dnstap/dnstap.c
@@ -193,6 +193,7 @@ static int dnstap_log(kr_layer_t *ctx, enum dnstap_log_phase phase) {
m.socket_family = DNSTAP__SOCKET_FAMILY__INET6;
m.has_socket_family = true;
break;
+ default:;
}
}
diff --git a/modules/hints/meson.build b/modules/hints/meson.build
index d5046cb4..7e681f11 100644
--- a/modules/hints/meson.build
+++ b/modules/hints/meson.build
@@ -18,5 +18,5 @@ hints_mod = shared_module(
)
config_tests += [
- ['hints', files('tests/hints.test.lua'), ['skip_asan']],
+ ['hints', files('tests/hints.test.lua')],
]
diff --git a/modules/http/meson.build b/modules/http/meson.build
index 9d20c929..7d892159 100644
--- a/modules/http/meson.build
+++ b/modules/http/meson.build
@@ -21,7 +21,7 @@ lua_mod_src += [
config_tests += [
['http', files('http.test.lua')],
['http.doh', files('http_doh.test.lua')],
- ['http.tls', files('test_tls/tls.test.lua')],
+ ['http.tls', files('test_tls/tls.test.lua'), ['skip_asan']],
]
# install static files
diff --git a/modules/stats/stats.c b/modules/stats/stats.c
index a8a29de2..d0386738 100644
--- a/modules/stats/stats.c
+++ b/modules/stats/stats.c
@@ -125,7 +125,7 @@ static inline int collect_key(char *key, const knot_dname_t *name, uint16_t type
if (key_len < 0) {
return kr_error(key_len);
}
- return key_len + sizeof(type);
+ return key_len + (int)sizeof(type);
}
static void collect_sample(struct stat_data *data, struct kr_rplan *rplan)
@@ -323,26 +323,26 @@ static char* stats_get(void *env, struct kr_module *module, const char *args)
struct stat_data *data = module->data;
/* Expecting CHAR_BIT to be 8, this is a safe bet */
- char *ret = malloc(3 * sizeof(size_t) + 2);
- if (!ret) {
- return NULL;
- }
+ char *str_value = NULL;
+ int ret = 0;
/* Check if it exists in const map. */
for (unsigned i = 0; i < metric_const_end; ++i) {
if (strcmp(const_metrics[i].key, args) == 0) {
- sprintf(ret, "%zu", const_metrics[i].val);
- return ret;
+ ret = asprintf(&str_value, "%zu", const_metrics[i].val);
+ if (ret < 0)
+ return NULL;
+ return str_value;
}
}
/* Check in variable map */
trie_val_t *val = trie_get_try(data->trie, args, strlen(args));
- if (!val) {
- free(ret);
+ if (!val)
return NULL;
- }
- sprintf(ret, "%zu", (size_t) *val);
- return ret;
+ ret = asprintf(&str_value, "%zu", (size_t) *val);
+ if (ret < 0)
+ return NULL;
+ return str_value;
}
/** Checks whether:
@@ -366,7 +366,7 @@ static int list_entry(const char *key, uint32_t key_len, trie_val_t *val, void *
struct list_entry_context *ctx = baton;
if (!key_matches_prefix(key, key_len, ctx->key_prefix, ctx->key_prefix_len))
return 0;
- size_t number = (size_t) *val;
+ size_t number = (size_t)*val;
uint32_t dot_index = 0;
for (uint32_t i = 0; i < key_len; i++) {
@@ -387,10 +387,10 @@ static int list_entry(const char *key, uint32_t key_len, trie_val_t *val, void *
}
if (kr_fails_assert(sup))
return 0;
- json_append_member(sup, sub_key_nt, json_mknumber(number));
+ json_append_member(sup, sub_key_nt, json_mknumber((double)number));
} else {
auto_free char *key_nt = strndup(key, key_len);
- json_append_member(ctx->root, key_nt, json_mknumber(number));
+ json_append_member(ctx->root, key_nt, json_mknumber((double)number));
}
return 0;
}
@@ -415,7 +415,7 @@ static char* stats_list(void *env, struct kr_module *module, const char *args)
}
if (kr_fails_assert(sup))
break;
- json_append_member(sup, elm->sub_key, json_mknumber(elm->val));
+ json_append_member(sup, elm->sub_key, json_mknumber((double)elm->val));
}
}
struct list_entry_context ctx = {