1 Index: linux-3.18.7/arch/mips/include/asm/checksum.h
2 ===================================================================
3 --- linux-3.18.7.orig/arch/mips/include/asm/checksum.h 2015-02-11 08:01:12.000000000 +0100
4 +++ linux-3.18.7/arch/mips/include/asm/checksum.h 2015-02-15 01:50:55.118444466 +0100
6 const unsigned int *stop = word + ihl;
13 - carry = (csum < word[1]);
14 + csum = net_hdr_word(word++);
16 + w = net_hdr_word(word++);
22 - carry = (csum < word[2]);
23 + w = net_hdr_word(word++);
29 - carry = (csum < word[3]);
30 + w = net_hdr_word(word++);
38 - carry = (csum < *word);
39 + w = net_hdr_word(word++);
44 } while (word != stop);
46 return csum_fold(csum);
48 return csum_fold(csum_partial(buff, len, 0));
51 -#define _HAVE_ARCH_IPV6_CSUM
52 -static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
53 - const struct in6_addr *daddr,
54 - __u32 len, unsigned short proto,
58 - " .set push # csum_ipv6_magic\n"
59 - " .set noreorder \n"
61 - " addu %0, %5 # proto (long in network byte order)\n"
62 - " sltu $1, %0, %5 \n"
65 - " addu %0, %6 # csum\n"
66 - " sltu $1, %0, %6 \n"
67 - " lw %1, 0(%2) # four words source address\n"
70 - " sltu $1, %0, %1 \n"
75 - " sltu $1, %0, %1 \n"
80 - " sltu $1, %0, %1 \n"
85 - " sltu $1, %0, %1 \n"
90 - " sltu $1, %0, %1 \n"
95 - " sltu $1, %0, %1 \n"
100 - " sltu $1, %0, %1 \n"
102 - " lw %1, 12(%3) \n"
105 - " sltu $1, %0, %1 \n"
107 - " addu %0, $1 # Add final carry\n"
109 - : "=r" (sum), "=r" (proto)
110 - : "r" (saddr), "r" (daddr),
111 - "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
113 - return csum_fold(sum);
116 #endif /* _ASM_CHECKSUM_H */
117 Index: linux-3.18.7/include/uapi/linux/ip.h
118 ===================================================================
119 --- linux-3.18.7.orig/include/uapi/linux/ip.h 2015-02-15 01:50:18.000000000 +0100
120 +++ linux-3.18.7/include/uapi/linux/ip.h 2015-02-15 01:50:55.118444466 +0100
124 /*The options start here. */
126 +} __attribute__((packed, aligned(2)));
130 Index: linux-3.18.7/include/uapi/linux/ipv6.h
131 ===================================================================
132 --- linux-3.18.7.orig/include/uapi/linux/ipv6.h 2015-02-15 01:50:18.000000000 +0100
133 +++ linux-3.18.7/include/uapi/linux/ipv6.h 2015-02-15 01:50:55.118444466 +0100
136 struct in6_addr saddr;
137 struct in6_addr daddr;
139 +} __attribute__((packed, aligned(2)));
142 /* index values for the variables in ipv6_devconf */
143 Index: linux-3.18.7/include/uapi/linux/tcp.h
144 ===================================================================
145 --- linux-3.18.7.orig/include/uapi/linux/tcp.h 2015-02-15 01:50:18.000000000 +0100
146 +++ linux-3.18.7/include/uapi/linux/tcp.h 2015-02-15 01:50:55.118444466 +0100
152 +} __attribute__((packed, aligned(2)));
155 * The union cast uses a gcc extension to avoid aliasing problems
161 +} __attribute__((packed, aligned(2)));
163 #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3])
165 Index: linux-3.18.7/include/uapi/linux/udp.h
166 ===================================================================
167 --- linux-3.18.7.orig/include/uapi/linux/udp.h 2015-02-15 01:50:18.000000000 +0100
168 +++ linux-3.18.7/include/uapi/linux/udp.h 2015-02-15 01:50:55.118444466 +0100
174 +} __attribute__((packed, aligned(2)));
176 /* UDP socket options */
177 #define UDP_CORK 1 /* Never send partially complete segments */
178 Index: linux-3.18.7/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
179 ===================================================================
180 --- linux-3.18.7.orig/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2015-02-15 01:50:18.000000000 +0100
181 +++ linux-3.18.7/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c 2015-02-15 01:50:55.118444466 +0100
186 - tuple->src.u3.ip = ap[0];
187 - tuple->dst.u3.ip = ap[1];
188 + tuple->src.u3.ip = net_hdr_word(ap++);
189 + tuple->dst.u3.ip = net_hdr_word(ap);
193 Index: linux-3.18.7/include/uapi/linux/icmp.h
194 ===================================================================
195 --- linux-3.18.7.orig/include/uapi/linux/icmp.h 2015-02-15 01:50:18.000000000 +0100
196 +++ linux-3.18.7/include/uapi/linux/icmp.h 2015-02-15 01:50:55.118444466 +0100
202 +} __attribute__((packed, aligned(2)));
206 Index: linux-3.18.7/include/uapi/linux/in6.h
207 ===================================================================
208 --- linux-3.18.7.orig/include/uapi/linux/in6.h 2015-02-15 01:50:18.000000000 +0100
209 +++ linux-3.18.7/include/uapi/linux/in6.h 2015-02-15 01:50:55.118444466 +0100
211 #define s6_addr16 in6_u.u6_addr16
212 #define s6_addr32 in6_u.u6_addr32
215 +} __attribute__((packed, aligned(2)));
216 #endif /* __UAPI_DEF_IN6_ADDR */
218 #if __UAPI_DEF_SOCKADDR_IN6
219 Index: linux-3.18.7/net/ipv6/tcp_ipv6.c
220 ===================================================================
221 --- linux-3.18.7.orig/net/ipv6/tcp_ipv6.c 2015-02-15 01:50:18.000000000 +0100
222 +++ linux-3.18.7/net/ipv6/tcp_ipv6.c 2015-02-15 02:12:55.605235801 +0100
224 #include <linux/ipsec.h>
225 #include <linux/times.h>
226 #include <linux/slab.h>
227 +#include <asm/unaligned.h>
228 #include <linux/uaccess.h>
229 #include <linux/ipv6.h>
230 #include <linux/icmpv6.h>
231 @@ -833,10 +834,10 @@
232 topt = (__be32 *)(t1 + 1);
235 - *topt++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
236 - (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP);
237 - *topt++ = htonl(tsval);
238 - *topt++ = htonl(tsecr);
239 + put_unaligned_be32((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
240 + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP, topt++);
241 + put_unaligned_be32(tsval, topt++);
242 + put_unaligned_be32(tsecr, topt++);
245 #ifdef CONFIG_TCP_MD5SIG
246 Index: linux-3.18.7/include/linux/ipv6.h
247 ===================================================================
248 --- linux-3.18.7.orig/include/linux/ipv6.h 2015-02-15 01:50:18.000000000 +0100
249 +++ linux-3.18.7/include/linux/ipv6.h 2015-02-15 01:50:55.118444466 +0100
252 #define ipv6_optlen(p) (((p)->hdrlen+1) << 3)
253 #define ipv6_authlen(p) (((p)->hdrlen+2) << 2)
256 * This structure contains configuration options per IPv6 link.
258 Index: linux-3.18.7/net/ipv6/datagram.c
259 ===================================================================
260 --- linux-3.18.7.orig/net/ipv6/datagram.c 2015-02-15 01:50:18.000000000 +0100
261 +++ linux-3.18.7/net/ipv6/datagram.c 2015-02-15 01:50:55.118444466 +0100
263 ipv6_iface_scope_id(&sin->sin6_addr,
266 - ipv6_addr_set_v4mapped(*(__be32 *)(nh + serr->addr_offset),
267 + ipv6_addr_set_v4mapped(net_hdr_word(nh + serr->addr_offset),
269 sin->sin6_scope_id = 0;
271 @@ -712,12 +712,12 @@
274 if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
275 - if ((fl6->flowlabel^*(__be32 *)CMSG_DATA(cmsg))&~IPV6_FLOWINFO_MASK) {
276 + if ((fl6->flowlabel^net_hdr_word(CMSG_DATA(cmsg)))&~IPV6_FLOWINFO_MASK) {
281 - fl6->flowlabel = IPV6_FLOWINFO_MASK & *(__be32 *)CMSG_DATA(cmsg);
282 + fl6->flowlabel = IPV6_FLOWINFO_MASK & net_hdr_word(CMSG_DATA(cmsg));
285 case IPV6_2292HOPOPTS:
286 Index: linux-3.18.7/net/ipv6/ip6_gre.c
287 ===================================================================
288 --- linux-3.18.7.orig/net/ipv6/ip6_gre.c 2015-02-15 01:50:18.000000000 +0100
289 +++ linux-3.18.7/net/ipv6/ip6_gre.c 2015-02-15 01:50:55.118444466 +0100
292 t = ip6gre_tunnel_lookup(skb->dev, &ipv6h->daddr, &ipv6h->saddr,
294 - *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
295 + net_hdr_word(((__be32 *)p) + (grehlen / 4) - 1) : 0,
299 @@ -475,11 +475,11 @@
303 - key = *(__be32 *)(h + offset);
304 + key = net_hdr_word(h + offset);
308 - seqno = ntohl(*(__be32 *)(h + offset));
309 + seqno = ntohl(net_hdr_word(h + offset));
315 if (tunnel->parms.o_flags&GRE_SEQ) {
317 - *ptr = htonl(tunnel->o_seqno);
318 + net_hdr_word(ptr) = htonl(tunnel->o_seqno);
321 if (tunnel->parms.o_flags&GRE_KEY) {
324 dsfield = ipv6_get_dsfield(ipv6h);
325 if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
326 - fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
327 + fl6.flowlabel |= net_hdr_word(ipv6h) & IPV6_TCLASS_MASK;
328 if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
329 fl6.flowlabel |= ip6_flowlabel(ipv6h);
330 if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
331 Index: linux-3.18.7/net/ipv6/ip6_tunnel.c
332 ===================================================================
333 --- linux-3.18.7.orig/net/ipv6/ip6_tunnel.c 2015-02-15 01:50:18.000000000 +0100
334 +++ linux-3.18.7/net/ipv6/ip6_tunnel.c 2015-02-15 01:50:55.118444466 +0100
335 @@ -1291,7 +1291,7 @@
337 dsfield = ipv6_get_dsfield(ipv6h);
338 if (t->parms.flags & IP6_TNL_F_USE_ORIG_TCLASS)
339 - fl6.flowlabel |= (*(__be32 *) ipv6h & IPV6_TCLASS_MASK);
340 + fl6.flowlabel |= net_hdr_word(ipv6h) & IPV6_TCLASS_MASK;
341 if (t->parms.flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
342 fl6.flowlabel |= ip6_flowlabel(ipv6h);
343 if (t->parms.flags & IP6_TNL_F_USE_ORIG_FWMARK)
344 Index: linux-3.18.7/net/ipv6/exthdrs.c
345 ===================================================================
346 --- linux-3.18.7.orig/net/ipv6/exthdrs.c 2015-02-15 01:50:18.000000000 +0100
347 +++ linux-3.18.7/net/ipv6/exthdrs.c 2015-02-15 01:50:55.118444466 +0100
352 - pkt_len = ntohl(*(__be32 *)(nh + optoff + 2));
353 + pkt_len = ntohl(net_hdr_word(nh + optoff + 2));
354 if (pkt_len <= IPV6_MAXPLEN) {
355 IP6_INC_STATS_BH(net, ipv6_skb_idev(skb),
356 IPSTATS_MIB_INHDRERRORS);
357 Index: linux-3.18.7/include/linux/types.h
358 ===================================================================
359 --- linux-3.18.7.orig/include/linux/types.h 2015-02-15 01:50:18.000000000 +0100
360 +++ linux-3.18.7/include/linux/types.h 2015-02-15 01:50:55.118444466 +0100
363 #define rcu_head callback_head
365 +struct net_hdr_word {
367 +} __attribute__((packed, aligned(2)));
369 +#define net_hdr_word(_p) (((struct net_hdr_word *) (_p))->words[0])
371 #endif /* __ASSEMBLY__ */
372 #endif /* _LINUX_TYPES_H */
373 Index: linux-3.18.7/net/ipv4/af_inet.c
374 ===================================================================
375 --- linux-3.18.7.orig/net/ipv4/af_inet.c 2015-02-15 01:50:18.000000000 +0100
376 +++ linux-3.18.7/net/ipv4/af_inet.c 2015-02-15 01:50:55.118444466 +0100
377 @@ -1324,8 +1324,8 @@
378 if (unlikely(ip_fast_csum((u8 *)iph, 5)))
381 - id = ntohl(*(__be32 *)&iph->id);
382 - flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF));
383 + id = ntohl(net_hdr_word(&iph->id));
384 + flush = (u16)((ntohl(net_hdr_word(iph)) ^ skb_gro_len(skb)) | (id & ~IP_DF));
387 for (p = *head; p; p = p->next) {
388 Index: linux-3.18.7/net/ipv4/route.c
389 ===================================================================
390 --- linux-3.18.7.orig/net/ipv4/route.c 2015-02-15 01:50:18.000000000 +0100
391 +++ linux-3.18.7/net/ipv4/route.c 2015-02-15 01:50:55.118444466 +0100
394 pkey = &ip_hdr(skb)->daddr;
396 - n = __ipv4_neigh_lookup(dev, *(__force u32 *)pkey);
397 + n = __ipv4_neigh_lookup(dev, net_hdr_word(pkey));
400 return neigh_create(&arp_tbl, pkey, dev);
401 Index: linux-3.18.7/net/ipv4/tcp_output.c
402 ===================================================================
403 --- linux-3.18.7.orig/net/ipv4/tcp_output.c 2015-02-15 01:50:18.000000000 +0100
404 +++ linux-3.18.7/net/ipv4/tcp_output.c 2015-02-15 01:50:55.122444370 +0100
405 @@ -446,48 +446,53 @@
406 u16 options = opts->options; /* mungable copy */
408 if (unlikely(OPTION_MD5 & options)) {
409 - *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
410 - (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
411 + net_hdr_word(ptr++) =
412 + htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
413 + (TCPOPT_MD5SIG << 8) | TCPOLEN_MD5SIG);
414 /* overload cookie hash location */
415 opts->hash_location = (__u8 *)ptr;
419 if (unlikely(opts->mss)) {
420 - *ptr++ = htonl((TCPOPT_MSS << 24) |
421 - (TCPOLEN_MSS << 16) |
423 + net_hdr_word(ptr++) =
424 + htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) |
428 if (likely(OPTION_TS & options)) {
429 if (unlikely(OPTION_SACK_ADVERTISE & options)) {
430 - *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
431 - (TCPOLEN_SACK_PERM << 16) |
432 - (TCPOPT_TIMESTAMP << 8) |
433 - TCPOLEN_TIMESTAMP);
434 + net_hdr_word(ptr++) =
435 + htonl((TCPOPT_SACK_PERM << 24) |
436 + (TCPOLEN_SACK_PERM << 16) |
437 + (TCPOPT_TIMESTAMP << 8) |
438 + TCPOLEN_TIMESTAMP);
439 options &= ~OPTION_SACK_ADVERTISE;
441 - *ptr++ = htonl((TCPOPT_NOP << 24) |
442 - (TCPOPT_NOP << 16) |
443 - (TCPOPT_TIMESTAMP << 8) |
444 - TCPOLEN_TIMESTAMP);
445 + net_hdr_word(ptr++) =
446 + htonl((TCPOPT_NOP << 24) |
447 + (TCPOPT_NOP << 16) |
448 + (TCPOPT_TIMESTAMP << 8) |
449 + TCPOLEN_TIMESTAMP);
451 - *ptr++ = htonl(opts->tsval);
452 - *ptr++ = htonl(opts->tsecr);
453 + net_hdr_word(ptr++) = htonl(opts->tsval);
454 + net_hdr_word(ptr++) = htonl(opts->tsecr);
457 if (unlikely(OPTION_SACK_ADVERTISE & options)) {
458 - *ptr++ = htonl((TCPOPT_NOP << 24) |
459 - (TCPOPT_NOP << 16) |
460 - (TCPOPT_SACK_PERM << 8) |
461 - TCPOLEN_SACK_PERM);
462 + net_hdr_word(ptr++) =
463 + htonl((TCPOPT_NOP << 24) |
464 + (TCPOPT_NOP << 16) |
465 + (TCPOPT_SACK_PERM << 8) |
466 + TCPOLEN_SACK_PERM);
469 if (unlikely(OPTION_WSCALE & options)) {
470 - *ptr++ = htonl((TCPOPT_NOP << 24) |
471 - (TCPOPT_WINDOW << 16) |
472 - (TCPOLEN_WINDOW << 8) |
474 + net_hdr_word(ptr++) =
475 + htonl((TCPOPT_NOP << 24) |
476 + (TCPOPT_WINDOW << 16) |
477 + (TCPOLEN_WINDOW << 8) |
481 if (unlikely(opts->num_sack_blocks)) {
482 @@ -495,16 +500,17 @@
483 tp->duplicate_sack : tp->selective_acks;
486 - *ptr++ = htonl((TCPOPT_NOP << 24) |
487 - (TCPOPT_NOP << 16) |
488 - (TCPOPT_SACK << 8) |
489 - (TCPOLEN_SACK_BASE + (opts->num_sack_blocks *
490 + net_hdr_word(ptr++) =
491 + htonl((TCPOPT_NOP << 24) |
492 + (TCPOPT_NOP << 16) |
493 + (TCPOPT_SACK << 8) |
494 + (TCPOLEN_SACK_BASE + (opts->num_sack_blocks *
495 TCPOLEN_SACK_PERBLOCK)));
497 for (this_sack = 0; this_sack < opts->num_sack_blocks;
499 - *ptr++ = htonl(sp[this_sack].start_seq);
500 - *ptr++ = htonl(sp[this_sack].end_seq);
501 + net_hdr_word(ptr++) = htonl(sp[this_sack].start_seq);
502 + net_hdr_word(ptr++) = htonl(sp[this_sack].end_seq);
505 tp->rx_opt.dsack = 0;
507 if (unlikely(OPTION_FAST_OPEN_COOKIE & options)) {
508 struct tcp_fastopen_cookie *foc = opts->fastopen_cookie;
510 - *ptr++ = htonl((TCPOPT_EXP << 24) |
511 - ((TCPOLEN_EXP_FASTOPEN_BASE + foc->len) << 16) |
512 - TCPOPT_FASTOPEN_MAGIC);
513 + net_hdr_word(ptr++) =
514 + htonl((TCPOPT_EXP << 24) |
515 + ((TCPOLEN_EXP_FASTOPEN_BASE + foc->len) << 16) |
516 + TCPOPT_FASTOPEN_MAGIC);
518 memcpy(ptr, foc->val, foc->len);
519 if ((foc->len & 3) == 2) {
520 Index: linux-3.18.7/net/ipv4/igmp.c
521 ===================================================================
522 --- linux-3.18.7.orig/net/ipv4/igmp.c 2015-02-15 01:50:18.000000000 +0100
523 +++ linux-3.18.7/net/ipv4/igmp.c 2015-02-15 01:50:55.122444370 +0100
527 psrc = (__be32 *)skb_put(skb, sizeof(__be32));
528 - *psrc = psf->sf_inaddr;
529 + net_hdr_word(psrc) = psf->sf_inaddr;
531 if ((type == IGMPV3_ALLOW_NEW_SOURCES ||
532 type == IGMPV3_BLOCK_OLD_SOURCES) && psf->sf_crcount) {
533 Index: linux-3.18.7/include/uapi/linux/igmp.h
534 ===================================================================
535 --- linux-3.18.7.orig/include/uapi/linux/igmp.h 2015-02-15 01:50:18.000000000 +0100
536 +++ linux-3.18.7/include/uapi/linux/igmp.h 2015-02-15 01:50:55.122444370 +0100
538 __u8 code; /* For newer IGMP */
542 +} __attribute__((packed, aligned(2)));
544 /* V3 group record types [grec_type] */
545 #define IGMPV3_MODE_IS_INCLUDE 1
551 +} __attribute__((packed, aligned(2)));
553 struct igmpv3_report {
558 struct igmpv3_grec grec[0];
560 +} __attribute__((packed, aligned(2)));
562 struct igmpv3_query {
569 +} __attribute__((packed, aligned(2)));
571 #define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
572 #define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
573 Index: linux-3.18.7/net/core/flow_dissector.c
574 ===================================================================
575 --- linux-3.18.7.orig/net/core/flow_dissector.c 2015-02-15 01:50:18.000000000 +0100
576 +++ linux-3.18.7/net/core/flow_dissector.c 2015-02-15 01:50:55.122444370 +0100
578 ports = __skb_header_pointer(skb, thoff + poff,
579 sizeof(_ports), data, hlen, &_ports);
582 + return (__be32)net_hdr_word(ports);
586 Index: linux-3.18.7/include/uapi/linux/icmpv6.h
587 ===================================================================
588 --- linux-3.18.7.orig/include/uapi/linux/icmpv6.h 2015-02-15 01:50:18.000000000 +0100
589 +++ linux-3.18.7/include/uapi/linux/icmpv6.h 2015-02-15 01:50:55.122444370 +0100
591 #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
592 #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
593 #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
595 +} __attribute__((packed, aligned(2)));
598 #define ICMPV6_ROUTER_PREF_LOW 0x3
599 Index: linux-3.18.7/include/net/ndisc.h
600 ===================================================================
601 --- linux-3.18.7.orig/include/net/ndisc.h 2015-02-15 01:50:18.000000000 +0100
602 +++ linux-3.18.7/include/net/ndisc.h 2015-02-15 01:50:55.122444370 +0100
604 struct icmp6hdr icmph;
605 __be32 reachable_time;
606 __be32 retrans_timer;
608 +} __attribute__((packed, aligned(2)));
611 struct icmp6hdr icmph;
612 @@ -148,10 +148,10 @@
614 const u32 *p32 = pkey;
616 - return (((p32[0] ^ hash32_ptr(dev)) * hash_rnd[0]) +
617 - (p32[1] * hash_rnd[1]) +
618 - (p32[2] * hash_rnd[2]) +
619 - (p32[3] * hash_rnd[3]));
620 + return (((net_hdr_word(&p32[0]) ^ hash32_ptr(dev)) * hash_rnd[0]) +
621 + (net_hdr_word(&p32[1]) * hash_rnd[1]) +
622 + (net_hdr_word(&p32[2]) * hash_rnd[2]) +
623 + (net_hdr_word(&p32[3]) * hash_rnd[3]));
626 static inline struct neighbour *__ipv6_neigh_lookup_noref(struct net_device *dev, const void *pkey)
628 n = rcu_dereference_bh(n->next)) {
629 u32 *n32 = (u32 *) n->primary_key;
631 - ((n32[0] ^ p32[0]) | (n32[1] ^ p32[1]) |
632 - (n32[2] ^ p32[2]) | (n32[3] ^ p32[3])) == 0)
633 + ((n32[0] ^ net_hdr_word(&p32[0])) |
634 + (n32[1] ^ net_hdr_word(&p32[1])) |
635 + (n32[2] ^ net_hdr_word(&p32[2])) |
636 + (n32[3] ^ net_hdr_word(&p32[3]))) == 0)
640 Index: linux-3.18.7/net/sched/cls_u32.c
641 ===================================================================
642 --- linux-3.18.7.orig/net/sched/cls_u32.c 2015-02-15 01:50:18.000000000 +0100
643 +++ linux-3.18.7/net/sched/cls_u32.c 2015-02-15 02:14:43.685467248 +0100
645 data = skb_header_pointer(skb, toff, 4, &hdata);
648 + if ((net_hdr_word(data) ^ key->val) & key->mask) {
649 if ((*data ^ key->val) & key->mask) {
650 n = rcu_dereference_bh(n->next);
656 - sel = ht->divisor & u32_hash_fold(*data, &n->sel,
658 + sel = ht->divisor & u32_hash_fold(net_hdr_word(data),
659 + &n->sel, n->fshift);
661 if (!(n->sel.flags & (TC_U32_VAROFFSET | TC_U32_OFFSET | TC_U32_EAT)))
663 Index: linux-3.18.7/net/ipv6/ip6_offload.c
664 ===================================================================
665 --- linux-3.18.7.orig/net/ipv6/ip6_offload.c 2015-02-15 01:50:18.000000000 +0100
666 +++ linux-3.18.7/net/ipv6/ip6_offload.c 2015-02-15 02:14:06.541386363 +0100
670 iph2 = (struct ipv6hdr *)(p->data + off);
671 - first_word = *(__be32 *)iph ^ *(__be32 *)iph2;
672 + first_word = net_hdr_word(iph) ^ net_hdr_word(iph2);
674 /* All fields must match except length and Traffic Class.
675 * XXX skbs on the gro_list have all been parsed and pulled
676 Index: linux-3.18.7/include/net/addrconf.h
677 ===================================================================
678 --- linux-3.18.7.orig/include/net/addrconf.h 2015-02-15 01:50:18.000000000 +0100
679 +++ linux-3.18.7/include/net/addrconf.h 2015-02-15 01:50:55.122444370 +0100
683 struct in6_addr prefix;
685 +} __attribute__((packed, aligned(2)));
688 #include <linux/netdevice.h>
689 Index: linux-3.18.7/include/net/inet_ecn.h
690 ===================================================================
691 --- linux-3.18.7.orig/include/net/inet_ecn.h 2015-02-15 01:50:18.000000000 +0100
692 +++ linux-3.18.7/include/net/inet_ecn.h 2015-02-15 01:50:55.126444189 +0100
693 @@ -115,13 +115,13 @@
695 if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
697 - *(__be32*)iph |= htonl(INET_ECN_CE << 20);
698 + net_hdr_word(iph) |= htonl(INET_ECN_CE << 20);
702 static inline void IP6_ECN_clear(struct ipv6hdr *iph)
704 - *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20);
705 + net_hdr_word(iph) &= ~htonl(INET_ECN_MASK << 20);
708 static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
709 Index: linux-3.18.7/include/net/ipv6.h
710 ===================================================================
711 --- linux-3.18.7.orig/include/net/ipv6.h 2015-02-15 01:50:18.000000000 +0100
712 +++ linux-3.18.7/include/net/ipv6.h 2015-02-15 01:50:55.126444189 +0100
716 __be32 identification;
718 +} __attribute__((packed, aligned(2)));
720 #define IP6_MF 0x0001
721 #define IP6_OFFSET 0xFFF8
728 + net_hdr_word(&addr[0]) = wh;
729 + net_hdr_word(&addr[1]) = wl;
732 static inline void ipv6_addr_set(struct in6_addr *addr,
734 const __be32 *a1 = addr1->s6_addr32;
735 const __be32 *a2 = addr2->s6_addr32;
736 unsigned int pdw, pbi;
737 + /* Used for last <32-bit fraction of prefix */
740 /* check complete u32 in prefix */
741 pdw = prefixlen >> 5;
744 /* check incomplete u32 in prefix */
745 pbi = prefixlen & 0x1f;
746 - if (pbi && ((a1[pdw] ^ a2[pdw]) & htonl((0xffffffff) << (32 - pbi))))
747 + pbia1 = net_hdr_word(&a1[pdw]);
748 + pbia2 = net_hdr_word(&a2[pdw]);
749 + if (pbi && ((pbia1 ^ pbia2) & htonl((0xffffffff) << (32 - pbi))))
753 @@ -609,13 +613,13 @@
755 static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
757 - const __be32 *a1 = token1, *a2 = token2;
758 + const struct in6_addr *a1 = token1, *a2 = token2;
763 for (i = 0; i < addrlen; i++) {
764 - __be32 xb = a1[i] ^ a2[i];
765 + __be32 xb = a1->s6_addr32[i] ^ a2->s6_addr32[i];
767 return i * 32 + 31 - __fls(ntohl(xb));
769 @@ -739,17 +743,18 @@
770 static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
773 - *(__be32 *)hdr = htonl(0x60000000 | (tclass << 20)) | flowlabel;
774 + net_hdr_word((__be32 *)hdr) =
775 + htonl(0x60000000 | (tclass << 20)) | flowlabel;
778 static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
780 - return *(__be32 *)hdr & IPV6_FLOWINFO_MASK;
781 + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWINFO_MASK;
784 static inline __be32 ip6_flowlabel(const struct ipv6hdr *hdr)
786 - return *(__be32 *)hdr & IPV6_FLOWLABEL_MASK;
787 + return net_hdr_word((__be32 *)hdr) & IPV6_FLOWLABEL_MASK;
790 static inline u8 ip6_tclass(__be32 flowinfo)
791 Index: linux-3.18.7/include/net/secure_seq.h
792 ===================================================================
793 --- linux-3.18.7.orig/include/net/secure_seq.h 2015-02-15 01:50:18.000000000 +0100
794 +++ linux-3.18.7/include/net/secure_seq.h 2015-02-15 01:50:55.126444189 +0100
796 #define _NET_SECURE_SEQ
798 #include <linux/types.h>
799 +#include <linux/in6.h>
801 u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
802 u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
803 Index: linux-3.18.7/include/uapi/linux/in.h
804 ===================================================================
805 --- linux-3.18.7.orig/include/uapi/linux/in.h 2015-02-15 01:50:18.000000000 +0100
806 +++ linux-3.18.7/include/uapi/linux/in.h 2015-02-15 01:50:55.126444189 +0100
808 /* Internet address. */
812 +} __attribute__((packed, aligned(2)));
816 Index: linux-3.18.7/net/core/secure_seq.c
817 ===================================================================
818 --- linux-3.18.7.orig/net/core/secure_seq.c 2015-02-15 01:50:18.000000000 +0100
819 +++ linux-3.18.7/net/core/secure_seq.c 2015-02-15 01:50:55.126444189 +0100
821 u32 secret[MD5_MESSAGE_BYTES / 4];
822 u32 hash[MD5_DIGEST_WORDS];
824 + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
827 memcpy(hash, saddr, 16);
828 for (i = 0; i < 4; i++)
829 - secret[i] = net_secret[i] + (__force u32)daddr[i];
830 + secret[i] = net_secret[i] + (__force u32)daddr6->s6_addr32[i];
831 secret[4] = net_secret[4] +
832 (((__force u16)sport << 16) + (__force u16)dport);
833 for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
835 u32 secret[MD5_MESSAGE_BYTES / 4];
836 u32 hash[MD5_DIGEST_WORDS];
838 + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
841 memcpy(hash, saddr, 16);
842 for (i = 0; i < 4; i++)
843 - secret[i] = net_secret[i] + (__force u32) daddr[i];
844 + secret[i] = net_secret[i] + (__force u32) daddr6->s6_addr32[i];
845 secret[4] = net_secret[4] + (__force u32)dport;
846 for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
847 secret[i] = net_secret[i];
848 @@ -150,11 +152,12 @@
849 u32 hash[MD5_DIGEST_WORDS];
852 + const struct in6_addr *daddr6 = (struct in6_addr *) daddr;
855 memcpy(hash, saddr, 16);
856 for (i = 0; i < 4; i++)
857 - secret[i] = net_secret[i] + daddr[i];
858 + secret[i] = net_secret[i] + daddr6->s6_addr32[i];
859 secret[4] = net_secret[4] +
860 (((__force u16)sport << 16) + (__force u16)dport);
861 for (i = 5; i < MD5_MESSAGE_BYTES / 4; i++)
862 Index: linux-3.18.7/net/ipv6/ip6_fib.c
863 ===================================================================
864 --- linux-3.18.7.orig/net/ipv6/ip6_fib.c 2015-02-15 01:50:18.000000000 +0100
865 +++ linux-3.18.7/net/ipv6/ip6_fib.c 2015-02-15 01:50:55.126444189 +0100
867 * See include/asm-generic/bitops/le.h.
869 return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) &
871 + net_hdr_word(&addr[fn_bit >> 5]);
874 static struct fib6_node *node_alloc(void)
875 Index: linux-3.18.7/net/netfilter/nf_conntrack_proto_tcp.c
876 ===================================================================
877 --- linux-3.18.7.orig/net/netfilter/nf_conntrack_proto_tcp.c 2015-02-15 01:50:18.000000000 +0100
878 +++ linux-3.18.7/net/netfilter/nf_conntrack_proto_tcp.c 2015-02-15 01:50:55.126444189 +0100
881 /* Fast path for timestamp-only option */
882 if (length == TCPOLEN_TSTAMP_ALIGNED
883 - && *(__be32 *)ptr == htonl((TCPOPT_NOP << 24)
884 + && net_hdr_word(ptr) == htonl((TCPOPT_NOP << 24)
886 | (TCPOPT_TIMESTAMP << 8)
887 | TCPOLEN_TIMESTAMP))
888 Index: linux-3.18.7/net/xfrm/xfrm_input.c
889 ===================================================================
890 --- linux-3.18.7.orig/net/xfrm/xfrm_input.c 2015-02-15 01:50:18.000000000 +0100
891 +++ linux-3.18.7/net/xfrm/xfrm_input.c 2015-02-15 01:50:55.126444189 +0100
893 if (!pskb_may_pull(skb, hlen))
896 - *spi = *(__be32 *)(skb_transport_header(skb) + offset);
897 - *seq = *(__be32 *)(skb_transport_header(skb) + offset_seq);
898 + *spi = net_hdr_word(skb_transport_header(skb) + offset);
899 + *seq = net_hdr_word(skb_transport_header(skb) + offset_seq);
903 Index: linux-3.18.7/net/ipv4/tcp_input.c
904 ===================================================================
905 --- linux-3.18.7.orig/net/ipv4/tcp_input.c 2015-02-15 01:50:18.000000000 +0100
906 +++ linux-3.18.7/net/ipv4/tcp_input.c 2015-02-15 01:50:55.126444189 +0100
907 @@ -3677,14 +3677,16 @@
909 const __be32 *ptr = (const __be32 *)(th + 1);
911 - if (*ptr == htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16)
912 - | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
913 + if (net_hdr_word(ptr) ==
914 + htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
915 + (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP)) {
916 tp->rx_opt.saw_tstamp = 1;
918 - tp->rx_opt.rcv_tsval = ntohl(*ptr);
919 + tp->rx_opt.rcv_tsval = get_unaligned_be32(ptr);
922 - tp->rx_opt.rcv_tsecr = ntohl(*ptr) - tp->tsoffset;
923 + if (net_hdr_word(ptr))
924 + tp->rx_opt.rcv_tsecr = get_unaligned_be32(ptr) -
927 tp->rx_opt.rcv_tsecr = 0;
929 Index: linux-3.18.7/include/uapi/linux/if_pppox.h
930 ===================================================================
931 --- linux-3.18.7.orig/include/uapi/linux/if_pppox.h 2015-02-15 01:50:18.000000000 +0100
932 +++ linux-3.18.7/include/uapi/linux/if_pppox.h 2015-02-15 01:50:55.126444189 +0100
938 struct in_addr sin_addr;
941 Index: linux-3.18.7/net/ipv6/netfilter/nf_log_ipv6.c
942 ===================================================================
943 --- linux-3.18.7.orig/net/ipv6/netfilter/nf_log_ipv6.c 2015-02-11 08:01:12.000000000 +0100
944 +++ linux-3.18.7/net/ipv6/netfilter/nf_log_ipv6.c 2015-02-15 02:17:44.193854463 +0100
946 /* Max length: 44 "LEN=65535 TC=255 HOPLIMIT=255 FLOWLBL=FFFFF " */
947 nf_log_buf_add(m, "LEN=%Zu TC=%u HOPLIMIT=%u FLOWLBL=%u ",
948 ntohs(ih->payload_len) + sizeof(struct ipv6hdr),
949 + (ntohl(net_hdr_word(ih)) & 0x0ff00000) >> 20,
950 (ntohl(*(__be32 *)ih) & 0x0ff00000) >> 20,
952 - (ntohl(*(__be32 *)ih) & 0x000fffff));
953 + (ntohl(net_hdr_word(ih)) & 0x000fffff));
956 ptr = ip6hoff + sizeof(struct ipv6hdr);