diff options
| author | Stefano Brivio <sbrivio@redhat.com> | 2026-11-24 00:19:29 +0100 |
|---|---|---|
| committer | Stefano Brivio <sbrivio@redhat.com> | 2026-11-30 00:37:09 +0100 |
| commit | 40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf (patch) | |
| tree | b65c9b6ffc2f7012ecb06b52a5b32c61b8b5a7dc | |
| parent | 7d506434cc080aaa427ad9aa609481cc7d4014a8 (diff) | |
| download | passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar.gz passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar.bz2 passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar.lz passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar.xz passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.tar.zst passt-40ce82daa14ed6497fb1468fb3d2e9c6ee9f19bf.zip | |
tap: Rate limit messages about filtered guest-side addresses
Even though those are debug messages, very frequent messages would
make debugging harder.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
| -rw-r--r-- | tap.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -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)) { |
