diff --git a/src/lib/bio/network.c b/src/lib/bio/network.c index 706c10c109be7..018cec168a29e 100644 --- a/src/lib/bio/network.c +++ b/src/lib/bio/network.c @@ -181,7 +181,7 @@ fr_trie_t *fr_bio_network_trie_alloc(TALLOC_CTX *ctx, int af, fr_ipaddr_t const * Can't add v4 networks to a v6 socket, or vice versa. */ if (allow[i].af != af) { - fr_strerror_printf("Address family in entry %zd - 'allow = %pV' " + fr_strerror_printf("Address family in entry %zu - 'allow = %pV' " "does not match 'ipaddr'", i + 1, fr_box_ipaddr(allow[i])); fail: talloc_free(trie); @@ -239,7 +239,7 @@ fr_trie_t *fr_bio_network_trie_alloc(TALLOC_CTX *ctx, int af, fr_ipaddr_t const * Can't add v4 networks to a v6 socket, or vice versa. */ if (deny[i].af != af) { - fr_strerror_printf("Address family in entry %zd - 'deny = %pV' " + fr_strerror_printf("Address family in entry %zu - 'deny = %pV' " "does not match 'ipaddr'", i + 1, fr_box_ipaddr(deny[i])); goto fail; } @@ -258,7 +258,7 @@ fr_trie_t *fr_bio_network_trie_alloc(TALLOC_CTX *ctx, int af, fr_ipaddr_t const */ value = fr_trie_lookup_by_key(trie, &deny[i].addr, deny[i].prefix); if (!value) { - fr_strerror_printf("The network in entry %zd - 'deny = %pV' is not " + fr_strerror_printf("The network in entry %zu - 'deny = %pV' is not " "contained within a previous 'allow'", i + 1, fr_box_ipaddr(deny[i])); goto fail; } @@ -267,7 +267,7 @@ fr_trie_t *fr_bio_network_trie_alloc(TALLOC_CTX *ctx, int af, fr_ipaddr_t const * A "deny" cannot be within a previous "deny". */ if (value == FR_BIO_NETWORK_DENY) { - fr_strerror_printf("The network in entry %zd - 'deny = %pV' is overlaps " + fr_strerror_printf("The network in entry %zu - 'deny = %pV' is overlaps " "with another 'deny' rule", i + 1, fr_box_ipaddr(deny[i])); goto fail; } diff --git a/src/lib/eap/base.c b/src/lib/eap/base.c index cc5a4469cd531..b561ea4260a13 100644 --- a/src/lib/eap/base.c +++ b/src/lib/eap/base.c @@ -173,7 +173,7 @@ static bool eap_is_valid(TALLOC_CTX *ctx, eap_packet_raw_t **eap_packet_p) */ packet_len = talloc_array_length((uint8_t *) eap_packet); if (packet_len <= EAP_HEADER_LEN) { - fr_strerror_printf("Invalid EAP data length %zd <= 4", packet_len); + fr_strerror_printf("Invalid EAP data length %zu <= 4", packet_len); return false; } @@ -181,7 +181,7 @@ static bool eap_is_valid(TALLOC_CTX *ctx, eap_packet_raw_t **eap_packet_p) len = ntohs(len); if ((len <= EAP_HEADER_LEN) || (len > packet_len)) { - fr_strerror_printf("Invalid EAP length field. Expected value in range %u-%zu, was %u bytes", + fr_strerror_printf("Invalid EAP length field. Expected value in range %d-%zu, was %u bytes", EAP_HEADER_LEN, packet_len, len); return false; } diff --git a/src/lib/eap/compose.c b/src/lib/eap/compose.c index 032eff53ce83a..04277d15d11d1 100644 --- a/src/lib/eap/compose.c +++ b/src/lib/eap/compose.c @@ -270,14 +270,14 @@ rlm_rcode_t eap_compose(eap_session_t *eap_session) default: /* Should never enter here */ - REDEBUG("Reply code %d is unknown, rejecting the request", reply->code); + REDEBUG("Reply code %u is unknown, rejecting the request", reply->code); request->reply->code = FR_RADIUS_CODE_ACCESS_REJECT; reply->code = FR_EAP_CODE_FAILURE; rcode = RLM_MODULE_REJECT; break; } - RDEBUG2("Sending EAP %s (code %i) ID %d length %i", + RDEBUG2("Sending EAP %s (code %d) ID %d length %i", eap_codes[eap_packet->code], eap_packet->code, reply->id, eap_packet->length[0] * 256 + eap_packet->length[1]); diff --git a/src/lib/eap_aka_sim/crypto.c b/src/lib/eap_aka_sim/crypto.c index 946594c6041f5..da3473d3d32c8 100644 --- a/src/lib/eap_aka_sim/crypto.c +++ b/src/lib/eap_aka_sim/crypto.c @@ -231,7 +231,7 @@ static int fr_aka_sim_find_mac(uint8_t const **out, uint8_t *data, size_t data_l if (p[0] == FR_MAC) { len = p[1] << 2; if ((p + len) > end) { - fr_strerror_printf("Malformed AT_MAC: Length (%zu) exceeds buffer (%zu)", len, end - p); + fr_strerror_printf("Malformed AT_MAC: Length (%zu) exceeds buffer (%zu)", len, (size_t) (end - p)); return -1; } @@ -1243,11 +1243,11 @@ void fr_aka_sim_crypto_keys_log(request_t *request, fr_aka_sim_keys_t *keys) for (i = 0; i < keys->gsm.num_vectors; i++) { RHEXDUMP_INLINE3(keys->gsm.vector[i].rand, AKA_SIM_VECTOR_GSM_RAND_SIZE, - "[%i] RAND :", i); + "[%u] RAND :", i); RHEXDUMP_INLINE3(keys->gsm.vector[i].sres, AKA_SIM_VECTOR_GSM_SRES_SIZE, - "[%i] SRES :", i); + "[%u] SRES :", i); RHEXDUMP_INLINE3(keys->gsm.vector[i].kc, AKA_SIM_VECTOR_GSM_KC_SIZE, - "[%i] KC :", i); + "[%u] KC :", i); } } break; diff --git a/src/lib/eap_aka_sim/decode.c b/src/lib/eap_aka_sim/decode.c index 8cd77f9109a0a..c541101a204e4 100644 --- a/src/lib/eap_aka_sim/decode.c +++ b/src/lib/eap_aka_sim/decode.c @@ -419,7 +419,7 @@ static ssize_t sim_decode_tlv(TALLOC_CTX *ctx, fr_pair_list_t *out, if ((p + sim_at_len) > end) { fr_strerror_printf("%s: Malformed nested attribute %d: Length field (%zu bytes) value " "longer than remaining data in parent (%zu bytes)", - __FUNCTION__, sim_at, sim_at_len, end - p); + __FUNCTION__, sim_at, sim_at_len, (size_t) (end - p)); error: talloc_free(decr); @@ -597,13 +597,13 @@ static ssize_t sim_decode_pair_value(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_di res_len /= 8; if (res_len > (attr_len - 2)) { - fr_strerror_printf("%s: RES Length field value (%u bits) > attribute value length (%zu bits)", + fr_strerror_printf("%s: RES Length field value (%d bits) > attribute value length (%zu bits)", __FUNCTION__, res_len * 8, (attr_len - 2) * 8); return -1; } if ((res_len < 4) || (res_len > 16)) { - fr_strerror_printf("%s: RES Length field value must be between 32-128 bits, got %u bits", + fr_strerror_printf("%s: RES Length field value must be between 32-128 bits, got %d bits", __FUNCTION__, (res_len * 8)); return -1; } diff --git a/src/lib/eap_aka_sim/encode.c b/src/lib/eap_aka_sim/encode.c index 9bc8c82b8a7d1..55052ebf40fb0 100644 --- a/src/lib/eap_aka_sim/encode.c +++ b/src/lib/eap_aka_sim/encode.c @@ -823,7 +823,7 @@ ssize_t fr_aka_sim_encode_pair(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *en PAIR_VERIFY(vp); if (vp->da->depth > FR_DICT_MAX_TLV_STACK) { - fr_strerror_printf("%s: Attribute depth %i exceeds maximum nesting depth %i", + fr_strerror_printf("%s: Attribute depth %u exceeds maximum nesting depth %d", __FUNCTION__, vp->da->depth, FR_DICT_MAX_TLV_STACK); return PAIR_ENCODE_FATAL_ERROR; } diff --git a/src/lib/eap_aka_sim/id.c b/src/lib/eap_aka_sim/id.c index 6f3df6e1dd5ec..39cf930ffae63 100644 --- a/src/lib/eap_aka_sim/id.c +++ b/src/lib/eap_aka_sim/id.c @@ -531,8 +531,8 @@ int fr_aka_sim_id_3gpp_pseudonym_encrypt(char out[AKA_SIM_3GPP_PSEUDONYM_LEN + 1 u_p += 3; } if ((out_p - out) != AKA_SIM_3GPP_PSEUDONYM_LEN) { - fr_strerror_printf("Base64 output length invalid, expected %i bytes, got %zu bytes", - AKA_SIM_3GPP_PSEUDONYM_LEN, out_p - out); + fr_strerror_printf("Base64 output length invalid, expected %u bytes, got %zu bytes", + AKA_SIM_3GPP_PSEUDONYM_LEN, (size_t) (out_p - out)); return -1; } @@ -645,7 +645,7 @@ int fr_aka_sim_id_3gpp_pseudonym_decrypt(char out[AKA_SIM_IMSI_MAX_LEN + 1], * some sort of memory corruption has occurred. */ if (unlikely(decr_len > (AKA_SIM_IMSI_MAX_LEN + 1))) { - fr_strerror_printf("Decrypted data len invalid. Expected %i bytes, got %zu bytes", + fr_strerror_printf("Decrypted data len invalid. Expected %u bytes, got %zu bytes", (AKA_SIM_IMSI_MAX_LEN + 1), decr_len); goto error; } diff --git a/src/lib/eap_aka_sim/vector.c b/src/lib/eap_aka_sim/vector.c index 82b6ad2e04adc..889596d0f4c75 100644 --- a/src/lib/eap_aka_sim/vector.c +++ b/src/lib/eap_aka_sim/vector.c @@ -49,7 +49,7 @@ static int vector_opc_from_op(request_t *request, uint8_t const **out, uint8_t o opc_vp = fr_pair_find_by_da(list, NULL, attr_sim_opc); if (opc_vp) { if (opc_vp->vp_length != MILENAGE_OPC_SIZE) { - REDEBUG("&control.%s has incorrect length, expected %u bytes got %zu bytes", + REDEBUG("&control.%s has incorrect length, expected %d bytes got %zu bytes", attr_sim_opc->name, MILENAGE_OPC_SIZE, opc_vp->vp_length); return -1; } @@ -60,7 +60,7 @@ static int vector_opc_from_op(request_t *request, uint8_t const **out, uint8_t o op_vp = fr_pair_find_by_da(list, NULL, attr_sim_op); if (op_vp) { if (op_vp->vp_length != MILENAGE_OP_SIZE) { - REDEBUG("&control.%s has incorrect length, expected %u bytes got %zu bytes", + REDEBUG("&control.%s has incorrect length, expected %d bytes got %zu bytes", attr_sim_op->name, MILENAGE_OP_SIZE, op_vp->vp_length); return -1; } @@ -160,7 +160,7 @@ static int vector_gsm_from_ki(request_t *request, fr_pair_list_t *vps, int idx, break; default: - REDEBUG("Unknown/unsupported algorithm %i", version); + REDEBUG("Unknown/unsupported algorithm %u", version); return -1; } @@ -432,7 +432,7 @@ static int vector_umts_from_ki(request_t *request, fr_pair_list_t *vps, fr_aka_s return -1; default: - REDEBUG("Unknown/unsupported algorithm %i", version); + REDEBUG("Unknown/unsupported algorithm %u", version); return -1; } diff --git a/src/lib/eap_aka_sim/xlat.c b/src/lib/eap_aka_sim/xlat.c index 56777feca624b..e0acdf33236fc 100644 --- a/src/lib/eap_aka_sim/xlat.c +++ b/src/lib/eap_aka_sim/xlat.c @@ -167,7 +167,7 @@ static xlat_action_t aka_sim_id_3gpp_temporary_id_key_index_xlat(TALLOC_CTX *ctx fr_value_box_t *vb; if (id->vb_length != AKA_SIM_3GPP_PSEUDONYM_LEN) { - REDEBUG2("3gpp pseudonym incorrect length, expected %i bytes, got %zu bytes", + REDEBUG2("3gpp pseudonym incorrect length, expected %u bytes, got %zu bytes", AKA_SIM_3GPP_PSEUDONYM_LEN, id->vb_length); return XLAT_ACTION_FAIL; } @@ -250,7 +250,7 @@ static xlat_action_t aka_sim_3gpp_temporary_id_decrypt_xlat(TALLOC_CTX *ctx, fr_ if (tag_vb) include_tag = tag_vb->vb_bool; if (id_len != (AKA_SIM_3GPP_PSEUDONYM_LEN)) { - REDEBUG2("3gpp pseudonym incorrect length, expected %i bytes, got %zu bytes", + REDEBUG2("3gpp pseudonym incorrect length, expected %u bytes, got %zu bytes", AKA_SIM_3GPP_PSEUDONYM_LEN, id_len); error: return XLAT_ACTION_FAIL; @@ -471,7 +471,7 @@ static xlat_action_t aka_sim_3gpp_temporary_id_encrypt_xlat(TALLOC_CTX *ctx, fr_ id_p = id; id_end = id_p + id_len; } else { - REDEBUG2("IMSI incorrect length, expected %i bytes, got %zu bytes", AKA_SIM_IMSI_MAX_LEN + 1, + REDEBUG2("IMSI incorrect length, expected %u bytes, got %zu bytes", AKA_SIM_IMSI_MAX_LEN + 1, id_len); goto error; diff --git a/src/lib/server/cf_file.c b/src/lib/server/cf_file.c index 06385100d4ab0..83d5d694257b2 100644 --- a/src/lib/server/cf_file.c +++ b/src/lib/server/cf_file.c @@ -259,8 +259,8 @@ char const *cf_expand_variables(char const *cf, int lineno, if (buf.st_size >= ((output + outsize) - p)) { close(fd); - ERROR("%s[%d]: Reference \"${%s}\" file is too large (%zd >= %zd)", cf, lineno, name, - (size_t) buf.st_size, ((output + outsize) - p)); + ERROR("%s[%d]: Reference \"${%s}\" file is too large (%zu >= %zu)", cf, lineno, name, + (size_t) buf.st_size, (size_t) ((output + outsize) - p)); return NULL; } @@ -696,30 +696,30 @@ bool cf_file_check(CONF_PAIR *cp, bool check_perms) if ((conf_check_gid != (gid_t)-1) && ((egid = getegid()) != conf_check_gid)) { if (setegid(conf_check_gid) < 0) { - cf_log_perr(cp, "Failed setting effective group ID (%i) for file check: %s", - conf_check_gid, fr_syserror(errno)); + cf_log_perr(cp, "Failed setting effective group ID (%d) for file check: %s", + (int) conf_check_gid, fr_syserror(errno)); goto error; } } if ((conf_check_uid != (uid_t)-1) && ((euid = geteuid()) != conf_check_uid)) { if (seteuid(conf_check_uid) < 0) { - cf_log_perr(cp, "Failed setting effective user ID (%i) for file check: %s", - conf_check_uid, fr_syserror(errno)); + cf_log_perr(cp, "Failed setting effective user ID (%d) for file check: %s", + (int) conf_check_uid, fr_syserror(errno)); goto error; } } fd = open(filename, O_RDONLY); if (conf_check_uid != euid) { if (seteuid(euid) < 0) { - cf_log_perr(cp, "Failed restoring effective user ID (%i) after file check: %s", - euid, fr_syserror(errno)); + cf_log_perr(cp, "Failed restoring effective user ID (%d) after file check: %s", + (int) euid, fr_syserror(errno)); goto error; } } if (conf_check_gid != egid) { if (setegid(egid) < 0) { - cf_log_perr(cp, "Failed restoring effective group ID (%i) after file check: %s", - egid, fr_syserror(errno)); + cf_log_perr(cp, "Failed restoring effective group ID (%d) after file check: %s", + (int) egid, fr_syserror(errno)); goto error; } } diff --git a/src/lib/server/cf_parse.c b/src/lib/server/cf_parse.c index 8e9ddbb4351fa..4cf4591ae6476 100644 --- a/src/lib/server/cf_parse.c +++ b/src/lib/server/cf_parse.c @@ -370,7 +370,7 @@ static int cf_pair_unescape(CONF_PAIR *cp, conf_parser_t const *rule) p = cp->value; q = str; while (*p) { - int x; + unsigned int x; if (*p != '\\') { *(q++) = *(p++); diff --git a/src/lib/server/cf_parse.h b/src/lib/server/cf_parse.h index 2932901c29278..f1dbdd9bebbe3 100644 --- a/src/lib/server/cf_parse.h +++ b/src/lib/server/cf_parse.h @@ -479,7 +479,7 @@ do {\ #define FR_INTEGER_COND_CHECK(_name, _var, _cond, _new)\ do {\ if (!(_cond)) {\ - WARN("Ignoring \"" _name " = %i\", forcing to \"" _name " = %i\"", _var, _new);\ + WARN("Ignoring \"" _name " = %u\", forcing to \"" _name " = %u\"", (unsigned int) (_var), (unsigned int) (_new));\ _var = _new;\ }\ } while (0) diff --git a/src/lib/server/cf_util.c b/src/lib/server/cf_util.c index 1d33883caf1b7..18813dfcc1e0b 100644 --- a/src/lib/server/cf_util.c +++ b/src/lib/server/cf_util.c @@ -2286,7 +2286,7 @@ void _cf_item_debug(CONF_ITEM const *ci) DEBUG(" name1 : %s", cs->name1); DEBUG(" name2 : %s", cs->name2 ? cs->name2 : ""); DEBUG(" name2_quote : %s", fr_table_str_by_value(fr_token_quotes_table, cs->name2_quote, "")); - DEBUG(" argc : %u", cs->argc); + DEBUG(" argc : %d", cs->argc); for (i = 0; i < cs->argc; i++) { char const *quote = fr_table_str_by_value(fr_token_quotes_table, cs->argv_quote[i], ""); diff --git a/src/lib/server/connection.c b/src/lib/server/connection.c index c6ef11e01cf21..abcc99201cba3 100644 --- a/src/lib/server/connection.c +++ b/src/lib/server/connection.c @@ -1344,7 +1344,7 @@ static void _connection_error(UNUSED fr_event_list_t *el, int fd, UNUSED int fla { connection_t *conn = talloc_get_type_abort(uctx, connection_t); - ERROR("Connection failed for fd (%u): %s", fd, fr_syserror(fd_errno)); + ERROR("Connection failed for fd (%d): %s", fd, fr_syserror(fd_errno)); connection_state_enter_failed(conn); } @@ -1415,7 +1415,7 @@ int connection_signal_on_fd(connection_t *conn, int fd) _connection_writable, _connection_error, conn) < 0) { - PERROR("Failed inserting fd (%u) into event loop %p", + PERROR("Failed inserting fd (%d) into event loop %p", fd, conn->pub.el); connection_state_enter_failed(conn); return -1; diff --git a/src/lib/server/time_tracking.h b/src/lib/server/time_tracking.h index 2970c8df92ff3..720f54f7672c4 100644 --- a/src/lib/server/time_tracking.h +++ b/src/lib/server/time_tracking.h @@ -298,8 +298,8 @@ static inline void fr_time_tracking_end(fr_time_delta_t *predicted, */ static inline CC_HINT(nonnull) void fr_time_tracking_debug(fr_time_tracking_t *tt, FILE *fp) { -#define DPRINT_TIME(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_unwrap(tt->_x)) -#define DPRINT(_x) fprintf(fp, "\t" #_x " = %"PRIu64"\n", fr_time_delta_unwrap(tt->_x)) +#define DPRINT_TIME(_x) fprintf(fp, "\t" #_x " = %"PRId64"\n", fr_time_unwrap(tt->_x)) +#define DPRINT(_x) fprintf(fp, "\t" #_x " = %"PRId64"\n", fr_time_delta_unwrap(tt->_x)) DPRINT_TIME(started); DPRINT_TIME(ended); diff --git a/src/lib/tls/base.c b/src/lib/tls/base.c index ff6d0430d1ab7..12d70731244a7 100644 --- a/src/lib/tls/base.c +++ b/src/lib/tls/base.c @@ -239,7 +239,7 @@ static void *fr_openssl_talloc(size_t len, char const *file, NDEBUG_UNUSED int l chunk = talloc_array(ssl_talloc_ctx, uint8_t, len); #ifndef NDEBUG - talloc_set_name(chunk, "%s:%u", file, line); + talloc_set_name(chunk, "%s:%d", file, line); #endif return chunk; } @@ -256,7 +256,7 @@ static void *fr_openssl_talloc_realloc(void *old, size_t len, NDEBUG_UNUSED char chunk = talloc_realloc_size(ssl_talloc_ctx, old, len); #ifndef NDEBUG - talloc_set_name(chunk, "%s:%u", file, line); + talloc_set_name(chunk, "%s:%d", file, line); #endif return chunk; } diff --git a/src/lib/tls/ctx.c b/src/lib/tls/ctx.c index a18c2f3112e79..db40b1fe5ea00 100644 --- a/src/lib/tls/ctx.c +++ b/src/lib/tls/ctx.c @@ -951,7 +951,7 @@ SSL_CTX *fr_tls_ctx_alloc(fr_tls_conf_t const *conf, bool client) DEBUG3("Configured ciphers (by priority)"); while ((cipher = SSL_get_cipher_list(ssl, i))) { - DEBUG3("[%i] %s", i, cipher); + DEBUG3("[%u] %s", i, cipher); i++; /* Print index starting at zero */ } diff --git a/src/lib/tls/session.c b/src/lib/tls/session.c index 007452fbb92a5..3b652aeb566d4 100644 --- a/src/lib/tls/session.c +++ b/src/lib/tls/session.c @@ -519,7 +519,7 @@ void fr_tls_session_info_cb(SSL const *ssl, int where, int ret) } # endif } else { - ROPTIONAL(RDEBUG2, DEBUG2, "Handshake state - %s%s (%i)", role, state, SSL_get_state(ssl)); + ROPTIONAL(RDEBUG2, DEBUG2, "Handshake state - %s%s (%u)", role, state, SSL_get_state(ssl)); } return; } @@ -619,7 +619,8 @@ static void session_msg_log(request_t *request, fr_tls_session_t *tls_session, u if (((size_t)tls_session->info.version >= NUM_ELEMENTS(tls_version_str)) || !tls_version_str[tls_session->info.version]) { - snprintf(unknown_version, sizeof(unknown_version), "unknown_tls_version_0x%04x", tls_session->info.version); + snprintf(unknown_version, sizeof(unknown_version), "unknown_tls_version_0x%04x", + (unsigned int) tls_session->info.version); version = unknown_version; } else { version = tls_version_str[tls_session->info.version]; @@ -631,7 +632,7 @@ static void session_msg_log(request_t *request, fr_tls_session_t *tls_session, u if (((size_t)tls_session->info.content_type >= NUM_ELEMENTS(tls_content_type_str)) || !tls_content_type_str[tls_session->info.content_type]) { snprintf(unknown_content_type, sizeof(unknown_content_type), - "unknown_content_type_0x%04x", tls_session->info.content_type); + "unknown_content_type_0x%04x", (unsigned int) tls_session->info.content_type); content_type = unknown_content_type; } else { content_type = tls_content_type_str[tls_session->info.content_type]; @@ -954,7 +955,7 @@ int fr_tls_session_recv(request_t *request, fr_tls_session_t *tls_session) ret = BIO_write(tls_session->into_ssl, tls_session->dirty_in.data, tls_session->dirty_in.used); if (ret != (int) tls_session->dirty_in.used) { record_init(&tls_session->dirty_in); - REDEBUG("Failed writing %zd bytes to SSL BIO: %d", tls_session->dirty_in.used, ret); + REDEBUG("Failed writing %zu bytes to SSL BIO: %d", tls_session->dirty_in.used, ret); goto error; } @@ -1542,7 +1543,7 @@ static unlang_action_t tls_session_async_handshake(rlm_rcode_t *p_result, int *p if (tls_session->dirty_in.used) { ret = BIO_write(tls_session->into_ssl, tls_session->dirty_in.data, tls_session->dirty_in.used); if (ret != (int)tls_session->dirty_in.used) { - REDEBUG("Failed writing %zd bytes to TLS BIO: %d", tls_session->dirty_in.used, ret); + REDEBUG("Failed writing %zu bytes to TLS BIO: %d", tls_session->dirty_in.used, ret); record_init(&tls_session->dirty_in); goto error; } diff --git a/src/lib/tls/session.h b/src/lib/tls/session.h index 4b1802f45a969..8f2b43fb234da 100644 --- a/src/lib/tls/session.h +++ b/src/lib/tls/session.h @@ -195,7 +195,7 @@ static inline CC_HINT(nonnull) void _fr_tls_session_request_bind(char const *fil { int ret; - RDEBUG3("%s[%u] - Binding SSL * (%p) to request (%p)", file, line, ssl, request); + RDEBUG3("%s[%d] - Binding SSL * (%p) to request (%p)", file, line, ssl, request); #ifndef NDEBUG { @@ -231,7 +231,7 @@ static inline CC_HINT(nonnull) void _fr_tls_session_request_unbind(char const *f (void)talloc_get_type_abort(request, request_t); #endif - RDEBUG3("%s[%u] - Unbinding SSL * (%p) from request (%p)", file, line, ssl, request); + RDEBUG3("%s[%d] - Unbinding SSL * (%p) from request (%p)", file, line, ssl, request); ret = SSL_set_ex_data(ssl, FR_TLS_EX_INDEX_REQUEST, NULL); if (unlikely(ret == 0)) { fr_assert(0); diff --git a/src/lib/tls/utils.c b/src/lib/tls/utils.c index 2b3eebd4e0bbe..318d82650ef2e 100644 --- a/src/lib/tls/utils.c +++ b/src/lib/tls/utils.c @@ -122,7 +122,7 @@ int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1) if (asn1->type == V_ASN1_UTCTIME) {/* two digit year */ if ((end - p) < 2) { fr_strerror_printf("ASN1 date string too short, expected 2 additional bytes, got %zu bytes", - end - p); + (size_t) (end - p)); return -1; } @@ -132,7 +132,7 @@ int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1) } else if (asn1->type == V_ASN1_GENERALIZEDTIME) {/* four digit year */ if ((end - p) < 4) { fr_strerror_printf("ASN1 string too short, expected 4 additional bytes, got %zu bytes", - end - p); + (size_t) (end - p)); return -1; } @@ -145,7 +145,7 @@ int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1) if ((end - p) < 4) { fr_strerror_printf("ASN1 string too short, expected 10 additional bytes, got %zu bytes", - end - p); + (size_t) (end - p)); return -1; } diff --git a/src/lib/unlang/call.c b/src/lib/unlang/call.c index 68d0e4bdda18d..549a66db2f714 100644 --- a/src/lib/unlang/call.c +++ b/src/lib/unlang/call.c @@ -87,7 +87,7 @@ static unlang_action_t unlang_call_frame_init(rlm_rcode_t *p_result, request_t * packet_type_vp = fr_pair_find_by_da(&request->request_pairs, NULL, gext->attr_packet_type); if (!packet_type_vp) { bad_packet_type: - REDEBUG("No such value '%d' of attribute 'Packet-Type' for server %s", + REDEBUG("No such value '%u' of attribute 'Packet-Type' for server %s", request->packet->code, cf_section_name2(gext->server_cs)); error: *p_result = RLM_MODULE_FAIL; diff --git a/src/lib/unlang/call_env.c b/src/lib/unlang/call_env.c index 2805d6b685361..9d9047b9f706a 100644 --- a/src/lib/unlang/call_env.c +++ b/src/lib/unlang/call_env.c @@ -92,7 +92,7 @@ call_env_result_t call_env_result(TALLOC_CTX *ctx, request_t *request, void *out } if (call_env_single(env->rule->flags) && (fr_value_box_list_num_elements(tmpl_expanded) > 1)) { - RPEDEBUG("%d values found for %s. Only one is allowed", + RPEDEBUG("%u values found for %s. Only one is allowed", fr_value_box_list_num_elements(tmpl_expanded), env->rule->name); return CALL_ENV_INVALID; } diff --git a/src/lib/unlang/compile.c b/src/lib/unlang/compile.c index ac5f9abfae5c0..d65889d5a6266 100644 --- a/src/lib/unlang/compile.c +++ b/src/lib/unlang/compile.c @@ -4843,7 +4843,7 @@ static unlang_t *compile_item(unlang_t *parent, unlang_compile_t *unlang_ctx, CO if (!op->thread_inst_size) return c; if (!fr_rb_insert(unlang_instruction_tree, c)) { - cf_log_err(ci, "Instruction \"%s\" number %i has conflict with previous one.", + cf_log_err(ci, "Instruction \"%s\" number %u has conflict with previous one.", c->debug_name, c->number); talloc_free(c); return NULL; @@ -5285,7 +5285,7 @@ static void unlang_perf_dump(fr_log_t *log, unlang_t const *instruction, int dep t = &unlang_thread_array[instruction->number]; - fr_log(log, L_DBG, file, line, "count=%" PRIu64 " cpu_time=%" PRIu64 " yielded_time=%" PRIu64 , + fr_log(log, L_DBG, file, line, "count=%" PRIu64 " cpu_time=%" PRId64 " yielded_time=%" PRId64 , t->use_count, fr_time_delta_unwrap(t->tracking.running_total), fr_time_delta_unwrap(t->tracking.waiting_total)); if (g->children) { diff --git a/src/lib/unlang/interpret.c b/src/lib/unlang/interpret.c index 3817ea0179ccf..16749ca91a52e 100644 --- a/src/lib/unlang/interpret.c +++ b/src/lib/unlang/interpret.c @@ -420,7 +420,7 @@ unlang_frame_action_t result_calculate(request_t *request, unlang_stack_frame_t if (retry->count >= instruction->actions.retry.mrc) { retry->state = FR_RETRY_MRC; - REDEBUG("Retries hit max_rtx_count (%d) - returning 'fail'", instruction->actions.retry.mrc); + REDEBUG("Retries hit max_rtx_count (%u) - returning 'fail'", instruction->actions.retry.mrc); fail: *result = RLM_MODULE_FAIL; @@ -431,7 +431,7 @@ unlang_frame_action_t result_calculate(request_t *request, unlang_stack_frame_t RINDENT(); if (instruction->actions.retry.mrc) { - RDEBUG("... retrying (%d/%d)", retry->count, instruction->actions.retry.mrc); + RDEBUG("... retrying (%u/%u)", retry->count, instruction->actions.retry.mrc); } else { RDEBUG("... retrying"); } diff --git a/src/lib/unlang/interpret_synchronous.c b/src/lib/unlang/interpret_synchronous.c index 9df557399d848..74fb9811b4494 100644 --- a/src/lib/unlang/interpret_synchronous.c +++ b/src/lib/unlang/interpret_synchronous.c @@ -249,7 +249,7 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request break; } - DEBUG4("%u event(s) pending%s", + DEBUG4("%d event(s) pending%s", num_events == -1 ? 0 : num_events, num_events == -1 ? " - event loop exiting" : ""); /* @@ -275,7 +275,7 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request */ sub_request = fr_heap_pop(&intps->runnable); if (!sub_request) { - DEBUG4("No pending requests (%u yielded)", intps->yielded); + DEBUG4("No pending requests (%d yielded)", intps->yielded); continue; } @@ -295,7 +295,7 @@ rlm_rcode_t unlang_interpret_synchronous(fr_event_list_t *el, request_t *request */ if (sub_request == request) rcode = sub_rcode; - DEBUG3("%u runnable, %u yielded", fr_heap_num_elements(intps->runnable), intps->yielded); + DEBUG3("%u runnable, %d yielded", fr_heap_num_elements(intps->runnable), intps->yielded); } talloc_free(intps); diff --git a/src/lib/unlang/subrequest_child.c b/src/lib/unlang/subrequest_child.c index 92746932b6e2e..a571a2eff92bb 100644 --- a/src/lib/unlang/subrequest_child.c +++ b/src/lib/unlang/subrequest_child.c @@ -357,7 +357,7 @@ int unlang_subrequest_child_push(rlm_rcode_t *out, request_t *child, state->free_child = free_child; if (!fr_cond_assert_msg(stack_depth_current(child) == 0, - "Child stack depth must be 0 (not %u), when subrequest_child_push is called", + "Child stack depth must be 0 (not %d), when subrequest_child_push is called", stack_depth_current(child))) return -1; /* diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 89796b4ba8acb..2a0dea1259c2d 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -166,7 +166,7 @@ void xlat_debug_attr_vp(request_t *request, fr_pair_t *vp, tmpl_t const *vpt) } RIDEBUG3("attr : %u", vp->da->attr); vendor = fr_dict_vendor_by_da(vp->da); - if (vendor) RIDEBUG2("vendor : %i (%s)", vendor->pen, vendor->name); + if (vendor) RIDEBUG2("vendor : %u (%s)", vendor->pen, vendor->name); RIDEBUG3("type : %s", fr_type_to_str(vp->vp_type)); switch (vp->vp_type) { diff --git a/src/lib/unlang/xlat_expr.c b/src/lib/unlang/xlat_expr.c index 1b9cdfd06f415..59d3392d1cc82 100644 --- a/src/lib/unlang/xlat_expr.c +++ b/src/lib/unlang/xlat_expr.c @@ -319,14 +319,14 @@ static xlat_action_t xlat_binary_op(TALLOC_CTX *ctx, fr_dcursor_t *out, fr_assert(!fr_comparison_op[op]); if (fr_value_box_list_num_elements(&a->vb_group) > 1) { - REDEBUG("Expected one value as the first argument, got %d", + REDEBUG("Expected one value as the first argument, got %u", fr_value_box_list_num_elements(&a->vb_group)); return XLAT_ACTION_FAIL; } a = fr_value_box_list_head(&a->vb_group); if (fr_value_box_list_num_elements(&b->vb_group) > 1) { - REDEBUG("Expected one value as the second argument, got %d", + REDEBUG("Expected one value as the second argument, got %u", fr_value_box_list_num_elements(&b->vb_group)); return XLAT_ACTION_FAIL; } diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 879181c36203d..105bca7b2b76d 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -132,7 +132,7 @@ static inline int xlat_tokenize_regex(xlat_exp_head_t *head, fr_sbuff_t *in) (void) fr_sbuff_out(&err, &num, in); if (err != FR_SBUFF_PARSE_OK) { invalid_ref: - fr_strerror_printf("Invalid regex reference. Must be in range 0-%u", REQUEST_MAX_REGEX); + fr_strerror_printf("Invalid regex reference. Must be in range 0-%d", REQUEST_MAX_REGEX); fr_sbuff_marker_release(&m_s); return -1; } @@ -958,7 +958,7 @@ static void _xlat_debug_node(xlat_exp_t const *node, int depth) */ list = tmpl_request(node->vpt); while ((rr = tmpl_request_list_next(list, rr))) { - INFO_INDENT("ref %d", rr->request); + INFO_INDENT("ref %u", rr->request); } INFO_INDENT("list %s", tmpl_list_name(tmpl_list(node->vpt), "")); if (tmpl_attr_tail_num(node->vpt) != NUM_UNSPEC) { @@ -1472,7 +1472,8 @@ fr_slen_t xlat_tokenize_argv(TALLOC_CTX *ctx, xlat_exp_head_t **out, fr_sbuff_t if (!arg->variadic) { arg++; if (arg->type == FR_TYPE_NULL) { - fr_strerror_printf("Too many arguments, expected %zu, got %u", arg - arg_start, argc - 1); + fr_strerror_printf("Too many arguments, expected %zu, got %d", + (size_t) (arg - arg_start), argc - 1); goto error; } } diff --git a/src/lib/util/acutest_helpers.h b/src/lib/util/acutest_helpers.h index 4218ec7df6f77..4ab840c117279 100644 --- a/src/lib/util/acutest_helpers.h +++ b/src/lib/util/acutest_helpers.h @@ -31,24 +31,24 @@ extern "C" { do { \ size_t _our_got = (_got); \ TEST_CHECK_(_exp == _our_got, "%s", #_got); \ - TEST_MSG("Expected length : %zu", (size_t)_exp); \ - TEST_MSG("Got length : %zu", (size_t)_our_got); \ + TEST_MSG("Expected length : %zu", (size_t) (_exp)); \ + TEST_MSG("Got length : %zu", (size_t) (_our_got)); \ } while(0) #define TEST_CHECK_SLEN(_got, _exp) \ do { \ ssize_t _our_got = (_got); \ TEST_CHECK_(_exp == _our_got, "%s", #_got); \ - TEST_MSG("Expected length : %zd", (ssize_t)_exp); \ - TEST_MSG("Got length : %zd", (ssize_t)_our_got); \ + TEST_MSG("Expected length : %zd", (ssize_t) (_exp)); \ + TEST_MSG("Got length : %zd", (ssize_t) (_our_got)); \ } while(0) #define TEST_CHECK_SLEN_RETURN(_got, _exp) \ do { \ ssize_t _our_got = (_got); \ TEST_CHECK_(_exp == _our_got, "%s", #_got); \ - TEST_MSG("Expected length : %zd", (ssize_t)_exp); \ - TEST_MSG("Got length : %zd", (ssize_t)_our_got); \ + TEST_MSG("Expected length : %zd", (ssize_t) (_exp)); \ + TEST_MSG("Got length : %zd", (ssize_t) (_our_got)); \ if (_exp != _our_got) return; \ } while(0) @@ -56,8 +56,8 @@ do { \ do { \ int _our_got = (_got); \ TEST_CHECK_(_exp == _our_got, "%s", #_got); \ - TEST_MSG("Expected ret : %"PRId64, (int64_t)_exp); \ - TEST_MSG("Got ret : %"PRId64, (int64_t)_our_got); \ + TEST_MSG("Expected ret : %"PRId64, (int64_t) (_exp)); \ + TEST_MSG("Got ret : %"PRId64, (int64_t) (_our_got)); \ } while(0) #define TEST_CHECK_STRCMP(_got, _exp) \ diff --git a/src/lib/util/atexit.c b/src/lib/util/atexit.c index de66df56f3c26..725c94ff00ea2 100644 --- a/src/lib/util/atexit.c +++ b/src/lib/util/atexit.c @@ -82,7 +82,7 @@ static _Thread_local bool thread_is_exiting; */ static int _atexit_entry_free(fr_atexit_entry_t *e) { - ATEXIT_DEBUG("%s - Thread %u freeing %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u freeing %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), e->list, e, e->func, e->uctx, e->file, e->line); @@ -114,7 +114,7 @@ static fr_atexit_entry_t *atexit_entry_alloc(char const *file, int line, e->file = file; e->line = line; - ATEXIT_DEBUG("%s - Thread %u arming %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u arming %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), list, e, e->func, e->uctx, e->file, e->line); @@ -236,7 +236,7 @@ unsigned int fr_atexit_global_disarm(bool uctx_scope, fr_atexit_t func, void con if ((e->func != func) || ((e->uctx != uctx) && uctx_scope)) continue; - ATEXIT_DEBUG("%s - Disarming %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Disarming %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, fr_atexit_global, e, e->func, e->uctx, e->file, e->line); @@ -263,7 +263,7 @@ void fr_atexit_global_disarm_all(void) if (!fr_atexit_global) return; while ((e = fr_dlist_pop_head(&fr_atexit_global->head))) { - ATEXIT_DEBUG("%s - Disarming %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Disarming %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, fr_atexit_global, e, e->func, e->uctx, e->file, e->line); @@ -294,7 +294,7 @@ int fr_atexit_global_trigger_all(void) * destructors. */ while ((e = fr_dlist_next(&fr_atexit_global->head, e))) { - ATEXIT_DEBUG("%s - Triggering %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Triggering %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, fr_atexit_global, e, e->func, e->uctx, e->file, e->line); @@ -303,7 +303,7 @@ int fr_atexit_global_trigger_all(void) e = fr_dlist_remove(&fr_atexit_global->head, e); if (talloc_free(to_free) < 0) { fr_strerror_printf_push("atexit handler failed %p/%p func=%p, uctx=%p" - " (alloced %s:%u)", + " (alloced %s:%d)", fr_atexit_global, to_free, to_free->func, to_free->uctx, to_free->file, to_free->line); @@ -345,7 +345,7 @@ int fr_atexit_trigger(bool uctx_scope, fr_atexit_t func, void const *uctx) while ((e = fr_dlist_next(&fr_atexit_global->head, e))) { if ((e->func != func) || ((e->uctx != uctx) && uctx_scope)) continue; - ATEXIT_DEBUG("%s - Triggering %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Triggering %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, fr_atexit_global, e, e->func, e->uctx, e->file, e->line); @@ -354,7 +354,7 @@ int fr_atexit_trigger(bool uctx_scope, fr_atexit_t func, void const *uctx) e = fr_dlist_remove(&fr_atexit_global->head, e); if (talloc_free(to_free) < 0) { fr_strerror_printf_push("atexit handler failed %p/%p func=%p, uctx=%p" - " (alloced %s:%u)", + " (alloced %s:%d)", fr_atexit_global, to_free, to_free->func, to_free->uctx, to_free->file, to_free->line); @@ -380,7 +380,7 @@ int fr_atexit_trigger(bool uctx_scope, fr_atexit_t func, void const *uctx) while ((ee = fr_dlist_next(&list->head, ee))) { if ((ee->func != func) || ((ee->uctx != uctx) && uctx_scope)) continue; - ATEXIT_DEBUG("%s - Thread %u triggering %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u triggering %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), list, ee, ee->func, ee->uctx, ee->file, ee->line); @@ -390,7 +390,7 @@ int fr_atexit_trigger(bool uctx_scope, fr_atexit_t func, void const *uctx) ee = fr_dlist_remove(&list->head, ee); if (talloc_free(to_free) < 0) { fr_strerror_printf_push("atexit handler failed %p/%p func=%p, uctx=%p" - " (alloced %s:%u)", + " (alloced %s:%d)", list, to_free, to_free->func, to_free->uctx, to_free->file, to_free->line); @@ -548,7 +548,7 @@ unsigned int fr_atexit_thread_local_disarm(bool uctx_scope, fr_atexit_t func, vo if ((e->func != func) || ((e->uctx != uctx) && uctx_scope)) continue; - ATEXIT_DEBUG("%s - Thread %u disarming %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u disarming %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), fr_atexit_thread_local, e, e->func, e->uctx, e->file, e->line); @@ -575,7 +575,7 @@ void fr_atexit_thread_local_disarm_all(void) if (!fr_atexit_thread_local) return; while ((e = fr_dlist_pop_head(&fr_atexit_thread_local->head))) { - ATEXIT_DEBUG("%s - Thread %u disarming %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u disarming %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), fr_atexit_thread_local, e, e->func, e->uctx, e->file, e->line); @@ -614,7 +614,7 @@ int fr_atexit_thread_trigger_all(void) list = talloc_get_type_abort(e->uctx, fr_atexit_list_t); ee = NULL; while ((ee = fr_dlist_next(&list->head, ee))) { - ATEXIT_DEBUG("%s - Thread %u triggering %p/%p func=%p, uctx=%p (alloced %s:%u)", + ATEXIT_DEBUG("%s - Thread %u triggering %p/%p func=%p, uctx=%p (alloced %s:%d)", __FUNCTION__, (unsigned int)pthread_self(), list, ee, ee->func, ee->uctx, ee->file, ee->line); @@ -624,7 +624,7 @@ int fr_atexit_thread_trigger_all(void) ee = fr_dlist_remove(&list->head, ee); if (talloc_free(to_free) < 0) { fr_strerror_printf_push("atexit handler failed %p/%p func=%p, uctx=%p" - " (alloced %s:%u)", + " (alloced %s:%d)", list, to_free, to_free->func, to_free->uctx, to_free->file, to_free->line diff --git a/src/lib/util/debug.c b/src/lib/util/debug.c index 8179f79f37ddb..2bc8e68317ff1 100644 --- a/src/lib/util/debug.c +++ b/src/lib/util/debug.c @@ -1424,7 +1424,7 @@ void fr_fault_log_hex(uint8_t const *data, size_t data_len) for (p = buffer, j = 0; j < len; j++, p += 3) snprintf(p, end - p, "%02x ", data[i + j]); - dprintf(fr_fault_log_fd, "%04x: %s\n", (int)i, buffer); + dprintf(fr_fault_log_fd, "%04x: %s\n", (unsigned int) i, buffer); } } @@ -1457,19 +1457,19 @@ bool _fr_assert_fail(char const *file, int line, char const *expr, char const *m va_end(ap); #ifndef NDEBUG - FR_FAULT_LOG("ASSERT FAILED %s[%u]: %s: %s", file, line, expr, str); + FR_FAULT_LOG("ASSERT FAILED %s[%d]: %s: %s", file, line, expr, str); fr_fault(SIGABRT); #else - FR_FAULT_LOG("ASSERT WOULD FAIL %s[%u]: %s: %s", file, line, expr, str); + FR_FAULT_LOG("ASSERT WOULD FAIL %s[%d]: %s: %s", file, line, expr, str); return false; #endif } #ifndef NDEBUG - FR_FAULT_LOG("ASSERT FAILED %s[%u]: %s", file, line, expr); + FR_FAULT_LOG("ASSERT FAILED %s[%d]: %s", file, line, expr); fr_fault(SIGABRT); #else - FR_FAULT_LOG("ASSERT WOULD FAIL %s[%u]: %s", file, line, expr); + FR_FAULT_LOG("ASSERT WOULD FAIL %s[%d]: %s", file, line, expr); return false; #endif } @@ -1492,9 +1492,9 @@ void _fr_assert_fatal(char const *file, int line, char const *expr, char const * (void)vsnprintf(str, sizeof(str), msg, ap); va_end(ap); - FR_FAULT_LOG("FATAL ASSERT %s[%u]: %s: %s", file, line, expr, str); + FR_FAULT_LOG("FATAL ASSERT %s[%d]: %s: %s", file, line, expr, str); } else { - FR_FAULT_LOG("FATAL ASSERT %s[%u]: %s", file, line, expr); + FR_FAULT_LOG("FATAL ASSERT %s[%d]: %s", file, line, expr); } #ifdef NDEBUG @@ -1520,10 +1520,10 @@ NEVER_RETURNS void _fr_exit(char const *file, int line, int status, bool now) char const *error = fr_strerror(); if (error && *error && (status != 0)) { - FR_FAULT_LOG("%sEXIT(%i) CALLED %s[%u]. Last error was: %s", now ? "_" : "", + FR_FAULT_LOG("%sEXIT(%i) CALLED %s[%d]. Last error was: %s", now ? "_" : "", status, file, line, error); } else { - FR_FAULT_LOG("%sEXIT(%i) CALLED %s[%u]", now ? "_" : "", status, file, line); + FR_FAULT_LOG("%sEXIT(%i) CALLED %s[%d]", now ? "_" : "", status, file, line); } fr_debug_break(false); /* If running under GDB we'll break here */ diff --git a/src/lib/util/dict_fixup.c b/src/lib/util/dict_fixup.c index f970cd8366fb6..b96dfda1d29e5 100644 --- a/src/lib/util/dict_fixup.c +++ b/src/lib/util/dict_fixup.c @@ -358,7 +358,7 @@ static inline CC_HINT(always_inline) int dict_fixup_group_apply(UNUSED dict_fixu da = dict_protocol_reference(fixup->da->parent, fixup->ref, true); if (!da) { - fr_strerror_printf_push("Failed resolving reference for attribute at %s[%u]", + fr_strerror_printf_push("Failed resolving reference for attribute at %s[%d]", fr_cwd_strip(fixup->da->filename), fixup->da->line); return -1; } @@ -431,7 +431,7 @@ int dict_fixup_clone(fr_dict_attr_t **dst_p, fr_dict_attr_t const *src) fr_dict_attr_t *cloned; if (src->dict->proto != dst->dict->proto) { - fr_strerror_printf("Incompatible protocols. Referenced '%s', referencing '%s'. Defined at %s[%u]", + fr_strerror_printf("Incompatible protocols. Referenced '%s', referencing '%s'. Defined at %s[%d]", src->dict->proto->name, dst->dict->proto->name, dst->filename, dst->line); return -1; } @@ -580,7 +580,7 @@ static inline CC_HINT(always_inline) int dict_fixup_clone_apply(UNUSED dict_fixu src = dict_protocol_reference(fixup->da->parent, fixup->ref, true); if (!src) { - fr_strerror_printf_push("Failed resolving reference for attribute at %s[%u]", + fr_strerror_printf_push("Failed resolving reference for attribute at %s[%d]", fr_cwd_strip(fixup->da->filename), fixup->da->line); return -1; } @@ -638,13 +638,13 @@ static inline CC_HINT(always_inline) int dict_fixup_clone_enum_apply(UNUSED dict src = dict_protocol_reference(fixup->da->parent, fixup->ref, true); if (!src) { - fr_strerror_printf_push("Failed resolving reference for attribute at %s[%u]", + fr_strerror_printf_push("Failed resolving reference for attribute at %s[%d]", fr_cwd_strip(fixup->da->filename), fixup->da->line); return -1; } if (src->dict->proto != fixup->da->dict->proto) { - fr_strerror_printf("Incompatible protocols. Referenced '%s', referencing '%s'. Defined at %s[%u]", + fr_strerror_printf("Incompatible protocols. Referenced '%s', referencing '%s'. Defined at %s[%d]", src->dict->proto->name, fixup->da->dict->proto->name, fixup->da->filename, fixup->da->line); return -1; } @@ -797,7 +797,7 @@ static inline CC_HINT(always_inline) int dict_fixup_alias_apply(UNUSED dict_fixu */ da = fr_dict_attr_by_oid(NULL, fixup->ref_parent, fixup->ref); if (!da) { - fr_strerror_printf("Attribute '%s' aliased by '%s' doesn't exist in namespace '%s', at %s[%u]", + fr_strerror_printf("Attribute '%s' aliased by '%s' doesn't exist in namespace '%s', at %s[%d]", fixup->ref, fixup->alias, fixup->ref_parent->name, fixup->filename, fixup->line); return -1; } diff --git a/src/lib/util/dict_print.c b/src/lib/util/dict_print.c index 585cabd7744f9..cae96f2bdad6d 100644 --- a/src/lib/util/dict_print.c +++ b/src/lib/util/dict_print.c @@ -195,7 +195,7 @@ static int dict_attr_debug(fr_dict_attr_t const *da, void *uctx) our_uctx->dict, da->type, &da->flags); snprintf(our_uctx->prefix, sizeof(our_uctx->prefix), - "[%02i] 0x%016" PRIxPTR "%*s", + "[%02u] 0x%016" PRIxPTR "%*s", da->depth, (unsigned long)da, (da->depth - our_uctx->start_depth) * 4, ""); diff --git a/src/lib/util/dict_tokenize.c b/src/lib/util/dict_tokenize.c index 501073af6f921..af82091559958 100644 --- a/src/lib/util/dict_tokenize.c +++ b/src/lib/util/dict_tokenize.c @@ -64,14 +64,14 @@ typedef enum CC_HINT(flag_enum) { } dict_nest_t; DIAG_ON(attributes) -fr_table_num_sorted_t const dict_nest_table[] = { +static fr_table_num_sorted_t const dict_nest_table[] = { { L("ATTRIBUTE"), NEST_ATTRIBUTE }, { L("NONE"), NEST_NONE }, { L("PROTOCOL"), NEST_PROTOCOL }, { L("ROOT"), NEST_ROOT }, { L("VENDOR"), NEST_VENDOR } }; -size_t const dict_nest_table_len = NUM_ELEMENTS(dict_nest_table); +static size_t const dict_nest_table_len = NUM_ELEMENTS(dict_nest_table); /** Parser context for dict_from_file * @@ -116,7 +116,7 @@ void dict_dctx_debug(dict_tokenize_ctx_t *dctx) int i; for (i = 0; i <= dctx->stack_depth; i++) { - FR_FAULT_LOG("[%d]: %s %s (%s): %s[%u]", + FR_FAULT_LOG("[%d]: %s %s (%s): %s[%d]", i, fr_table_str_by_value(dict_nest_table, dctx->stack[i].nest, ""), dctx->stack[i].da->name, @@ -911,12 +911,12 @@ static int dict_attr_allow_dup(fr_dict_attr_t const *da) } if (dup_name) { - fr_strerror_printf("Duplicate attribute name '%s' in namespace '%s'. Originally defined %s[%u]", + fr_strerror_printf("Duplicate attribute name '%s' in namespace '%s'. Originally defined %s[%d]", da->name, da->parent->name, dup_name->filename, dup_name->line); return 0; } - fr_strerror_printf("Duplicate attribute number %u in parent '%s'. Originally defined %s[%u]", + fr_strerror_printf("Duplicate attribute number %u in parent '%s'. Originally defined %s[%d]", da->attr, da->parent->name, dup_num->filename, dup_num->line); return 0; } @@ -1372,8 +1372,8 @@ static int dict_read_process_begin(dict_tokenize_ctx_t *dctx, char **argv, int a frame = dict_dctx_find_frame(dctx, NEST_ROOT | NEST_PROTOCOL | NEST_ATTRIBUTE); if (!fr_cond_assert_msg(frame, "Context stack doesn't have an attribute or dictionary " - "root to begin searching from %s[%u]", CURRENT_FILENAME(dctx), CURRENT_LINE(dctx)) || - !fr_cond_assert_msg(fr_type_is_structural(frame->da->type), "Context attribute is not structural %s[%u]", + "root to begin searching from %s[%d]", CURRENT_FILENAME(dctx), CURRENT_LINE(dctx)) || + !fr_cond_assert_msg(fr_type_is_structural(frame->da->type), "Context attribute is not structural %s[%d]", CURRENT_FILENAME(dctx), CURRENT_LINE(dctx))) { return -1; } @@ -2646,7 +2646,7 @@ static int dict_read_process_protocol(dict_tokenize_ctx_t *dctx, char **argv, in */ if (dict) { if (type_size && (dict->root->flags.type_size != type_size)) { - fr_strerror_printf("Conflicting flags for PROTOCOL \"%s\" (current %d versus new %d)", + fr_strerror_printf("Conflicting flags for PROTOCOL \"%s\" (current %d versus new %u)", dict->root->name, dict->root->flags.type_size, type_size); return -1; } diff --git a/src/lib/util/dict_util.c b/src/lib/util/dict_util.c index 757c6a33c1b09..bedbe7c2db07b 100644 --- a/src/lib/util/dict_util.c +++ b/src/lib/util/dict_util.c @@ -1257,7 +1257,7 @@ int dict_protocol_add(fr_dict_t *dict) dict->in_protocol_by_name = true; if (!fr_hash_table_insert(dict_gctx->protocol_by_num, dict)) { - fr_strerror_printf("%s: Duplicate protocol number %i", __FUNCTION__, dict->root->attr); + fr_strerror_printf("%s: Duplicate protocol number %u", __FUNCTION__, dict->root->attr); return -1; } dict->in_protocol_by_num = true; @@ -1560,7 +1560,7 @@ int dict_attr_add_to_namespace(fr_dict_attr_t const *parent, fr_dict_attr_t *da) if (a && (strcasecmp(a->name, da->name) == 0)) { if ((a->attr != da->attr) || (a->type != da->type) || (a->parent != da->parent)) { fr_strerror_printf("Duplicate attribute name '%s' in namespace '%s'. " - "Originally defined %s[%u]", + "Originally defined %s[%d]", da->name, parent->name, a->filename, a->line); goto error; @@ -1619,7 +1619,7 @@ int fr_dict_attr_add_initialised(fr_dict_attr_t *da) exists = fr_dict_attr_by_name(NULL, da->parent, da->name); if (exists) { fr_strerror_printf("Duplicate attribute name '%s' in namespace '%s'. " - "Originally defined %s[%u]", da->name, da->parent->name, + "Originally defined %s[%d]", da->name, da->parent->name, exists->filename, exists->line); return -1; } @@ -1658,7 +1658,7 @@ int fr_dict_attr_add_initialised(fr_dict_attr_t *da) exists = fr_dict_attr_child_by_num(da->parent, da->attr); if (exists) { fr_strerror_printf("Duplicate attribute number %u. " - "Originally defined by '%s' at %s[%u]", + "Originally defined by '%s' at %s[%d]", da->attr, exists->name, exists->filename, exists->line); return -1; } @@ -2154,7 +2154,7 @@ ssize_t fr_dict_attr_by_oid_legacy(fr_dict_t const *dict, fr_dict_attr_t const * default: if (dict_attr_can_have_children(*parent)) break; - fr_strerror_printf("Attribute %s (%i) is not a TLV, so cannot contain a child attribute. " + fr_strerror_printf("Attribute %s (%u) is not a TLV, so cannot contain a child attribute. " "Error at sub OID \"%s\"", (*parent)->name, (*parent)->attr, oid); return 0; /* We parsed nothing */ } @@ -2182,7 +2182,7 @@ ssize_t fr_dict_attr_by_oid_legacy(fr_dict_t const *dict, fr_dict_attr_t const * child = dict_attr_child_by_num(*parent, num); if (!child) { - fr_strerror_printf("Unknown attribute '%i' in OID string \"%s\" for parent %s", + fr_strerror_printf("Unknown attribute '%u' in OID string \"%s\" for parent %s", num, oid, (*parent)->name); return 0; /* We parsed nothing */ } @@ -2709,7 +2709,7 @@ fr_dict_attr_t const *fr_dict_vendor_da_by_num(fr_dict_attr_t const *vendor_root vendor = dict_attr_child_by_num(vendor_root, vendor_pen); if (!vendor) { - fr_strerror_printf("Vendor %i not defined", vendor_pen); + fr_strerror_printf("Vendor %u not defined", vendor_pen); return NULL; } @@ -3753,7 +3753,7 @@ static void dependent_debug(fr_dict_t *dict) for (dep = fr_rb_iter_init_inorder(&iter, dict->dependents); dep; dep = fr_rb_iter_next_inorder(&iter)) { - fprintf(stderr, "\t<- %s (%u)\n", dep->dependent, dep->count); + fprintf(stderr, "\t<- %s (%d)\n", dep->dependent, dep->count); } } #endif @@ -3836,7 +3836,7 @@ static int _dict_free(fr_dict_t *dict) for (dep = fr_rb_iter_init_inorder(&iter, dict->dependents); dep; dep = fr_rb_iter_next_inorder(&iter)) { - fr_strerror_printf_push("%s (%u)", dep->dependent, dep->count); + fr_strerror_printf_push("%s (%d)", dep->dependent, dep->count); } return -1; @@ -4548,7 +4548,7 @@ void fr_dict_global_ctx_debug(fr_dict_gctx_t const *gctx) for (dep = fr_rb_iter_init_inorder(&dep_iter, dict->dependents); dep; dep = fr_rb_iter_next_inorder(&dep_iter)) { - FR_FAULT_LOG("\t%s is referenced from %s count (%u)", dict->root->name, dep->dependent, dep->count); + FR_FAULT_LOG("\t%s is referenced from %s count (%d)", dict->root->name, dep->dependent, dep->count); } } @@ -4556,7 +4556,7 @@ void fr_dict_global_ctx_debug(fr_dict_gctx_t const *gctx) for (dep = fr_rb_iter_init_inorder(&dep_iter, gctx->internal->dependents); dep; dep = fr_rb_iter_next_inorder(&dep_iter)) { - FR_FAULT_LOG("\t%s is referenced from %s count (%u)", gctx->internal->root->name, dep->dependent, dep->count); + FR_FAULT_LOG("\t%s is referenced from %s count (%d)", gctx->internal->root->name, dep->dependent, dep->count); } } } @@ -4785,19 +4785,19 @@ void fr_dict_attr_verify(char const *file, int line, fr_dict_attr_t const *da) int i; fr_dict_attr_t const *da_p; - if (!da) fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t pointer was NULL", file, line); + if (!da) fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t pointer was NULL", file, line); (void) talloc_get_type_abort_const(da, fr_dict_attr_t); if ((!da->flags.is_root) && (da->depth == 0)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t %s vendor: %i, attr %i: " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t %s vendor: %u, attr %u: " "Is not root, but depth is 0", file, line, da->name, fr_dict_vendor_num_by_da(da), da->attr); } if (da->depth > FR_DICT_MAX_TLV_STACK) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t %s vendor: %i, attr %i: " - "Indicated depth (%u) greater than TLV stack depth (%u)", + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t %s vendor: %u, attr %u: " + "Indicated depth (%u) greater than TLV stack depth (%d)", file, line, da->name, fr_dict_vendor_num_by_da(da), da->attr, da->depth, FR_DICT_MAX_TLV_STACK); } @@ -4808,12 +4808,12 @@ void fr_dict_attr_verify(char const *file, int line, fr_dict_attr_t const *da) for (i = da->depth, da_p = da; (i >= 0) && da; i--, da_p = da_p->parent) { if (!da_p) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t %s vendor: %i, attr %i: " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t %s vendor: %u, attr %u: " "Depth indicated there should be a parent, but parent is NULL", file, line, da->name, fr_dict_vendor_num_by_da(da), da->attr); } if (i != (int)da_p->depth) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t %s vendor: %i, attr %i: " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t %s vendor: %u, attr %u: " "Depth out of sequence, expected %i, got %u", file, line, da->name, fr_dict_vendor_num_by_da(da), da->attr, i, da_p->depth); } @@ -4821,12 +4821,12 @@ void fr_dict_attr_verify(char const *file, int line, fr_dict_attr_t const *da) } if ((i + 1) < 0) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_dict_attr_t top of hierarchy was not at depth 0", + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_dict_attr_t top of hierarchy was not at depth 0", file, line); } if (da->parent && (da->parent->type == FR_TYPE_VENDOR) && !fr_dict_attr_has_ext(da, FR_DICT_ATTR_EXT_VENDOR)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: VSA missing 'vendor' extension", file, line); + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: VSA missing 'vendor' extension", file, line); } switch (da->type) { @@ -4837,12 +4837,12 @@ void fr_dict_attr_verify(char const *file, int line, fr_dict_attr_t const *da) if (da->type == FR_TYPE_GROUP) break; fr_assert_msg(fr_dict_attr_has_ext(da, FR_DICT_ATTR_EXT_CHILDREN), - "CONSISTENCY CHECK FAILED %s[%u]: %s missing 'children' extension", + "CONSISTENCY CHECK FAILED %s[%d]: %s missing 'children' extension", file, line, fr_type_to_str(da->type)); fr_assert_msg(fr_dict_attr_has_ext(da, FR_DICT_ATTR_EXT_NAMESPACE), - "CONSISTENCY CHECK FAILED %s[%u]: %s missing 'namespace' extension", + "CONSISTENCY CHECK FAILED %s[%d]: %s missing 'namespace' extension", file, line, fr_type_to_str(da->type)); diff --git a/src/lib/util/dict_validate.c b/src/lib/util/dict_validate.c index 8e84b99e5d523..38643c6f0d156 100644 --- a/src/lib/util/dict_validate.c +++ b/src/lib/util/dict_validate.c @@ -67,7 +67,7 @@ bool dict_attr_flags_valid(fr_dict_attr_t *da) #define FORBID_OTHER_FLAGS(_flag, _allowed) \ do { \ if (all_flags & ~shift_ ## _flag & ~(_allowed)) { \ - fr_strerror_printf("The '" STRINGIFY(_flag) "' flag cannot be used with any other flag (%u) %s[%u]", all_flags, da->filename, da->line); \ + fr_strerror_printf("The '" STRINGIFY(_flag) "' flag cannot be used with any other flag (%u) %s[%d]", all_flags, da->filename, da->line); \ return false; \ } \ } while (0) diff --git a/src/lib/util/dns.c b/src/lib/util/dns.c index c5acb20d5c786..8138fc337defc 100644 --- a/src/lib/util/dns.c +++ b/src/lib/util/dns.c @@ -852,7 +852,7 @@ ssize_t fr_dns_label_from_value_box(size_t *need, uint8_t *buf, size_t buf_len, } else if (buf != where) { if (dns_label_compress(buf, buf, where, NULL, where, &data)) { FR_PROTO_TRACE("Compressed single label %s to %zu bytes", - value->vb_strvalue, data - where); + value->vb_strvalue, (size_t) (data - where)); } else { FR_PROTO_TRACE("Did not compress single label"); } @@ -991,7 +991,7 @@ ssize_t fr_dns_label_uncompressed_length(uint8_t const *packet, uint8_t const *b */ if (offset >= (p - packet)) { fr_strerror_printf("Pointer %04x at offset %04x is an invalid forward reference", - offset, (int) (p - packet)); + offset, (unsigned int) (p - packet)); return -(p - packet); } @@ -1010,7 +1010,7 @@ ssize_t fr_dns_label_uncompressed_length(uint8_t const *packet, uint8_t const *b */ if (q >= current) { fr_strerror_printf("Pointer %04x at offset %04x creates a loop within a label", - offset, (int) (p - packet)); + offset, (unsigned int) (p - packet)); return -(p - packet); } @@ -1020,7 +1020,7 @@ ssize_t fr_dns_label_uncompressed_length(uint8_t const *packet, uint8_t const *b */ if (!dns_pointer_valid(lb, offset)) { fr_strerror_printf("Pointer %04x at offset %04x does not point to a DNS label", - offset, (int) (p - packet)); + offset, (unsigned int) (p - packet)); return -(p - packet); } @@ -1031,7 +1031,7 @@ ssize_t fr_dns_label_uncompressed_length(uint8_t const *packet, uint8_t const *b */ if (*q > 63) { fr_strerror_printf("Pointer %04x at offset %04x does not point to the start of a label", - offset, (int) (p - packet)); + offset, (unsigned int) (p - packet)); return -(p - packet); } @@ -1040,7 +1040,7 @@ ssize_t fr_dns_label_uncompressed_length(uint8_t const *packet, uint8_t const *b */ if (!*q) { fr_strerror_printf("Pointer %04x at offset %04x refers to an invalid field", offset, - (int) (p - packet)); + (unsigned int) (p - packet)); return -(p - packet); } diff --git a/src/lib/util/event.c b/src/lib/util/event.c index 465a09a359172..779ba8798cbd2 100644 --- a/src/lib/util/event.c +++ b/src/lib/util/event.c @@ -534,7 +534,7 @@ static inline CC_HINT(always_inline) fr_event_fd_cb_t event_fd_func(fr_event_fd_ switch (map->idx_type) { default: - fr_assert_fail("Invalid index type %i", map->idx_type); + fr_assert_fail("Invalid index type %u", map->idx_type); return NULL; case FR_EVENT_FUNC_IDX_FILTER: @@ -1152,7 +1152,7 @@ int _fr_event_filter_insert(NDEBUG_LOCATION_ARGS */ if ((filter > (NUM_ELEMENTS(filter_maps) - 1))) { not_supported: - fr_strerror_printf("Filter %i not supported", filter); + fr_strerror_printf("Filter %u not supported", filter); goto free; } ef->map = &filter_maps[filter]; @@ -1263,7 +1263,7 @@ int fr_event_fd_delete(fr_event_list_t *el, int fd, fr_event_filter_t filter) ef = fr_rb_find(el->fds, &(fr_event_fd_t){ .fd = fd, .filter = filter }); if (unlikely(!ef)) { - fr_strerror_printf("No events are registered for fd %i, filter %d", fd, filter); + fr_strerror_printf("No events are registered for fd %d, filter %u", fd, filter); return -1; } @@ -1418,7 +1418,7 @@ static int _event_timer_free(fr_event_timer_t *ev) * Events MUST be in the lst (or the insertion list). */ if (!fr_cond_assert_msg(ret == 0, - "Event %p, lst_id %i, allocd %s[%u], was not found in the event lst or " + "Event %p, lst_id %u, allocd %s[%d], was not found in the event lst or " "insertion list when freed: %s", ev, ev->lst_id, err_file, err_line, fr_strerror())) return -1; } @@ -1538,7 +1538,7 @@ int _fr_event_timer_at(NDEBUG_LOCATION_ARGS * Events MUST be in the lst (or the insertion list). */ if (!fr_cond_assert_msg(ret == 0, - "Event %p, lst_id %i, allocd %s[%u], was not found in the event " + "Event %p, lst_id %u, allocd %s[%d], was not found in the event " "lst or insertion list when freed: %s", ev, ev->lst_id, err_file, err_line, fr_strerror())) return -1; } @@ -1836,7 +1836,7 @@ int _fr_event_pid_wait(NDEBUG_LOCATION_ARGS case CLD_EXITED: case CLD_KILLED: case CLD_DUMPED: - EVENT_DEBUG("%p - PID %ld early exit - code %s (%i), status %i", + EVENT_DEBUG("%p - PID %ld early exit - code %s (%d), status %d", el, (long)pid, fr_table_str_by_value(si_codes, info.si_code, ""), info.si_code, info.si_status); @@ -1871,7 +1871,7 @@ int _fr_event_pid_wait(NDEBUG_LOCATION_ARGS break; default: - fr_strerror_printf("Unexpected code %s (%u) whilst waiting on PID %ld", + fr_strerror_printf("Unexpected code %s (%d) whilst waiting on PID %ld", fr_table_str_by_value(si_codes, info.si_code, ""), info.si_code, (long) pid); @@ -3102,7 +3102,7 @@ void fr_event_report(fr_event_list_t *el, fr_time_t now, void *uctx) node = fr_rb_iter_next_inorder(&event_iter)) { fr_event_counter_t *counter = talloc_get_type_abort(node, fr_event_counter_t); - EVENT_DEBUG(" : %u allocd at %s[%u]", + EVENT_DEBUG(" : %u allocd at %s[%d]", counter->count, counter->file, counter->line); } } @@ -3127,7 +3127,7 @@ void fr_event_timer_dump(fr_event_list_t *el) ev; ev = fr_lst_iter_next(el->times, &iter)) { (void)talloc_get_type_abort(ev, fr_event_timer_t); - EVENT_DEBUG("%s[%u]: %p time=%" PRId64 " (%c), callback=%p", + EVENT_DEBUG("%s[%d]: %p time=%" PRId64 " (%c), callback=%p", ev->file, ev->line, ev, fr_time_unwrap(ev->when), fr_time_gt(now, ev->when) ? '<' : '>', ev->callback); } diff --git a/src/lib/util/heap.c b/src/lib/util/heap.c index 2e4c500dc484a..3dd1951fea6f1 100644 --- a/src/lib/util/heap.c +++ b/src/lib/util/heap.c @@ -255,12 +255,12 @@ int fr_heap_extract(fr_heap_t **hp, void *data) * Out of bounds. */ if (unlikely((parent == 0) || (parent > h->num_elements))) { - fr_strerror_printf("Heap parent (%i) out of bounds (0-%i)", parent, h->num_elements); + fr_strerror_printf("Heap parent (%u) out of bounds (0-%u)", parent, h->num_elements); return -1; } if (unlikely(data != h->p[parent])) { - fr_strerror_printf("Invalid heap index. Expected data %p at offset %i, got %p", data, + fr_strerror_printf("Invalid heap index. Expected data %p at offset %u, got %p", data, parent, h->p[parent]); return -1; } diff --git a/src/lib/util/heap_tests.c b/src/lib/util/heap_tests.c index 04e4f1313b962..c006faf8fd3f5 100644 --- a/src/lib/util/heap_tests.c +++ b/src/lib/util/heap_tests.c @@ -80,7 +80,7 @@ static void heap_test(int skip) TEST_CASE("deletions"); { - unsigned int entry; + int entry; for (i = 0; i < HEAP_TEST_SIZE / skip; i++) { entry = i * skip; diff --git a/src/lib/util/inet.c b/src/lib/util/inet.c index 82f1b87746856..3c5b3e95dd088 100644 --- a/src/lib/util/inet.c +++ b/src/lib/util/inet.c @@ -911,7 +911,7 @@ int fr_inet_pton(fr_ipaddr_t *out, char const *value, ssize_t inlen, int af, boo /* * No idea what it is... */ - fr_strerror_printf("Invalid address family %i", af); + fr_strerror_printf("Invalid address family %d", af); return -1; } @@ -1371,7 +1371,7 @@ int8_t fr_ipaddr_cmp(fr_ipaddr_t const *a, fr_ipaddr_t const *b) #endif default: - fr_strerror_printf("Invalid address family %u", a->af); + fr_strerror_printf("Invalid address family %d", a->af); return -2; } } diff --git a/src/lib/util/log.c b/src/lib/util/log.c index 61a8fbf7226af..7cd26d1de5d5e 100644 --- a/src/lib/util/log.c +++ b/src/lib/util/log.c @@ -806,9 +806,9 @@ void fr_log_hex(fr_log_t const *log, fr_log_type_t type, char const *file, int l if (line_prefix_fmt) { fr_log(log, type, file, line, "%s%04x: %s", - line_prefix, (int)i, buffer); + line_prefix, (unsigned int) i, buffer); } else { - fr_log(log, type, file, line, "%04x: %s", (int)i, buffer); + fr_log(log, type, file, line, "%04x: %s", (unsigned int) i, buffer); } } @@ -859,9 +859,9 @@ void fr_log_hex_marker(fr_log_t const *log, fr_log_type_t type, char const *file if (line_prefix_fmt) { fr_log(log, type, file, line, "%s%04x: %s", - line_prefix, (int)i, buffer); + line_prefix, (unsigned int) i, buffer); } else { - fr_log(log, type, file, line, "%04x: %s", (int)i, buffer); + fr_log(log, type, file, line, "%04x: %s", (unsigned int) i, buffer); } /* @@ -1210,7 +1210,7 @@ int fr_log_close(fr_log_t *log) break; } - fr_strerror_printf("Failed closing invalid log dst %i", log->dst); + fr_strerror_printf("Failed closing invalid log dst %u", log->dst); return -1; } diff --git a/src/lib/util/lst_tests.c b/src/lib/util/lst_tests.c index d4cae4273c6e3..b914fb756c814 100644 --- a/src/lib/util/lst_tests.c +++ b/src/lib/util/lst_tests.c @@ -93,9 +93,9 @@ static void lst_test_basic(void) static void lst_test(int skip) { fr_lst_t *lst; - unsigned int i; + int i; lst_thing *values; - unsigned int left; + int left; int ret; lst = fr_lst_alloc(NULL, lst_cmp, lst_thing, idx, 0); @@ -193,7 +193,7 @@ static void lst_stress_realloc(void) /* Add the first INITIAL_CAPACITY values to lst and to hp */ TEST_CASE("partial fill"); - for (unsigned int i = 0; i < INITIAL_CAPACITY; i++) { + for (int i = 0; i < INITIAL_CAPACITY; i++) { TEST_CHECK((ret = fr_lst_insert(lst, &lst_array[i])) >= 0); TEST_MSG("lst insert failed, iteration %d; returned %i - %s", i, ret, fr_strerror()); TEST_CHECK((ret = fr_heap_insert(&hp, &hp_array[i])) >= 0); @@ -461,10 +461,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\nlst size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); talloc_free(lst); } @@ -497,10 +497,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\nheap size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); talloc_free(hp); } @@ -531,10 +531,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\narray size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_alloc, start_alloc)) / 1000); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_insert, start_insert)) / 1000); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop_first, start_pop)) / 1000); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_unwrap(fr_time_sub(end_pop, start_pop)) / 1000); talloc_free(array); } diff --git a/src/lib/util/minmax_heap_tests.c b/src/lib/util/minmax_heap_tests.c index fd812da1a9a5f..2c350ec8a11b7 100644 --- a/src/lib/util/minmax_heap_tests.c +++ b/src/lib/util/minmax_heap_tests.c @@ -158,7 +158,7 @@ static void minmax_heap_test(int skip) TEST_CASE("deletions"); { - unsigned int entry; + int entry; for (i = 0; i < MINMAX_HEAP_TEST_SIZE / skip; i++) { entry = i * skip; @@ -313,7 +313,7 @@ static void minmax_heap_test_order(void) prev = NULL; while ((thing = fr_minmax_heap_min_pop(hp))) { TEST_CHECK(thing->data >= data); - TEST_MSG("Expected data >= %i, got %i", data, thing->data); + TEST_MSG("Expected data >= %u, got %u", data, thing->data); if (thing->data >= data) data = thing->data; TEST_CHECK(thing != prev); prev = thing; @@ -338,7 +338,7 @@ static void minmax_heap_test_order(void) prev = NULL; while ((thing = fr_minmax_heap_max_pop(hp))) { TEST_CHECK(thing->data <= data); - TEST_MSG("Expected data >= %i, got %i", data, thing->data); + TEST_MSG("Expected data >= %u, got %u", data, thing->data); if (thing->data <= data) data = thing->data; TEST_CHECK(thing != prev); prev = thing; @@ -410,10 +410,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\nminmax heap size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); talloc_free(minmax); } @@ -445,10 +445,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\nheap size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); talloc_free(hp); } @@ -479,10 +479,10 @@ static void queue_cmp(unsigned int count) end_pop = fr_time(); TEST_MSG_ALWAYS("\narray size: %u\n", count); - TEST_MSG_ALWAYS("alloc: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); - TEST_MSG_ALWAYS("pop-first: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); - TEST_MSG_ALWAYS("pop: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); + TEST_MSG_ALWAYS("alloc: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_alloc, start_alloc))); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_insert, start_insert))); + TEST_MSG_ALWAYS("pop-first: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop_first, start_pop))); + TEST_MSG_ALWAYS("pop: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end_pop, start_pop))); talloc_free(array); } @@ -589,9 +589,9 @@ static void minmax_heap_cycle(void) end = fr_time(); TEST_MSG_ALWAYS("\ncycle size: %d\n", MINMAX_HEAP_CYCLE_SIZE); - TEST_MSG_ALWAYS("insert: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(start_remove, start_insert))); - TEST_MSG_ALWAYS("extract: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(start_swap, start_remove))); - TEST_MSG_ALWAYS("swap: %"PRIu64" μs\n", fr_time_delta_to_usec(fr_time_sub(end, start_swap))); + TEST_MSG_ALWAYS("insert: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(start_remove, start_insert))); + TEST_MSG_ALWAYS("extract: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(start_swap, start_remove))); + TEST_MSG_ALWAYS("swap: %"PRId64" μs\n", fr_time_delta_to_usec(fr_time_sub(end, start_swap))); talloc_free(hp); free(array); diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 0ee32e8060ed6..db7c30bfd739e 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -2001,7 +2001,7 @@ int fr_pair_cmp(fr_pair_t const *a, fr_pair_t const *b) slen = regex_compile(NULL, &preg, a->vp_strvalue, talloc_array_length(a->vp_strvalue) - 1, NULL, false, true); if (slen <= 0) { - fr_strerror_printf_push("Error at offset %zu compiling regex for %s", -slen, + fr_strerror_printf_push("Error at offset %zd compiling regex for %s", -slen, a->da->name); return -1; } @@ -3178,13 +3178,13 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p (void) talloc_get_type_abort_const(vp, fr_pair_t); if (!vp->da) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t da pointer was NULL", file, line); + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t da pointer was NULL", file, line); } fr_dict_attr_verify(file, line, vp->da); if (list) { fr_fatal_assert_msg(fr_pair_order_list_parent(vp) == &list->order, - "CONSISTENCY CHECK FAILED %s[%u]: pair does not have the correct parentage " + "CONSISTENCY CHECK FAILED %s[%d]: pair does not have the correct parentage " "at \"%s\"", file, line, vp->da->name); } @@ -3198,7 +3198,7 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p if (vp->data.enumv) fr_dict_attr_verify(file, line, vp->data.enumv); if (parent && !fr_dict_attr_can_contain(parent->da, vp->da)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" should be parented by %s, but is parented by %s", + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" should be parented by %s, but is parented by %s", file, line, vp->da->name, vp->da->parent->name, parent->da->name); } @@ -3206,7 +3206,7 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p fr_pair_t *parent = fr_pair_parent(vp); if (parent && (parent->vp_type != FR_TYPE_GROUP) && (parent->da == vp->da)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" structural (non-group) type contains itself", + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" structural (non-group) type contains itself", file, line, vp->da->name); } @@ -3222,19 +3222,19 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p if (!vp->vp_octets) break; /* We might be in the middle of initialisation */ if (!talloc_get_type(vp->vp_ptr, uint8_t)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" data buffer type should be " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" data buffer type should be " "uint8_t but is %s", file, line, vp->da->name, talloc_get_name(vp->vp_ptr)); } len = talloc_array_length(vp->vp_octets); if (vp->vp_length > len) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" length %zu is greater than " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" length %zu is greater than " "uint8_t data buffer length %zu", file, line, vp->da->name, vp->vp_length, len); } parent = talloc_parent(vp->vp_ptr); if (parent != vp) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" char buffer is not " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" char buffer is not " "parented by fr_pair_t %p, instead parented by %p (%s)", file, line, vp->da->name, vp, parent, parent ? talloc_get_name(parent) : "NULL"); @@ -3250,24 +3250,24 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p if (!vp->vp_octets) break; /* We might be in the middle of initialisation */ if (!talloc_get_type(vp->vp_ptr, char)) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" data buffer type should be " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" data buffer type should be " "char but is %s", file, line, vp->da->name, talloc_get_name(vp->vp_ptr)); } len = (talloc_array_length(vp->vp_strvalue) - 1); if (vp->vp_length > len) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" length %zu is greater than " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" length %zu is greater than " "char buffer length %zu", file, line, vp->da->name, vp->vp_length, len); } if (vp->vp_strvalue[vp->vp_length] != '\0') { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" char buffer not \\0 " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" char buffer not \\0 " "terminated", file, line, vp->da->name); } parent = talloc_parent(vp->vp_ptr); if (parent != vp) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" char buffer is not " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" char buffer is not " "parented by fr_pair_t %p, instead parented by %p (%s)", file, line, vp->da->name, vp, parent, parent ? talloc_get_name(parent) : "NULL"); @@ -3278,13 +3278,13 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p case FR_TYPE_IPV4_ADDR: if (vp->vp_ip.af != AF_INET) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" address family is not " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" address family is not " "set correctly for IPv4 address. Expected %i got %i", file, line, vp->da->name, AF_INET, vp->vp_ip.af); } if (vp->vp_ip.prefix != 32) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" address prefix " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" address prefix " "set correctly for IPv4 address. Expected %i got %i", file, line, vp->da->name, 32, vp->vp_ip.prefix); @@ -3293,13 +3293,13 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p case FR_TYPE_IPV6_ADDR: if (vp->vp_ip.af != AF_INET6) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" address family is not " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" address family is not " "set correctly for IPv6 address. Expected %i got %i", file, line, vp->da->name, AF_INET6, vp->vp_ip.af); } if (vp->vp_ip.prefix != 128) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" address prefix " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" address prefix " "set correctly for IPv6 address. Expected %i got %i", file, line, vp->da->name, 128, vp->vp_ip.prefix); @@ -3314,7 +3314,7 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p TALLOC_CTX *parent = talloc_parent(child); fr_fatal_assert_msg(parent == vp, - "CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" should be parented " + "CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" should be parented " "by fr_pair_t \"%s\". Expected talloc parent %p (%s) got %p (%s)", file, line, child->da->name, vp->da->name, @@ -3325,7 +3325,7 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p * Check if the child can be in the parent. */ fr_fatal_assert_msg(fr_dict_attr_can_contain(vp->da, child->da), - "CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t \"%s\" should be parented " + "CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t \"%s\" should be parented " "by fr_pair_t \"%s\", but it is instead parented by \"%s\"", file, line, child->da->name, child->da->parent->name, vp->da->name); @@ -3349,7 +3349,7 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p da = vp->da; if (da != vp->da) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t " "dictionary pointer %p \"%s\" (%s) " "and global dictionary pointer %p \"%s\" (%s) differ", file, line, vp->da, vp->da->name, @@ -3369,10 +3369,10 @@ void fr_pair_verify(char const *file, int line, fr_pair_list_t const *list, fr_p !((vp->da->type == FR_TYPE_COMBO_IP_PREFIX) && ((vp->vp_type == FR_TYPE_IPV4_PREFIX) || (vp->vp_type == FR_TYPE_IPV6_PREFIX)))) { char data_type_int[10], da_type_int[10]; - snprintf(data_type_int, sizeof(data_type_int), "%i", vp->vp_type); - snprintf(da_type_int, sizeof(da_type_int), "%i", vp->vp_type); + snprintf(data_type_int, sizeof(data_type_int), "%u", vp->vp_type); + snprintf(da_type_int, sizeof(da_type_int), "%u", vp->vp_type); - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: fr_pair_t attribute %p \"%s\" " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: fr_pair_t attribute %p \"%s\" " "data type (%s) does not match da type (%s)", file, line, vp->da, vp->da->name, fr_table_str_by_value(fr_type_table, vp->vp_type, data_type_int), @@ -3409,7 +3409,7 @@ void fr_pair_list_verify(char const *file, int line, TALLOC_CTX const *expected, */ fast = fr_pair_list_next(list, fast); fr_fatal_assert_msg(fast != slow, - "CONSISTENCY CHECK FAILED %s[%u]: Looping list found. Fast pointer hit " + "CONSISTENCY CHECK FAILED %s[%d]: Looping list found. Fast pointer hit " "slow pointer at \"%s\"", file, line, slow->da->name); @@ -3419,7 +3419,7 @@ void fr_pair_list_verify(char const *file, int line, TALLOC_CTX const *expected, fr_log_talloc_report(expected); if (parent) fr_log_talloc_report(parent); - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: Expected fr_pair_t \"%s\" to be parented " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: Expected fr_pair_t \"%s\" to be parented " "by %p (%s), instead parented by %p (%s)\n", file, line, slow->da->name, expected, talloc_get_name(expected), diff --git a/src/lib/util/pair_list_perf_test.c b/src/lib/util/pair_list_perf_test.c index 81fd79637d415..06e6f9e9c58f6 100644 --- a/src/lib/util/pair_list_perf_test.c +++ b/src/lib/util/pair_list_perf_test.c @@ -347,9 +347,9 @@ static void do_test_fr_pair_append(unsigned int len, unsigned int perc, unsigned TEST_CHECK(fr_pair_list_num_elements(&test_vps) == len); fr_pair_list_free(&test_vps); } - TEST_MSG_ALWAYS("repetitions=%d", reps); - TEST_MSG_ALWAYS("perc_rep=%d", perc); - TEST_MSG_ALWAYS("list_length=%d", len); + TEST_MSG_ALWAYS("repetitions=%u", reps); + TEST_MSG_ALWAYS("perc_rep=%u", perc); + TEST_MSG_ALWAYS("list_length=%u", len); TEST_MSG_ALWAYS("used=%"PRId64, fr_time_delta_unwrap(used)); TEST_MSG_ALWAYS("per_sec=%0.0lf", (reps * len)/(fr_time_delta_unwrap(used) / (double)NSEC)); } @@ -393,9 +393,9 @@ static void do_test_fr_pair_find_by_da_idx(unsigned int len, unsigned int perc, } } fr_pair_list_free(&test_vps); - TEST_MSG_ALWAYS("repetitions=%d", reps); - TEST_MSG_ALWAYS("perc_rep=%d", perc); - TEST_MSG_ALWAYS("list_length=%d", len); + TEST_MSG_ALWAYS("repetitions=%u", reps); + TEST_MSG_ALWAYS("perc_rep=%u", perc); + TEST_MSG_ALWAYS("list_length=%u", len); TEST_MSG_ALWAYS("used=%"PRId64, fr_time_delta_unwrap(used)); TEST_MSG_ALWAYS("per_sec=%0.0lf", (reps * len)/(fr_time_delta_unwrap(used) / (double)NSEC)); } @@ -442,9 +442,9 @@ static void do_test_find_nth(unsigned int len, unsigned int perc, unsigned int r } } fr_pair_list_free(&test_vps); - TEST_MSG_ALWAYS("repetitions=%d", reps); - TEST_MSG_ALWAYS("perc_rep=%d", perc); - TEST_MSG_ALWAYS("list_length=%d", len); + TEST_MSG_ALWAYS("repetitions=%u", reps); + TEST_MSG_ALWAYS("perc_rep=%u", perc); + TEST_MSG_ALWAYS("list_length=%u", len); TEST_MSG_ALWAYS("used=%"PRId64, fr_time_delta_unwrap(used)); TEST_MSG_ALWAYS("per_sec=%0.0lf", (reps * len)/(fr_time_delta_unwrap(used) / (double)NSEC)); } @@ -476,9 +476,9 @@ static void do_test_fr_pair_list_free(unsigned int len, unsigned int perc, unsig used = fr_time_delta_add(used, fr_time_sub(end, start)); } fr_pair_list_free(&test_vps); - TEST_MSG_ALWAYS("repetitions=%d", reps); - TEST_MSG_ALWAYS("perc_rep=%d", perc); - TEST_MSG_ALWAYS("list_length=%d", len); + TEST_MSG_ALWAYS("repetitions=%u", reps); + TEST_MSG_ALWAYS("perc_rep=%u", perc); + TEST_MSG_ALWAYS("list_length=%u", len); TEST_MSG_ALWAYS("used=%"PRId64, fr_time_delta_unwrap(used)); TEST_MSG_ALWAYS("per_sec=%0.0lf", (reps * len)/(fr_time_delta_unwrap(used) / (double)NSEC)); } diff --git a/src/lib/util/pair_tests.c b/src/lib/util/pair_tests.c index 341744d48b8b3..24737157c805a 100644 --- a/src/lib/util/pair_tests.c +++ b/src/lib/util/pair_tests.c @@ -122,7 +122,7 @@ static void test_fr_pair_afrom_child_num(void) PAIR_VERIFY(vp); TEST_CHECK(vp && vp->da->attr == FR_TEST_ATTR_STRING); - TEST_MSG("Expected attr(%d) == vp->da->attr(%d)", attr, vp->da->attr); + TEST_MSG("Expected attr(%u) == vp->da->attr(%u)", attr, vp->da->attr); talloc_free(vp); } diff --git a/src/lib/util/pcap.c b/src/lib/util/pcap.c index fe96c4ef98bed..0fb7a09c4e23d 100644 --- a/src/lib/util/pcap.c +++ b/src/lib/util/pcap.c @@ -120,7 +120,7 @@ fr_pcap_t *fr_pcap_init(TALLOC_CTX *ctx, char const *name, fr_pcap_type_t type) fr_pcap_t *this; if (!fr_cond_assert(type >= PCAP_INTERFACE_IN && type <= PCAP_INTERFACE_IN_OUT)) { - fr_strerror_printf("Invalid PCAP type: %d", type); + fr_strerror_printf("Invalid PCAP type: %u", type); return NULL; } @@ -352,7 +352,7 @@ int fr_pcap_open(fr_pcap_t *pcap) case PCAP_INVALID: default: (void)fr_cond_assert(0); - fr_strerror_printf("Bad handle type (%i)", pcap->type); + fr_strerror_printf("Bad handle type (%u)", pcap->type); return -1; } diff --git a/src/lib/util/rb.c b/src/lib/util/rb.c index 79af315abcfe4..d9e119053b47d 100644 --- a/src/lib/util/rb.c +++ b/src/lib/util/rb.c @@ -151,7 +151,7 @@ int _fr_rb_init(fr_rb_tree_t *tree, TALLOC_CTX *node_ctx, if (unlikely(offset >= UINT16_MAX)) { fr_strerror_printf("Inline fr_rb_node_t offset too large. " - "Expected <= %u, got %zd", UINT16_MAX, offset); + "Expected <= %zu, got %zd", (size_t) UINT16_MAX, offset); return -1; } diff --git a/src/lib/util/sem.c b/src/lib/util/sem.c index 218b339cfbcec..89fd1a4d17371 100644 --- a/src/lib/util/sem.c +++ b/src/lib/util/sem.c @@ -306,7 +306,7 @@ int fr_sem_wait(int sem_id, char const *file, bool undo_on_exit, bool nonblock) fr_strerror_printf("Failed waiting on semaphore bound to \"%s\" - %s. Semaphore " "owned by %s:%s PID %u%s", file, fr_syserror(semop_err), - uid_str, gid_str, sem_pid, dead ? " (dead)" : ""); + uid_str, gid_str, (unsigned int) sem_pid, dead ? " (dead)" : ""); talloc_free(uid_str); talloc_free(gid_str); @@ -348,7 +348,7 @@ static bool sem_check_uid(char const *file, int proj_id, if (unlikely(!expected_str)) { simple_error: fr_strerror_printf("Semaphore on \"%s\" ID 0x%x - %s is incorrect", - file, proj_id, thing); + file, (unsigned int) proj_id, thing); return false; } @@ -359,7 +359,7 @@ static bool sem_check_uid(char const *file, int proj_id, goto simple_error; } fr_strerror_printf("Semaphore on \"%s\" ID 0x%x - %s is incorrect. Expected \"%s\", got \"%s\"", - file, proj_id, thing, expected_str, got_str); + file, (unsigned int) proj_id, thing, expected_str, got_str); talloc_free(expected_str); talloc_free(got_str); @@ -378,7 +378,7 @@ static bool sem_check_gid(char const *file, int proj_id, if (unlikely(!expected_str)) { simple_error: fr_strerror_printf("Semaphore on \"%s\" ID 0x%x - %s is incorrect", - file, proj_id, thing); + file, (unsigned int) proj_id, thing); return false; } @@ -389,7 +389,7 @@ static bool sem_check_gid(char const *file, int proj_id, goto simple_error; } fr_strerror_printf("Semaphore on \"%s\" ID 0x%x - %s is incorrect. Expected \"%s\", got \"%s\"", - file, proj_id, thing, expected_str, got_str); + file, (unsigned int) proj_id, thing, expected_str, got_str); talloc_free(expected_str); talloc_free(got_str); @@ -429,7 +429,7 @@ int fr_sem_get(char const *file, int proj_id, uid_t uid, gid_t gid, bool check_p sem_key = ftok(file, proj_id); if (sem_key < 0) { fr_strerror_printf("Failed associating semaphore with \"%s\" ID 0x%x: %s", - file, proj_id, fr_syserror(errno)); + file, (unsigned int) proj_id, fr_syserror(errno)); return -1; } @@ -443,7 +443,7 @@ int fr_sem_get(char const *file, int proj_id, uid_t uid, gid_t gid, bool check_p if (errno != ENOENT) { /* Semaphore existed but we ran into an error */ fr_strerror_printf("Failed getting semaphore on \"%s\" ID 0x%x: %s", - file, proj_id, fr_syserror(errno)); + file, (unsigned int) proj_id, fr_syserror(errno)); return -2; } @@ -463,7 +463,7 @@ int fr_sem_get(char const *file, int proj_id, uid_t uid, gid_t gid, bool check_p } fr_strerror_printf("Failed creating semaphore on \"%s\" ID 0x%x: %s", - file, proj_id, fr_syserror(errno)); + file, (unsigned int) proj_id, fr_syserror(errno)); return -3; } @@ -481,7 +481,7 @@ int fr_sem_get(char const *file, int proj_id, uid_t uid, gid_t gid, bool check_p if (semctl(sem_id, 0, IPC_SET, &info) < 0) { fr_strerror_printf("Failed setting permissions for semaphore on \"%s\" ID 0x%x: %s", - file, proj_id, fr_syserror(errno)); + file, (unsigned int) proj_id, fr_syserror(errno)); fr_sem_close(sem_id, file); return -3; } @@ -498,13 +498,13 @@ int fr_sem_get(char const *file, int proj_id, uid_t uid, gid_t gid, bool check_p ret = semctl(sem_id, 0, IPC_STAT, &info); if (ret < 0) { fr_strerror_printf("Failed getting semaphore permissions on \"%s\" ID 0x%x: %s", - file, proj_id, fr_syserror(errno)); + file, (unsigned int) proj_id, fr_syserror(errno)); return -2; } if (info.sem_perm.mode & S_IWOTH) { fr_strerror_printf("Semaphore on \"%s\" ID 0x%x is world writable (insecure)", - file, proj_id); + file, (unsigned int) proj_id); return -2; } diff --git a/src/lib/util/strerror_tests.c b/src/lib/util/strerror_tests.c index afa9ee8b89fa7..18a8599fc5f8b 100644 --- a/src/lib/util/strerror_tests.c +++ b/src/lib/util/strerror_tests.c @@ -200,7 +200,7 @@ static void strerror_printf_benchmark(void) start = fr_time(); for (i = 0; i < 100000; i++) { - fr_strerror_printf("I am a test %u string %u %s", i, i, "benchmark"); + fr_strerror_printf("I am a test %d string %d %s", i, i, "benchmark"); fr_strerror_clear(); /* Clear */ } stop = fr_time(); diff --git a/src/lib/util/struct.c b/src/lib/util/struct.c index a87a9510bfb76..acf33f6368be6 100644 --- a/src/lib/util/struct.c +++ b/src/lib/util/struct.c @@ -109,7 +109,7 @@ ssize_t fr_struct_from_network(TALLOC_CTX *ctx, fr_pair_list_t *out, if (calc_len > (size_t) (end - p)) { FR_PROTO_TRACE("Length header (%zu) is larger than remaining data (%zu)", - claimed_len + field_len, (end - p)); + claimed_len + field_len, (size_t) (end - p)); goto unknown; } @@ -233,7 +233,7 @@ ssize_t fr_struct_from_network(TALLOC_CTX *ctx, fr_pair_list_t *out, * of the input is suspect. */ if (child_length > (size_t) (end - p)) { - FR_PROTO_TRACE("fr_struct_from_network - child length %zd overflows buffer", child_length); + FR_PROTO_TRACE("fr_struct_from_network - child length %zu overflows buffer", child_length); goto unknown; } @@ -245,7 +245,7 @@ ssize_t fr_struct_from_network(TALLOC_CTX *ctx, fr_pair_list_t *out, child_length = end - p; } else if ((size_t) (end - p) < child_length) { - FR_PROTO_TRACE("fr_struct_from_network - child length %zd underflows buffer", child_length); + FR_PROTO_TRACE("fr_struct_from_network - child length %zu underflows buffer", child_length); goto unknown; } @@ -395,7 +395,7 @@ ssize_t fr_struct_from_network(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_assert(struct_vp != NULL); fr_pair_append(out, struct_vp); - FR_PROTO_TRACE("used %zd bytes", data_len); + FR_PROTO_TRACE("used %zu bytes", data_len); return p - data; } diff --git a/src/lib/util/value.c b/src/lib/util/value.c index 08af6a1f8107f..2a2a91165dba5 100644 --- a/src/lib/util/value.c +++ b/src/lib/util/value.c @@ -2153,8 +2153,8 @@ static int fr_value_box_fixed_size_from_octets(fr_value_box_t *dst, if (!fr_type_is_fixed_size(dst_type)) if (!fr_cond_assert(false)) return -1; if (src->vb_length > network_max_size(dst_type)) { - fr_strerror_printf("Invalid cast from %s to %s. Source length %zd is greater than " - "destination type size %zd", + fr_strerror_printf("Invalid cast from %s to %s. Source length %zu is greater than " + "destination type size %zu", fr_type_to_str(src->type), fr_type_to_str(dst_type), src->vb_length, @@ -3512,8 +3512,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_value_box_t tmp; if (src->vb_length < network_min_size(dst_type)) { - fr_strerror_printf("Invalid cast from %s to %s. Source is length %zd is smaller than " - "destination type size %zd", + fr_strerror_printf("Invalid cast from %s to %s. Source is length %zu is smaller than " + "destination type size %zu", fr_type_to_str(src->type), fr_type_to_str(dst_type), src->vb_length, @@ -3522,8 +3522,8 @@ int fr_value_box_cast(TALLOC_CTX *ctx, fr_value_box_t *dst, } if (src->vb_length > network_max_size(dst_type)) { - fr_strerror_printf("Invalid cast from %s to %s. Source length %zd is greater than " - "destination type size %zd", + fr_strerror_printf("Invalid cast from %s to %s. Source length %zu is greater than " + "destination type size %zu", fr_type_to_str(src->type), fr_type_to_str(dst_type), src->vb_length, @@ -6245,7 +6245,7 @@ DIAG_ON(nonnull-compare) #endif switch (vb->type) { case FR_TYPE_STRING: - fr_fatal_assert_msg(vb->vb_strvalue, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t strvalue field " + fr_fatal_assert_msg(vb->vb_strvalue, "CONSISTENCY CHECK FAILED %s[%d]: fr_value_box_t strvalue field " "was NULL", file, line); fr_fatal_assert_msg(vb->vb_strvalue[vb->vb_length] == '\0', "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t strvalue field " @@ -6255,7 +6255,7 @@ DIAG_ON(nonnull-compare) /* We always \0 terminate to be safe, even though most things should use the len field */ if (len <= vb->vb_length) { - fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%u]: Expected fr_value_box_t->vb_strvalue talloc buffer " + fr_fatal_assert_fail("CONSISTENCY CHECK FAILED %s[%d]: Expected fr_value_box_t->vb_strvalue talloc buffer " "len >= %zu, got %zu", file, line, vb->vb_length + 1, len); } @@ -6263,12 +6263,12 @@ DIAG_ON(nonnull-compare) break; case FR_TYPE_OCTETS: - fr_fatal_assert_msg(vb->vb_octets, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t octets field " + fr_fatal_assert_msg(vb->vb_octets, "CONSISTENCY CHECK FAILED %s[%d]: fr_value_box_t octets field " "was NULL", file, line); break; case FR_TYPE_VOID: - fr_fatal_assert_msg(vb->vb_void, "CONSISTENCY CHECK FAILED %s[%i]: fr_value_box_t ptr field " + fr_fatal_assert_msg(vb->vb_void, "CONSISTENCY CHECK FAILED %s[%d]: fr_value_box_t ptr field " "was NULL", file, line); break; diff --git a/src/protocols/dhcpv4/decode.c b/src/protocols/dhcpv4/decode.c index 904fac7b39a8e..297cb6eed1641 100644 --- a/src/protocols/dhcpv4/decode.c +++ b/src/protocols/dhcpv4/decode.c @@ -288,7 +288,7 @@ static ssize_t decode_value(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t } finish: - FR_PROTO_TRACE("decoding value complete, adding new pair and returning %zu byte(s)", p - data); + FR_PROTO_TRACE("decoding value complete, adding new pair and returning %zu byte(s)", (size_t) (p - data)); fr_pair_append(out, vp); return p - data; @@ -634,14 +634,14 @@ ssize_t fr_dhcpv4_decode_option(TALLOC_CTX *ctx, fr_pair_list_t *out, /* * The actual amount of data we decoded, including the various headers. */ - FR_PROTO_TRACE("decoding option complete, %zu decoded, returning %zu byte(s)", slen, (size_t) (next - data)); + FR_PROTO_TRACE("decoding option complete, %zd decoded, returning %zu byte(s)", slen, (size_t) (next - data)); return next - data; } slen = decode_option(ctx, out, fr_dict_root(dict_dhcpv4), data, data[1] + 2, decode_ctx); if (slen < 0) return slen; - FR_PROTO_TRACE("decoding option complete, %zu decoded, returning %u byte(s)", slen, data[1] + 2); + FR_PROTO_TRACE("decoding option complete, %zd decoded, returning %u byte(s)", slen, (unsigned int) data[1] + 2); return data[1] + 2; } diff --git a/src/protocols/dhcpv4/pcap.c b/src/protocols/dhcpv4/pcap.c index 47dee0495a110..ebbdd5697a299 100644 --- a/src/protocols/dhcpv4/pcap.c +++ b/src/protocols/dhcpv4/pcap.c @@ -181,7 +181,7 @@ fr_packet_t *fr_dhcpv4_pcap_recv(fr_pcap_t *pcap) */ len = (p - data) + UDP_HDR_SIZE; /* length value */ if ((size_t) len > header->caplen) { - fr_strerror_printf("Payload (%zu) smaller than required for layers 2+3+4", len); + fr_strerror_printf("Payload (%zd) smaller than required for layers 2+3+4", len); return NULL; } diff --git a/src/protocols/dns/decode.c b/src/protocols/dns/decode.c index 6097a513850db..7dd755c80d376 100644 --- a/src/protocols/dns/decode.c +++ b/src/protocols/dns/decode.c @@ -231,7 +231,7 @@ static ssize_t decode_record(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_ uint8_t const *rr, uint8_t const *end, fr_dns_ctx_t *packet_ctx, uint8_t const *counter) { - int i, count; + unsigned int i, count; uint8_t const *p = rr; /* @@ -244,7 +244,7 @@ static ssize_t decode_record(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_ for (i = 0; (i < count) && (p < end); i++) { ssize_t slen; - FR_PROTO_HEX_DUMP(p, end - p, "fr_dns_decode - %s %d/%d", attr->name, i, count); + FR_PROTO_HEX_DUMP(p, end - p, "fr_dns_decode - %s %u/%u", attr->name, i, count); slen = fr_struct_from_network(ctx, out, attr, p, end - p, packet_ctx, decode_value_trampoline, decode_tlv_trampoline); diff --git a/src/protocols/radius/base.c b/src/protocols/radius/base.c index b381becb87173..e8ad10c88efc9 100644 --- a/src/protocols/radius/base.c +++ b/src/protocols/radius/base.c @@ -299,7 +299,7 @@ ssize_t fr_radius_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, uint16_t *src if (data_len < 4) { char buffer[INET6_ADDRSTRLEN]; - FR_DEBUG_STRERROR_PRINTF("Expected at least 4 bytes of header data, got %zu bytes", data_len); + FR_DEBUG_STRERROR_PRINTF("Expected at least 4 bytes of header data, got %zd bytes", data_len); invalid: FR_DEBUG_STRERROR_PRINTF("Invalid data from %s", inet_ntop(src_ipaddr->af, &src_ipaddr->addr, buffer, sizeof(buffer))); @@ -319,7 +319,7 @@ ssize_t fr_radius_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, uint16_t *src */ if (packet_len < RADIUS_HEADER_LENGTH) { FR_DEBUG_STRERROR_PRINTF("Expected at least " STRINGIFY(RADIUS_HEADER_LENGTH) " bytes of packet " - "data, got %zu bytes", packet_len); + "data, got %zd bytes", packet_len); goto invalid; } @@ -329,7 +329,7 @@ ssize_t fr_radius_recv_header(int sockfd, fr_ipaddr_t *src_ipaddr, uint16_t *src */ if (packet_len > MAX_PACKET_LEN) { FR_DEBUG_STRERROR_PRINTF("Length field value too large, expected maximum of " - STRINGIFY(MAX_PACKET_LEN) " bytes, got %zu bytes", packet_len); + STRINGIFY(MAX_PACKET_LEN) " bytes, got %zd bytes", packet_len); goto invalid; } @@ -366,7 +366,8 @@ int fr_radius_sign(uint8_t *packet, uint8_t const *vector, * to catch uninitialised fields. */ if (!fr_cond_assert(secret_len <= UINT16_MAX)) { - fr_strerror_printf("Secret is too long. Expected <= %u, got %zu", UINT16_MAX, secret_len); + fr_strerror_printf("Secret is too long. Expected <= %u, got %zu", + (unsigned int) UINT16_MAX, secret_len); return -1; } @@ -724,7 +725,7 @@ bool fr_radius_ok(uint8_t const *packet, size_t *packet_len_p, */ if ((max_attributes > 0) && (num_attributes > max_attributes)) { - FR_DEBUG_STRERROR_PRINTF("Possible DoS attack - too many attributes in request (received %d, max %d are allowed).", + FR_DEBUG_STRERROR_PRINTF("Possible DoS attack - too many attributes in request (received %u, max %u are allowed).", num_attributes, max_attributes); failure = DECODE_FAIL_TOO_MANY_ATTRIBUTES; goto finish; @@ -788,7 +789,7 @@ int fr_radius_verify(uint8_t *packet, uint8_t const *vector, uint8_t message_authenticator[RADIUS_AUTH_VECTOR_LENGTH]; if (packet_len < RADIUS_HEADER_LENGTH) { - fr_strerror_printf("invalid packet length %zd", packet_len); + fr_strerror_printf("invalid packet length %zu", packet_len); return -1; } diff --git a/src/protocols/radius/decode.c b/src/protocols/radius/decode.c index 67c5e6783e2f0..b908d894a38b7 100644 --- a/src/protocols/radius/decode.c +++ b/src/protocols/radius/decode.c @@ -1499,7 +1499,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, fr_pair_list_t *out, FR_PROTO_HEX_DUMP(data, attr_len, "%s", __FUNCTION__ ); - FR_PROTO_TRACE("Parent %s len %zu ... %zu", parent->name, attr_len, packet_ctx->end - data); + FR_PROTO_TRACE("Parent %s len %zu ... %zu", parent->name, attr_len, (size_t) (packet_ctx->end - data)); data_len = attr_len; @@ -1610,7 +1610,7 @@ ssize_t fr_radius_decode_pair_value(TALLOC_CTX *ctx, fr_pair_list_t *out, * Decrypt the attribute. */ if (encrypt) { - FR_PROTO_TRACE("Decrypting type %u", encrypt); + FR_PROTO_TRACE("Decrypting type %d", encrypt); /* * Encrypted attributes can only exist for the * old-style format. Extended attributes CANNOT diff --git a/src/protocols/radius/encode.c b/src/protocols/radius/encode.c index fbda2418d7687..2a64d54fcb0eb 100644 --- a/src/protocols/radius/encode.c +++ b/src/protocols/radius/encode.c @@ -1531,7 +1531,7 @@ ssize_t fr_radius_encode_pair(fr_dbuff_t *dbuff, fr_dcursor_t *cursor, void *enc PAIR_VERIFY(vp); if (vp->da->depth > FR_DICT_MAX_TLV_STACK) { - fr_strerror_printf("%s: Attribute depth %i exceeds maximum nesting depth %i", + fr_strerror_printf("%s: Attribute depth %u exceeds maximum nesting depth %i", __FUNCTION__, vp->da->depth, FR_DICT_MAX_TLV_STACK); return PAIR_ENCODE_FATAL_ERROR; } diff --git a/src/protocols/tacacs/base.c b/src/protocols/tacacs/base.c index 7b7974ebc5b0a..a3e26881ba666 100644 --- a/src/protocols/tacacs/base.c +++ b/src/protocols/tacacs/base.c @@ -274,7 +274,7 @@ ssize_t fr_tacacs_length(uint8_t const *buffer, size_t buffer_len) if (!((pkt->hdr.type == FR_TAC_PLUS_AUTHEN) || (pkt->hdr.type == FR_TAC_PLUS_AUTHOR) || (pkt->hdr.type == FR_TAC_PLUS_ACCT))) { - fr_strerror_printf("Unknown packet type %u", pkt->hdr.type); + fr_strerror_printf("Unknown packet type %d", pkt->hdr.type); return -1; } @@ -434,8 +434,8 @@ void _fr_tacacs_packet_log_hex(fr_log_t const *log, fr_tacacs_packet_t const *pa /* * It has to be at least 12 bytes long. */ - PRINT(" major %u", (p[0] & 0xf0) >> 4); - PRINT(" minor %u", (p[0] & 0x0f)); + PRINT(" major %d", (p[0] & 0xf0) >> 4); + PRINT(" minor %d", (p[0] & 0x0f)); PRINT(" type %02x", p[1]); PRINT(" seq_no %02x", p[2]); diff --git a/src/protocols/tacacs/decode.c b/src/protocols/tacacs/decode.c index 65119e48ca57a..88374eb01c42b 100644 --- a/src/protocols/tacacs/decode.c +++ b/src/protocols/tacacs/decode.c @@ -44,7 +44,7 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) if (pkt->authen_cont.flags == FR_TAC_PLUS_CONTINUE_FLAG_ABORT) return FR_PACKET_TYPE_VALUE_AUTHENTICATION_CONTINUE_ABORT; - fr_strerror_printf("Invalid value %u for authentication continue flag", pkt->authen_cont.flags); + fr_strerror_printf("Invalid value %d for authentication continue flag", pkt->authen_cont.flags); return -1; } @@ -74,7 +74,7 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) break; } - fr_strerror_printf("Invalid value %u for authentication reply status", pkt->authen_reply.status); + fr_strerror_printf("Invalid value %d for authentication reply status", pkt->authen_reply.status); return -1; case FR_TAC_PLUS_AUTHOR: @@ -96,7 +96,7 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) break; } - fr_strerror_printf("Invalid value %u for authorization reply status", pkt->author_reply.status); + fr_strerror_printf("Invalid value %d for authorization reply status", pkt->author_reply.status); return -1; case FR_TAC_PLUS_ACCT: @@ -115,7 +115,7 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) break; } - fr_strerror_printf("Invalid value %u for accounting reply status", pkt->acct_reply.status); + fr_strerror_printf("Invalid value %d for accounting reply status", pkt->acct_reply.status); return -1; default: @@ -127,7 +127,7 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) #define PACKET_HEADER_CHECK(_msg, _hdr) do { \ p = buffer + FR_HEADER_LENGTH; \ if (sizeof(_hdr) > (size_t) (end - p)) { \ - fr_strerror_printf("Header for %s is too small (%zu < %zu)", _msg, end - (uint8_t const *) pkt, p - (uint8_t const *) pkt); \ + fr_strerror_printf("Header for %s is too small (%zu < %zu)", _msg, (size_t) (end - (uint8_t const *) pkt), (size_t) (p - (uint8_t const *) pkt)); \ goto fail; \ } \ body = p + sizeof(_hdr); \ @@ -140,14 +140,14 @@ int fr_tacacs_packet_to_code(fr_tacacs_packet_t const *pkt) #define ARG_COUNT_CHECK(_msg, _hdr) do { \ fr_assert(p == (uint8_t const *) &(_hdr)); \ if (data_len > (size_t) (end - p)) { \ - fr_strerror_printf("Argument count %u overflows the remaining data (%zu) in the %s packet", _hdr.arg_cnt, end - p, _msg); \ + fr_strerror_printf("Argument count %u overflows the remaining data (%zu) in the %s packet", _hdr.arg_cnt, (size_t) (end - p), _msg); \ goto fail; \ } \ argv = body; \ attrs = buffer + FR_HEADER_LENGTH + data_len; \ body += _hdr.arg_cnt; \ p = attrs; \ - for (int i = 0; i < _hdr.arg_cnt; i++) { \ + for (unsigned int i = 0; i < _hdr.arg_cnt; i++) { \ if (_hdr.arg_len[i] > (size_t) (end - p)) { \ fr_strerror_printf("Argument %u length %u overflows packet", i, _hdr.arg_len[i]); \ goto fail; \ @@ -376,7 +376,7 @@ static int tacacs_decode_field(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_att if (field_len > (end - p)) { fr_strerror_printf("'%s' length %u overflows the remaining data (%zu) in the packet", - da->name, field_len, end - p); + da->name, field_len, (size_t) (end - p)); return -1; } @@ -488,7 +488,7 @@ ssize_t fr_tacacs_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t co if (!((pkt->hdr.type == FR_TAC_PLUS_AUTHEN) || (pkt->hdr.type == FR_TAC_PLUS_AUTHOR) || (pkt->hdr.type == FR_TAC_PLUS_ACCT))) { - fr_strerror_printf("Unknown packet type %u", pkt->hdr.type); + fr_strerror_printf("Unknown packet type %d", pkt->hdr.type); return -1; } @@ -1056,7 +1056,7 @@ ssize_t fr_tacacs_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t co } break; default: - fr_strerror_printf("decode: Unsupported packet type %u", pkt->hdr.type); + fr_strerror_printf("decode: Unsupported packet type %d", pkt->hdr.type); goto fail; } diff --git a/src/protocols/tacacs/encode.c b/src/protocols/tacacs/encode.c index 9cde8cf54fa82..378aad317972e 100644 --- a/src/protocols/tacacs/encode.c +++ b/src/protocols/tacacs/encode.c @@ -959,7 +959,7 @@ ssize_t fr_tacacs_encode(fr_dbuff_t *dbuff, uint8_t const *original_packet, char return -1; default: - fr_strerror_printf("encode: unknown packet type %u", packet->hdr.type); + fr_strerror_printf("encode: unknown packet type %d", packet->hdr.type); return -1; } diff --git a/src/protocols/vmps/vmps.c b/src/protocols/vmps/vmps.c index 72236c487e6ee..5942c3c9a9e54 100644 --- a/src/protocols/vmps/vmps.c +++ b/src/protocols/vmps/vmps.c @@ -461,7 +461,7 @@ static void print_hex_data(uint8_t const *ptr, int attrlen, int depth) */ void fr_vmps_print_hex(FILE *fp, uint8_t const *packet, size_t packet_len) { - int length; + uint32_t length; uint8_t const *attr, *end; uint32_t id;