From e0a9bd604d2a6f97215a978eb02f2556bf5492ea Mon Sep 17 00:00:00 2001 From: nbd Date: Sun, 13 Jan 2013 13:06:09 +0000 Subject: ar71xx: avoid __packed define in the unaligned access hack patch, make the ipv6 address struct also 2-byte-aligned/packed git-svn-id: svn://svn.openwrt.org/openwrt/trunk@35127 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../patches-3.7/902-unaligned_access_hacks.patch | 43 +++++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'target/linux') diff --git a/target/linux/ar71xx/patches-3.7/902-unaligned_access_hacks.patch b/target/linux/ar71xx/patches-3.7/902-unaligned_access_hacks.patch index 7e4cf9fea..9145919ab 100644 --- a/target/linux/ar71xx/patches-3.7/902-unaligned_access_hacks.patch +++ b/target/linux/ar71xx/patches-3.7/902-unaligned_access_hacks.patch @@ -57,7 +57,7 @@ __be32 daddr; /*The options start here. */ -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); struct ip_auth_hdr { @@ -68,7 +68,7 @@ struct in6_addr saddr; struct in6_addr daddr; -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); /* index values for the variables in ipv6_devconf */ @@ -79,7 +79,7 @@ __sum16 check; __be16 urg_ptr; -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); /* * The union cast uses a gcc extension to avoid aliasing problems @@ -88,7 +88,7 @@ struct tcphdr hdr; __be32 words[5]; -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) @@ -99,7 +99,7 @@ __be16 len; __sum16 check; -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); /* UDP socket options */ #define UDP_CORK 1 /* Never send partially complete segments */ @@ -131,7 +131,7 @@ } frag; } un; -}; -+} __packed __attribute__((aligned(2))); ++} __attribute__((packed, aligned(2))); /* @@ -156,3 +156,34 @@ return true; } return false; +--- a/include/uapi/linux/in6.h ++++ b/include/uapi/linux/in6.h +@@ -36,7 +36,7 @@ struct in6_addr { + #define s6_addr in6_u.u6_addr8 + #define s6_addr16 in6_u.u6_addr16 + #define s6_addr32 in6_u.u6_addr32 +-}; ++} __attribute__((packed, aligned(2))); + + /* IPv6 Wildcard Address (::) and Loopback Address (::1) defined in RFC2553 + * NOTE: Be aware the IN6ADDR_* constants and in6addr_* externals are defined +--- a/net/ipv6/af_inet6.c ++++ b/net/ipv6/af_inet6.c +@@ -61,6 +61,7 @@ + #endif + + #include ++#include + #include + + MODULE_AUTHOR("Cast of dozens"); +@@ -880,7 +881,8 @@ static struct sk_buff **ipv6_gro_receive + continue; + + iph2 = ipv6_hdr(p); +- first_word = *(__be32 *)iph ^ *(__be32 *)iph2 ; ++ first_word = __get_unaligned_cpu32((__u32 *) iph) ^ ++ __get_unaligned_cpu32((__u32 *) iph2); + + /* All fields must match except length and Traffic Class. */ + if (nlen != skb_network_header_len(p) || -- cgit v1.2.3