1
0
mirror of http://git.haproxy.org/git/haproxy.git/ synced 2024-12-28 07:32:15 +00:00

CLEANUP: stick-tables: use read_u32() to display a node's key

This fixes another aliasing issue that pops up in stick_table.c
and peers.c's debug code.
This commit is contained in:
Willy Tarreau 2020-02-25 09:41:22 +01:00
parent 8b5075806d
commit 6cde5d883c
2 changed files with 4 additions and 2 deletions

View File

@ -22,6 +22,7 @@
#include <common/compat.h>
#include <common/config.h>
#include <common/net_helper.h>
#include <common/time.h>
#include <common/standard.h>
#include <common/hathreads.h>
@ -475,7 +476,7 @@ static int peer_prepare_updatemsg(char *msg, size_t size, struct peer_prep_param
cursor += stlen;
}
else if (st->table->type == SMP_T_SINT) {
netinteger = htonl(*((uint32_t *)ts->key.key));
netinteger = htonl(read_u32(ts->key.key));
memcpy(cursor, &netinteger, sizeof(netinteger));
cursor += sizeof(netinteger);
}

View File

@ -19,6 +19,7 @@
#include <common/initcall.h>
#include <common/memory.h>
#include <common/mini-clist.h>
#include <common/net_helper.h>
#include <common/standard.h>
#include <common/time.h>
@ -3366,7 +3367,7 @@ static int table_dump_entry_to_buffer(struct buffer *msg,
chunk_appendf(msg, " key=%s", addr);
}
else if (t->type == SMP_T_SINT) {
chunk_appendf(msg, " key=%u", *(unsigned int *)entry->key.key);
chunk_appendf(msg, " key=%u", read_u32(entry->key.key));
}
else if (t->type == SMP_T_STR) {
chunk_appendf(msg, " key=");