diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 19:01:31 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-03-27 19:01:31 +0200 |
commit | 21e4ada4bb0321250702c3af32d10f6a1bc65931 (patch) | |
tree | 65d55e026a0a682f2c789968b20657940db1e0f7 /src/config.y | |
parent | cfadfce5484418ed88d235df8d82c14ebfe70d4c (diff) | |
download | fastd-21e4ada4bb0321250702c3af32d10f6a1bc65931.tar fastd-21e4ada4bb0321250702c3af32d10f6a1bc65931.zip |
Use configured peer names
Diffstat (limited to 'src/config.y')
-rw-r--r-- | src/config.y | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/config.y b/src/config.y index 210a33d..6d005ac 100644 --- a/src/config.y +++ b/src/config.y @@ -103,7 +103,7 @@ mode: TOK_TAP { conf->mode = MODE_TAP; } | TOK_TUN { conf->mode = MODE_TUN; } ; -protocol: maybe_string { +protocol: TOK_STRING { if (!strcmp($1, "null")) conf->protocol = &fastd_protocol_null; #ifdef WITH_PROTOCOL_ECFXP @@ -119,16 +119,10 @@ 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; - conf->peers = current_peer; + fastd_peer_config_new(ctx, conf); - memset(¤t_peer->address, 0, sizeof(fastd_peer_address)); - - current_peer->enabled = true; - current_peer->address.sa.sa_family = AF_UNSPEC; - current_peer->key = NULL; - current_peer->protocol_config = NULL; + if ($1) + conf->peers->name = strdup($1); } ; @@ -161,7 +155,7 @@ include: TOK_STRING { fastd_read_config(ctx, conf, $1, depth); } maybe_string: TOK_STRING - | { $$ = ""; } + | { $$ = NULL; } ; maybe_port: ':' port { $$ = $2; } |