diff options
Diffstat (limited to 'main/openvpn/src/openvpn/mroute.h')
-rw-r--r-- | main/openvpn/src/openvpn/mroute.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/main/openvpn/src/openvpn/mroute.h b/main/openvpn/src/openvpn/mroute.h index 608f70be..60653f96 100644 --- a/main/openvpn/src/openvpn/mroute.h +++ b/main/openvpn/src/openvpn/mroute.h @@ -186,19 +186,23 @@ mroute_addr_hash_len (const struct mroute_addr *a) static inline void mroute_extract_in_addr_t (struct mroute_addr *dest, const in_addr_t src) { + uint32_t tmp_addr = htonl (src); dest->type = MR_ADDR_IPV4; dest->netbits = 0; dest->len = 4; - *(in_addr_t*)dest->addr = htonl (src); + memcpy(dest->addr, &tmp_addr, sizeof(uint32_t)); } static inline in_addr_t in_addr_t_from_mroute_addr (const struct mroute_addr *addr) { - if ((addr->type & MR_ADDR_MASK) == MR_ADDR_IPV4 && addr->netbits == 0 && addr->len == 4) - return ntohl(*(in_addr_t*)addr->addr); - else + if ((addr->type & MR_ADDR_MASK) == MR_ADDR_IPV4 && addr->netbits == 0 && addr->len == 4) { + uint32_t tmp = 0; + memcpy(&tmp, addr->addr, sizeof(uint32_t)); + return ntohl(tmp); + } else { return 0; + } } static inline void |