[lxc-devel] [lxd/master] lxd: Add an additional VXLAN TTL configuration key
Roosterfish on Github
lxc-bot at linuxcontainers.org
Thu Oct 11 18:42:12 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 401 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20181011/880df851/attachment.bin>
-------------- next part --------------
From 89d67bc995a92b69f8bc1e29ceb6abdabcb9e8fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20Peliz=C3=A4us?= <jp at adformc.de>
Date: Thu, 11 Oct 2018 20:37:44 +0200
Subject: [PATCH] lxd: Add an additional VXLAN TTL configuration key
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is mandatory in multicast routing scenarios.
Signed-off-by: Julian Pelizäus <jp at adformc.de>
---
doc/networks.md | 1 +
lxd/networks.go | 6 ++++++
lxd/networks_config.go | 1 +
shared/container.go | 13 +++++++++++++
4 files changed, 21 insertions(+)
diff --git a/doc/networks.md b/doc/networks.md
index 482cecd0db..737e604912 100644
--- a/doc/networks.md
+++ b/doc/networks.md
@@ -59,6 +59,7 @@ tunnel.NAME.local | string | gre or vxlan | -
tunnel.NAME.port | integer | vxlan | 0 | Specific port to use for the vxlan tunnel
tunnel.NAME.protocol | string | standard mode | - | Tunneling protocol ("vxlan" or "gre")
tunnel.NAME.remote | string | gre or vxlan | - | Remote address for the tunnel (not necessary for multicast vxlan)
+tunnel.NAME.ttl | integer | vxlan | 1 | Specific TTL to use for multicast routing topologies
Those keys can be set using the lxc tool with:
diff --git a/lxd/networks.go b/lxd/networks.go
index c9ec4c7c4b..1e281de110 100644
--- a/lxd/networks.go
+++ b/lxd/networks.go
@@ -1629,6 +1629,12 @@ func (n *network) Start() error {
tunId = "1"
}
cmd = append(cmd, []string{"id", tunId}...)
+
+ tunTtl := getConfig("ttl")
+ if tunTtl == "" {
+ tunTtl = "1"
+ }
+ cmd = append(cmd, []string{"ttl", tunTtl}...)
}
// Create the interface
diff --git a/lxd/networks_config.go b/lxd/networks_config.go
index 28b874c035..bf0f0c5019 100644
--- a/lxd/networks_config.go
+++ b/lxd/networks_config.go
@@ -53,6 +53,7 @@ var networkConfigKeys = map[string]func(value string) error{
"tunnel.TARGET.group": networkValidAddressV4,
"tunnel.TARGET.id": shared.IsInt64,
"tunnel.TARGET.interface": networkValidName,
+ "tunnel.TARGET.ttl": shared.IsUint8,
"ipv4.address": func(value string) error {
if shared.IsOneOf(value, []string{"none", "auto"}) == nil {
diff --git a/shared/container.go b/shared/container.go
index e7cb82dad1..17220508d2 100644
--- a/shared/container.go
+++ b/shared/container.go
@@ -29,6 +29,19 @@ func IsInt64(value string) error {
return nil
}
+func IsUint8(value string) error {
+ if value == "" {
+ return nil
+ }
+
+ _, err := strconv.ParseUint(value, 10, 8)
+ if err != nil {
+ return fmt.Errorf("Invalid value for an integer: %s. Must be between 0 and 255", value)
+ }
+
+ return nil
+}
+
func IsUint32(value string) error {
if value == "" {
return nil
More information about the lxc-devel
mailing list