diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-29 01:28:55 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-29 01:28:55 +0200 |
commit | aadf0a94b436990202cd2f13f1fe8528a9fd183c (patch) | |
tree | 87f5dd658b0503a4c33489e051b6a1b9dd0d85c1 /src/config.y | |
parent | 63e123738a9636618421d35ff97a278c06b69703 (diff) | |
download | fastd-aadf0a94b436990202cd2f13f1fe8528a9fd183c.tar fastd-aadf0a94b436990202cd2f13f1fe8528a9fd183c.zip |
Implement on-up commands; also fix log print conditions
Diffstat (limited to 'src/config.y')
-rw-r--r-- | src/config.y | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/config.y b/src/config.y index c1d6053..78c0833 100644 --- a/src/config.y +++ b/src/config.y @@ -32,8 +32,11 @@ %parse-param {int depth} %code requires { + #define _GNU_SOURCE + #include <fastd.h> #include <arpa/inet.h> + #include <unistd.h> } %union { @@ -63,6 +66,8 @@ %token TOK_ANY %token TOK_TAP %token TOK_TUN +%token TOK_ON +%token TOK_UP %token <addr> TOK_ADDR %token <addr6> TOK_ADDR6 @@ -105,6 +110,7 @@ statement: TOK_INTERFACE interface ';' | TOK_MODE mode ';' | TOK_PROTOCOL protocol ';' | TOK_SECRET secret ';' + | TOK_ON TOK_UP on_up ';' | TOK_PEER peer '{' peer_conf '}' | TOK_INCLUDE include ';' ; @@ -154,6 +160,15 @@ protocol: TOK_STRING { secret: TOK_STRING { free(conf->secret); conf->secret = $1; } ; +on_up: TOK_STRING { + free(conf->on_up); + free(conf->on_up_dir); + + conf->on_up = $1; + conf->on_up_dir = get_current_dir_name(); + } + ; + peer: maybe_string { fastd_peer_config_new(ctx, conf); conf->peers->name = $1; |