- Problem
A UDP socket can have many firewall rules. On close, the code calls:
firewall_remove_udpipv4_local_endpoint(localPort);
[Close path](
|
else |
|
{ |
|
firewall_remove_udpipv4_local_endpoint(localPort); |
|
} |
)
However, the remove loop stops after the first match:
table.remove(&tuple);
break;
[Remove loop](
|
for (auto &tuple : table) |
|
{ |
|
if (tuple.localPort == localPort) |
|
{ |
|
table.remove(&tuple); |
|
break; |
|
} |
)
-
Why is it bad
One UDP socket may allow many remote hosts. These rules all have the same local port. Closing the socket removes only one hole. The other holes stay in the firewall.
-
Suggested fix
Remove every UDP rule with the matching local port. Do this for both IPv4 and IPv6.
A UDP socket can have many firewall rules. On close, the code calls:
firewall_remove_udpipv4_local_endpoint(localPort);[Close path](
network-stack/lib/tcpip/network_wrapper.cc
Lines 956 to 959 in 58425e6
However, the remove loop stops after the first match:
table.remove(&tuple); break;[Remove loop](
network-stack/lib/firewall/firewall.cc
Lines 625 to 631 in 58425e6
Why is it bad
One UDP socket may allow many remote hosts. These rules all have the same local port. Closing the socket removes only one hole. The other holes stay in the firewall.
Suggested fix
Remove every UDP rule with the matching local port. Do this for both IPv4 and IPv6.