mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 15:41:26 +00:00
#10 fixed basic ack. pings bigger than 110 still lost
This commit is contained in:
parent
9b438c20d4
commit
9355cd7829
|
@ -150,7 +150,7 @@ dns_decode(char *buf, size_t buflen, struct query *q, qr_t qr, char *packet, siz
|
||||||
}
|
}
|
||||||
|
|
||||||
if (q != NULL)
|
if (q != NULL)
|
||||||
q->id = header->id;
|
q->id = id;
|
||||||
|
|
||||||
readname(packet, packetlen, &data, name, sizeof(name));
|
readname(packet, packetlen, &data, name, sizeof(name));
|
||||||
readshort(packet, &data, &type);
|
readshort(packet, &data, &type);
|
||||||
|
|
|
@ -73,7 +73,7 @@ send_packet(int fd, char cmd, const char *data, const size_t datalen)
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
q.id = rand_seed;
|
q.id = ++chunkid;
|
||||||
q.type = T_NULL;
|
q.type = T_NULL;
|
||||||
|
|
||||||
buf[0] = cmd;
|
buf[0] = cmd;
|
||||||
|
@ -229,7 +229,7 @@ send_chunk(int fd)
|
||||||
char *p;
|
char *p;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
q.id = rand_seed;
|
q.id = ++chunkid;
|
||||||
q.type = T_NULL;
|
q.type = T_NULL;
|
||||||
|
|
||||||
p = activepacket;
|
p = activepacket;
|
||||||
|
@ -340,10 +340,10 @@ handshake(int dns_fd)
|
||||||
if (read >= 8) {
|
if (read >= 8) {
|
||||||
memcpy(&seed, in + 4, 4);
|
memcpy(&seed, in + 4, 4);
|
||||||
seed = ntohl(seed);
|
seed = ntohl(seed);
|
||||||
printf("version ok, both running 0x%08x\n", VERSION);
|
printf("Version ok, both running 0x%08x\n", VERSION);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
printf("version ok but did not receive proper login challenge\n");
|
printf("Version ok but did not receive proper login challenge\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(&version, in + 4, 4);
|
memcpy(&version, in + 4, 4);
|
||||||
|
@ -475,6 +475,7 @@ main(int argc, char **argv)
|
||||||
username = NULL;
|
username = NULL;
|
||||||
memset(password, 0, 33);
|
memset(password, 0, 33);
|
||||||
foreground = 0;
|
foreground = 0;
|
||||||
|
chunkid = 0;
|
||||||
newroot = NULL;
|
newroot = NULL;
|
||||||
device = NULL;
|
device = NULL;
|
||||||
|
|
||||||
|
|
|
@ -25,23 +25,21 @@
|
||||||
START_TEST(test_encoding_base32)
|
START_TEST(test_encoding_base32)
|
||||||
{
|
{
|
||||||
char temp[256];
|
char temp[256];
|
||||||
char *start = "HELLOTEST";
|
char end[256];
|
||||||
char *out = "1HELLOTEST";
|
char *start = "1HELLOTEST";
|
||||||
char *end;
|
|
||||||
char *tempend;
|
char *tempend;
|
||||||
int codedlength;
|
int len;
|
||||||
|
|
||||||
memset(temp, 0, sizeof(temp));
|
memset(temp, 0, sizeof(temp));
|
||||||
end = malloc(16);
|
memset(end, 0, sizeof(end));
|
||||||
memset(end, 0, 16);
|
|
||||||
|
|
||||||
codedlength = encode_data(start, 9, 256, temp);
|
encode_data(start, 9, 256, temp);
|
||||||
tempend = temp + strlen(temp);
|
tempend = temp + strlen(temp);
|
||||||
decode_data(end, 16, temp, tempend);
|
printf("%d '%s'\n", strlen(temp), temp);
|
||||||
|
len = decode_data(end, sizeof(end), temp, tempend);
|
||||||
|
|
||||||
fail_unless(strcmp(out, end) == 0, NULL);
|
printf("%d %d '%s'\n", len, strlen(end), end);
|
||||||
|
fail_unless(strcmp(start, end) == 0, NULL);
|
||||||
free(end);
|
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue