]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
netfilter: ipvs: prefer skb_ensure_writable
authorFlorian Westphal <fw@strlen.de>
Thu, 23 May 2019 13:44:06 +0000 (15:44 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 31 May 2019 16:02:44 +0000 (18:02 +0200)
It does the same thing, use it instead so we can remove skb_make_writable.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipvs/ip_vs_app.c
net/netfilter/ipvs/ip_vs_core.c
net/netfilter/ipvs/ip_vs_ftp.c
net/netfilter/ipvs/ip_vs_proto_sctp.c
net/netfilter/ipvs/ip_vs_proto_tcp.c
net/netfilter/ipvs/ip_vs_proto_udp.c
net/netfilter/ipvs/ip_vs_xmit.c

index 7588aeaa605ffe640aa258f69e85938b5191c729..ba34ac25ee7bdc2b49fb9b22bc6cf2fe4149cb36 100644 (file)
@@ -363,7 +363,7 @@ static inline int app_tcp_pkt_out(struct ip_vs_conn *cp, struct sk_buff *skb,
        struct tcphdr *th;
        __u32 seq;
 
-       if (!skb_make_writable(skb, tcp_offset + sizeof(*th)))
+       if (skb_ensure_writable(skb, tcp_offset + sizeof(*th)))
                return 0;
 
        th = (struct tcphdr *)(skb_network_header(skb) + tcp_offset);
@@ -440,7 +440,7 @@ static inline int app_tcp_pkt_in(struct ip_vs_conn *cp, struct sk_buff *skb,
        struct tcphdr *th;
        __u32 seq;
 
-       if (!skb_make_writable(skb, tcp_offset + sizeof(*th)))
+       if (skb_ensure_writable(skb, tcp_offset + sizeof(*th)))
                return 0;
 
        th = (struct tcphdr *)(skb_network_header(skb) + tcp_offset);
index d1d7b2483fd7782c298b292e0571b9070cf73644..90adca9a55101d836e392d1eb8f53f5d69a9170d 100644 (file)
@@ -898,7 +898,7 @@ static int handle_response_icmp(int af, struct sk_buff *skb,
        if (IPPROTO_TCP == protocol || IPPROTO_UDP == protocol ||
            IPPROTO_SCTP == protocol)
                offset += 2 * sizeof(__u16);
-       if (!skb_make_writable(skb, offset))
+       if (skb_ensure_writable(skb, offset))
                goto out;
 
 #ifdef CONFIG_IP_VS_IPV6
@@ -1288,7 +1288,7 @@ handle_response(int af, struct sk_buff *skb, struct ip_vs_proto_data *pd,
 
        IP_VS_DBG_PKT(11, af, pp, skb, iph->off, "Outgoing packet");
 
-       if (!skb_make_writable(skb, iph->len))
+       if (skb_ensure_writable(skb, iph->len))
                goto drop;
 
        /* mangle the packet */
index fe69d46ff77959a49f5c574bb6a74b50eab23208..5cbefa927f09c13f457220711b64523b8b3e08db 100644 (file)
@@ -273,7 +273,7 @@ static int ip_vs_ftp_out(struct ip_vs_app *app, struct ip_vs_conn *cp,
                return 1;
 
        /* Linear packets are much easier to deal with. */
-       if (!skb_make_writable(skb, skb->len))
+       if (skb_ensure_writable(skb, skb->len))
                return 0;
 
        if (cp->app_data == (void *) IP_VS_FTP_PASV) {
@@ -439,7 +439,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp,
                return 1;
 
        /* Linear packets are much easier to deal with. */
-       if (!skb_make_writable(skb, skb->len))
+       if (skb_ensure_writable(skb, skb->len))
                return 0;
 
        data = data_start = ip_vs_ftp_data_ptr(skb, ipvsh);
index b58ddb7dffd1521ddab2b43a7c396731405b96ba..a0921adc31a9ffe7db09d18e7ae54213a79a8fd7 100644 (file)
@@ -101,7 +101,7 @@ sctp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
 #endif
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, sctphoff + sizeof(*sctph)))
+       if (skb_ensure_writable(skb, sctphoff + sizeof(*sctph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
@@ -148,7 +148,7 @@ sctp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
 #endif
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, sctphoff + sizeof(*sctph)))
+       if (skb_ensure_writable(skb, sctphoff + sizeof(*sctph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
index 00ce07dda9800458f9669529edefe09e3ad420fe..089ee592a9555b23d6b071b2d3d2822e23da72bb 100644 (file)
@@ -163,7 +163,7 @@ tcp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
        oldlen = skb->len - tcphoff;
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
+       if (skb_ensure_writable(skb, tcphoff + sizeof(*tcph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
@@ -241,7 +241,7 @@ tcp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
        oldlen = skb->len - tcphoff;
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, tcphoff+sizeof(*tcph)))
+       if (skb_ensure_writable(skb, tcphoff + sizeof(*tcph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
index 92c078abcb3ebda801ceab280f0bbcc2b9a51acf..de366aa3c03b9333b12ab73b901b4f821d18a353 100644 (file)
@@ -153,7 +153,7 @@ udp_snat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
        oldlen = skb->len - udphoff;
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, udphoff+sizeof(*udph)))
+       if (skb_ensure_writable(skb, udphoff + sizeof(*udph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
@@ -236,7 +236,7 @@ udp_dnat_handler(struct sk_buff *skb, struct ip_vs_protocol *pp,
        oldlen = skb->len - udphoff;
 
        /* csum_check requires unshared skb */
-       if (!skb_make_writable(skb, udphoff+sizeof(*udph)))
+       if (skb_ensure_writable(skb, udphoff + sizeof(*udph)))
                return 0;
 
        if (unlikely(cp->app != NULL)) {
index 8d6f94b6777293dd08c19f9522c594d33a3710b6..0b41d0504429731dcdaf1893334eacd275103423 100644 (file)
@@ -279,7 +279,7 @@ static inline bool decrement_ttl(struct netns_ipvs *ipvs,
                }
 
                /* don't propagate ttl change to cloned packets */
-               if (!skb_make_writable(skb, sizeof(struct ipv6hdr)))
+               if (skb_ensure_writable(skb, sizeof(struct ipv6hdr)))
                        return false;
 
                ipv6_hdr(skb)->hop_limit--;
@@ -294,7 +294,7 @@ static inline bool decrement_ttl(struct netns_ipvs *ipvs,
                }
 
                /* don't propagate ttl change to cloned packets */
-               if (!skb_make_writable(skb, sizeof(struct iphdr)))
+               if (skb_ensure_writable(skb, sizeof(struct iphdr)))
                        return false;
 
                /* Decrease ttl */
@@ -796,7 +796,7 @@ ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!skb_make_writable(skb, sizeof(struct iphdr)))
+       if (skb_ensure_writable(skb, sizeof(struct iphdr)))
                goto tx_error;
 
        if (skb_cow(skb, rt->dst.dev->hard_header_len))
@@ -885,7 +885,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!skb_make_writable(skb, sizeof(struct ipv6hdr)))
+       if (skb_ensure_writable(skb, sizeof(struct ipv6hdr)))
                goto tx_error;
 
        if (skb_cow(skb, rt->dst.dev->hard_header_len))
@@ -1404,7 +1404,7 @@ ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!skb_make_writable(skb, offset))
+       if (skb_ensure_writable(skb, offset))
                goto tx_error;
 
        if (skb_cow(skb, rt->dst.dev->hard_header_len))
@@ -1493,7 +1493,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
        }
 
        /* copy-on-write the packet before mangling it */
-       if (!skb_make_writable(skb, offset))
+       if (skb_ensure_writable(skb, offset))
                goto tx_error;
 
        if (skb_cow(skb, rt->dst.dev->hard_header_len))