--- zzzz-none-000/linux-4.4.60/include/net/ipv6.h 2017-04-08 07:53:53.000000000 +0000 +++ scorpion-7490-727/linux-4.4.60/include/net/ipv6.h 2021-02-04 17:41:59.000000000 +0000 @@ -107,7 +107,7 @@ __u8 reserved; __be16 frag_off; __be32 identification; -}; +} __attribute__((packed, aligned(2))); #define IP6_MF 0x0001 #define IP6_OFFSET 0xFFF8 @@ -417,8 +417,8 @@ } #endif #endif - addr[0] = wh; - addr[1] = wl; + net_hdr_word(&addr[0]) = wh; + net_hdr_word(&addr[1]) = wl; } static inline void ipv6_addr_set(struct in6_addr *addr, @@ -477,6 +477,8 @@ const __be32 *a1 = addr1->s6_addr32; const __be32 *a2 = addr2->s6_addr32; unsigned int pdw, pbi; + /* Used for last <32-bit fraction of prefix */ + u32 pbia1, pbia2; /* check complete u32 in prefix */ pdw = prefixlen >> 5; @@ -485,7 +487,9 @@ /* check incomplete u32 in prefix */ pbi = prefixlen & 0x1f; - if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi)))) + pbia1 = net_hdr_word(&a1[pdw]); + pbia2 = net_hdr_word(&a2[pdw]); + if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi)))) return false; return true; @@ -629,13 +633,13 @@ */ static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen) { - const __be32 *a1 = token1, *a2 = token2; + const struct in6_addr *a1 = token1, *a2 = token2; int i; addrlen >>= 2; for (i = 0; i < addrlen; i++) { - __be32 xb = a1[i] ^ a2[i]; + __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i]; if (xb) return i * 32 + 31 - __fls(ntohl(xb)); } @@ -799,17 +803,18 @@ static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass, __be32 flowlabel) { - *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel; + net_hdr_word((__be32 *)hdr) = + htonl(0x60000000 | (tclass << 20)) | flowlabel; } static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr) { - return *(__be32 *)hdr & IPV6_FLOWINFO_MASK; + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK; } static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr) { - return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK; + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK; } static inline u8 ip6_tclass(__be32 flowinfo)