summaryrefslogtreecommitdiffstats
path: root/src/config.y
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-14 13:06:11 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-14 13:06:11 +0200
commit701fcc7c7e353def78d89d9ee0ca52d32fb894b9 (patch)
treee39e37e1bf8e8bd5d38885d059c61006ce90f172 /src/config.y
parentac235fb7d28da6690f5ef7d7dc37d40bcebbd87a (diff)
downloadfastd-701fcc7c7e353def78d89d9ee0ca52d32fb894b9.tar
fastd-701fcc7c7e353def78d89d9ee0ca52d32fb894b9.zip
Separate handshake from encryption method
Diffstat (limited to 'src/config.y')
-rw-r--r--src/config.y28
1 files changed, 12 insertions, 16 deletions
diff --git a/src/config.y b/src/config.y
index ac5f808..b1d68e0 100644
--- a/src/config.y
+++ b/src/config.y
@@ -61,6 +61,7 @@
%token TOK_MTU
%token TOK_MODE
%token TOK_PROTOCOL
+%token TOK_METHOD
%token TOK_PEER
%token TOK_ADDRESS
%token TOK_SECRET
@@ -99,12 +100,6 @@
#include <peer.h>
void fastd_config_error(YYLTYPE *loc, fastd_context *ctx, fastd_config *conf, const char *filename, int depth, char *s);
-
- extern const fastd_protocol fastd_protocol_null;
-
- #ifdef WITH_PROTOCOL_ECFXP
- extern const fastd_protocol fastd_protocol_ec25519_fhmqvc_xsalsa20_poly1305;
- #endif
}
@@ -130,6 +125,7 @@ statement: TOK_LOG log ';'
| TOK_MTU mtu ';'
| TOK_MODE mode ';'
| TOK_PROTOCOL protocol ';'
+ | TOK_METHOD method ';'
| TOK_SECRET secret ';'
| TOK_ON TOK_UP on_up ';'
| TOK_ON TOK_DOWN on_down ';'
@@ -180,19 +176,19 @@ mode: TOK_TAP { conf->mode = MODE_TAP; }
;
protocol: TOK_STRING {
- if (!strcmp($1->str, "null")) {
- conf->protocol = &fastd_protocol_null;
- }
-#ifdef WITH_PROTOCOL_ECFXP
- else if (!strcmp($1->str, "ecfxp")) {
- conf->protocol = &fastd_protocol_ec25519_fhmqvc_xsalsa20_poly1305;
- }
-#endif
- else {
+ if (!fastd_config_protocol(ctx, conf, $1->str)) {
fastd_config_error(&@$, ctx, conf, filename, depth, "invalid protocol");
YYERROR;
}
-}
+ }
+ ;
+
+method: TOK_STRING {
+ if (!fastd_config_method(ctx, conf, $1->str)) {
+ fastd_config_error(&@$, ctx, conf, filename, depth, "invalid method");
+ YYERROR;
+ }
+ }
;
secret: TOK_STRING { free(conf->secret); conf->secret = strdup($1->str); }