mirror of
https://github.com/yarrick/iodine.git
synced 2024-12-23 05:43:32 +02:00
Send P in ping packets
This commit is contained in:
parent
5c1bb035ca
commit
82b5d23788
2 changed files with 10 additions and 6 deletions
14
dns.c
14
dns.c
|
@ -165,7 +165,7 @@ dns_send_chunk(int fd)
|
|||
p = activepacket;
|
||||
p += packetpos;
|
||||
avail = packetlen - packetpos;
|
||||
lastlen = dns_write(fd, ++chunkid, p, avail);
|
||||
lastlen = dns_write(fd, ++chunkid, p, avail, 0);
|
||||
printf("Sent %d bytes of %d remaining\n", lastlen, avail);
|
||||
}
|
||||
|
||||
|
@ -191,7 +191,7 @@ dns_ping(int dns_fd)
|
|||
packetlen = 0;
|
||||
}
|
||||
snprintf(data, 3, "%02X", pingid);
|
||||
dns_write(dns_fd, ++pingid, data, 2);
|
||||
dns_write(dns_fd, ++pingid, data, 2, 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -253,7 +253,7 @@ put_hex(char *p, char h)
|
|||
}
|
||||
|
||||
int
|
||||
dns_write(int fd, int id, char *buf, int len)
|
||||
dns_write(int fd, int id, char *buf, int len, int ping)
|
||||
{
|
||||
int avail;
|
||||
int i;
|
||||
|
@ -275,8 +275,12 @@ dns_write(int fd, int id, char *buf, int len)
|
|||
bzero(data, sizeof(data));
|
||||
d = data;
|
||||
|
||||
// First byte is 0 for middle packet and 1 for last packet
|
||||
*d = '0' + final;
|
||||
if (ping) {
|
||||
*d = 'P';
|
||||
} else {
|
||||
// First byte is 0 for middle packet and 1 for last packet
|
||||
*d = '0' + final;
|
||||
}
|
||||
d++;
|
||||
|
||||
if (len > 0) {
|
||||
|
|
2
dns.h
2
dns.h
|
@ -24,7 +24,7 @@ int dns_sending();
|
|||
void dns_handle_tun(int, char *, int);
|
||||
void dns_ping(int);
|
||||
void dns_query(int, int, char *, int);
|
||||
int dns_write(int, int, char *, int);
|
||||
int dns_write(int, int, char *, int, int);
|
||||
int dns_read(int, char *, int);
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue