summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-04-16 07:39:27 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-04-16 07:39:27 +0200
commitdc11e3bc08b1887204c42ac9737a4f2eefb32bde (patch)
tree4426221c6e80aa814fa54f0062fa921e785e66b3 /src
parent872e0dfa86417e89022f84ac78b2d90236cb97d4 (diff)
downloadfastd-0.4-rc1.tar
fastd-0.4-rc1.zip
Rename peer-to-peer to forward; remove now useless peer command line optionv0.4-rc1
Diffstat (limited to 'src')
-rw-r--r--src/config.c49
-rw-r--r--src/config.l2
-rw-r--r--src/config.y14
-rw-r--r--src/fastd.c2
-rw-r--r--src/fastd.h2
5 files changed, 10 insertions, 59 deletions
diff --git a/src/config.c b/src/config.c
index d581ccf..fea8da5 100644
--- a/src/config.c
+++ b/src/config.c
@@ -66,7 +66,7 @@ static void default_config(fastd_config *conf) {
conf->mtu = 1500;
conf->mode = MODE_TAP;
- conf->peer_to_peer = false;
+ conf->forward = false;
conf->protocol = &fastd_protocol_ec25519_fhmqvc;
conf->method = &fastd_method_null;
@@ -484,51 +484,8 @@ void fastd_configure(fastd_context *ctx, fastd_config *conf, int argc, char *con
continue;
}
- IF_OPTION_ARG("-p", "--peer") {
- peer = fastd_peer_config_new(ctx, conf);
-
- if (strcmp(arg, "float") == 0)
- continue;
-
- if (arg[0] == '[') {
- charptr = strchr(arg, ']');
- if (!charptr || (charptr[1] != ':'))
- exit_error(ctx, "invalid peer address `%s'", arg);
-
- addrstr = strndup(arg+1, charptr-arg-1);
- charptr++;
- }
- else {
- charptr = strchr(arg, ':');
- if (!charptr)
- exit_error(ctx, "invalid peer address `%s'", arg);
-
- addrstr = strndup(arg, charptr-arg);
- }
-
- l = strtol(charptr+1, &endptr, 10);
- if (*endptr || l < 0 || l > 65535)
- exit_error(ctx, "invalid peer port `%s'", charptr+1);
-
- if (arg[0] == '[') {
- peer->address.in6.sin6_family = AF_INET6;
- if (inet_pton(AF_INET6, addrstr, &peer->address.in6.sin6_addr) != 1)
- exit_error(ctx, "invalid peer address `%s'", addrstr);
- peer->address.in6.sin6_port = htons(l);
- }
- else {
- peer->address.in.sin_family = AF_INET;
- if (inet_pton(AF_INET, addrstr, &peer->address.in.sin_addr) != 1)
- exit_error(ctx, "invalid peer address `%s'", addrstr);
- peer->address.in.sin_port = htons(l);
- }
-
- free(addrstr);
- continue;
- }
-
- IF_OPTION("--peer-to-peer") {
- conf->peer_to_peer = true;
+ IF_OPTION("--forward") {
+ conf->forward = true;
continue;
}
diff --git a/src/config.l b/src/config.l
index c05f0e1..963a05b 100644
--- a/src/config.l
+++ b/src/config.l
@@ -86,7 +86,7 @@ warn { UPDATE_LOCATION; return TOK_WARN; }
info { UPDATE_LOCATION; return TOK_INFO; }
verbose { UPDATE_LOCATION; return TOK_VERBOSE; }
debug { UPDATE_LOCATION; return TOK_DEBUG; }
-peer-to-peer { UPDATE_LOCATION; return TOK_PEER_TO_PEER; }
+forward { UPDATE_LOCATION; return TOK_FORWARD; }
yes { UPDATE_LOCATION; return TOK_YES; }
no { UPDATE_LOCATION; return TOK_NO; }
port { UPDATE_LOCATION; return TOK_PORT; }
diff --git a/src/config.y b/src/config.y
index 5ef30b6..e283630 100644
--- a/src/config.y
+++ b/src/config.y
@@ -87,7 +87,7 @@
%token TOK_INFO
%token TOK_VERBOSE
%token TOK_DEBUG
-%token TOK_PEER_TO_PEER
+%token TOK_FORWARD
%token TOK_YES
%token TOK_NO
%token TOK_PORT
@@ -107,8 +107,6 @@
}
-%type <str> maybe_string
-
%type <num> port
%type <boolean> boolean
%type <num> maybe_port
@@ -137,7 +135,7 @@ statement: TOK_LOG log ';'
| TOK_ON TOK_ESTABLISH on_establish ';'
| TOK_ON TOK_DISESTABLISH on_disestablish ';'
| TOK_PEER peer '{' peer_conf '}'
- | TOK_PEER_TO_PEER peer_to_peer ';'
+ | TOK_FORWARD forward ';'
| TOK_INCLUDE include ';'
;
@@ -235,7 +233,7 @@ on_disestablish: TOK_STRING {
}
;
-peer: maybe_string {
+peer: TOK_STRING {
fastd_peer_config_new(ctx, conf);
conf->peers->name = strdup($1->str);
}
@@ -285,7 +283,7 @@ peer_include: TOK_STRING {
;
-peer_to_peer: boolean { conf->peer_to_peer = $1; }
+forward: boolean { conf->forward = $1; }
;
@@ -306,10 +304,6 @@ include: TOK_PEER TOK_STRING maybe_as {
;
-maybe_string: TOK_STRING
- | { $$ = NULL; }
- ;
-
maybe_port: port { $$ = $1; }
| { $$ = 0; }
;
diff --git a/src/fastd.c b/src/fastd.c
index ee7f03a..c4a9162 100644
--- a/src/fastd.c
+++ b/src/fastd.c
@@ -255,7 +255,7 @@ void fastd_handle_receive(fastd_context *ctx, fastd_peer *peer, fastd_buffer buf
if (write(ctx->tunfd, buffer.data, buffer.len) < 0)
pr_warn_errno(ctx, "write");
- if (ctx->conf->mode == MODE_TAP && ctx->conf->peer_to_peer) {
+ if (ctx->conf->mode == MODE_TAP && ctx->conf->forward) {
const fastd_eth_addr *dest_addr = fastd_get_dest_address(ctx, buffer);
if (fastd_eth_addr_is_unicast(dest_addr)) {
diff --git a/src/fastd.h b/src/fastd.h
index 1fa4d17..99e1831 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -124,7 +124,7 @@ struct _fastd_config {
uint16_t mtu;
fastd_mode mode;
- bool peer_to_peer;
+ bool forward;
const fastd_protocol *protocol;
const fastd_method *method;