libnet/d/bridge: add a new Hairpin config flag

The bridge driver currently determines if hairpin mode is enabled by
checking whether the userland proxy is enabled, and if the binary path
is set to a non-empty string. It's used (amongst other things) by the
driver to decide whether 6-to-4 portmappings are supported, while it
normalizes port bindings.

As the userland proxy is going to be handled by the nat portmapper,
proxy-related params will be removed from the bridge driver, but the
port binding normalization will stay in the bridge driver.

So, introduce a new Hairpin config flag, and reimplement the original
logic in the daemon, when creating the bridge config.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
This commit is contained in:
Albin Kerouanton
2025-06-27 10:21:22 +02:00
parent 6f59a8e665
commit afb231d027
4 changed files with 33 additions and 11 deletions

View File

@@ -931,8 +931,9 @@ func driverOptions(config *config.Config) nwconfig.Option {
"DisableFilterForwardDrop": config.BridgeConfig.DisableFilterForwardDrop,
"EnableIPTables": config.BridgeConfig.EnableIPTables,
"EnableIP6Tables": config.BridgeConfig.EnableIP6Tables,
"EnableUserlandProxy": config.BridgeConfig.EnableUserlandProxy,
"UserlandProxyPath": config.BridgeConfig.UserlandProxyPath,
"EnableUserlandProxy": config.EnableUserlandProxy,
"UserlandProxyPath": config.UserlandProxyPath,
"Hairpin": !config.EnableUserlandProxy || config.UserlandProxyPath == "",
"AllowDirectRouting": config.BridgeConfig.AllowDirectRouting,
"Rootless": config.Rootless,
},