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

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) ===
There is an intermittent issue, experienced on at least Ubuntu 18.04 (5.3.0-40-generic) and Alpine 3.11 (5.4.12-1-virt) when using the router network interface type that causes the IP proxy neighbour entries on the host side of the veth pair to not be created.

The `ip neigh add proxy` command returns without an error, however by the time the network up hook has started the IP neighbour proxy entries are no longer there (if they ever were).

I've also tested this using netlink rather than the ip command to add and both are equally affected.

Adding a short sleep between setting up the veth pair and adding the proxy entries appears to fix it.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 954e36b490b9b961641cf030817d10dba2a4ddea Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parr...@canonical.com>
Date: Sun, 8 Mar 2020 18:28:44 +0000
Subject: [PATCH] network: Adds short sleep between veth setup and neighbour
 proxy add

There is an intermittent issue, experienced on at least Ubuntu 18.04 
(5.3.0-40-generic) and Alpine 3.11 (5.4.12-1-virt) when using the router 
network interface type that causes the IP proxy neighbour entries on the host 
side of the veth pair to not be created.

The `ip neigh add proxy` command returns without an error, however by the time 
the network up hook has started the IP neighbour proxy entries are no longer 
there (if they ever were).

I've also tested this using netlink rather than the ip command to add and both 
are equally affected.

Adding a short sleep between setting up the veth pair and adding the proxy 
entries appears to fix it.

Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
---
 src/lxc/network.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/lxc/network.c b/src/lxc/network.c
index 7b9ea1f25a..c87a7d3201 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -382,6 +382,13 @@ static int instantiate_veth(struct lxc_handler *handler, 
struct lxc_netdev *netd
        }
 
        if (netdev->priv.veth_attr.mode == VETH_MODE_ROUTER) {
+               /* sleep for a short period of time to work around a bug that 
intermittently prevents IP neighbour
+                  proxy entries from being added using lxc_ip_neigh_proxy 
below. When the issue occurs the entries
+                  appear to be added successfully but then do not appear in 
the proxy list. The length of time
+                  slept doesn't appear to be important, only that the process 
sleeps for a short period of time.
+               */
+               nanosleep((const struct timespec[]){{0, 1000}}, NULL);
+
                if (netdev->ipv4_gateway) {
                        char bufinet4[INET_ADDRSTRLEN];
                        if (!inet_ntop(AF_INET, netdev->ipv4_gateway, bufinet4, 
sizeof(bufinet4))) {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to