mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-27 02:29:20 +02:00
Send P in ping packets
This commit is contained in:
parent
5c1bb035ca
commit
82b5d23788
10
dns.c
10
dns.c
|
@ -165,7 +165,7 @@ dns_send_chunk(int fd)
|
||||||
p = activepacket;
|
p = activepacket;
|
||||||
p += packetpos;
|
p += packetpos;
|
||||||
avail = packetlen - 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);
|
printf("Sent %d bytes of %d remaining\n", lastlen, avail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ dns_ping(int dns_fd)
|
||||||
packetlen = 0;
|
packetlen = 0;
|
||||||
}
|
}
|
||||||
snprintf(data, 3, "%02X", pingid);
|
snprintf(data, 3, "%02X", pingid);
|
||||||
dns_write(dns_fd, ++pingid, data, 2);
|
dns_write(dns_fd, ++pingid, data, 2, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -253,7 +253,7 @@ put_hex(char *p, char h)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
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 avail;
|
||||||
int i;
|
int i;
|
||||||
|
@ -275,8 +275,12 @@ dns_write(int fd, int id, char *buf, int len)
|
||||||
bzero(data, sizeof(data));
|
bzero(data, sizeof(data));
|
||||||
d = data;
|
d = data;
|
||||||
|
|
||||||
|
if (ping) {
|
||||||
|
*d = 'P';
|
||||||
|
} else {
|
||||||
// First byte is 0 for middle packet and 1 for last packet
|
// First byte is 0 for middle packet and 1 for last packet
|
||||||
*d = '0' + final;
|
*d = '0' + final;
|
||||||
|
}
|
||||||
d++;
|
d++;
|
||||||
|
|
||||||
if (len > 0) {
|
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_handle_tun(int, char *, int);
|
||||||
void dns_ping(int);
|
void dns_ping(int);
|
||||||
void dns_query(int, int, char *, 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);
|
int dns_read(int, char *, int);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue