Compare commits
3 Commits
v0.0.41-mu
...
v0.0.42-mu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
286d6abf2d | ||
|
|
1f1464e90d | ||
|
|
55d9dd9277 |
2
mud
2
mud
Submodule mud updated: 7e5c487951...2c4443a823
26
src/main.c
26
src/main.c
@@ -189,9 +189,12 @@ static int gt_setup_secretkey (struct mud *mud, char *keyfile)
|
|||||||
|
|
||||||
if (str_empty(keyfile)) {
|
if (str_empty(keyfile)) {
|
||||||
char buf[2*sizeof(key)+1];
|
char buf[2*sizeof(key)+1];
|
||||||
|
size_t size = sizeof(key);
|
||||||
|
|
||||||
mud_get_key(mud, key, sizeof(key));
|
if (mud_get_key(mud, key, &size))
|
||||||
gt_tohex(buf, sizeof(buf), key, sizeof(key));
|
return -1;
|
||||||
|
|
||||||
|
gt_tohex(buf, sizeof(buf), key, size);
|
||||||
state_send(gt.state_fd, "SECRETKEY", buf);
|
state_send(gt.state_fd, "SECRETKEY", buf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -233,9 +236,11 @@ int main (int argc, char **argv)
|
|||||||
gt_set_signal();
|
gt_set_signal();
|
||||||
|
|
||||||
char *host = NULL;
|
char *host = NULL;
|
||||||
char *port = "5000";
|
long port = 5000;
|
||||||
|
|
||||||
char *bind_list = NULL;
|
char *bind_list = NULL;
|
||||||
char *bind_port = "5000";
|
long bind_port = 5000;
|
||||||
|
|
||||||
char *dev = NULL;
|
char *dev = NULL;
|
||||||
char *keyfile = NULL;
|
char *keyfile = NULL;
|
||||||
char *statefile = NULL;
|
char *statefile = NULL;
|
||||||
@@ -249,9 +254,9 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
struct option opts[] = {
|
struct option opts[] = {
|
||||||
{ "host", &host, option_str },
|
{ "host", &host, option_str },
|
||||||
{ "port", &port, option_str },
|
{ "port", &port, option_long },
|
||||||
{ "bind", &bind_list, option_str },
|
{ "bind", &bind_list, option_str },
|
||||||
{ "bind-port", &bind_port, option_str },
|
{ "bind-port", &bind_port, option_long },
|
||||||
{ "dev", &dev, option_str },
|
{ "dev", &dev, option_str },
|
||||||
{ "keyfile", &keyfile, option_str },
|
{ "keyfile", &keyfile, option_str },
|
||||||
{ "multiqueue", NULL, option_option },
|
{ "multiqueue", NULL, option_option },
|
||||||
@@ -324,7 +329,7 @@ int main (int argc, char **argv)
|
|||||||
if (time_tolerance > 0)
|
if (time_tolerance > 0)
|
||||||
mud_set_time_tolerance_sec(mud, time_tolerance);
|
mud_set_time_tolerance_sec(mud, time_tolerance);
|
||||||
|
|
||||||
if (bind_list) {
|
if (host && port && bind_list) {
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
char *name = &tmp[0];
|
char *name = &tmp[0];
|
||||||
|
|
||||||
@@ -336,19 +341,16 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
tmp[i] = 0;
|
tmp[i] = 0;
|
||||||
|
|
||||||
if (mud_bind(mud, name))
|
if (mud_peer(mud, name, host, port))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
name = &tmp[i+1];
|
name = &tmp[i+1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name[0] && mud_bind(mud, name))
|
if (name[0] && mud_peer(mud, name, host, port))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (host && mud_peer(mud, host, port))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
int mud_fd = mud_get_fd(mud);
|
int mud_fd = mud_get_fd(mud);
|
||||||
|
|
||||||
state_send(gt.state_fd, "INITIALIZED", tun_name);
|
state_send(gt.state_fd, "INITIALIZED", tun_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user