} while (word != stop);
return csum_fold(csum);
-@@ -182,73 +186,6 @@ static inline __sum16 ip_compute_csum(co
+@@ -179,74 +183,6 @@ static inline __sum16 ip_compute_csum(co
return csum_fold(csum_partial(buff, len, 0));
}
- " .set pop"
- : "=&r" (sum), "=&r" (tmp)
- : "r" (saddr), "r" (daddr),
-- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum));
+- "0" (htonl(len)), "r" (htonl(proto)), "r" (sum)
+- : "memory");
-
- return csum_fold(sum);
-}
#include <linux/uaccess.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
-@@ -944,10 +945,10 @@ static void tcp_v6_send_response(const s
+@@ -901,10 +902,10 @@ static void tcp_v6_send_response(const s
topt = (__be32 *)(t1 + 1);
if (tsecr) {
*/
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
-@@ -492,7 +492,7 @@ int ipv6_recv_error(struct sock *sk, str
+@@ -497,7 +497,7 @@ int ipv6_recv_error(struct sock *sk, str
ipv6_iface_scope_id(&sin->sin6_addr,
IP6CB(skb)->iif);
} else {
&sin->sin6_addr);
sin->sin6_scope_id = 0;
}
-@@ -846,12 +846,12 @@ int ip6_datagram_send_ctl(struct net *ne
+@@ -851,12 +851,12 @@ int ip6_datagram_send_ctl(struct net *ne
}
if (fl6->flowlabel&IPV6_FLOWINFO_MASK) {
case IPV6_2292HOPOPTS:
--- a/net/ipv6/exthdrs.c
+++ b/net/ipv6/exthdrs.c
-@@ -1002,7 +1002,7 @@ static bool ipv6_hop_jumbo(struct sk_buf
+@@ -1013,7 +1013,7 @@ static bool ipv6_hop_jumbo(struct sk_buf
goto drop;
}
- pkt_len = ntohl(*(__be32 *)(nh + optoff + 2));
+ pkt_len = ntohl(net_hdr_word(nh + optoff + 2));
if (pkt_len <= IPV6_MAXPLEN) {
- __IP6_INC_STATS(net, idev, IPSTATS_MIB_INHDRERRORS);
- icmpv6_param_prob(skb, ICMPV6_HDR_FIELD, optoff+2);
+ icmpv6_param_prob_reason(skb, ICMPV6_HDR_FIELD, optoff + 2,
+ SKB_DROP_REASON_IP_INHDR);
--- a/include/linux/types.h
+++ b/include/linux/types.h
-@@ -231,5 +231,11 @@ typedef void (*swap_func_t)(void *a, voi
+@@ -232,5 +232,11 @@ typedef void (*swap_func_t)(void *a, voi
typedef int (*cmp_r_func_t)(const void *a, const void *b, const void *priv);
typedef int (*cmp_func_t)(const void *a, const void *b);
#endif /* _LINUX_TYPES_H */
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
-@@ -1477,8 +1477,8 @@ struct sk_buff *inet_gro_receive(struct
+@@ -1515,8 +1515,8 @@ struct sk_buff *inet_gro_receive(struct
if (unlikely(ip_fast_csum((u8 *)iph, 5)))
- goto out_unlock;
+ goto out;
- id = ntohl(*(__be32 *)&iph->id);
- flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF));
list_for_each_entry(p, head, list) {
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
-@@ -610,48 +610,53 @@ static void tcp_options_write(__be32 *pt
+@@ -612,48 +612,53 @@ static void tcp_options_write(struct tcp
u16 options = opts->options; /* mungable copy */
if (unlikely(OPTION_MD5 & options)) {
}
if (unlikely(opts->num_sack_blocks)) {
-@@ -659,16 +664,17 @@ static void tcp_options_write(__be32 *pt
+@@ -661,16 +666,17 @@ static void tcp_options_write(struct tcp
tp->duplicate_sack : tp->selective_acks;
int this_sack;
}
tp->rx_opt.dsack = 0;
-@@ -681,13 +687,14 @@ static void tcp_options_write(__be32 *pt
+@@ -683,13 +689,14 @@ static void tcp_options_write(struct tcp
if (foc->exp) {
len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
@@ -49,7 +49,7 @@ struct igmpv3_grec {
__be16 grec_nsrcs;
__be32 grec_mca;
- __be32 grec_src[0];
+ __be32 grec_src[];
-};
+} __attribute__((packed, aligned(2)));
@@ -58,7 +58,7 @@ struct igmpv3_report {
__be16 resv2;
__be16 ngrec;
- struct igmpv3_grec grec[0];
+ struct igmpv3_grec grec[];
-};
+} __attribute__((packed, aligned(2)));
@@ -79,7 +79,7 @@ struct igmpv3_query {
__u8 qqic;
__be16 nsrcs;
- __be32 srcs[0];
+ __be32 srcs[];
-};
+} __attribute__((packed, aligned(2)));
#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
--- a/net/core/flow_dissector.c
+++ b/net/core/flow_dissector.c
-@@ -129,7 +129,7 @@ __be32 __skb_flow_get_ports(const struct
+@@ -131,7 +131,7 @@ __be32 __skb_flow_get_ports(const struct
ports = __skb_header_pointer(skb, thoff + poff,
sizeof(_ports), data, hlen, &_ports);
if (ports)
goto next_ht;
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
-@@ -241,7 +241,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *
+@@ -259,7 +259,7 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *
continue;
iph2 = (struct ipv6hdr *)(p->data + off);
* XXX skbs on the gro_list have all been parsed and pulled
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
-@@ -47,7 +47,7 @@ struct prefix_info {
+@@ -52,7 +52,7 @@ struct prefix_info {
__be32 reserved2;
struct in6_addr prefix;
-};
+} __attribute__((packed, aligned(2)));
- #include <linux/ipv6.h>
- #include <linux/netdevice.h>
+ /* rfc4861 4.6.2: IPv6 PIO is 32 bytes in size */
+ static_assert(sizeof(struct prefix_info) == 32);
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -138,9 +138,9 @@ static inline int IP6_ECN_set_ce(struct
(__force __wsum)to);
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
-@@ -147,7 +147,7 @@ struct frag_hdr {
+@@ -149,7 +149,7 @@ struct frag_hdr {
__u8 reserved;
__be16 frag_off;
__be32 identification;
-};
+} __attribute__((packed, aligned(2)));
- #define IP6_MF 0x0001
- #define IP6_OFFSET 0xFFF8
-@@ -561,8 +561,8 @@ static inline void __ipv6_addr_set_half(
+ /*
+ * Jumbo payload option, as described in RFC 2675 2.
+@@ -615,8 +615,8 @@ static inline void __ipv6_addr_set_half(
}
#endif
#endif
}
static inline void ipv6_addr_set(struct in6_addr *addr,
-@@ -621,6 +621,8 @@ static inline bool ipv6_prefix_equal(con
+@@ -675,6 +675,8 @@ static inline bool ipv6_prefix_equal(con
const __be32 *a1 = addr1->s6_addr32;
const __be32 *a2 = addr2->s6_addr32;
unsigned int pdw, pbi;
/* check complete u32 in prefix */
pdw = prefixlen >> 5;
-@@ -629,7 +631,9 @@ static inline bool ipv6_prefix_equal(con
+@@ -683,7 +685,9 @@ static inline bool ipv6_prefix_equal(con
/* check incomplete u32 in prefix */
pbi = prefixlen & 0x1f;
return false;
return true;
-@@ -746,13 +750,13 @@ static inline void ipv6_addr_set_v4mappe
+@@ -805,13 +809,13 @@ static inline void ipv6_addr_set_v4mappe
*/
static inline int __ipv6_addr_diff32(const void *token1, const void *token2, int addrlen)
{
if (xb)
return i * 32 + 31 - __fls(ntohl(xb));
}
-@@ -946,17 +950,18 @@ static inline u32 ip6_multipath_hash_fie
+@@ -1005,17 +1009,18 @@ static inline u32 ip6_multipath_hash_fie
static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
__be32 flowlabel)
{
#include <linux/types.h>
+#include <linux/in6.h>
- u64 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
- u64 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
+ struct net;
+
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
-@@ -88,7 +88,7 @@ enum {
+@@ -91,7 +91,7 @@ enum {
/* Internet address. */
struct in_addr {
__be32 s_addr;
#define IP_TOS 1
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
-@@ -141,7 +141,7 @@ static __be32 addr_bit_set(const void *t
+@@ -142,7 +142,7 @@ static __be32 addr_bit_set(const void *t
* See include/asm-generic/bitops/le.h.
*/
return (__force __be32)(1 << ((~fn_bit ^ BITOP_BE32_SWIZZLE) & 0x1f)) &
struct fib6_info *fib6_info_alloc(gfp_t gfp_flags, bool with_fib6_nh)
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
-@@ -400,7 +400,7 @@ static void tcp_sack(const struct sk_buf
+@@ -406,7 +406,7 @@ static void tcp_sack(const struct sk_buf
/* Fast path for timestamp-only option */
if (length == TCPOLEN_TSTAMP_ALIGNED
| TCPOLEN_TIMESTAMP))
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
-@@ -167,8 +167,8 @@ int xfrm_parse_spi(struct sk_buff *skb,
+@@ -168,8 +168,8 @@ int xfrm_parse_spi(struct sk_buff *skb,
if (!pskb_may_pull(skb, hlen))
return -EINVAL;
EXPORT_SYMBOL(xfrm_parse_spi);
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
-@@ -4158,14 +4158,16 @@ static bool tcp_parse_aligned_timestamp(
+@@ -4183,14 +4183,16 @@ static bool tcp_parse_aligned_timestamp(
{
const __be32 *ptr = (const __be32 *)(th + 1);
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
-@@ -270,8 +270,10 @@ static inline bool neigh_key_eq128(const
+@@ -286,8 +286,10 @@ static inline bool neigh_key_eq128(const
const u32 *n32 = (const u32 *)n->primary_key;
const u32 *p32 = pkey;
*sum = csum_fold(csum_partial(diff, sizeof(diff),
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
-@@ -525,7 +525,7 @@ static inline bool is_etherdev_addr(cons
+@@ -555,7 +555,7 @@ static inline bool is_etherdev_addr(cons
* @b: Pointer to Ethernet header
*
* Compare two Ethernet headers, returns 0 if equal.
* aligned OR the platform can handle unaligned access. This is the
* case for all packets coming into netif_receive_skb or similar
* entry points.
-@@ -548,11 +548,12 @@ static inline unsigned long compare_ethe
+@@ -578,11 +578,12 @@ static inline unsigned long compare_ethe
fold |= *(unsigned long *)(a + 6) ^ *(unsigned long *)(b + 6);
return fold;
#else
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
-@@ -223,7 +223,7 @@ struct sk_buff *tcp_gro_receive(struct l
+@@ -60,7 +60,7 @@ static struct sk_buff *__tcpv4_gso_segme
+ th2 = tcp_hdr(seg->next);
+ iph2 = ip_hdr(seg->next);
- th2 = tcp_hdr(p);
+- if (!(*(u32 *)&th->source ^ *(u32 *)&th2->source) &&
++ if (!(net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) &&
+ iph->daddr == iph2->daddr && iph->saddr == iph2->saddr)
+ return segs;
+@@ -252,7 +252,7 @@ struct sk_buff *tcp_gro_lookup(struct li
+ continue;
+
+ th2 = tcp_hdr(p);
- if (*(u32 *)&th->source ^ *(u32 *)&th2->source) {
+ if (net_hdr_word(&th->source) ^ net_hdr_word(&th2->source)) {
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
-@@ -241,8 +241,8 @@ found:
+@@ -318,8 +318,8 @@ struct sk_buff *tcp_gro_receive(struct l
~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH));
flush |= (__force int)(th->ack_seq ^ th2->ack_seq);
for (i = sizeof(*th); i < thlen; i += 4)
* continue this flow as an atomic flow with a fixed ID or if we use
--- a/net/ipv6/netfilter/ip6table_mangle.c
+++ b/net/ipv6/netfilter/ip6table_mangle.c
-@@ -44,7 +44,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
+@@ -44,7 +44,7 @@ ip6t_mangle_out(void *priv, struct sk_bu
hop_limit = ipv6_hdr(skb)->hop_limit;
/* flowlabel and prio (includes version, which shouldn't change either */
- flowlabel = *((u_int32_t *)ipv6_hdr(skb));
+ flowlabel = net_hdr_word(ipv6_hdr(skb));
- ret = ip6t_do_table(skb, state, priv);
+ ret = ip6t_do_table(priv, skb, state);
-@@ -53,7 +53,7 @@ ip6t_mangle_out(struct sk_buff *skb, con
+@@ -53,7 +53,7 @@ ip6t_mangle_out(void *priv, struct sk_bu
!ipv6_addr_equal(&ipv6_hdr(skb)->daddr, &daddr) ||
skb->mark != mark ||
ipv6_hdr(skb)->hop_limit != hop_limit ||