From 4fa0076956fc87146b530e27f1129acfaed70025 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 11 Mar 2026 23:03:08 +1100 Subject: fwd: Don't initialise unused port bitmaps Since b223bec48213 ("fwd, tcp, udp: Set up listening sockets based on forward table"), the 'map' field of struct fwd_ports has only been used for forwarding rules with the FWD_SCAN bit, where it is initialised from a port scan. However, we still pointlessly initialise it for rules with !FWD_SCAN. Remove the unneeded code. Fixes: b223bec48213 ("fwd, tcp, udp: Set up listening sockets based on forward table") Signed-off-by: David Gibson Signed-off-by: Stefano Brivio --- fwd.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fwd.c b/fwd.c index c5090fb..9e45509 100644 --- a/fwd.c +++ b/fwd.c @@ -405,13 +405,8 @@ void fwd_rule_add(struct fwd_ports *fwd, uint8_t flags, new->socks = &fwd->socks[fwd->sock_count]; fwd->sock_count += num; - for (port = new->first; port <= new->last; port++) { + for (port = new->first; port <= new->last; port++) new->socks[port - new->first] = -1; - - /* Fill in the legacy forwarding data structures to match the table */ - if (!(new->flags & FWD_SCAN)) - bitmap_set(fwd->map, port); - } } /** -- cgit v1.2.3