Compare commits
3 Commits
v0.0.69-mu
...
v0.0.72-mu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0645f0d4d0 | ||
|
|
3656ab9e2a | ||
|
|
adb791d3ba |
2
mud
2
mud
Submodule mud updated: ca9aa34ae3...e1fd7f8b0d
37
src/main.c
37
src/main.c
@@ -239,6 +239,7 @@ int main (int argc, char **argv)
|
|||||||
long port = 5000;
|
long port = 5000;
|
||||||
|
|
||||||
char *bind_list = NULL;
|
char *bind_list = NULL;
|
||||||
|
char *bind_backup = NULL;
|
||||||
long bind_port = 5000;
|
long bind_port = 5000;
|
||||||
|
|
||||||
char *dev = NULL;
|
char *dev = NULL;
|
||||||
@@ -262,6 +263,7 @@ int main (int argc, char **argv)
|
|||||||
{ "host", &host, option_str },
|
{ "host", &host, option_str },
|
||||||
{ "port", &port, option_long },
|
{ "port", &port, option_long },
|
||||||
{ "bind", &bind_list, option_str },
|
{ "bind", &bind_list, option_str },
|
||||||
|
{ "bind-backup", &bind_backup, option_str },
|
||||||
{ "bind-port", &bind_port, option_long },
|
{ "bind-port", &bind_port, option_long },
|
||||||
{ "dev", &dev, option_str },
|
{ "dev", &dev, option_str },
|
||||||
{ "mtu", &mtu, option_long },
|
{ "mtu", &mtu, option_long },
|
||||||
@@ -357,30 +359,43 @@ 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 (host && port && bind_list) {
|
if (host && port) {
|
||||||
|
if (bind_backup) {
|
||||||
|
if (mud_peer(mud, bind_backup, host, port, 1)) {
|
||||||
|
perror("mud_peer (backup)");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bind_list) {
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
char *name = &tmp[0];
|
char *name = &tmp[0];
|
||||||
|
|
||||||
size_t size = str_cpy(tmp, bind_list, sizeof(tmp)-1);
|
str_cpy(tmp, bind_list, sizeof(tmp)-1);
|
||||||
|
|
||||||
for (size_t i=0; i<size; i++) {
|
while (*name) {
|
||||||
if (tmp[i]!=',')
|
char *p = name;
|
||||||
continue;
|
|
||||||
|
|
||||||
tmp[i] = 0;
|
while (*p && *p!=',')
|
||||||
|
p++;
|
||||||
|
|
||||||
if (mud_peer(mud, name, host, port))
|
if (*p)
|
||||||
|
*p++ = 0;
|
||||||
|
|
||||||
|
if (mud_peer(mud, name, host, port, 0)) {
|
||||||
|
perror("mud_peer");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
name = &tmp[i+1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name[0] && mud_peer(mud, name, host, port))
|
name = p;
|
||||||
return 1;
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int mud_fd = mud_get_fd(mud);
|
int mud_fd = mud_get_fd(mud);
|
||||||
|
|
||||||
|
fd_set_nonblock(mud_fd);
|
||||||
|
|
||||||
state_send(gt.state_fd, "INITIALIZED", tun_name);
|
state_send(gt.state_fd, "INITIALIZED", tun_name);
|
||||||
|
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
|
|||||||
Reference in New Issue
Block a user