[lxc-devel] [lxd/master] Improve proxy doc a little
simondeziel on Github
lxc-bot at linuxcontainers.org
Thu Sep 17 23:19:00 UTC 2020
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200917/4fc8eba4/attachment.bin>
-------------- next part --------------
From 99dcd5b14eb4def5101893cc985eb77c759766c3 Mon Sep 17 00:00:00 2001
From: Simon Deziel <simon at sdeziel.info>
Date: Thu, 17 Sep 2020 19:13:54 -0400
Subject: [PATCH 1/2] proxy bind= should accept host|instance as the doc says
Keep accepting guest|container as synonyms of instance.
Signed-off-by: Simon Deziel <simon at sdeziel.info>
---
lxd/device/proxy.go | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lxd/device/proxy.go b/lxd/device/proxy.go
index e2e7d604a3..d169a4671e 100644
--- a/lxd/device/proxy.go
+++ b/lxd/device/proxy.go
@@ -57,11 +57,11 @@ func (d *proxy) validateConfig(instConf instance.ConfigReader) error {
return err
}
- // Supported bind types are: "host" or "guest" (and "container", a legacy option equivalent to "guest").
+ // Supported bind types are: "host" or "instance" (or "guest" or "container", legacy options equivalent to "instance").
// If an empty value is supplied the default behavior is to assume "host" bind mode.
validateBind := func(input string) error {
- if !shared.StringInSlice(d.config["bind"], []string{"", "host", "guest", "container"}) {
- return fmt.Errorf("Invalid binding side given. Must be \"host\" or \"guest\"")
+ if !shared.StringInSlice(d.config["bind"], []string{"", "host", "instance", "guest", "container"}) {
+ return fmt.Errorf("Invalid binding side given. Must be \"host\" or \"instance\"")
}
return nil
@@ -505,7 +505,7 @@ func (d *proxy) setupProxyProcInfo() (*proxyProcInfo, error) {
connectPidFd = fmt.Sprintf("%d", containerPidFd)
listenAddr = d.rewriteHostAddr(listenAddr)
- case "guest", "container":
+ case "instance", "guest", "container":
listenPid = containerPid
listenPidFd = fmt.Sprintf("%d", containerPidFd)
@@ -514,7 +514,7 @@ func (d *proxy) setupProxyProcInfo() (*proxyProcInfo, error) {
connectAddr = d.rewriteHostAddr(connectAddr)
default:
- return nil, fmt.Errorf("Invalid binding side given. Must be \"host\" or \"guest\"")
+ return nil, fmt.Errorf("Invalid binding side given. Must be \"host\" or \"instance\"")
}
listenAddrMode := "0644"
From e741c6e18db1fdbc9d77d18ef7192a82bd7382b8 Mon Sep 17 00:00:00 2001
From: Simon Deziel <simon at sdeziel.info>
Date: Thu, 17 Sep 2020 19:17:02 -0400
Subject: [PATCH 2/2] Valid proxy type= values are all lower case so fix doc
Signed-off-by: Simon Deziel <simon at sdeziel.info>
---
doc/instances.md | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/doc/instances.md b/doc/instances.md
index 31a25be210..39fcf231a2 100644
--- a/doc/instances.md
+++ b/doc/instances.md
@@ -723,15 +723,15 @@ addresses to an address inside the instance or to do the reverse and
have an address in the instance connect through the host.
The supported connection types are:
-* `TCP <-> TCP`
-* `UDP <-> UDP`
-* `UNIX <-> UNIX`
-* `TCP <-> UNIX`
-* `UNIX <-> TCP`
-* `UDP <-> TCP`
-* `TCP <-> UDP`
-* `UDP <-> UNIX`
-* `UNIX <-> UDP`
+* `tcp <-> tcp`
+* `udp <-> udp`
+* `unix <-> unix`
+* `tcp <-> unix`
+* `unix <-> tcp`
+* `udp <-> tcp`
+* `tcp <-> udp`
+* `udp <-> unix`
+* `unix <-> udp`
The proxy device also supports a `nat` mode where packets are forwarded using NAT rather than being proxied through
a separate connection. This has benefit that the client address is maintained without the need for the target
@@ -749,8 +749,8 @@ In order to define a static IPv6 address, the parent managed network needs to ha
In NAT mode the supported connection types are:
-* `TCP <-> TCP`
-* `UDP <-> UDP`
+* `tcp <-> tcp`
+* `udp <-> udp`
When defining IPv6 addresses use square bracket notation, e.g.
More information about the lxc-devel
mailing list