diff options
author | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-05-06 13:32:39 +0300 |
---|---|---|
committer | Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> | 2022-05-06 13:32:39 +0300 |
commit | 2f05d9a4320a704c9ab2deb8e576cf2a949d3ca9 (patch) | |
tree | 9c11ac3d863f064fcca13499974675e35805a629 /src | |
parent | 0a5e4d334a24afdc9a33afef498d41a21a015015 (diff) |
........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 | 3 | ||||
-rw-r--r-- | src/libs/zbxdbhigh/template_item.c | 4 | ||||
-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 | 45 |
7 files changed, 39 insertions, 34 deletions
diff --git a/src/libs/zbxdbcache/dbconfig.c b/src/libs/zbxdbcache/dbconfig.c index d775d4c1690..ddb7b286fd2 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 = (int)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 1803755047b..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; - int inventory_mode_orig; - int 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 = 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])) { - int 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 = 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 9c2073a107a..0c4312689a3 100644 --- a/src/libs/zbxdbhigh/lld_override.c +++ b/src/libs/zbxdbhigh/lld_override.c @@ -240,7 +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]) ? 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/zbxdbhigh/template_item.c b/src/libs/zbxdbhigh/template_item.c index 505175fba72..863dd105dc1 100644 --- a/src/libs/zbxdbhigh/template_item.c +++ b/src/libs/zbxdbhigh/template_item.c @@ -2458,11 +2458,11 @@ static void save_template_lld_overrides(zbx_vector_ptr_t *overrides, zbx_hashset if (HOST_INVENTORY_COUNT != override_operation->inventory_mode) { zbx_db_insert_add_values(&db_insert_opinventory, override_operationid, - override_operation->inventory_mode); + (int)override_operation->inventory_mode); zbx_audit_discovery_rule_update_json_add_lld_override_opinventory((*pitem)->itemid, overrideid, override_operationid, - override_operation->inventory_mode); + (int)override_operation->inventory_mode); } override_operationid++; diff --git a/src/zabbix_server/lld/lld.c b/src/zabbix_server/lld/lld.c index 7888baa9544..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, - int *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 9204b439e0b..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, - int *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 5307c6765dd..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; - int inventory_mode; - int 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; - int 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, - int 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 (atoi(row[7]) != ipmi_authtype) + if ((signed char)atoi(row[7]) != ipmi_authtype) { - host->ipmi_authtype_orig = 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 = 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, - int 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, int 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) { @@ -2705,7 +2705,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, if (host->inventory_mode_orig != host->inventory_mode) { zbx_audit_host_update_json_update_inventory_mode(host->hostid, - host->inventory_mode_orig, host->inventory_mode); + (int)host->inventory_mode_orig, (int)host->inventory_mode); if (HOST_INVENTORY_DISABLED == host->inventory_mode) zbx_vector_uint64_append(&del_host_inventory_hostids, host->hostid); @@ -2916,7 +2916,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, host->hostid = hostid++; zbx_db_insert_add_values(&db_insert, host->hostid, host->host, host->name, proxy_hostid, - ipmi_authtype, (int)ipmi_privilege, ipmi_username, ipmi_password, + (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, (int)host->custom_interfaces); @@ -2926,13 +2926,16 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, zbx_db_insert_add_values(&db_insert_hdiscovery, host->hostid, parent_hostid, host_proto); if (HOST_INVENTORY_DISABLED != host->inventory_mode) - zbx_db_insert_add_values(&db_insert_hinventory, host->hostid, host->inventory_mode); + { + zbx_db_insert_add_values(&db_insert_hinventory, host->hostid, + (int)host->inventory_mode); + } zbx_audit_host_update_json_add_details(host->hostid, host->host, proxy_hostid, - ipmi_authtype, (int)ipmi_privilege, ipmi_username, ipmi_password, + (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 { @@ -2979,11 +2982,11 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, if (0 != (host->flags & ZBX_FLAG_LLD_HOST_UPDATE_IPMI_AUTH)) { zbx_snprintf_alloc(&sql1, &sql1_alloc, &sql1_offset, - "%sipmi_authtype=%d", d, ipmi_authtype); + "%sipmi_authtype=%d", d, (int)ipmi_authtype); d = ","; zbx_audit_host_update_json_update_ipmi_authtype(host->hostid, - host->ipmi_authtype_orig, ipmi_authtype); + (int)host->ipmi_authtype_orig, (int)ipmi_authtype); } if (0 != (host->flags & ZBX_FLAG_LLD_HOST_UPDATE_IPMI_PRIV)) { @@ -3109,7 +3112,7 @@ static void lld_hosts_save(zbx_uint64_t parent_hostid, zbx_vector_ptr_t *hosts, if (host->inventory_mode_orig != host->inventory_mode && HOST_INVENTORY_DISABLED == host->inventory_mode_orig) { - zbx_db_insert_add_values(&db_insert_hinventory, host->hostid, host->inventory_mode); + zbx_db_insert_add_values(&db_insert_hinventory, host->hostid, (int)host->inventory_mode); } if (0 != (host->flags & ZBX_FLAG_LLD_HOST_UPDATE_HOST)) @@ -4440,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; - int 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__); @@ -4456,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 = 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]); @@ -4517,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 = 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, |