From: Felix Fietkau Date: Sun, 13 Jan 2013 13:06:09 +0000 (+0000) Subject: ar71xx: avoid __packed define in the unaligned access hack patch, make the ipv6 addre... X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=53e0ba49b92bb8dbfc87a0883bd0bb5821c0e9d1;p=openwrt%2Fstaging%2Fldir.git ar71xx: avoid __packed define in the unaligned access hack patch, make the ipv6 address struct also 2-byte-aligned/packed SVN-Revision: 35127 --- 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 7e4cf9feac..9145919abe 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) ||