diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 00:16:20 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-25 00:16:20 +0100 |
commit | 6ce20e2bb6660694e995d890f2846fc26c96c8f7 (patch) | |
tree | 5cbe80433351372237843f11951518e16e9a32b8 /src/config.y | |
parent | 0b61ebf351a69a3451727254eec2c7e1cc024b4c (diff) | |
download | fastd-6ce20e2bb6660694e995d890f2846fc26c96c8f7.tar fastd-6ce20e2bb6660694e995d890f2846fc26c96c8f7.zip |
Add keypair config
Diffstat (limited to 'src/config.y')
-rw-r--r-- | src/config.y | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/config.y b/src/config.y index 9a0d333..02a9529 100644 --- a/src/config.y +++ b/src/config.y @@ -29,6 +29,8 @@ %token <str> TOK_PROTOCOL %token <str> TOK_PEER %token <str> TOK_ADDRESS +%token <str> TOK_SECRET +%token <str> TOK_KEY %token <addr> TOK_ADDR %token <addr6> TOK_ADDR6 @@ -73,10 +75,11 @@ statement: TOK_INTERFACE interface ';' | TOK_MTU mtu ';' | TOK_MODE mode ';' | TOK_PROTOCOL protocol ';' + | TOK_SECRET secret ';' | TOK_PEER peer '{' peer_conf '}' ; -interface: TOK_STRING { conf->ifname = strdup($1); } +interface: TOK_STRING { free(conf->ifname); conf->ifname = strdup($1); } ; bind: TOK_ADDR maybe_port { @@ -116,6 +119,9 @@ protocol: maybe_string { } ; +secret: TOK_STRING { free(conf->secret); conf->secret = strdup($1); } + ; + peer: maybe_string { fastd_peer_config *current_peer = malloc(sizeof(fastd_peer_config)); current_peer->next = conf->peers; @@ -132,6 +138,7 @@ peer_conf: peer_conf peer_statement ; peer_statement: TOK_ADDRESS peer_address ';' + | TOK_KEY peer_key ';' ; peer_address: TOK_ADDR maybe_port_default { @@ -146,6 +153,10 @@ peer_address: TOK_ADDR maybe_port_default { } ; +peer_key: TOK_STRING { free(conf->peers->key); conf->peers->key = strdup($1); } + ; + + maybe_string: TOK_STRING | { $$[0] = '\0'; } ; |