Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -975,8 +975,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "WebAssembly for Proxies (C++ host implementation)",
project_desc = "WebAssembly for Proxies (C++ host implementation)",
project_url = "https://github.com/proxy-wasm/proxy-wasm-cpp-host",
version = "82633e3ea94cdb96604e7fb01e3c0a36eb35c54d",
sha256 = "850e00833f27113a3ef74811233a596ebf0e08477f84eb0dc993f7009ae1ca95",
version = "d32cb05cb666216db5e1a383c1ffa2c1aeec19bb",
sha256 = "c81b948fde4c0bebc3e1d32d3507052bc788153179e2229686aa28e817ee6913",
strip_prefix = "proxy-wasm-cpp-host-{version}",
urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-host/archive/{version}.tar.gz"],
use_category = ["dataplane_ext"],
Expand All @@ -992,7 +992,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
"envoy.wasm.runtime.wavm",
"envoy.wasm.runtime.wasmtime",
],
release_date = "2021-07-13",
release_date = "2021-08-02",
cpe = "N/A",
),
proxy_wasm_rust_sdk = dict(
Expand Down
6 changes: 3 additions & 3 deletions source/extensions/common/wasm/ext/envoy_null_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ namespace Extensions {
namespace Common {
namespace Wasm {

proxy_wasm::Word resolve_dns(void* raw_context, proxy_wasm::Word dns_address,
proxy_wasm::Word dns_address_size, proxy_wasm::Word token_ptr);
proxy_wasm::Word resolve_dns(proxy_wasm::Word dns_address, proxy_wasm::Word dns_address_size,
proxy_wasm::Word token_ptr);

} // namespace Wasm
} // namespace Common
Expand All @@ -36,7 +36,7 @@ using namespace proxy_wasm::null_plugin;
inline WasmResult envoy_resolve_dns(const char* dns_address, size_t dns_address_size,
uint32_t* token) {
return static_cast<WasmResult>(
::Envoy::Extensions::Common::Wasm::resolve_dns(proxy_wasm::current_context_, WR(dns_address),
::Envoy::Extensions::Common::Wasm::resolve_dns(WR(dns_address),
WS(dns_address_size), WR(token))
.u64_);
}
Expand Down
8 changes: 2 additions & 6 deletions source/extensions/common/wasm/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@

#include "absl/strings/str_cat.h"

#define WASM_CONTEXT(_c) \
static_cast<Context*>(proxy_wasm::exports::ContextOrEffectiveContext( \
static_cast<proxy_wasm::ContextBase*>((void)_c, proxy_wasm::current_context_)))

using proxy_wasm::FailState;
using proxy_wasm::Word;

Expand Down Expand Up @@ -152,8 +148,8 @@ Wasm::~Wasm() {
}

// NOLINTNEXTLINE(readability-identifier-naming)
Word resolve_dns(void* raw_context, Word dns_address_ptr, Word dns_address_size, Word token_ptr) {
auto context = WASM_CONTEXT(raw_context);
Word resolve_dns(Word dns_address_ptr, Word dns_address_size, Word token_ptr) {
auto context = static_cast<Context*>(proxy_wasm::contextOrEffectiveContext());
auto root_context = context->isRootContext() ? context : context->rootContext();
auto address = context->wasmVm()->getMemory(dns_address_ptr, dns_address_size);
if (!address) {
Expand Down
16 changes: 8 additions & 8 deletions test/extensions/common/wasm/wasm_vm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ class MockHostFunctions {
#if defined(PROXY_WASM_HAS_RUNTIME_V8)
MockHostFunctions* g_host_functions;

void pong(void*, Word value) { g_host_functions->pong(convertWordToUint32(value)); }
void pong(Word value) { g_host_functions->pong(convertWordToUint32(value)); }

Word random(void*) { return {g_host_functions->random()}; }
Word random() { return {g_host_functions->random()}; }

// pong() with wrong number of arguments.
void bad_pong1(void*) {}
void badPong1() {}

// pong() with wrong return type.
Word bad_pong2(void*, Word) { return 2; }
Word badPong2(Word) { return 2; }

// pong() with wrong argument type.
double bad_pong3(void*, double) { return 3; }
double badPong3(double) { return 3; }

class WasmVmTest : public testing::TestWithParam<bool> {
public:
Expand Down Expand Up @@ -195,13 +195,13 @@ TEST_P(WasmVmTest, V8BadHostFunctions) {
wasm_vm_->registerCallback("env", "random", &random, CONVERT_FUNCTION_WORD_TO_UINT32(random));
EXPECT_FALSE(wasm_vm_->link("test"));

wasm_vm_->registerCallback("env", "pong", &bad_pong1, CONVERT_FUNCTION_WORD_TO_UINT32(bad_pong1));
wasm_vm_->registerCallback("env", "pong", &badPong1, CONVERT_FUNCTION_WORD_TO_UINT32(badPong1));
EXPECT_FALSE(wasm_vm_->link("test"));

wasm_vm_->registerCallback("env", "pong", &bad_pong2, CONVERT_FUNCTION_WORD_TO_UINT32(bad_pong2));
wasm_vm_->registerCallback("env", "pong", &badPong2, CONVERT_FUNCTION_WORD_TO_UINT32(badPong2));
EXPECT_FALSE(wasm_vm_->link("test"));

wasm_vm_->registerCallback("env", "pong", &bad_pong3, CONVERT_FUNCTION_WORD_TO_UINT32(bad_pong3));
wasm_vm_->registerCallback("env", "pong", &badPong3, CONVERT_FUNCTION_WORD_TO_UINT32(badPong3));
EXPECT_FALSE(wasm_vm_->link("test"));
}

Expand Down