summaryrefslogtreecommitdiffstats
path: root/src/peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/peer.c')
-rw-r--r--src/peer.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/peer.c b/src/peer.c
index 82d5fa4..07354df 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -31,17 +31,11 @@
static inline void on_establish(fastd_context_t *ctx, const fastd_peer_t *peer) {
- if (!ctx->conf->on_establish)
- return;
-
- fastd_shell_exec(ctx, ctx->conf->on_establish, ctx->conf->on_establish_dir, peer, &peer->local_address, &peer->address, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_establish, peer, &peer->local_address, &peer->address, NULL);
}
static inline void on_disestablish(fastd_context_t *ctx, const fastd_peer_t *peer) {
- if (!ctx->conf->on_disestablish)
- return;
-
- fastd_shell_exec(ctx, ctx->conf->on_disestablish, ctx->conf->on_disestablish_dir, peer, &peer->local_address, &peer->address, NULL);
+ fastd_shell_command_exec(ctx, &ctx->conf->on_disestablish, peer, &peer->local_address, &peer->address, NULL);
}
static inline void free_socket(fastd_context_t *ctx, fastd_peer_t *peer) {
@@ -558,7 +552,7 @@ fastd_peer_t* fastd_peer_add(fastd_context_t *ctx, fastd_peer_config_t *peer_con
}
fastd_peer_t* fastd_peer_add_temporary(fastd_context_t *ctx) {
- if (!ctx->conf->on_verify)
+ if (!fastd_shell_command_isset(&ctx->conf->on_verify))
exit_bug(ctx, "tried to add temporary peer without on-verify command");
fastd_peer_t *peer = calloc(1, sizeof(fastd_peer_t));
@@ -577,11 +571,11 @@ fastd_peer_t* fastd_peer_add_temporary(fastd_context_t *ctx) {
}
bool fastd_peer_verify_temporary(fastd_context_t *ctx, fastd_peer_t *peer, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *peer_addr) {
- if (!ctx->conf->on_verify)
+ if (!fastd_shell_command_isset(&ctx->conf->on_verify))
exit_bug(ctx, "tried to verify temporary peer without on-verify command");
int ret;
- if (!fastd_shell_exec(ctx, ctx->conf->on_verify, ctx->conf->on_verify_dir, peer, local_addr, peer_addr, &ret))
+ if (!fastd_shell_command_exec(ctx, &ctx->conf->on_verify, peer, local_addr, peer_addr, &ret))
return false;
if (WIFSIGNALED(ret)) {