The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7098

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===

From ce2e6bc02772f5ae9a168fa802bd5046a18695a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 27 Mar 2020 21:31:29 -0400
Subject: [PATCH 1/2] lxd/device/nic_routed: Don't fail on missing IPv6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/device/nic_routed.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lxd/device/nic_routed.go b/lxd/device/nic_routed.go
index ba226eb5d4..10f558944b 100644
--- a/lxd/device/nic_routed.go
+++ b/lxd/device/nic_routed.go
@@ -2,6 +2,7 @@ package device
 
 import (
        "fmt"
+       "os"
        "strings"
 
        deviceConfig "github.com/lxc/lxd/lxd/device/config"
@@ -283,7 +284,7 @@ func (d *nicRouted) postStart() error {
        if v["host_name"] != "" {
                // Attempt to disable IPv6 router advertisement acceptance.
                err := util.SysctlSet(fmt.Sprintf("net/ipv6/conf/%s/accept_ra", 
v["host_name"]), "0")
-               if err != nil {
+               if err != nil && !os.IsNotExist(err) {
                        return err
                }
 

From bad2748788a711183e2cd5a26cea9470716abe3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 27 Mar 2020 21:32:58 -0400
Subject: [PATCH 2/2] lxd/device/nic_routed: Set rp_filter=1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Suggested-by: Etienne Champetier
Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/device/nic_routed.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lxd/device/nic_routed.go b/lxd/device/nic_routed.go
index 10f558944b..0e1b3a7e6e 100644
--- a/lxd/device/nic_routed.go
+++ b/lxd/device/nic_routed.go
@@ -288,6 +288,12 @@ func (d *nicRouted) postStart() error {
                        return err
                }
 
+               // Prevent source address spoofing by requiring a return path.
+               err = util.SysctlSet(fmt.Sprintf("net/ipv4/conf/%s/rp_filter", 
v["host_name"]), "1")
+               if err != nil && !os.IsNotExist(err) {
+                       return err
+               }
+
                if d.config["ipv4.address"] != "" {
                        _, err := shared.RunCommand("ip", "-4", "addr", "add", 
fmt.Sprintf("%s/32", d.ipv4HostAddress()), "dev", v["host_name"])
                        if err != nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to