Also, try the attached patch with a standard build, i.e. optimization
turned on and no special flags like -fno-builtin-memcpy.
I would be curious if the cast-to-char changes the memcpy inlining
behavior to prevent the alignment fault.
Thanks,
James
--- openvpn-2.0_rc5/mroute.c 2004-12-02 14:12:03.000000000 -0600
+++ mroute.c 2004-12-17 00:51:53.274416872 -0600
@@ -109,14 +109,14 @@
src->type = MR_ADDR_IPV4;
src->netbits = 0;
src->len = 4;
- memcpy (src->addr, &ip->saddr, 4);
+ memcpy (src->addr, (uint8_t*)&ip->saddr, 4);
}
if (dest)
{
dest->type = MR_ADDR_IPV4;
dest->netbits = 0;
dest->len = 4;
- memcpy (dest->addr, &ip->daddr, 4);
+ memcpy (dest->addr, (uint8_t*)&ip->daddr, 4);
/* mcast address? */
if (((*(in_addr_t*)dest->addr) &
htonl(IP_MCAST_SUBNET_MASK)) == htonl(IP_MCAST_NETWORK))
@@ -147,14 +147,14 @@
src->type = MR_ADDR_ETHER;
src->netbits = 0;
src->len = 6;
- memcpy (src->addr, eth->source, 6);
+ memcpy (src->addr, (uint8_t*)eth->source, 6);
}
if (dest)
{
dest->type = MR_ADDR_ETHER;
dest->netbits = 0;
dest->len = 6;
- memcpy (dest->addr, eth->dest, 6);
+ memcpy (dest->addr, (uint8_t*)eth->dest, 6);
/* ethernet broadcast/multicast packet? */
if (is_mac_mcast_addr (eth->dest))