[Devel] [PATCH RHEL7 COMMIT] netfilter: rpfilter: bypass ipv4 lbcast packets with zeronet source

Vasily Averin vvs at virtuozzo.com
Fri Feb 5 14:31:58 MSK 2021


The commit is pushed to "branch-rh7-3.10.0-1160.11.1.vz7.172.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.11.1.vz7.172.12
------>
commit 0071b6d95e814f76755dcede94de0997f26d145e
Author: Liping Zhang <zlpnobody at gmail.com>
Date:   Fri Feb 5 14:31:58 2021 +0300

    netfilter: rpfilter: bypass ipv4 lbcast packets with zeronet source
    
    Otherwise, DHCP Discover packets(0.0.0.0->255.255.255.255) may be
    dropped incorrectly.
    
    Signed-off-by: Liping Zhang <zlpnobody at gmail.com>
    Acked-by: Florian Westphal <fw at strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
    
    https://jira.sw.ru/browse/PSBM-125002
    (cherry picked from commit 3b760dcb0fd304873dfde9ff072a49f893c6f5c4)
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 net/ipv4/netfilter/nft_fib_ipv4.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/netfilter/nft_fib_ipv4.c b/net/ipv4/netfilter/nft_fib_ipv4.c
index 1c82b94a..d938edf 100644
--- a/net/ipv4/netfilter/nft_fib_ipv4.c
+++ b/net/ipv4/netfilter/nft_fib_ipv4.c
@@ -101,12 +101,13 @@ void nft_fib4_eval(const struct nft_expr *expr, struct nft_regs *regs,
 	}
 
 	iph = ip_hdr(pkt->skb);
-	if (ipv4_is_multicast(iph->daddr) &&
-	    ipv4_is_zeronet(iph->saddr) &&
-	    ipv4_is_local_multicast(iph->daddr)) {
-		nft_fib_store_result(dest, priv->result, pkt,
-				     get_ifindex(pkt->skb->dev));
-		return;
+	if (ipv4_is_zeronet(iph->saddr)) {
+		if (ipv4_is_lbcast(iph->daddr) ||
+		    ipv4_is_local_multicast(iph->daddr)) {
+			nft_fib_store_result(dest, priv->result, pkt,
+					     get_ifindex(pkt->skb->dev));
+			return;
+		}
 	}
 
 	if (priv->flags & NFTA_FIB_F_MARK)


More information about the Devel mailing list