netfilter: nat: remove duplicate skb_is_nonlinear() in __nf_nat_mangle_tcp_packet()
authorTaehee Yoo <ap420073@gmail.com>
Wed, 12 Sep 2018 14:07:31 +0000 (23:07 +0900)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 20 Sep 2018 16:26:56 +0000 (18:26 +0200)
__nf_nat_mangle_tcp_packet() and nf_nat_mangle_udp_packet() call
mangle_contents(). and __nf_nat_mangle_tcp_packet()
and mangle_contents() call skb_is_nonlinear(). so that
skb_is_nonlinear() in __nf_nat_mangle_tcp_packet() is unnecessary.

Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_nat_helper.c

index 99606baedda4903dc4fa360ac63d28fad1109b7e..38793b95d9bca6b6aa884bda1d2590b2824e1060 100644 (file)
@@ -37,7 +37,7 @@ static void mangle_contents(struct sk_buff *skb,
 {
        unsigned char *data;
 
-       BUG_ON(skb_is_nonlinear(skb));
+       SKB_LINEAR_ASSERT(skb);
        data = skb_network_header(skb) + dataoff;
 
        /* move post-replacement */
@@ -110,8 +110,6 @@ bool __nf_nat_mangle_tcp_packet(struct sk_buff *skb,
            !enlarge_skb(skb, rep_len - match_len))
                return false;
 
-       SKB_LINEAR_ASSERT(skb);
-
        tcph = (void *)skb->data + protoff;
 
        oldlen = skb->len - protoff;