From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by passt.top (Postfix, from userid 1000) id 927EE5A0619; Tue, 24 Nov 2026 03:40:12 +0100 (CET) From: Stefano Brivio To: passt-dev@passt.top Subject: [PATCH 2/3] tap: Rate limit messages about filtered guest-side addresses Date: Tue, 24 Nov 2026 03:40:11 +0100 Message-ID: <20261124024012.547787-3-sbrivio@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261124024012.547787-1-sbrivio@redhat.com> References: <20261124024012.547787-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: QBE7YDCY52N2DYHSGHL67J2ME6H2UJ45 X-Message-ID-Hash: QBE7YDCY52N2DYHSGHL67J2ME6H2UJ45 X-MailFrom: sbrivio@passt.top X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Anders Ingemann , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Even though those are debug messages, very frequent messages would make debugging harder. Signed-off-by: Stefano Brivio --- tap.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tap.c b/tap.c index 78030f3..eb2f147 100644 --- a/tap.c +++ b/tap.c @@ -662,13 +662,14 @@ static void tap_packet_debug(const struct iphdr *iph, /** * tap_filter_address() - Filter packets based on source and destination address + * @now: Current timestamp * @af: Address family, AF_INET or AF_INET6 * @saddr: Source address * @daddr: Destination address * * Return: true if packet must be dropped, false otherwise */ -static bool tap_filter_address(sa_family_t af, +static bool tap_filter_address(const struct timespec *now, sa_family_t af, const void *saddr, const void *daddr) { /* The scope of sstr and dstr could be in theory reduced into the @@ -686,9 +687,9 @@ static bool tap_filter_address(sa_family_t af, !IN6_IS_ADDR_LOOPBACK(saddr) && !IN6_IS_ADDR_LOOPBACK(daddr)) return false; - debug("Invalid address on tap interface: %s -> %s", - inet_ntop(af, saddr, sstr, sizeof(sstr)), - inet_ntop(af, daddr, dstr, sizeof(dstr))); + debug_ratelimit(now, "Invalid address on tap interface: %s -> %s", + inet_ntop(af, saddr, sstr, sizeof(sstr)), + inet_ntop(af, daddr, dstr, sizeof(dstr))); return true; } @@ -774,7 +775,7 @@ resume: l4len = htons(iph->tot_len) - hlen; - if (tap_filter_address(AF_INET, &iph->saddr, &iph->daddr)) + if (tap_filter_address(now, AF_INET, &iph->saddr, &iph->daddr)) continue; if (!c->ip4.addr_fixed && @@ -1004,7 +1005,7 @@ resume: if (!ipv6_l4hdr(&data, &proto, &l4len)) continue; - if (tap_filter_address(AF_INET6, saddr, daddr)) + if (tap_filter_address(now, AF_INET6, saddr, daddr)) continue; if (IN6_IS_ADDR_LINKLOCAL(saddr)) { -- 2.43.0