mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-24 00:59:19 +02:00
Added CMC to I and S packet types
This commit is contained in:
parent
225d48dbc3
commit
53dfac0b3c
|
@ -54,10 +54,12 @@ Client sends:
|
||||||
5 bits coded as Base32 char, meaning userid
|
5 bits coded as Base32 char, meaning userid
|
||||||
5 bits coded as Base32 char, with value 5 or 6, representing number of raw
|
5 bits coded as Base32 char, with value 5 or 6, representing number of raw
|
||||||
bits per encoded byte
|
bits per encoded byte
|
||||||
|
CMC
|
||||||
Server sends:
|
Server sends:
|
||||||
Name of codec if accepted. After this all upstream data packets must
|
Name of codec if accepted. After this all upstream data packets must
|
||||||
be encoded with the new codec.
|
be encoded with the new codec.
|
||||||
BADCODEC if not accepted. Client must then revert to Base32
|
BADCODEC if not accepted. Client must then revert to Base32
|
||||||
|
BADLEN if length of query is too short
|
||||||
|
|
||||||
Probe downstream fragment size:
|
Probe downstream fragment size:
|
||||||
Client sends:
|
Client sends:
|
||||||
|
|
14
src/iodine.c
14
src/iodine.c
|
@ -476,9 +476,14 @@ send_version(int fd, uint32_t version)
|
||||||
static void
|
static void
|
||||||
send_ip_request(int fd, int userid)
|
send_ip_request(int fd, int userid)
|
||||||
{
|
{
|
||||||
char buf[512] = "I_.";
|
char buf[512] = "I____.";
|
||||||
buf[1] = b32_5to8(userid);
|
buf[1] = b32_5to8(userid);
|
||||||
|
|
||||||
|
buf[2] = b32_5to8((rand_seed >> 10) & 0x1f);
|
||||||
|
buf[3] = b32_5to8((rand_seed >> 5) & 0x1f);
|
||||||
|
buf[4] = b32_5to8((rand_seed ) & 0x1f);
|
||||||
|
rand_seed++;
|
||||||
|
|
||||||
strncat(buf, topdomain, 512 - strlen(buf));
|
strncat(buf, topdomain, 512 - strlen(buf));
|
||||||
send_query(fd, buf);
|
send_query(fd, buf);
|
||||||
}
|
}
|
||||||
|
@ -498,10 +503,15 @@ send_case_check(int fd)
|
||||||
static void
|
static void
|
||||||
send_codec_switch(int fd, int userid, int bits)
|
send_codec_switch(int fd, int userid, int bits)
|
||||||
{
|
{
|
||||||
char buf[512] = "S__.";
|
char buf[512] = "S_____.";
|
||||||
buf[1] = b32_5to8(userid);
|
buf[1] = b32_5to8(userid);
|
||||||
buf[2] = b32_5to8(bits);
|
buf[2] = b32_5to8(bits);
|
||||||
|
|
||||||
|
buf[3] = b32_5to8((rand_seed >> 10) & 0x1f);
|
||||||
|
buf[4] = b32_5to8((rand_seed >> 5) & 0x1f);
|
||||||
|
buf[5] = b32_5to8((rand_seed ) & 0x1f);
|
||||||
|
rand_seed++;
|
||||||
|
|
||||||
strncat(buf, topdomain, 512 - strlen(buf));
|
strncat(buf, topdomain, 512 - strlen(buf));
|
||||||
send_query(fd, buf);
|
send_query(fd, buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,7 @@ handle_null_request(int tun_fd, int dns_fd, struct query *q, int domain_len)
|
||||||
} else if(in[0] == 'S' || in[0] == 's') {
|
} else if(in[0] == 'S' || in[0] == 's') {
|
||||||
int codec;
|
int codec;
|
||||||
struct encoder *enc;
|
struct encoder *enc;
|
||||||
if (domain_len != 4) { /* len = 4, example: "S15." */
|
if (domain_len < 3) { /* len at least 3, example: "S15" */
|
||||||
write_dns(dns_fd, q, "BADLEN", 6);
|
write_dns(dns_fd, q, "BADLEN", 6);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue