mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-22 13:06:06 +03:00
server sends data in response
This commit is contained in:
parent
5e7385a0ea
commit
36b134361b
2
dns.c
2
dns.c
@ -185,7 +185,7 @@ dns_ping(int dns_fd)
|
||||
printf("No reply on chunk, resending\n");
|
||||
dns_send_chunk(dns_fd);
|
||||
} else {
|
||||
dns_write(dns_fd, dns_fd, "", 1);
|
||||
dns_write(dns_fd, dns_fd, "", 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
11
dnsd.c
11
dnsd.c
@ -198,22 +198,27 @@ dnsd_respond(int fd, short id, struct sockaddr_in from)
|
||||
header->rd = 0;
|
||||
header->ra = 0;
|
||||
|
||||
header->ancount = htons(1);
|
||||
if(outbuflen > 0)
|
||||
header->ancount = htons(1);
|
||||
else
|
||||
header->ancount = htons(0);
|
||||
|
||||
p = buf + sizeof(HEADER);
|
||||
|
||||
p += host2dns("fluff", p, 5);
|
||||
PUTSHORT(T_PTR, p);
|
||||
PUTSHORT(T_NULL, p);
|
||||
PUTSHORT(C_IN, p);
|
||||
PUTLONG(htons(3600), p);
|
||||
|
||||
size = host2dns("mupp", p+2, 4);
|
||||
size = host2dns(outbuf, p+2, outbuflen);
|
||||
PUTSHORT(size, p);
|
||||
p += size;
|
||||
|
||||
len = p - buf;
|
||||
printf("%d\n", len);
|
||||
sendto(fd, buf, len, 0, (struct sockaddr*)&from, sizeof(from));
|
||||
|
||||
outbuflen = 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
7
dnstun.c
7
dnstun.c
@ -70,16 +70,11 @@ tunnel(int tun_fd, int dns_fd)
|
||||
}
|
||||
|
||||
if(i == 0) {
|
||||
//dns_ping(dns_fd);
|
||||
dns_ping(dns_fd);
|
||||
} else {
|
||||
if(FD_ISSET(tun_fd, &fds)) {
|
||||
read = read_tun(tun_fd, frame, FRAMESIZE);
|
||||
if (read > 0) {
|
||||
int fd;
|
||||
|
||||
fd = open("moo", O_WRONLY | O_CREAT, S_IRGRP);
|
||||
write(fd, frame->data, read - 4);
|
||||
close(fd);
|
||||
printf("Got data on tun! %d bytes\n", read);
|
||||
dns_handle_tun(dns_fd, frame->data, read - 4);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user