diff options
author | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-05-10 10:47:10 +0300 |
---|---|---|
committer | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-05-10 10:47:10 +0300 |
commit | f3385fef57beac49b991876f6f2701c604697993 (patch) | |
tree | f951fbc57a35096153c8be8aa2be303b878949c8 /src | |
parent | 770b1791d75905f31d435299d673de13f6a1cff3 (diff) | |
parent | 2f05d9a4320a704c9ab2deb8e576cf2a949d3ca9 (diff) |
........S. [ZBX-20823] fixed inability to update hosts that were created by LLD on aarch64
Merge in ZBX/zabbix from feature/ZBX-20823-6.0 to release/6.0
* commit '2f05d9a4320a704c9ab2deb8e576cf2a949d3ca9':
........S. [ZBX-20823] fixed inability to update hosts that were created by LLD on aarch64
........S. [ZBX-20823] fixed inability to update hosts that were created by LLD on aarch64
.D........ [ZBX-20823] added ChangeLog entry
........S. [ZBX-20823] fixed inability to update hosts that were created by LLD on aarch64
........S. [ZBX-20823] fixed inability to update hosts that were created by LLD on aarch64
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/zbxdbcache/dbconfig.c | 2 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/host.c | 13 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/lld_override.c | 4 | ||||
-rw-r--r-- | src/libs/zbxeval/execute.c | 2 | ||||
-rw-r--r-- | src/libs/zbxnix/fatal.c | 7 | ||||
-rw-r--r-- | src/zabbix_server/lld/lld.c | 4 | ||||
-rw-r--r-- | src/zabbix_server/lld/lld.h | 2 | ||||
-rw-r--r-- | src/zabbix_server/lld/lld_host.c | 30 |
8 files changed, 34 insertions, 30 deletions
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c index b0f952d8d55..94cc31c41eb 100644 --- a/src/libs/zbxdbcache/dbconfig.c +++ b/src/libs/zbxdbcache/dbconfig.c @@ -7354,7 +7354,7 @@ static void DCget_host(DC_HOST *dst_host, const ZBX_DC_HOST *src_host, unsigned if (ZBX_ITEM_GET_INVENTORY & mode) { if (NULL != (host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories, &src_host->hostid))) - dst_host->inventory_mode = (char)host_inventory->inventory_mode; + dst_host->inventory_mode = (signed char)host_inventory->inventory_mode; else dst_host->inventory_mode = HOST_INVENTORY_DISABLED; } diff --git a/src/libs/zbxdbhigh/host.c b/src/libs/zbxdbhigh/host.c index 2f17bafaeaa..71eefab809d 100644 --- a/src/libs/zbxdbhigh/host.c +++ b/src/libs/zbxdbhigh/host.c @@ -2031,8 +2031,8 @@ typedef struct unsigned char discover; unsigned char custom_interfaces_orig; unsigned char custom_interfaces; - char inventory_mode_orig; - char inventory_mode; + signed char inventory_mode_orig; + signed char inventory_mode; zbx_uint64_t templateid_host; } zbx_host_prototype_t; @@ -2207,7 +2207,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem if (SUCCEED == DBis_null(row[7])) host_prototype->inventory_mode = HOST_INVENTORY_DISABLED; else - host_prototype->inventory_mode = (char)atoi(row[7]); + host_prototype->inventory_mode = (signed char)atoi(row[7]); host_prototype->inventory_mode_orig = HOST_INVENTORY_DISABLED; @@ -2252,7 +2252,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem if (host_prototype->itemid == itemid && 0 == strcmp(host_prototype->host, row[2])) { - char inventory_mode_null_processed; + signed char inventory_mode_null_processed; ZBX_STR2UINT64(host_prototype->hostid, row[1]); @@ -2283,7 +2283,7 @@ static void DBhost_prototypes_make(zbx_uint64_t hostid, zbx_vector_uint64_t *tem if (SUCCEED == DBis_null(row[8])) inventory_mode_null_processed = HOST_INVENTORY_DISABLED; else - inventory_mode_null_processed = (char)atoi(row[8]); + inventory_mode_null_processed = (signed char)atoi(row[8]); if (host_prototype->inventory_mode != inventory_mode_null_processed) { @@ -3833,7 +3833,8 @@ static void DBhost_prototypes_save(const zbx_vector_ptr_t *host_prototypes, } zbx_audit_host_prototype_update_json_update_inventory_mode(host_prototype->hostid, - host_prototype->inventory_mode_orig, host_prototype->inventory_mode); + (int)host_prototype->inventory_mode_orig, + (int)host_prototype->inventory_mode); } } diff --git a/src/libs/zbxdbhigh/lld_override.c b/src/libs/zbxdbhigh/lld_override.c index c3cc7cb98cf..0c4312689a3 100644 --- a/src/libs/zbxdbhigh/lld_override.c +++ b/src/libs/zbxdbhigh/lld_override.c @@ -240,8 +240,8 @@ void zbx_load_lld_override_operations(const zbx_vector_uint64_t *overrideids, ch override_operation->severity = FAIL == DBis_null(row[10]) ? (unsigned char)atoi(row[10]) : TRIGGER_SEVERITY_COUNT; - override_operation->inventory_mode = FAIL == DBis_null(row[11]) ? - (unsigned char)atoi(row[11]) : HOST_INVENTORY_COUNT; + override_operation->inventory_mode = FAIL == DBis_null(row[11]) ? (signed char)atoi(row[11]) : + HOST_INVENTORY_COUNT; zbx_vector_ptr_append(ops, override_operation); diff --git a/src/libs/zbxeval/execute.c b/src/libs/zbxeval/execute.c index 83f55c81832..9f3ef11c7eb 100644 --- a/src/libs/zbxeval/execute.c +++ b/src/libs/zbxeval/execute.c @@ -2073,7 +2073,7 @@ static int eval_execute_function_ascii(const zbx_eval_context_t *ctx, const zbx_ arg = &output->values[output->values_num - 1]; - if (SUCCEED != zbx_variant_convert(arg, ZBX_VARIANT_STR) || 0 > *arg->data.str) + if (SUCCEED != zbx_variant_convert(arg, ZBX_VARIANT_STR)) { *error = zbx_dsprintf(*error, "invalid function argument at \"%s\"", ctx->expression + token->loc.l); return FAIL; diff --git a/src/libs/zbxnix/fatal.c b/src/libs/zbxnix/fatal.c index 376703ede38..495fc5fa392 100644 --- a/src/libs/zbxnix/fatal.c +++ b/src/libs/zbxnix/fatal.c @@ -247,6 +247,8 @@ void zbx_log_fatal_info(void *context, unsigned int flags) #if defined(REG_EIP) || defined(REG_RIP) ucontext_t *uctx = (ucontext_t *)context; +#else + ZBX_UNUSED(context); #endif /* look for GET_PC() macro in sigcontextinfo.h files */ @@ -265,8 +267,6 @@ void zbx_log_fatal_info(void *context, unsigned int flags) # endif #endif /* HAVE_SYS_UCONTEXT_H */ - int i; - FILE *fd; zabbix_log(LOG_LEVEL_CRIT, "====== Fatal information: ======"); @@ -275,6 +275,7 @@ void zbx_log_fatal_info(void *context, unsigned int flags) #ifdef HAVE_SYS_UCONTEXT_H #ifdef ZBX_GET_PC + int i; /* On 64-bit GNU/Linux ZBX_GET_PC() returns 'greg_t' defined as 'long long int' (8 bytes). */ /* On 32-bit GNU/Linux it is defined as 'int' (4 bytes). To print registers in a common way we print */ /* them as 'long int' or 'unsigned long int' which is 8 bytes on 64-bit GNU/Linux and 4 bytes on */ @@ -335,6 +336,8 @@ void zbx_log_fatal_info(void *context, unsigned int flags) if (0 != (flags & ZBX_FATAL_LOG_MEM_MAP)) { + FILE *fd; + zabbix_log(LOG_LEVEL_CRIT, "=== Memory map: ==="); if (NULL != (fd = fopen("/proc/self/maps", "r"))) diff --git a/src/zabbix_server/lld/lld.c b/src/zabbix_server/lld/lld.c index 6bf5120538e..70c73a14cb8 100644 --- a/src/zabbix_server/lld/lld.c +++ b/src/zabbix_server/lld/lld.c @@ -593,7 +593,7 @@ static void lld_dump_overrides(const zbx_vector_ptr_t *overrides) zabbix_log(LOG_LEVEL_TRACE, " delay '%s'", ZBX_NULL2STR(override_operation->delay)); zabbix_log(LOG_LEVEL_TRACE, " history '%s'", ZBX_NULL2STR(override_operation->history)); zabbix_log(LOG_LEVEL_TRACE, " trends '%s'", ZBX_NULL2STR(override_operation->trends)); - zabbix_log(LOG_LEVEL_TRACE, " inventory_mode: %d", override_operation->inventory_mode); + zabbix_log(LOG_LEVEL_TRACE, " inventory_mode: %d", (int)override_operation->inventory_mode); for (k = 0; k < override_operation->tags.values_num; k++) { zabbix_log(LOG_LEVEL_TRACE, " tag:'%s' value:'%s'", @@ -841,7 +841,7 @@ void lld_override_trigger(const zbx_vector_ptr_t *overrides, const char *name, u } void lld_override_host(const zbx_vector_ptr_t *overrides, const char *name, zbx_vector_uint64_t *lnk_templateids, - char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, + signed char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, unsigned char *discover) { int i, j, k; diff --git a/src/zabbix_server/lld/lld.h b/src/zabbix_server/lld/lld.h index 9362e99ddb8..c86f096c949 100644 --- a/src/zabbix_server/lld/lld.h +++ b/src/zabbix_server/lld/lld.h @@ -231,7 +231,7 @@ void lld_override_item(const zbx_vector_ptr_t *overrides, const char *name, cons void lld_override_trigger(const zbx_vector_ptr_t *overrides, const char *name, unsigned char *severity, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, unsigned char *discover); void lld_override_host(const zbx_vector_ptr_t *overrides, const char *name, zbx_vector_uint64_t *lnk_templateids, - char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, + signed char *inventory_mode, zbx_vector_db_tag_ptr_t *override_tags, unsigned char *status, unsigned char *discover); void lld_override_graph(const zbx_vector_ptr_t *overrides, const char *name, unsigned char *discover); diff --git a/src/zabbix_server/lld/lld_host.c b/src/zabbix_server/lld/lld_host.c index deaf3fda3c3..f87b9e92c93 100644 --- a/src/zabbix_server/lld/lld_host.c +++ b/src/zabbix_server/lld/lld_host.c @@ -207,13 +207,13 @@ typedef struct ZBX_FLAG_LLD_HOST_UPDATE_TLS_PSK | ZBX_FLAG_LLD_HOST_UPDATE_CUSTOM_INTERFACES) zbx_uint64_t flags; const struct zbx_json_parse *jp_row; - char inventory_mode; - char inventory_mode_orig; + signed char inventory_mode; + signed char inventory_mode_orig; unsigned char status; unsigned char custom_interfaces; unsigned char custom_interfaces_orig; zbx_uint64_t proxy_hostid_orig; - char ipmi_authtype_orig; + signed char ipmi_authtype_orig; unsigned char ipmi_privilege_orig; char *ipmi_username_orig; char *ipmi_password_orig; @@ -405,7 +405,7 @@ out: * * ******************************************************************************/ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, zbx_uint64_t proxy_hostid, - char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username, const char *ipmi_password, + signed char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username, const char *ipmi_password, unsigned char tls_connect, unsigned char tls_accept, const char *tls_issuer, const char *tls_subject, const char *tls_psk_identity, const char *tls_psk) { @@ -466,9 +466,9 @@ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, z host->flags |= ZBX_FLAG_LLD_HOST_UPDATE_PROXY; } - if ((char)atoi(row[7]) != ipmi_authtype) + if ((signed char)atoi(row[7]) != ipmi_authtype) { - host->ipmi_authtype_orig = (char)atoi(row[7]); + host->ipmi_authtype_orig = (signed char)atoi(row[7]); host->flags |= ZBX_FLAG_LLD_HOST_UPDATE_IPMI_AUTH; } @@ -529,7 +529,7 @@ static void lld_hosts_get(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, z if (SUCCEED == DBis_null(row[11])) host->inventory_mode_orig = HOST_INVENTORY_DISABLED; else - host->inventory_mode_orig = (char)atoi(row[11]); + host->inventory_mode_orig = (signed char)atoi(row[11]); zbx_vector_uint64_create(&host->new_groupids); zbx_vector_uint64_create(&host->lnk_templateids); @@ -818,7 +818,7 @@ static void lld_hosts_validate(zbx_vector_ptr_t *hosts, char **error) } static zbx_lld_host_t *lld_host_make(zbx_vector_ptr_t *hosts, const char *host_proto, const char *name_proto, - char inventory_mode_proto, unsigned char status_proto, unsigned char discover_proto, + signed char inventory_mode_proto, unsigned char status_proto, unsigned char discover_proto, zbx_vector_db_tag_ptr_t *tags, const zbx_lld_row_t *lld_row, const zbx_vector_ptr_t *lld_macros, char **info, unsigned char custom_iface) { @@ -2648,8 +2648,8 @@ static void lld_interface_snmp_prepare_sql(zbx_uint64_t hostid, const zbx_uint64 * * ******************************************************************************/ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, const char *host_proto, - zbx_uint64_t proxy_hostid, char ipmi_authtype, unsigned char ipmi_privilege, const char *ipmi_username, - const char *ipmi_password, unsigned char tls_connect, + zbx_uint64_t proxy_hostid, signed char ipmi_authtype, unsigned char ipmi_privilege, + const char *ipmi_username, const char *ipmi_password, unsigned char tls_connect, unsigned char tls_accept, const char *tls_issuer, const char *tls_subject, const char *tls_psk_identity, const char *tls_psk, const zbx_vector_uint64_t *del_hostgroupids) { @@ -2935,7 +2935,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, (int)ipmi_authtype, (int)ipmi_privilege, ipmi_username, ipmi_password, (int)host->status, (int)ZBX_FLAG_DISCOVERY_CREATED, (int)tls_connect, (int)tls_accept, tls_issuer, tls_subject, tls_psk_identity, tls_psk, - host->custom_interfaces, host->inventory_mode); + host->custom_interfaces, (int)host->inventory_mode); } else { @@ -2986,7 +2986,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, d = ","; zbx_audit_host_update_json_update_ipmi_authtype(host->hostid, - host->ipmi_authtype_orig, (int)ipmi_authtype); + (int)host->ipmi_authtype_orig, (int)ipmi_authtype); } if (0 != (host->flags & ZBX_FLAG_LLD_HOST_UPDATE_IPMI_PRIV)) { @@ -4443,7 +4443,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows, zbx_uint64_t proxy_hostid; char *ipmi_username = NULL, *ipmi_password, *tls_issuer, *tls_subject, *tls_psk_identity, *tls_psk; - char ipmi_authtype, inventory_mode_proto; + signed char ipmi_authtype, inventory_mode_proto; unsigned char ipmi_privilege, tls_connect, tls_accept; zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__); @@ -4459,7 +4459,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows, if (NULL != (row = DBfetch(result))) { ZBX_DBROW2UINT64(proxy_hostid, row[0]); - ipmi_authtype = (char)atoi(row[1]); + ipmi_authtype = (signed char)atoi(row[1]); ZBX_STR2UCHAR(ipmi_privilege, row[2]); ipmi_username = zbx_strdup(NULL, row[3]); ipmi_password = zbx_strdup(NULL, row[4]); @@ -4520,7 +4520,7 @@ void lld_update_hosts(zbx_uint64_t lld_ruleid, const zbx_vector_ptr_t *lld_rows, if (SUCCEED == DBis_null(row[5])) inventory_mode_proto = HOST_INVENTORY_DISABLED; else - inventory_mode_proto = (char)atoi(row[5]); + inventory_mode_proto = (signed char)atoi(row[5]); lld_hosts_get(parent_hostid, &hosts, proxy_hostid, ipmi_authtype, ipmi_privilege, ipmi_username, ipmi_password, tls_connect, tls_accept, tls_issuer, tls_subject, |