Autoselect the device when there is only one

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2018-02-27 15:36:35 +00:00
parent 4fa56178cf
commit da44a9f55b
3 changed files with 44 additions and 19 deletions

View File

@@ -48,7 +48,7 @@ gt_set_timetolerance(int fd, unsigned long timetolerance)
int
gt_set(int argc, char **argv)
{
const char *dev = "tun0";
const char *dev = NULL;
unsigned long timetolerance = 0;
unsigned long timeout = 0;
size_t mtu = 0;
@@ -66,12 +66,12 @@ gt_set(int argc, char **argv)
int fd = ctl_create("/run/" PACKAGE_NAME, NULL);
if (fd == -1) {
perror("ctl_create");
perror("set");
return 1;
}
if (ctl_connect(fd, "/run/" PACKAGE_NAME, dev) == -1) {
gt_log("couldn't connect to %s\n", dev);
perror("set");
ctl_delete(fd);
return 1;
}