mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-26 09:48:46 +00:00
Decode TCP window scale option
This commit is contained in:
parent
a6bbb1b1a2
commit
fe5f9370a3
1 changed files with 6 additions and 2 deletions
|
@ -426,6 +426,7 @@ jboolean handle_tcp(const struct arguments *args,
|
||||||
// Decode options
|
// Decode options
|
||||||
// http://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml#tcp-parameters-1
|
// http://www.iana.org/assignments/tcp-parameters/tcp-parameters.xhtml#tcp-parameters-1
|
||||||
uint16_t mss = 0;
|
uint16_t mss = 0;
|
||||||
|
uint8_t ws = 0;
|
||||||
int optlen = tcpoptlen;
|
int optlen = tcpoptlen;
|
||||||
uint8_t *options = tcpoptions;
|
uint8_t *options = tcpoptions;
|
||||||
while (optlen > 0) {
|
while (optlen > 0) {
|
||||||
|
@ -434,9 +435,12 @@ jboolean handle_tcp(const struct arguments *args,
|
||||||
if (kind == 0) // End of options list
|
if (kind == 0) // End of options list
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (kind == 2)
|
if (kind == 2 && len == 4)
|
||||||
mss = ntohs(*((uint16_t *) (options + 2)));
|
mss = ntohs(*((uint16_t *) (options + 2)));
|
||||||
|
|
||||||
|
else if (kind == 3 && len == 3)
|
||||||
|
ws = *(options + 2);
|
||||||
|
|
||||||
if (kind == 1) {
|
if (kind == 1) {
|
||||||
optlen--;
|
optlen--;
|
||||||
options++;
|
options++;
|
||||||
|
@ -447,7 +451,7 @@ jboolean handle_tcp(const struct arguments *args,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log_android(ANDROID_LOG_WARN, "%s new session mss %d", packet, mss);
|
log_android(ANDROID_LOG_WARN, "%s new session mss %d ws %d", packet, mss, ws);
|
||||||
|
|
||||||
// Register session
|
// Register session
|
||||||
struct tcp_session *syn = malloc(sizeof(struct tcp_session));
|
struct tcp_session *syn = malloc(sizeof(struct tcp_session));
|
||||||
|
|
Loading…
Reference in a new issue