mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-23 00:29:20 +02:00
Dont forward the ping packet
This commit is contained in:
parent
36b134361b
commit
e24f396039
5
dns.c
5
dns.c
|
@ -185,7 +185,7 @@ dns_ping(int dns_fd)
|
||||||
printf("No reply on chunk, resending\n");
|
printf("No reply on chunk, resending\n");
|
||||||
dns_send_chunk(dns_fd);
|
dns_send_chunk(dns_fd);
|
||||||
} else {
|
} else {
|
||||||
dns_write(dns_fd, dns_fd, "", 0);
|
dns_write(dns_fd, chunkid++, "", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,12 +258,14 @@ dns_write(int fd, int id, char *buf, int len)
|
||||||
|
|
||||||
avail = MIN(avail, len); // do not use more bytes than is available;
|
avail = MIN(avail, len); // do not use more bytes than is available;
|
||||||
final = (avail == len); // is this the last block?
|
final = (avail == len); // is this the last block?
|
||||||
|
bzero(data, sizeof(data));
|
||||||
d = data;
|
d = data;
|
||||||
|
|
||||||
// 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) {
|
||||||
for (i = 0; i < avail; i++) {
|
for (i = 0; i < avail; i++) {
|
||||||
if (i > 0 && i % 31 == 0) {
|
if (i > 0 && i % 31 == 0) {
|
||||||
*d = '.';
|
*d = '.';
|
||||||
|
@ -272,6 +274,7 @@ dns_write(int fd, int id, char *buf, int len)
|
||||||
put_hex(d, buf[i]);
|
put_hex(d, buf[i]);
|
||||||
d += 2;
|
d += 2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (*d != '.') {
|
if (*d != '.') {
|
||||||
*d++ = '.';
|
*d++ = '.';
|
||||||
}
|
}
|
||||||
|
|
3
dnsd.c
3
dnsd.c
|
@ -290,8 +290,9 @@ dnsd_read(int fd, char *buf, int buflen)
|
||||||
packetlen++;
|
packetlen++;
|
||||||
}
|
}
|
||||||
dnsd_respond(fd, id, from);
|
dnsd_respond(fd, id, from);
|
||||||
if (lastblock && packetlen == 0) {
|
if (lastblock && packetlen < 2) {
|
||||||
// Skipping ping packet
|
// Skipping ping packet
|
||||||
|
packetlen = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (lastblock) {
|
if (lastblock) {
|
||||||
|
|
Loading…
Reference in New Issue