netfilter: ipv4: prefer skb_ensure_writable
authorFlorian Westphal <fw@strlen.de>
Thu, 23 May 2019 13:44:08 +0000 (15:44 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 31 May 2019 16:02:46 +0000 (18:02 +0200)
.. so skb_make_writable can be removed soon.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/ipv4/netfilter/arpt_mangle.c
net/ipv4/netfilter/ipt_ECN.c
net/ipv4/netfilter/nf_nat_h323.c
net/ipv4/netfilter/nf_nat_snmp_basic_main.c
net/netfilter/nf_nat_sip.c

index 87ca2c42359b8bad404667a22a21a98ed6410911..a4e07e5e9c118d9fa2314ac95016af635e2ae689 100644 (file)
@@ -17,7 +17,7 @@ target(struct sk_buff *skb, const struct xt_action_param *par)
        unsigned char *arpptr;
        int pln, hln;
 
-       if (!skb_make_writable(skb, skb->len))
+       if (skb_ensure_writable(skb, skb->len))
                return NF_DROP;
 
        arp = arp_hdr(skb);
index aaaf9a81fbc9730050bde35217f47634fd8aca41..9f6751893660014aa303d0cdf53167e022f5c978 100644 (file)
@@ -32,7 +32,7 @@ set_ect_ip(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
 
        if ((iph->tos & IPT_ECN_IP_MASK) != (einfo->ip_ect & IPT_ECN_IP_MASK)) {
                __u8 oldtos;
-               if (!skb_make_writable(skb, sizeof(struct iphdr)))
+               if (skb_ensure_writable(skb, sizeof(struct iphdr)))
                        return false;
                iph = ip_hdr(skb);
                oldtos = iph->tos;
@@ -61,7 +61,7 @@ set_ect_tcp(struct sk_buff *skb, const struct ipt_ECN_info *einfo)
             tcph->cwr == einfo->proto.tcp.cwr))
                return true;
 
-       if (!skb_make_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
+       if (skb_ensure_writable(skb, ip_hdrlen(skb) + sizeof(*tcph)))
                return false;
        tcph = (void *)ip_hdr(skb) + ip_hdrlen(skb);
 
index 7875c98072eb93fb0f555feda39e8433b9c37719..15f2b2604890771dd5bdb5940d57fd8414269206 100644 (file)
@@ -59,7 +59,7 @@ static int set_addr(struct sk_buff *skb, unsigned int protoff,
                        net_notice_ratelimited("nf_nat_h323: nf_nat_mangle_udp_packet error\n");
                        return -1;
                }
-               /* nf_nat_mangle_udp_packet uses skb_make_writable() to copy
+               /* nf_nat_mangle_udp_packet uses skb_ensure_writable() to copy
                 * or pull everything in a linear buffer, so we can safely
                 * use the skb pointers now */
                *data = skb->data + ip_hdrlen(skb) + sizeof(struct udphdr);
index 657d2dcec3cc179ca1f267d25c6546370bcfbdf7..717b726504febde644e2ac65bd1556445c60f8ac 100644 (file)
@@ -186,7 +186,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
                return NF_DROP;
        }
 
-       if (!skb_make_writable(skb, skb->len)) {
+       if (skb_ensure_writable(skb, skb->len)) {
                nf_ct_helper_log(skb, ct, "cannot mangle packet");
                return NF_DROP;
        }
index 464387b3600fbb9b0bc8cd14f72383d098bf1368..07805bf4d62a87a347ced048f42482828448b711 100644 (file)
@@ -285,7 +285,7 @@ next:
        if (dir == IP_CT_DIR_REPLY && ct_sip_info->forced_dport) {
                struct udphdr *uh;
 
-               if (!skb_make_writable(skb, skb->len)) {
+               if (skb_ensure_writable(skb, skb->len)) {
                        nf_ct_helper_log(skb, ct, "cannot mangle packet");
                        return NF_DROP;
                }