910-unaligned_access_hacks.patch 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. --- a/arch/mips/include/asm/checksum.h
  2. +++ b/arch/mips/include/asm/checksum.h
  3. @@ -134,26 +134,30 @@ static inline __sum16 ip_fast_csum(const
  4. const unsigned int *stop = word + ihl;
  5. unsigned int csum;
  6. int carry;
  7. + unsigned int w;
  8. - csum = word[0];
  9. - csum += word[1];
  10. - carry = (csum < word[1]);
  11. + csum = net_hdr_word(word++);
  12. +
  13. + w = net_hdr_word(word++);
  14. + csum += w;
  15. + carry = (csum < w);
  16. csum += carry;
  17. - csum += word[2];
  18. - carry = (csum < word[2]);
  19. + w = net_hdr_word(word++);
  20. + csum += w;
  21. + carry = (csum < w);
  22. csum += carry;
  23. - csum += word[3];
  24. - carry = (csum < word[3]);
  25. + w = net_hdr_word(word++);
  26. + csum += w;
  27. + carry = (csum < w);
  28. csum += carry;
  29. - word += 4;
  30. do {
  31. - csum += *word;
  32. - carry = (csum < *word);
  33. + w = net_hdr_word(word++);
  34. + csum += w;
  35. + carry = (csum < w);
  36. csum += carry;
  37. - word++;
  38. } while (word != stop);
  39. return csum_fold(csum);
  40. @@ -214,73 +218,6 @@ static inline __sum16 ip_compute_csum(co
  41. return csum_fold(csum_partial(buff, len, 0));
  42. }
  43. -#define _HAVE_ARCH_IPV6_CSUM
  44. -static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
  45. - const struct in6_addr *daddr,
  46. - __u32 len, __u8 proto,
  47. - __wsum sum)
  48. -{
  49. - __wsum tmp;
  50. -
  51. - __asm__(
  52. - " .set push # csum_ipv6_magic\n"
  53. - " .set noreorder \n"
  54. - " .set noat \n"
  55. - " addu %0, %5 # proto (long in network byte order)\n"
  56. - " sltu $1, %0, %5 \n"
  57. - " addu %0, $1 \n"
  58. -
  59. - " addu %0, %6 # csum\n"
  60. - " sltu $1, %0, %6 \n"
  61. - " lw %1, 0(%2) # four words source address\n"
  62. - " addu %0, $1 \n"
  63. - " addu %0, %1 \n"
  64. - " sltu $1, %0, %1 \n"
  65. -
  66. - " lw %1, 4(%2) \n"
  67. - " addu %0, $1 \n"
  68. - " addu %0, %1 \n"
  69. - " sltu $1, %0, %1 \n"
  70. -
  71. - " lw %1, 8(%2) \n"
  72. - " addu %0, $1 \n"
  73. - " addu %0, %1 \n"
  74. - " sltu $1, %0, %1 \n"
  75. -
  76. - " lw %1, 12(%2) \n"
  77. - " addu %0, $1 \n"
  78. - " addu %0, %1 \n"
  79. - " sltu $1, %0, %1 \n"
  80. -
  81. - " lw %1, 0(%3) \n"
  82. - " addu %0, $1 \n"
  83. - " addu %0, %1 \n"
  84. - " sltu $1, %0, %1 \n"
  85. -
  86. - " lw %1, 4(%3) \n"
  87. - " addu %0, $1 \n"
  88. - " addu %0, %1 \n"
  89. - " sltu $1, %0, %1 \n"
  90. -
  91. - " lw %1, 8(%3) \n"
  92. - " addu %0, $1 \n"
  93. - " addu %0, %1 \n"
  94. - " sltu $1, %0, %1 \n"
  95. -
  96. - " lw %1, 12(%3) \n"
  97. - " addu %0, $1 \n"
  98. - " addu %0, %1 \n"
  99. - " sltu $1, %0, %1 \n"
  100. -
  101. - " addu %0, $1 # Add final carry\n"
  102. - " .set pop"
  103. - : "=&r" (sum), "=&r" (tmp)
  104. - : "r" (saddr), "r" (daddr),
  105. - "0" (htonl(len)), "r" (htonl(proto)), "r" (sum));
  106. -
  107. - return csum_fold(sum);
  108. -}
  109. -
  110. #include <asm-generic/checksum.h>
  111. #endif /* CONFIG_GENERIC_CSUM */
  112. --- a/include/uapi/linux/ip.h
  113. +++ b/include/uapi/linux/ip.h
  114. @@ -102,7 +102,7 @@ struct iphdr {
  115. __be32 saddr;
  116. __be32 daddr;
  117. /*The options start here. */
  118. -};
  119. +} __attribute__((packed, aligned(2)));
  120. struct ip_auth_hdr {
  121. --- a/include/uapi/linux/ipv6.h
  122. +++ b/include/uapi/linux/ipv6.h
  123. @@ -129,7 +129,7 @@ struct ipv6hdr {
  124. struct in6_addr saddr;
  125. struct in6_addr daddr;
  126. -};
  127. +} __attribute__((packed, aligned(2)));
  128. /* index values for the variables in ipv6_devconf */
  129. --- a/include/uapi/linux/tcp.h
  130. +++ b/include/uapi/linux/tcp.h
  131. @@ -54,7 +54,7 @@ struct tcphdr {
  132. __be16 window;
  133. __sum16 check;
  134. __be16 urg_ptr;
  135. -};
  136. +} __attribute__((packed, aligned(2)));
  137. /*
  138. * The union cast uses a gcc extension to avoid aliasing problems
  139. @@ -64,7 +64,7 @@ struct tcphdr {
  140. union tcp_word_hdr {
  141. struct tcphdr hdr;
  142. __be32 words[5];
  143. -};
  144. +} __attribute__((packed, aligned(2)));
  145. #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
  146. --- a/include/uapi/linux/udp.h
  147. +++ b/include/uapi/linux/udp.h
  148. @@ -24,7 +24,7 @@ struct udphdr {
  149. __be16 dest;
  150. __be16 len;
  151. __sum16 check;
  152. -};
  153. +} __attribute__((packed, aligned(2)));
  154. /* UDP socket options */
  155. #define UDP_CORK 1 /* Never send partially complete segments */
  156. --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
  157. +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
  158. @@ -41,8 +41,8 @@ static bool ipv4_pkt_to_tuple(const stru
  159. if (ap == NULL)
  160. return false;
  161. - tuple->src.u3.ip = ap[0];
  162. - tuple->dst.u3.ip = ap[1];
  163. + tuple->src.u3.ip = net_hdr_word(ap++);
  164. + tuple->dst.u3.ip = net_hdr_word(ap);
  165. return true;
  166. }
  167. --- a/include/uapi/linux/icmp.h
  168. +++ b/include/uapi/linux/icmp.h
  169. @@ -81,7 +81,7 @@ struct icmphdr {
  170. } frag;
  171. __u8 reserved[4];
  172. } un;
  173. -};
  174. +} __attribute__((packed, aligned(2)));
  175. /*
  176. --- a/include/uapi/linux/in6.h
  177. +++ b/include/uapi/linux/in6.h
  178. @@ -42,7 +42,7 @@ struct in6_addr {
  179. #define s6_addr16 in6_u.u6_addr16
  180. #define s6_addr32 in6_u.u6_addr32
  181. #endif
  182. -};
  183. +} __attribute__((packed, aligned(2)));
  184. #endif /* __UAPI_DEF_IN6_ADDR */
  185. #if __UAPI_DEF_SOCKADDR_IN6
  186. --- a/net/ipv6/tcp_ipv6.c
  187. +++ b/net/ipv6/tcp_ipv6.c
  188. @@ -39,6 +39,7 @@
  189. #include <linux/ipsec.h>
  190. #include <linux/times.h>
  191. #include <linux/slab.h>
  192. +#include <asm/unaligned.h>
  193. #include <linux/uaccess.h>
  194. #include <linux/ipv6.h>
  195. #include <linux/icmpv6.h>
  196. @@ -796,10 +797,10 @@ static void tcp_v6_send_response(const s
  197. topt = (__be32 *)(t1 + 1);
  198. if (tsecr) {
  199. - *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
  200. - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
  201. - *topt++ = htonl(tsval);
  202. - *topt++ = htonl(tsecr);
  203. + put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
  204. + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++);
  205. + put_unaligned_be32(tsval, topt++);
  206. + put_unaligned_be32(tsecr, topt++);
  207. }
  208. #ifdef CONFIG_TCP_MD5SIG
  209. --- a/include/linux/ipv6.h
  210. +++ b/include/linux/ipv6.h
  211. @@ -5,6 +5,7 @@
  212. #define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
  213. #define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
  214. +
  215. /*
  216. * This structure contains configuration options per IPv6 link.
  217. */
  218. --- a/net/ipv6/datagram.c
  219. +++ b/net/ipv6/datagram.c
  220. @@ -471,7 +471,7 @@ int ipv6_recv_error(struct sock *sk, str
  221. ipv6_iface_scope_id(&sin->sin6_addr,
  222. IP6CB(skb)->iif);
  223. } else {
  224. - ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
  225. + ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset),
  226. &sin->sin6_addr);
  227. sin->sin6_scope_id = 0;
  228. }
  229. @@ -814,12 +814,12 @@ int ip6_datagram_send_ctl(struct net *ne
  230. }
  231. if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
  232. - if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
  233. + if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) {
  234. err = -EINVAL;
  235. goto exit_f;
  236. }
  237. }
  238. - fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
  239. + fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg));
  240. break;
  241. case IPV6_2292HOPOPTS:
  242. --- a/net/ipv6/ip6_gre.c
  243. +++ b/net/ipv6/ip6_gre.c
  244. @@ -395,7 +395,7 @@ static void ip6gre_err(struct sk_buff *s
  245. return;
  246. ipv6h = (const struct ipv6hdr *)skb->data;
  247. greh = (const struct gre_base_hdr *)(skb->data + offset);
  248. - key = key_off ? *(__be32 *)(skb->data + key_off) : 0;
  249. + key = key_off ? net_hdr_word((__be32 *)(skb->data + key_off)) : 0;
  250. t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
  251. key, greh->protocol);
  252. --- a/net/ipv6/exthdrs.c
  253. +++ b/net/ipv6/exthdrs.c
  254. @@ -574,7 +574,7 @@ static bool ipv6_hop_jumbo(struct sk_buf
  255. goto drop;
  256. }
  257. - pkt_len = ntohl(*(__be32 *)(nh + optoff + 2));
  258. + pkt_len = ntohl(net_hdr_word(nh + optoff + 2));
  259. if (pkt_len <= IPV6_MAXPLEN) {
  260. __IP6_INC_STATS(net, ipv6_skb_idev(skb),
  261. IPSTATS_MIB_INHDRERRORS);
  262. --- a/include/linux/types.h
  263. +++ b/include/linux/types.h
  264. @@ -231,5 +231,11 @@ typedef void (*call_rcu_func_t)(struct r
  265. /* clocksource cycle base type */
  266. typedef u64 cycle_t;
  267. +struct net_hdr_word {
  268. + u32 words[1];
  269. +} __attribute__((packed, aligned(2)));
  270. +
  271. +#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0])
  272. +
  273. #endif /* __ASSEMBLY__ */
  274. #endif /* _LINUX_TYPES_H */
  275. --- a/net/ipv4/af_inet.c
  276. +++ b/net/ipv4/af_inet.c
  277. @@ -1318,8 +1318,8 @@ struct sk_buff **inet_gro_receive(struct
  278. if (unlikely(ip_fast_csum((u8 *)iph, 5)))
  279. goto out_unlock;
  280. - id = ntohl(*(__be32 *)&iph->id);
  281. - flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF));
  282. + id = ntohl(net_hdr_word(&iph->id));
  283. + flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF));
  284. id >>= 16;
  285. for (p = *head; p; p = p->next) {
  286. --- a/net/ipv4/route.c
  287. +++ b/net/ipv4/route.c
  288. @@ -458,7 +458,7 @@ static struct neighbour *ipv4_neigh_look
  289. else if (skb)
  290. pkey = &ip_hdr(skb)->daddr;
  291. - n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey);
  292. + n = __ipv4_neigh_lookup(dev, net_hdr_word(pkey));
  293. if (n)
  294. return n;
  295. return neigh_create(&arp_tbl, pkey, dev);
  296. --- a/net/ipv4/tcp_output.c
  297. +++ b/net/ipv4/tcp_output.c
  298. @@ -448,48 +448,53 @@ static void tcp_options_write(__be32 *pt
  299. u16 options = opts->options; /* mungable copy */
  300. if (unlikely(OPTION_MD5 & options)) {
  301. - *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
  302. - (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
  303. + net_hdr_word(ptr++) =
  304. + htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
  305. + (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
  306. /* overload cookie hash location */
  307. opts->hash_location = (__u8 *)ptr;
  308. ptr += 4;
  309. }
  310. if (unlikely(opts->mss)) {
  311. - *ptr++ = htonl((TCPOPT_MSS << 24) |
  312. - (TCPOLEN_MSS << 16) |
  313. - opts->mss);
  314. + net_hdr_word(ptr++) =
  315. + htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) |
  316. + opts->mss);
  317. }
  318. if (likely(OPTION_TS & options)) {
  319. if (unlikely(OPTION_SACK_ADVERTISE & options)) {
  320. - *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
  321. - (TCPOLEN_SACK_PERM << 16) |
  322. - (TCPOPT_TIMESTAMP << 8) |
  323. - TCPOLEN_TIMESTAMP);
  324. + net_hdr_word(ptr++) =
  325. + htonl((TCPOPT_SACK_PERM << 24) |
  326. + (TCPOLEN_SACK_PERM << 16) |
  327. + (TCPOPT_TIMESTAMP << 8) |
  328. + TCPOLEN_TIMESTAMP);
  329. options &= ~OPTION_SACK_ADVERTISE;
  330. } else {
  331. - *ptr++ = htonl((TCPOPT_NOP << 24) |
  332. - (TCPOPT_NOP << 16) |
  333. - (TCPOPT_TIMESTAMP << 8) |
  334. - TCPOLEN_TIMESTAMP);
  335. + net_hdr_word(ptr++) =
  336. + htonl((TCPOPT_NOP << 24) |
  337. + (TCPOPT_NOP << 16) |
  338. + (TCPOPT_TIMESTAMP << 8) |
  339. + TCPOLEN_TIMESTAMP);
  340. }
  341. - *ptr++ = htonl(opts->tsval);
  342. - *ptr++ = htonl(opts->tsecr);
  343. + net_hdr_word(ptr++) = htonl(opts->tsval);
  344. + net_hdr_word(ptr++) = htonl(opts->tsecr);
  345. }
  346. if (unlikely(OPTION_SACK_ADVERTISE & options)) {
  347. - *ptr++ = htonl((TCPOPT_NOP << 24) |
  348. - (TCPOPT_NOP << 16) |
  349. - (TCPOPT_SACK_PERM << 8) |
  350. - TCPOLEN_SACK_PERM);
  351. + net_hdr_word(ptr++) =
  352. + htonl((TCPOPT_NOP << 24) |
  353. + (TCPOPT_NOP << 16) |
  354. + (TCPOPT_SACK_PERM << 8) |
  355. + TCPOLEN_SACK_PERM);
  356. }
  357. if (unlikely(OPTION_WSCALE & options)) {
  358. - *ptr++ = htonl((TCPOPT_NOP << 24) |
  359. - (TCPOPT_WINDOW << 16) |
  360. - (TCPOLEN_WINDOW << 8) |
  361. - opts->ws);
  362. + net_hdr_word(ptr++) =
  363. + htonl((TCPOPT_NOP << 24) |
  364. + (TCPOPT_WINDOW << 16) |
  365. + (TCPOLEN_WINDOW << 8) |
  366. + opts->ws);
  367. }
  368. if (unlikely(opts->num_sack_blocks)) {
  369. @@ -497,16 +502,17 @@ static void tcp_options_write(__be32 *pt
  370. tp->duplicate_sack : tp->selective_acks;
  371. int this_sack;
  372. - *ptr++ = htonl((TCPOPT_NOP << 24) |
  373. - (TCPOPT_NOP << 16) |
  374. - (TCPOPT_SACK << 8) |
  375. - (TCPOLEN_SACK_BASE + (opts->num_sack_blocks *
  376. + net_hdr_word(ptr++) =
  377. + htonl((TCPOPT_NOP << 24) |
  378. + (TCPOPT_NOP << 16) |
  379. + (TCPOPT_SACK << 8) |
  380. + (TCPOLEN_SACK_BASE + (opts->num_sack_blocks *
  381. TCPOLEN_SACK_PERBLOCK)));
  382. for (this_sack = 0; this_sack < opts->num_sack_blocks;
  383. ++this_sack) {
  384. - *ptr++ = htonl(sp[this_sack].start_seq);
  385. - *ptr++ = htonl(sp[this_sack].end_seq);
  386. + net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq);
  387. + net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq);
  388. }
  389. tp->rx_opt.dsack = 0;
  390. @@ -519,13 +525,14 @@ static void tcp_options_write(__be32 *pt
  391. if (foc->exp) {
  392. len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
  393. - *ptr = htonl((TCPOPT_EXP << 24) | (len << 16) |
  394. + net_hdr_word(ptr) =
  395. + htonl((TCPOPT_EXP << 24) | (len << 16) |
  396. TCPOPT_FASTOPEN_MAGIC);
  397. p += TCPOLEN_EXP_FASTOPEN_BASE;
  398. } else {
  399. len = TCPOLEN_FASTOPEN_BASE + foc->len;
  400. - *p++ = TCPOPT_FASTOPEN;
  401. - *p++ = len;
  402. + net_hdr_word(p++) = TCPOPT_FASTOPEN;
  403. + net_hdr_word(p++) = len;
  404. }
  405. memcpy(p, foc->val, foc->len);
  406. --- a/net/ipv4/igmp.c
  407. +++ b/net/ipv4/igmp.c
  408. @@ -537,7 +537,7 @@ static struct sk_buff *add_grec(struct s
  409. if (!skb)
  410. return NULL;
  411. psrc = (__be32 *)skb_put(skb, sizeof(__be32));
  412. - *psrc = psf->sf_inaddr;
  413. + net_hdr_word(psrc) = psf->sf_inaddr;
  414. scount++; stotal++;
  415. if ((type == IGMPV3_ALLOW_NEW_SOURCES ||
  416. type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) {
  417. --- a/include/uapi/linux/igmp.h
  418. +++ b/include/uapi/linux/igmp.h
  419. @@ -32,7 +32,7 @@ struct igmphdr {
  420. __u8 code; /* For newer IGMP */
  421. __sum16 csum;
  422. __be32 group;
  423. -};
  424. +} __attribute__((packed, aligned(2)));
  425. /* V3 group record types [grec_type] */
  426. #define IGMPV3_MODE_IS_INCLUDE 1
  427. @@ -48,7 +48,7 @@ struct igmpv3_grec {
  428. __be16 grec_nsrcs;
  429. __be32 grec_mca;
  430. __be32 grec_src[0];
  431. -};
  432. +} __attribute__((packed, aligned(2)));
  433. struct igmpv3_report {
  434. __u8 type;
  435. @@ -57,7 +57,7 @@ struct igmpv3_report {
  436. __be16 resv2;
  437. __be16 ngrec;
  438. struct igmpv3_grec grec[0];
  439. -};
  440. +} __attribute__((packed, aligned(2)));
  441. struct igmpv3_query {
  442. __u8 type;
  443. @@ -78,7 +78,7 @@ struct igmpv3_query {
  444. __u8 qqic;
  445. __be16 nsrcs;
  446. __be32 srcs[0];
  447. -};
  448. +} __attribute__((packed, aligned(2)));
  449. #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
  450. #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
  451. --- a/net/core/flow_dissector.c
  452. +++ b/net/core/flow_dissector.c
  453. @@ -84,7 +84,7 @@ __be32 __skb_flow_get_ports(const struct
  454. ports = __skb_header_pointer(skb, thoff + poff,
  455. sizeof(_ports), data, hlen, &_ports);
  456. if (ports)
  457. - return *ports;
  458. + return (__be32)net_hdr_word(ports);
  459. }
  460. return 0;
  461. --- a/include/uapi/linux/icmpv6.h
  462. +++ b/include/uapi/linux/icmpv6.h
  463. @@ -76,7 +76,7 @@ struct icmp6hdr {
  464. #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
  465. #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
  466. #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
  467. -};
  468. +} __attribute__((packed, aligned(2)));
  469. #define ICMPV6_ROUTER_PREF_LOW 0x3
  470. --- a/include/net/ndisc.h
  471. +++ b/include/net/ndisc.h
  472. @@ -87,7 +87,7 @@ struct ra_msg {
  473. struct icmp6hdr icmph;
  474. __be32 reachable_time;
  475. __be32 retrans_timer;
  476. -};
  477. +} __attribute__((packed, aligned(2)));
  478. struct rd_msg {
  479. struct icmp6hdr icmph;
  480. @@ -365,10 +365,10 @@ static inline u32 ndisc_hashfn(const voi
  481. {
  482. const u32 *p32 = pkey;
  483. - return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
  484. - (p32[1] * hash_rnd[1]) +
  485. - (p32[2] * hash_rnd[2]) +
  486. - (p32[3] * hash_rnd[3]));
  487. + return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) +
  488. + (net_hdr_word(&p32[1]) * hash_rnd[1]) +
  489. + (net_hdr_word(&p32[2]) * hash_rnd[2]) +
  490. + (net_hdr_word(&p32[3]) * hash_rnd[3]));
  491. }
  492. static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
  493. --- a/net/sched/cls_u32.c
  494. +++ b/net/sched/cls_u32.c
  495. @@ -159,7 +159,7 @@ next_knode:
  496. data = skb_header_pointer(skb, toff, 4, &hdata);
  497. if (!data)
  498. goto out;
  499. - if ((*data ^ key->val) & key->mask) {
  500. + if ((net_hdr_word(data) ^ key->val) & key->mask) {
  501. n = rcu_dereference_bh(n->next);
  502. goto next_knode;
  503. }
  504. @@ -212,8 +212,8 @@ check_terminal:
  505. &hdata);
  506. if (!data)
  507. goto out;
  508. - sel = ht->divisor & u32_hash_fold(*data, &n->sel,
  509. - n->fshift);
  510. + sel = ht->divisor & u32_hash_fold(net_hdr_word(data),
  511. + &n->sel, n->fshift);
  512. }
  513. if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT)))
  514. goto next_ht;
  515. --- a/net/ipv6/ip6_offload.c
  516. +++ b/net/ipv6/ip6_offload.c
  517. @@ -220,7 +220,7 @@ static struct sk_buff **ipv6_gro_receive
  518. continue;
  519. iph2 = (struct ipv6hdr *)(p->data + off);
  520. - first_word = *(__be32 *)iph ^ *(__be32 *)iph2;
  521. + first_word = net_hdr_word(iph) ^ net_hdr_word(iph2);
  522. /* All fields must match except length and Traffic Class.
  523. * XXX skbs on the gro_list have all been parsed and pulled
  524. --- a/include/net/addrconf.h
  525. +++ b/include/net/addrconf.h
  526. @@ -46,7 +46,7 @@ struct prefix_info {
  527. __be32 reserved2;
  528. struct in6_addr prefix;
  529. -};
  530. +} __attribute__((packed, aligned(2)));
  531. #include <linux/netdevice.h>
  532. --- a/include/net/inet_ecn.h
  533. +++ b/include/net/inet_ecn.h
  534. @@ -124,9 +124,9 @@ static inline int IP6_ECN_set_ce(struct
  535. if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
  536. return 0;
  537. - from = *(__be32 *)iph;
  538. + from = net_hdr_word(iph);
  539. to = from | htonl(INET_ECN_CE << 20);
  540. - *(__be32 *)iph = to;
  541. + net_hdr_word(iph) = to;
  542. if (skb->ip_summed == CHECKSUM_COMPLETE)
  543. skb->csum = csum_add(csum_sub(skb->csum, (__force __wsum)from),
  544. (__force __wsum)to);
  545. @@ -135,7 +135,7 @@ static inline int IP6_ECN_set_ce(struct
  546. static inline void IP6_ECN_clear(struct ipv6hdr *iph)
  547. {
  548. - *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20);
  549. + net_hdr_word(iph) &= ~htonl(INET_ECN_MASK << 20);
  550. }
  551. static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
  552. --- a/include/net/ipv6.h
  553. +++ b/include/net/ipv6.h
  554. @@ -107,7 +107,7 @@ struct frag_hdr {
  555. __u8 reserved;
  556. __be16 frag_off;
  557. __be32 identification;
  558. -};
  559. +} __attribute__((packed, aligned(2)));
  560. #define IP6_MF 0x0001
  561. #define IP6_OFFSET 0xFFF8
  562. @@ -450,8 +450,8 @@ static inline void __ipv6_addr_set_half(
  563. }
  564. #endif
  565. #endif
  566. - addr[0] = wh;
  567. - addr[1] = wl;
  568. + net_hdr_word(&addr[0]) = wh;
  569. + net_hdr_word(&addr[1]) = wl;
  570. }
  571. static inline void ipv6_addr_set(struct in6_addr *addr,
  572. @@ -510,6 +510,8 @@ static inline bool ipv6_prefix_equal(con
  573. const __be32 *a1 = addr1->s6_addr32;
  574. const __be32 *a2 = addr2->s6_addr32;
  575. unsigned int pdw, pbi;
  576. + /* Used for last <32-bit fraction of prefix */
  577. + u32 pbia1, pbia2;
  578. /* check complete u32 in prefix */
  579. pdw = prefixlen >> 5;
  580. @@ -518,7 +520,9 @@ static inline bool ipv6_prefix_equal(con
  581. /* check incomplete u32 in prefix */
  582. pbi = prefixlen & 0x1f;
  583. - if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
  584. + pbia1 = net_hdr_word(&a1[pdw]);
  585. + pbia2 = net_hdr_word(&a2[pdw]);
  586. + if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi))))
  587. return false;
  588. return true;
  589. @@ -662,13 +666,13 @@ static inline void ipv6_addr_set_v4mappe
  590. */
  591. static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
  592. {
  593. - const __be32 *a1 = token1, *a2 = token2;
  594. + const struct in6_addr *a1 = token1, *a2 = token2;
  595. int i;
  596. addrlen >>= 2;
  597. for (i = 0; i < addrlen; i++) {
  598. - __be32 xb = a1[i] ^ a2[i];
  599. + __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i];
  600. if (xb)
  601. return i * 32 + 31 - __fls(ntohl(xb));
  602. }
  603. @@ -837,17 +841,18 @@ static inline int ip6_default_np_autolab
  604. static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
  605. __be32 flowlabel)
  606. {
  607. - *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel;
  608. + net_hdr_word((__be32 *)hdr) =
  609. + htonl(0x60000000 | (tclass << 20)) | flowlabel;
  610. }
  611. static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
  612. {
  613. - return *(__be32 *)hdr & IPV6_FLOWINFO_MASK;
  614. + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK;
  615. }
  616. static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
  617. {
  618. - return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
  619. + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK;
  620. }
  621. static inline u8 ip6_tclass(__be32 flowinfo)
  622. --- a/include/net/secure_seq.h
  623. +++ b/include/net/secure_seq.h
  624. @@ -2,6 +2,7 @@
  625. #define _NET_SECURE_SEQ
  626. #include <linux/types.h>
  627. +#include <linux/in6.h>
  628. u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
  629. u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
  630. --- a/include/uapi/linux/in.h
  631. +++ b/include/uapi/linux/in.h
  632. @@ -83,7 +83,7 @@ enum {
  633. /* Internet address. */
  634. struct in_addr {
  635. __be32 s_addr;
  636. -};
  637. +} __attribute__((packed, aligned(2)));
  638. #endif
  639. #define IP_TOS 1
  640. --- a/net/core/secure_seq.c
  641. +++ b/net/core/secure_seq.c
  642. @@ -46,11 +46,12 @@ __u32 secure_tcpv6_sequence_number(const
  643. u32 secret[MD5_MESSAGE_BYTES / 4];
  644. u32 hash[MD5_DIGEST_WORDS];
  645. u32 i;
  646. + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
  647. net_secret_init();
  648. memcpy(hash, saddr, 16);
  649. for (i = 0; i < 4; i++)
  650. - secret[i] = net_secret[i] + (__force u32)daddr[i];
  651. + secret[i] = net_secret[i] + (__force u32)daddr6->s6_addr32[i];
  652. secret[4] = net_secret[4] +
  653. (((__force u16)sport << 16) + (__force u16)dport);
  654. for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
  655. @@ -68,11 +69,12 @@ u32 secure_ipv6_port_ephemeral(const __b
  656. u32 secret[MD5_MESSAGE_BYTES / 4];
  657. u32 hash[MD5_DIGEST_WORDS];
  658. u32 i;
  659. + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
  660. net_secret_init();
  661. memcpy(hash, saddr, 16);
  662. for (i = 0; i < 4; i++)
  663. - secret[i] = net_secret[i] + (__force u32) daddr[i];
  664. + secret[i] = net_secret[i] + (__force u32) daddr6->s6_addr32[i];
  665. secret[4] = net_secret[4] + (__force u32)dport;
  666. for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
  667. secret[i] = net_secret[i];
  668. @@ -146,6 +148,7 @@ EXPORT_SYMBOL(secure_dccp_sequence_numbe
  669. u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
  670. __be16 sport, __be16 dport)
  671. {
  672. + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
  673. u32 secret[MD5_MESSAGE_BYTES / 4];
  674. u32 hash[MD5_DIGEST_WORDS];
  675. u64 seq;
  676. @@ -154,7 +157,7 @@ u64 secure_dccpv6_sequence_number(__be32
  677. net_secret_init();
  678. memcpy(hash, saddr, 16);
  679. for (i = 0; i < 4; i++)
  680. - secret[i] = net_secret[i] + (__force u32)daddr[i];
  681. + secret[i] = net_secret[i] + (__force u32)daddr6->s6_addr32[i];
  682. secret[4] = net_secret[4] +
  683. (((__force u16)sport << 16) + (__force u16)dport);
  684. for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
  685. --- a/net/ipv6/ip6_fib.c
  686. +++ b/net/ipv6/ip6_fib.c
  687. @@ -136,7 +136,7 @@ static __be32 addr_bit_set(const void *t
  688. * See include/asm-generic/bitops/le.h.
  689. */
  690. return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) &
  691. - addr[fn_bit >> 5];
  692. + net_hdr_word(&addr[fn_bit >> 5]);
  693. }
  694. static struct fib6_node *node_alloc(void)
  695. --- a/net/netfilter/nf_conntrack_proto_tcp.c
  696. +++ b/net/netfilter/nf_conntrack_proto_tcp.c
  697. @@ -452,7 +452,7 @@ static void tcp_sack(const struct sk_buf
  698. /* Fast path for timestamp-only option */
  699. if (length == TCPOLEN_TSTAMP_ALIGNED
  700. - && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24)
  701. + && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24)
  702. | (TCPOPT_NOP << 16)
  703. | (TCPOPT_TIMESTAMP << 8)
  704. | TCPOLEN_TIMESTAMP))
  705. --- a/net/xfrm/xfrm_input.c
  706. +++ b/net/xfrm/xfrm_input.c
  707. @@ -154,8 +154,8 @@ int xfrm_parse_spi(struct sk_buff *skb,
  708. if (!pskb_may_pull(skb, hlen))
  709. return -EINVAL;
  710. - *spi = *(__be32 *)(skb_transport_header(skb) + offset);
  711. - *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq);
  712. + *spi = net_hdr_word(skb_transport_header(skb) + offset);
  713. + *seq = net_hdr_word(skb_transport_header(skb) + offset_seq);
  714. return 0;
  715. }
  716. --- a/net/ipv4/tcp_input.c
  717. +++ b/net/ipv4/tcp_input.c
  718. @@ -3892,14 +3892,16 @@ static bool tcp_parse_aligned_timestamp(
  719. {
  720. const __be32 *ptr = (const __be32 *)(th + 1);
  721. - if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
  722. - | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
  723. + if (net_hdr_word(ptr) ==
  724. + htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
  725. + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
  726. tp->rx_opt.saw_tstamp = 1;
  727. ++ptr;
  728. - tp->rx_opt.rcv_tsval = ntohl(*ptr);
  729. + tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr);
  730. ++ptr;
  731. - if (*ptr)
  732. - tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset;
  733. + if (net_hdr_word(ptr))
  734. + tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) -
  735. + tp->tsoffset;
  736. else
  737. tp->rx_opt.rcv_tsecr = 0;
  738. return true;
  739. --- a/include/uapi/linux/if_pppox.h
  740. +++ b/include/uapi/linux/if_pppox.h
  741. @@ -50,6 +50,7 @@ struct pppoe_addr {
  742. */
  743. struct pptp_addr {
  744. __u16 call_id;
  745. + __u16 pad;
  746. struct in_addr sin_addr;
  747. };
  748. --- a/net/ipv6/netfilter/nf_log_ipv6.c
  749. +++ b/net/ipv6/netfilter/nf_log_ipv6.c
  750. @@ -66,9 +66,9 @@ static void dump_ipv6_packet(struct nf_l
  751. /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
  752. nf_log_buf_add(m, "LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ",
  753. ntohs(ih->payload_len) + sizeof(struct ipv6hdr),
  754. - (ntohl(*(__be32 *)ih) & 0x0ff00000) >> 20,
  755. + (ntohl(net_hdr_word(ih)) & 0x0ff00000) >> 20,
  756. ih->hop_limit,
  757. - (ntohl(*(__be32 *)ih) & 0x000fffff));
  758. + (ntohl(net_hdr_word(ih)) & 0x000fffff));
  759. fragment = 0;
  760. ptr = ip6hoff + sizeof(struct ipv6hdr);
  761. --- a/include/net/neighbour.h
  762. +++ b/include/net/neighbour.h
  763. @@ -263,8 +263,10 @@ static inline bool neigh_key_eq128(const
  764. const u32 *n32 = (const u32 *)n->primary_key;
  765. const u32 *p32 = pkey;
  766. - return ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
  767. - (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0;
  768. + return ((n32[0] ^ net_hdr_word(&p32[0])) |
  769. + (n32[1] ^ net_hdr_word(&p32[1])) |
  770. + (n32[2] ^ net_hdr_word(&p32[2])) |
  771. + (n32[3] ^ net_hdr_word(&p32[3]))) == 0;
  772. }
  773. static inline struct neighbour *___neigh_lookup_noref(
  774. --- a/include/uapi/linux/netfilter_arp/arp_tables.h
  775. +++ b/include/uapi/linux/netfilter_arp/arp_tables.h
  776. @@ -69,7 +69,7 @@ struct arpt_arp {
  777. __u8 flags;
  778. /* Inverse flags */
  779. __u16 invflags;
  780. -};
  781. +} __attribute__((aligned(4)));
  782. /* Values for "flag" field in struct arpt_ip (general arp structure).
  783. * No flags defined yet.
  784. --- a/net/core/utils.c
  785. +++ b/net/core/utils.c
  786. @@ -321,8 +321,14 @@ void inet_proto_csum_replace16(__sum16 *
  787. bool pseudohdr)
  788. {
  789. __be32 diff[] = {
  790. - ~from[0], ~from[1], ~from[2], ~from[3],
  791. - to[0], to[1], to[2], to[3],
  792. + ~net_hdr_word(&from[0]),
  793. + ~net_hdr_word(&from[1]),
  794. + ~net_hdr_word(&from[2]),
  795. + ~net_hdr_word(&from[3]),
  796. + net_hdr_word(&to[0]),
  797. + net_hdr_word(&to[1]),
  798. + net_hdr_word(&to[2]),
  799. + net_hdr_word(&to[3]),
  800. };
  801. if (skb->ip_summed != CHECKSUM_PARTIAL) {
  802. *sum = csum_fold(csum_partial(diff, sizeof(diff),
  803. --- a/drivers/net/vxlan.c
  804. +++ b/drivers/net/vxlan.c
  805. @@ -1789,15 +1789,15 @@ static int vxlan_build_skb(struct sk_buf
  806. goto out_free;
  807. vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
  808. - vxh->vx_flags = VXLAN_HF_VNI;
  809. - vxh->vx_vni = vxlan_vni_field(vni);
  810. + net_hdr_word(&vxh->vx_flags) = VXLAN_HF_VNI;
  811. + net_hdr_word(&vxh->vx_vni) = vxlan_vni_field(vni);
  812. if (type & SKB_GSO_TUNNEL_REMCSUM) {
  813. unsigned int start;
  814. start = skb_checksum_start_offset(skb) - sizeof(struct vxlanhdr);
  815. - vxh->vx_vni |= vxlan_compute_rco(start, skb->csum_offset);
  816. - vxh->vx_flags |= VXLAN_HF_RCO;
  817. + net_hdr_word(&vxh->vx_vni) |= vxlan_compute_rco(start, skb->csum_offset);
  818. + net_hdr_word(&vxh->vx_flags) |= VXLAN_HF_RCO;
  819. if (!skb_is_gso(skb)) {
  820. skb->ip_summed = CHECKSUM_NONE;
  821. --- a/include/linux/etherdevice.h
  822. +++ b/include/linux/etherdevice.h
  823. @@ -435,7 +435,7 @@ static inline bool is_etherdev_addr(cons
  824. * @b: Pointer to Ethernet header
  825. *
  826. * Compare two Ethernet headers, returns 0 if equal.
  827. - * This assumes that the network header (i.e., IP header) is 4-byte
  828. + * This assumes that the network header (i.e., IP header) is 2-byte
  829. * aligned OR the platform can handle unaligned access. This is the
  830. * case for all packets coming into netif_receive_skb or similar
  831. * entry points.
  832. @@ -458,11 +458,12 @@ static inline unsigned long compare_ethe
  833. fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6);
  834. return fold;
  835. #else
  836. - u32 *a32 = (u32 *)((u8 *)a + 2);
  837. - u32 *b32 = (u32 *)((u8 *)b + 2);
  838. + const u16 *a16 = a;
  839. + const u16 *b16 = b;
  840. - return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
  841. - (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
  842. + return (a16[0] ^ b16[0]) | (a16[1] ^ b16[1]) | (a16[2] ^ b16[2]) |
  843. + (a16[3] ^ b16[3]) | (a16[4] ^ b16[4]) | (a16[5] ^ b16[5]) |
  844. + (a16[6] ^ b16[6]);
  845. #endif
  846. }
  847. --- a/net/ipv4/tcp_offload.c
  848. +++ b/net/ipv4/tcp_offload.c
  849. @@ -218,7 +218,7 @@ struct sk_buff **tcp_gro_receive(struct
  850. th2 = tcp_hdr(p);
  851. - if (*(u32 *)&th->source ^ *(u32 *)&th2->source) {
  852. + if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) {
  853. NAPI_GRO_CB(p)->same_flow = 0;
  854. continue;
  855. }
  856. @@ -236,8 +236,8 @@ found:
  857. ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
  858. flush |= (__force int)(th->ack_seq ^ th2->ack_seq);
  859. for (i = sizeof(*th); i < thlen; i += 4)
  860. - flush |= *(u32 *)((u8 *)th + i) ^
  861. - *(u32 *)((u8 *)th2 + i);
  862. + flush |= net_hdr_word((u8 *)th + i) ^
  863. + net_hdr_word((u8 *)th2 + i);
  864. /* When we receive our second frame we can made a decision on if we
  865. * continue this flow as an atomic flow with a fixed ID or if we use
  866. --- a/net/ipv6/netfilter/ip6table_mangle.c
  867. +++ b/net/ipv6/netfilter/ip6table_mangle.c
  868. @@ -58,7 +58,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
  869. hop_limit = ipv6_hdr(skb)->hop_limit;
  870. /* flowlabel and prio (includes version, which shouldn't change either */
  871. - flowlabel = *((u_int32_t *)ipv6_hdr(skb));
  872. + flowlabel = net_hdr_word(ipv6_hdr(skb));
  873. ret = ip6t_do_table(skb, state, state->net->ipv6.ip6table_mangle);
  874. @@ -67,7 +67,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
  875. !ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) ||
  876. skb->mark != mark ||
  877. ipv6_hdr(skb)->hop_limit != hop_limit ||
  878. - flowlabel != *((u_int32_t *)ipv6_hdr(skb)))) {
  879. + flowlabel != net_hdr_word(ipv6_hdr(skb)))) {
  880. err = ip6_route_me_harder(state->net, skb);
  881. if (err < 0)
  882. ret = NF_DROP_ERR(err);