summaryrefslogtreecommitdiffstats
path: root/src/config.y
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2015-10-18 03:32:21 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2015-10-18 03:32:21 +0200
commit412e341def88b0734fbac2c2f19fcecf2486ee86 (patch)
treef4050b542181869766dbb437ed06ec08cde1f3cb /src/config.y
parentdf48485aeab897c50fd792a740d1a5aed4378fc9 (diff)
downloadfastd-412e341def88b0734fbac2c2f19fcecf2486ee86.tar
fastd-412e341def88b0734fbac2c2f19fcecf2486ee86.zip
config: make on_up/down/establish/disestablish commands configurable per peer group
Diffstat (limited to 'src/config.y')
-rw-r--r--src/config.y60
1 files changed, 30 insertions, 30 deletions
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);