2020-11-25 16:53:48 +08:00
|
|
|
From f3f2765e074a489ceeb2364fbb941a40d3232ff5 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: wujing <wujing50@huawei.com>
|
|
|
|
|
Date: Tue, 24 Nov 2020 15:13:05 +0800
|
2020-12-03 19:12:21 +08:00
|
|
|
Subject: [PATCH 05/17] listening 127.0.0.1:port in cri stream websocket server
|
2020-11-25 16:53:48 +08:00
|
|
|
|
|
|
|
|
Signed-off-by: wujing <wujing50@huawei.com>
|
|
|
|
|
---
|
|
|
|
|
src/daemon/entry/cri/websocket/service/ws_server.cc | 6 ++----
|
|
|
|
|
.../modules/image/oci/storage/image_store/image_store.c | 8 ++++----
|
|
|
|
|
2 files changed, 6 insertions(+), 8 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/src/daemon/entry/cri/websocket/service/ws_server.cc b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
|
|
|
|
index 43cecb88..735f2780 100644
|
|
|
|
|
--- a/src/daemon/entry/cri/websocket/service/ws_server.cc
|
|
|
|
|
+++ b/src/daemon/entry/cri/websocket/service/ws_server.cc
|
|
|
|
|
@@ -106,12 +106,10 @@ void WebsocketServer::EmitLog(int level, const char *line)
|
|
|
|
|
|
|
|
|
|
int WebsocketServer::CreateContext()
|
|
|
|
|
{
|
|
|
|
|
- unsigned int opts = 0;
|
|
|
|
|
int limited;
|
|
|
|
|
struct lws_context_creation_info info;
|
|
|
|
|
struct rlimit oldLimit, newLimit;
|
|
|
|
|
const size_t WS_ULIMIT_FDS = 1024;
|
|
|
|
|
- char interface[] = "127.0.0.1";
|
|
|
|
|
|
|
|
|
|
m_url.SetScheme("ws");
|
|
|
|
|
m_url.SetHost("localhost:" + std::to_string(m_listenPort));
|
|
|
|
|
@@ -120,13 +118,13 @@ int WebsocketServer::CreateContext()
|
|
|
|
|
lws_set_log_level(LLL_ERR | LLL_WARN | LLL_NOTICE | LLL_INFO | LLL_DEBUG, WebsocketServer::EmitLog);
|
|
|
|
|
|
|
|
|
|
info.port = m_listenPort;
|
|
|
|
|
- info.iface = interface;
|
|
|
|
|
+ info.iface = "127.0.0.1";
|
|
|
|
|
info.protocols = m_protocols;
|
|
|
|
|
info.ssl_cert_filepath = nullptr;
|
|
|
|
|
info.ssl_private_key_filepath = nullptr;
|
|
|
|
|
info.gid = -1;
|
|
|
|
|
info.uid = -1;
|
|
|
|
|
- info.options = opts | LWS_SERVER_OPTION_VALIDATE_UTF8;
|
|
|
|
|
+ info.options = LWS_SERVER_OPTION_VALIDATE_UTF8 | LWS_SERVER_OPTION_DISABLE_IPV6;
|
|
|
|
|
info.max_http_header_pool = MAX_HTTP_HEADER_POOL;
|
|
|
|
|
info.extensions = nullptr;
|
|
|
|
|
|
|
|
|
|
diff --git a/src/daemon/modules/image/oci/storage/image_store/image_store.c b/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
|
|
|
|
index 0f613dd2..af8573ad 100644
|
|
|
|
|
--- a/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
|
|
|
|
+++ b/src/daemon/modules/image/oci/storage/image_store/image_store.c
|
|
|
|
|
@@ -59,8 +59,8 @@
|
|
|
|
|
#define IMAGE_JSON "images.json"
|
|
|
|
|
|
|
|
|
|
#define MAX_IMAGE_NAME_LENGTH 72
|
|
|
|
|
-#define DIGIST_PREFIX "@sha256:"
|
|
|
|
|
-#define MAX_IMAGE_DIGST_LENGTH 64
|
|
|
|
|
+#define DIGEST_PREFIX "@sha256:"
|
|
|
|
|
+#define MAX_IMAGE_DIGEST_LENGTH 64
|
|
|
|
|
|
|
|
|
|
typedef struct digest_image {
|
|
|
|
|
struct linked_list images_list;
|
|
|
|
|
@@ -2757,10 +2757,10 @@ static int resort_image_names(const char **names, size_t names_len, char **first
|
|
|
|
|
size_t len = strlen(names[i]);
|
|
|
|
|
if (strlen(names[i]) > MAX_IMAGE_NAME_LENGTH) {
|
|
|
|
|
prefix = util_sub_string(names[i], len - MAX_IMAGE_NAME_LENGTH,
|
|
|
|
|
- MAX_IMAGE_NAME_LENGTH - MAX_IMAGE_DIGST_LENGTH);
|
|
|
|
|
+ MAX_IMAGE_NAME_LENGTH - MAX_IMAGE_DIGEST_LENGTH);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- if (prefix != NULL && strcmp(prefix, DIGIST_PREFIX) == 0) {
|
|
|
|
|
+ if (prefix != NULL && strcmp(prefix, DIGEST_PREFIX) == 0) {
|
|
|
|
|
if (util_array_append(image_digests, names[i]) != 0) {
|
|
|
|
|
ERROR("Failed to append image to digest: %s", names[i]);
|
|
|
|
|
ret = -1;
|
|
|
|
|
--
|
2020-12-03 19:12:21 +08:00
|
|
|
2.25.1
|
2020-11-25 16:53:48 +08:00
|
|
|
|