From aadf0a94b436990202cd2f13f1fe8528a9fd183c Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 29 Mar 2012 01:28:55 +0200 Subject: Implement on-up commands; also fix log print conditions --- src/config.y | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/config.y') 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 #include + #include } %union { @@ -63,6 +66,8 @@ %token TOK_ANY %token TOK_TAP %token TOK_TUN +%token TOK_ON +%token TOK_UP %token TOK_ADDR %token 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; -- cgit v1.2.3