Browse code

libnetwork: expose proxy information in FirewallInfo

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>

Akihiro Suda authored on 2026/04/21 00:39:54
Showing 1 changed files
... ...
@@ -13,7 +13,8 @@ import (
13 13
 	"github.com/moby/moby/v2/daemon/libnetwork/osl"
14 14
 )
15 15
 
16
-// FirewallBackend returns the name of the firewall backend for "docker info".
16
+// FirewallBackend returns FirewallInfo for "docker info".
17
+// Despite the name, FirewallInfo may include information about the userland proxy as well.
17 18
 func (c *Controller) FirewallBackend() *system.FirewallInfo {
18 19
 	var info system.FirewallInfo
19 20
 	info.Driver = "iptables"
... ...
@@ -26,6 +27,15 @@ func (c *Controller) FirewallBackend() *system.FirewallInfo {
26 26
 			info.Info = [][2]string{{"ReloadedAt", reloadedAt.Format(time.RFC3339)}}
27 27
 		}
28 28
 	}
29
+	if c.cfg.EnableUserlandProxy {
30
+		// EnableUserlandProxy is exposed in FirewallInfo since Docker v29.5.
31
+		// In older versions, EnableUserlandProxy is not included in FirewallInfo,
32
+		// but it is still used in most cases as it is enabled by default.
33
+		info.Info = append(info.Info, [2]string{"EnableUserlandProxy", "true"})
34
+		if c.cfg.UserlandProxyPath != "" {
35
+			info.Info = append(info.Info, [2]string{"UserlandProxyPath", c.cfg.UserlandProxyPath})
36
+		}
37
+	}
29 38
 	return &info
30 39
 }
31 40