compiles on bsd

This commit is contained in:
Bjorn Andersson 2006-06-11 19:54:38 +00:00
parent 863dceb4cd
commit d81d1c8bd7
3 changed files with 14 additions and 13 deletions

View File

@ -21,6 +21,7 @@
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <err.h> #include <err.h>
@ -120,7 +121,7 @@ handshake(int dns_fd)
timeout = 1; timeout = 1;
for (i=0;i<5;i++) { for (i=0; running && i<5 ;i++) {
tv.tv_sec = timeout++; tv.tv_sec = timeout++;
tv.tv_usec = 0; tv.tv_usec = 0;
@ -139,18 +140,17 @@ handshake(int dns_fd)
continue; continue;
} }
if (read == 0) if (read > 0) {
continue;
p = strchr(in, '-'); p = strchr(in, '-');
if (p) { if (p) {
*p++ = '\0'; *p++ = '\0';
mtu = atoi(p); mtu = atoi(p);
printf("%s %d\n", in, mtu);
if (tun_setip(in) == 0 && tun_setmtu(atoi(p)) == 0) if (tun_setip(in) == 0 && tun_setmtu(atoi(p)) == 0)
return 0; return 0;
else
warn("Received handshake but b0rk");
}
} }
} }

View File

@ -21,6 +21,7 @@
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <fcntl.h> #include <fcntl.h>
#include <err.h> #include <err.h>

View File

@ -28,7 +28,7 @@ struct query {
char name[256]; char name[256];
short type; short type;
short id; short id;
struct sockaddr_in from; struct sockaddr from;
int fromlen; int fromlen;
}; };