--- zzzz-none-000/linux-4.4.271/include/net/ipv6.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/include/net/ipv6.h 2023-04-19 10:22:30.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 @@ -411,8 +411,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, @@ -471,6 +471,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; @@ -479,7 +481,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; @@ -608,13 +612,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)); } @@ -783,17 +787,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) @@ -821,6 +826,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); +void ip6_input_init(void); int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb),