Revision fb7e01b4875cbb47b9c8cec8c4da3dfd96ba6490 authored by Sebastian Wicki on 18 June 2024, 10:24:34 UTC, committed by Sebastian Wicki on 19 June 2024, 14:03:48 UTC
When restoring the previous DNS proxy port, we check if the port is
already in-use. However, if the port we retrieved from `GetProxyPort`
was previously set via `SetProxyPort`, then we want to use it
unconditionally. We rely on `isStatic` for this, as static ports cannot
change and the open port may be open with `SO_REUSEPORT` (which
`proxy.OpenLocalPorts()` does not check). Restored ports never have
`isStatic` set to true, so this does retain the "open ports" check if
the port was restored.

In addition, when restoring ports we want to make sure that previous
calls to `SetProxyPort` are also not overwritten, thus this commit also
only restores the port if it wasn't explicitly set.

This is the same behavior we had previously, which did not check the
returned port of `d.l7Proxy.GetProxyPort` against the list of open
ports.

Fixes: d11e4d261279 ("proxy: Reuse proxy ports from datapath on restart")

Signed-off-by: Sebastian Wicki <sebastian@isovalent.com>
1 parent 6aa4fa8
History

back to top