unaligned accesses in arp_tables.c
PATCH 1/1 unaligned accesses in arp_tables.c
On ia64, I was getting a ton of unaligned accesses from this bit of code in ipv4/netfilter/arp_tables.c:
/* Look for ifname matches; this should unroll nicely. */
for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
ret |= (((const unsigned long *)indev)[i]
^ ((const unsigned long *)arpinfo->iniface)[i])
& ((const unsigned long *)arpinfo->iniface_mask)[i];
}Alex Williamson suggested that I move 'u_int16_t invflags' up above 'char iniface[IFNAMSIZ]' in struct arpt_arp, since the u_int8_t is screwing up the alignment. Here's the patch I've been using to get around this on 2.4.24/25:
include/linux/netfilter_arp/arp_tables.h 2004-01-17 11:15:50.000000000 -0700 renamed from include/linux/netfilter_arp/arp_tables.h~ 2003-08-25 05:44:44.000000000 -0600 +3 -2
@@ -52,13 +52,14 @@ * so there is no use in offering a way to do filtering on it. */ + /* Inverse flags */ + u_int16_t invflags; + char iniface[IFNAMSIZ], outiface[IFNAMSIZ]; unsigned char iniface_mask[IFNAMSIZ], outiface_mask[IFNAMSIZ]; /* Flags word */ u_int8_t flags; - /* Inverse flags */ - u_int16_t invflags; }; struct arpt_entry_target