diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 2fa1469..0b6a7fd 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -111,15 +111,21 @@ struct ipv6hdr; static inline int IP6_ECN_set_ce(struct ipv6hdr *iph) { + __be32 dsfield; if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) return 0; - *(__be32*)iph |= htonl(INET_ECN_CE << 20); + dsfield = __get_unaligned_cpu32((__be32*)iph); + dsfield |= htonl(INET_ECN_CE << 20); + __put_unaligned_cpu32(dsfield, (__be32*)iph); return 1; } static inline void IP6_ECN_clear(struct ipv6hdr *iph) { - *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); + __be32 dsfield; + dsfield = __get_unaligned_cpu32((__be32*)iph); + dsfield &= ~htonl(INET_ECN_MASK << 20); + __put_unaligned_cpu32(dsfield, (__be32*)iph); } static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)