[Bug 84] New: Unaligned access in ip_tables.c:ip_packet_match

bugzilla-daemon@netfilter.org bugzilla-daemon@netfilter.org
Thu, 24 Apr 2003 13:48:55 +0200


https://bugzilla.netfilter.org/cgi-bin/bugzilla/show_bug.cgi?id=84

           Summary: Unaligned access in ip_tables.c:ip_packet_match
           Product: netfilter/iptables
           Version: linux-2.5.x
          Platform: alpha
        OS/Version: Debian GNU/Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: ip_tables (kernel)
        AssignedTo: laforge@netfilter.org
        ReportedBy: falk@debian.org
                CC: netfilter-buglog@lists.netfilter.org


I get tons of unaligned accesses in that function from code like this:

        /* Look for ifname matches; this should unroll nicely. */
	for (i = 0, ret = 0; i < IFNAMSIZ/sizeof(unsigned long); i++) {
		ret |= (((const unsigned long *)outdev)[i]
			^ ((const unsigned long *)ipinfo->outiface)[i])
			& ((const unsigned long *)ipinfo->outiface_mask)[i];
	}

The problem is that nulldevname is not long aligned since it is just a character
array. So either it needs extra alignment, or the loop needs to be expressed
different (note that gcc does never unroll loops by default except for constant
loop count 1. It does optimize memcmp and strncmp, though, so maybe it can be
expressed with those.)



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.