forecast: Fix undefined shift if traffic selector is /0

Not an issue in typical scenarios where the plugin is used on a gateway
with roadwarriors that use /32 addresses.  But could be an issue if used
on a client that tunnels everything to the gateway.

Fixes: e5ad2e6614 ("forecast: Add the broadcast/multicast forwarding plugin called forecast")
This commit is contained in:
Tobias Brunner
2026-07-24 08:47:36 +02:00
parent d5e7426c4c
commit 117cf65030
@@ -122,7 +122,7 @@ static bool ts2in(traffic_selector_t *ts,
{
memcpy(&addr->s_addr, net->get_address(net).ptr, 4);
net->destroy(net);
mask->s_addr = htonl(0xffffffffU << (32 - bits));
mask->s_addr = bits ? htonl(0xffffffffU << (32 - bits)) : 0;
return TRUE;
}
return FALSE;