From 412e341def88b0734fbac2c2f19fcecf2486ee86 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 18 Oct 2015 03:32:21 +0200 Subject: config: make on_up/down/establish/disestablish commands configurable per peer group --- src/config.y | 60 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/config.y') diff --git a/src/config.y b/src/config.y index 4f55d91..8495e25 100644 --- a/src/config.y +++ b/src/config.y @@ -196,12 +196,7 @@ statement: peer_group_statement | TOK_PROTOCOL protocol ';' | TOK_SECRET secret ';' | TOK_ON TOK_PRE_UP on_pre_up ';' - | TOK_ON TOK_UP on_up ';' - | TOK_ON TOK_DOWN on_down ';' | TOK_ON TOK_POST_DOWN on_post_down ';' - | TOK_ON TOK_CONNECT on_connect ';' - | TOK_ON TOK_ESTABLISH on_establish ';' - | TOK_ON TOK_DISESTABLISH on_disestablish ';' | TOK_STATUS TOK_SOCKET status_socket ';' | TOK_FORWARD forward ';' ; @@ -211,6 +206,11 @@ peer_group_statement: | TOK_PEER TOK_GROUP peer_group '{' peer_group_config '}' peer_group_after | TOK_PEER TOK_LIMIT peer_limit ';' | TOK_METHOD method ';' + | TOK_ON TOK_UP on_up ';' + | TOK_ON TOK_DOWN on_down ';' + | TOK_ON TOK_CONNECT on_connect ';' + | TOK_ON TOK_ESTABLISH on_establish ';' + | TOK_ON TOK_DISESTABLISH on_disestablish ';' | TOK_ON TOK_VERIFY on_verify ';' | TOK_INCLUDE include ';' ; @@ -408,36 +408,11 @@ on_pre_up: TOK_STRING { } ; -on_up: sync TOK_STRING { - fastd_shell_command_set(&conf.on_up, $2->str, $1); - } - ; - -on_down: sync TOK_STRING { - fastd_shell_command_set(&conf.on_down, $2->str, $1); - } - ; - on_post_down: TOK_STRING { fastd_shell_command_set(&conf.on_post_down, $1->str, true); } ; -on_connect: sync TOK_STRING { - fastd_shell_command_set(&conf.on_connect, $2->str, $1); - } - ; - -on_establish: sync TOK_STRING { - fastd_shell_command_set(&conf.on_establish, $2->str, $1); - } - ; - -on_disestablish: sync TOK_STRING { - fastd_shell_command_set(&conf.on_disestablish, $2->str, $1); - } - ; - status_socket: TOK_STRING { #ifdef WITH_STATUS_SOCKET free(conf.status_socket); conf.status_socket = fastd_strdup($1->str); @@ -585,6 +560,31 @@ method: TOK_STRING { } ; +on_up: sync TOK_STRING { + fastd_shell_command_set(&state->peer_group->on_up, $2->str, $1); + } + ; + +on_down: sync TOK_STRING { + fastd_shell_command_set(&state->peer_group->on_down, $2->str, $1); + } + ; + +on_connect: sync TOK_STRING { + fastd_shell_command_set(&state->peer_group->on_connect, $2->str, $1); + } + ; + +on_establish: sync TOK_STRING { + fastd_shell_command_set(&state->peer_group->on_establish, $2->str, $1); + } + ; + +on_disestablish: sync TOK_STRING { + fastd_shell_command_set(&state->peer_group->on_disestablish, $2->str, $1); + } + ; + on_verify: sync TOK_STRING { #ifdef WITH_DYNAMIC_PEERS fastd_shell_command_set(&conf.on_verify, $2->str, $1); -- cgit v1.2.3