__u8                    mc_ttl;
        __u8                    pmtudisc;
        __u8                    is_icsk:1,
-                               hdrincl:1,
                                mc_loop:1,
                                transparent:1,
                                mc_all:1,
        INET_FLAGS_RECVERR      = 9,
        INET_FLAGS_RECVERR_RFC4884 = 10,
        INET_FLAGS_FREEBIND     = 11,
+       INET_FLAGS_HDRINCL      = 12,
 };
 
 /* cmsg flags for inet */
 {
        __u8 flags = 0;
 
-       if (inet_sk(sk)->transparent || inet_sk(sk)->hdrincl)
+       if (inet_sk(sk)->transparent || inet_test_bit(HDRINCL, sk))
                flags |= FLOWI_FLAG_ANYSRC;
        return flags;
 }
 
        if (SOCK_RAW == sock->type) {
                inet->inet_num = protocol;
                if (IPPROTO_RAW == protocol)
-                       inet->hdrincl = 1;
+                       inet_set_bit(HDRINCL, sk);
        }
 
        if (READ_ONCE(net->ipv4.sysctl_ip_no_pmtu_disc))
 
        inet_sockopt.recverr    = inet_test_bit(RECVERR, sk);
        inet_sockopt.is_icsk    = inet->is_icsk;
        inet_sockopt.freebind   = inet_test_bit(FREEBIND, sk);
-       inet_sockopt.hdrincl    = inet->hdrincl;
+       inet_sockopt.hdrincl    = inet_test_bit(HDRINCL, sk);
        inet_sockopt.mc_loop    = inet->mc_loop;
        inet_sockopt.transparent = inet->transparent;
        inet_sockopt.mc_all     = inet->mc_all;
 
                        }
                }
        } else if ((flags & MSG_SPLICE_PAGES) && length) {
-               if (inet->hdrincl)
+               if (inet_test_bit(HDRINCL, sk))
                        return -EPERM;
                if (rt->dst.dev->features & NETIF_F_SG &&
                    getfrag == ip_generic_getfrag)
                 * so icmphdr does not in skb linear region and can not get icmp_type
                 * by icmp_hdr(skb)->type.
                 */
-               if (sk->sk_type == SOCK_RAW && !inet_sk(sk)->hdrincl)
+               if (sk->sk_type == SOCK_RAW &&
+                   !inet_test_bit(HDRINCL, sk))
                        icmp_type = fl4->fl4_icmp_type;
                else
                        icmp_type = icmp_hdr(skb)->type;
 
                        return -EINVAL;
                inet_assign_bit(FREEBIND, sk, val);
                return 0;
+       case IP_HDRINCL:
+               if (sk->sk_type != SOCK_RAW)
+                       return -ENOPROTOOPT;
+               inet_assign_bit(HDRINCL, sk, val);
+               return 0;
        }
 
        err = 0;
                        goto e_inval;
                inet->uc_ttl = val;
                break;
-       case IP_HDRINCL:
-               if (sk->sk_type != SOCK_RAW) {
-                       err = -ENOPROTOOPT;
-                       break;
-               }
-               inet->hdrincl = val ? 1 : 0;
-               break;
        case IP_NODEFRAG:
                if (sk->sk_type != SOCK_RAW) {
                        err = -ENOPROTOOPT;
        case IP_FREEBIND:
                val = inet_test_bit(FREEBIND, sk);
                goto copyval;
+       case IP_HDRINCL:
+               val = inet_test_bit(HDRINCL, sk);
+               goto copyval;
        }
 
        if (needs_rtnl)
                       inet->uc_ttl);
                break;
        }
-       case IP_HDRINCL:
-               val = inet->hdrincl;
-               break;
        case IP_NODEFRAG:
                val = inet->nodefrag;
                break;
 
                const struct iphdr *iph = (const struct iphdr *)skb->data;
                u8 *payload = skb->data + (iph->ihl << 2);
 
-               if (inet->hdrincl)
+               if (inet_test_bit(HDRINCL, sk))
                        payload = skb->data;
                ip_icmp_error(sk, skb, err, 0, info, payload);
        }
        if (len > 0xFFFF)
                goto out;
 
-       /* hdrincl should be READ_ONCE(inet->hdrincl)
-        * but READ_ONCE() doesn't work with bit fields.
-        * Doing this indirectly yields the same result.
-        */
-       hdrincl = inet->hdrincl;
-       hdrincl = READ_ONCE(hdrincl);
+       hdrincl = inet_test_bit(HDRINCL, sk);
+
        /*
         *      Check the flags.
         */
 
        __u8 scope = RT_SCOPE_UNIVERSE;
 
        if (sk) {
-               const struct inet_sock *inet = inet_sk(sk);
-
                oif = sk->sk_bound_dev_if;
                mark = READ_ONCE(sk->sk_mark);
                tos = ip_sock_rt_tos(sk);
                scope = ip_sock_rt_scope(sk);
-               prot = inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol;
+               prot = inet_test_bit(HDRINCL, sk) ? IPPROTO_RAW :
+                                                   sk->sk_protocol;
        }
 
        flowi4_init_output(fl4, oif, mark, tos & IPTOS_RT_MASK, scope,
        flowi4_init_output(fl4, sk->sk_bound_dev_if, READ_ONCE(sk->sk_mark),
                           ip_sock_rt_tos(sk) & IPTOS_RT_MASK,
                           ip_sock_rt_scope(sk),
-                          inet->hdrincl ? IPPROTO_RAW : sk->sk_protocol,
+                          inet_test_bit(HDRINCL, sk) ?
+                               IPPROTO_RAW : sk->sk_protocol,
                           inet_sk_flowi_flags(sk),
                           daddr, inet->inet_saddr, 0, 0, sk->sk_uid);
        rcu_read_unlock();
 
        if (SOCK_RAW == sock->type) {
                inet->inet_num = protocol;
                if (IPPROTO_RAW == protocol)
-                       inet->hdrincl = 1;
+                       inet_set_bit(HDRINCL, sk);
        }
 
        sk->sk_destruct         = inet6_sock_destruct;
 
                        }
                }
        } else if ((flags & MSG_SPLICE_PAGES) && length) {
-               if (inet_sk(sk)->hdrincl)
+               if (inet_test_bit(HDRINCL, sk))
                        return -EPERM;
                if (rt->dst.dev->features & NETIF_F_SG &&
                    getfrag == ip_generic_getfrag)
                struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
                u8 icmp6_type;
 
-               if (sk->sk_socket->type == SOCK_RAW && !inet_sk(sk)->hdrincl)
+               if (sk->sk_socket->type == SOCK_RAW &&
+                  !inet_test_bit(HDRINCL, sk))
                        icmp6_type = fl6->fl6_icmp_type;
                else
                        icmp6_type = icmp6_hdr(skb)->icmp6_type;
 
               struct inet6_skb_parm *opt,
               u8 type, u8 code, int offset, __be32 info)
 {
-       struct inet_sock *inet = inet_sk(sk);
        struct ipv6_pinfo *np = inet6_sk(sk);
        int err;
        int harderr;
        }
        if (np->recverr) {
                u8 *payload = skb->data;
-               if (!inet->hdrincl)
+               if (!inet_test_bit(HDRINCL, sk))
                        payload += offset;
                ipv6_icmp_error(sk, skb, err, 0, ntohl(info), payload);
        }
                                                         skb->len,
                                                         inet->inet_num, 0));
 
-       if (inet->hdrincl) {
+       if (inet_test_bit(HDRINCL, sk)) {
                if (skb_checksum_complete(skb)) {
                        atomic_inc(&sk->sk_drops);
                        kfree_skb_reason(skb, SKB_DROP_REASON_SKB_CSUM);
        if (msg->msg_flags & MSG_OOB)
                return -EOPNOTSUPP;
 
-       /* hdrincl should be READ_ONCE(inet->hdrincl)
-        * but READ_ONCE() doesn't work with bit fields.
-        * Doing this indirectly yields the same result.
-        */
-       hdrincl = inet->hdrincl;
-       hdrincl = READ_ONCE(hdrincl);
+       hdrincl = inet_test_bit(HDRINCL, sk);
 
        /*
         *      Get and verify the address.
        case IPV6_HDRINCL:
                if (sk->sk_type != SOCK_RAW)
                        return -EINVAL;
-               inet_sk(sk)->hdrincl = !!val;
+               inet_assign_bit(HDRINCL, sk, val);
                return 0;
        case IPV6_CHECKSUM:
                if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 &&
 
        switch (optname) {
        case IPV6_HDRINCL:
-               val = inet_sk(sk)->hdrincl;
+               val = inet_test_bit(HDRINCL, sk);
                break;
        case IPV6_CHECKSUM:
                /*