Skip to content

Commit

Permalink
Merge pull request #562 from openziti/hotfix/issue-561
Browse files Browse the repository at this point in the history
hotfix issue-561: handle unknown method invocations in link settings
  • Loading branch information
sabedevops authored Nov 23, 2022
2 parents 4be461f + 546a3b4 commit 79289ca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions programs/ziti-edge-tunnel/netif_driver/linux/resolvers.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ static int (*sd_booted_f)(void);
static int (*sd_bus_call_f)(sd_bus *bus, sd_bus_message *m, uint64_t usec, sd_bus_error *ret_error, sd_bus_message **reply);
static int (*sd_bus_call_method_f)(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *types, ...);
static void (*sd_bus_error_free_f)(sd_bus_error *e);
static int (*sd_bus_error_has_name_f)(const sd_bus_error *e, const char *name);
static int (*sd_bus_error_set_errno_f)(sd_bus_error *e, int error);
static sd_bus *(*sd_bus_flush_close_unref_f)(sd_bus *bus);
static int (*sd_bus_get_property_f)(sd_bus *bus, const char *destination, const char *path, const char *interface, const char *member, sd_bus_error *ret_error, sd_bus_message **reply, const char *type);
Expand All @@ -69,6 +70,7 @@ static void init_libsystemd() {
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_call", (void **) &sd_bus_call_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_call_method", (void **) &sd_bus_call_method_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_error_free", (void **) &sd_bus_error_free_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_error_has_name", (void **) &sd_bus_error_has_name_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_error_set_errno", (void **) &sd_bus_error_set_errno_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_flush_close_unref", (void **) &sd_bus_flush_close_unref_f));
TRY_DL(uv_dlsym(&libsystemd_h, "sd_bus_get_property", (void **) &sd_bus_get_property_f));
Expand Down Expand Up @@ -309,12 +311,18 @@ static bool set_systemd_resolved_link_setting(sd_bus *bus, const char* tun, cons
va_end(ap);

if (r < 0) {
ZITI_LOG(ERROR, "Failure in method invocation: %s for link: (%s): (%s, %s)",
if (sd_bus_error_has_name_f(&error, SD_BUS_ERROR_UNKNOWN_METHOD)) {
ZITI_LOG(WARN, "Attempted to call unknown method: %s for link: (%s)",
method, tun);
return true;
}

ZITI_LOG(ERROR, "Failure calling method: %s for link: (%s): (%s, %s)",
method, tun, error.name, error.message);
return false;
}

ZITI_LOG(DEBUG, "Success in method invocation: %s for link: (%s)", method, tun);
ZITI_LOG(DEBUG, "Success calling method: %s for link: (%s)", method, tun);

return true;
}
Expand Down

0 comments on commit 79289ca

Please sign in to comment.