Although NFT_PAYLOAD_L4CSUM_PSEUDOHDR flag is part of the enum, we use it as a boolean value. Change the flag usage to be more appropriate for an enum bitmask. Signed-off-by: Boris Sukholitko <boris.sukholitko@xxxxxxxxxxxx> --- net/netfilter/nft_payload.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index 50109663bb13..9e11df7389ca 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -792,8 +792,8 @@ int nft_payload_mangle(const struct nft_payload_set *priv, const struct nft_pktinfo *pkt, const u32 *src) { + int offset, csum_offset, needs_csum; struct sk_buff *skb = pkt->skb; - int offset, csum_offset; __wsum fsum, tsum; switch (priv->base) { @@ -822,8 +822,9 @@ int nft_payload_mangle(const struct nft_payload_set *priv, csum_offset = offset + priv->csum_offset; offset += priv->offset; + needs_csum = priv->csum_flags & NFT_PAYLOAD_L4CSUM_PSEUDOHDR; - if ((priv->csum_type == NFT_PAYLOAD_CSUM_INET || priv->csum_flags) && + if ((priv->csum_type == NFT_PAYLOAD_CSUM_INET || needs_csum) && ((priv->base != NFT_PAYLOAD_TRANSPORT_HEADER && priv->base != NFT_PAYLOAD_INNER_HEADER) || skb->ip_summed != CHECKSUM_PARTIAL)) { @@ -834,7 +835,7 @@ int nft_payload_mangle(const struct nft_payload_set *priv, nft_payload_csum_inet(skb, src, fsum, tsum, csum_offset)) goto err; - if (priv->csum_flags && + if (needs_csum && nft_payload_l4csum_update(pkt, skb, fsum, tsum) < 0) goto err; } -- 2.32.0
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature