lxc/0039-net-adapt-to-isulad.patch
lifeng 8966f1fe72 lxc: update lxc to 4.0.1
Signed-off-by: lifeng <lifeng68@huawei.com>
2020-04-23 19:30:12 +08:00

52 lines
1.6 KiB
Diff

From c474b4e528e591680c6f9cbbcb27bdfe4e5f94f9 Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Thu, 16 Apr 2020 12:01:39 +0800
Subject: [PATCH 39/49] net: adapt to isulad
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/commands_utils.c | 2 +-
src/lxc/network.c | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/lxc/commands_utils.c b/src/lxc/commands_utils.c
index c5fc094..2f2670d 100644
--- a/src/lxc/commands_utils.c
+++ b/src/lxc/commands_utils.c
@@ -114,7 +114,7 @@ int lxc_make_abstract_socket_name(char *path, size_t pathlen,
}
ret = snprintf(offset, len, "%s/%s/%s", lxcpath, name, suffix);
- if (ret < 0 || (size_t)ret >= len)
+ if (ret < 0)
return log_error_errno(-1, errno, "Failed to create abstract socket name");
/*
diff --git a/src/lxc/network.c b/src/lxc/network.c
index b442ed5..19adb23 100644
--- a/src/lxc/network.c
+++ b/src/lxc/network.c
@@ -3448,10 +3448,18 @@ static int lxc_network_setup_in_child_namespaces_common(struct lxc_netdev *netde
/* set the network device up */
if (netdev->flags & IFF_UP) {
+
+#ifdef HAVE_ISULAD
+ if (netdev->name[0] != '\0') {
+ err = lxc_netdev_up(netdev->name);
+ if (err)
+ return log_error_errno(-1, -err, "Failed to set network device \"%s\" up", netdev->name);
+ }
+#else
err = lxc_netdev_up(netdev->name);
if (err)
return log_error_errno(-1, -err, "Failed to set network device \"%s\" up", netdev->name);
-
+#endif
/* the network is up, make the loopback up too */
err = lxc_netdev_up("lo");
if (err)
--
1.8.3.1