}
#endif
+unsigned int bitfield_to_int(void *bitfield, size_t size) {
+ unsigned int value = 0;
+ if(size > sizeof value)
+ size = sizeof value;
+ memcpy(&value, bitfield, size);
+ return value;
+}
#define strerror(x) ((x)>0?strerror(x):winerror(GetLastError()))
#endif
+extern unsigned int bitfield_to_int(void *bitfield, size_t size);
+
#endif /* __TINC_UTILS_H__ */
for(node = connection_tree->head; node; node = node->next) {
c = node->data;
logger(LOG_DEBUG, _(" %s at %s options %lx socket %d status %04x outbuf %d/%d/%d"),
- c->name, c->hostname, c->options, c->socket, *(uint32_t *)&c->status,
+ c->name, c->hostname, c->options, c->socket, bitfield_to_int(&c->status, sizeof c->status),
c->outbufsize, c->outbufstart, c->outbuflen);
}
} else {
if(c->status.remove) {
logger(LOG_WARNING, _("Old connection_t for %s (%s) status %04x still lingering, deleting..."),
- c->name, c->hostname, *(uint32_t *)&c->status);
+ c->name, c->hostname, bitfield_to_int(&c->status, sizeof c->status));
connection_del(c);
continue;
}