From 31b0b8e7ad821c87bde36f9f4f3aeb483645c52d Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 11 Feb 2016 15:21:55 +0100 Subject: [PATCH] Native warning for urgent TCP --- app/src/main/jni/netguard/ip.c | 2 ++ app/src/main/jni/netguard/tcp.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/jni/netguard/ip.c b/app/src/main/jni/netguard/ip.c index 3a5e288e..3df0c106 100644 --- a/app/src/main/jni/netguard/ip.c +++ b/app/src/main/jni/netguard/ip.c @@ -254,6 +254,8 @@ void handle_ip(const struct arguments *args, flags[flen++] = 'F'; if (tcp->rst) flags[flen++] = 'R'; + if (tcp->urg) + flags[flen++] = 'U'; // TODO checksum } diff --git a/app/src/main/jni/netguard/tcp.c b/app/src/main/jni/netguard/tcp.c index a561bb83..7fb34cbf 100644 --- a/app/src/main/jni/netguard/tcp.c +++ b/app/src/main/jni/netguard/tcp.c @@ -380,10 +380,14 @@ jboolean handle_tcp(const struct arguments *args, flags[flen++] = 'S'; if (tcphdr->ack) flags[flen++] = 'A'; + if (tcphdr->psh) + flags[flen++] = 'P'; if (tcphdr->fin) flags[flen++] = 'F'; if (tcphdr->rst) flags[flen++] = 'R'; + if (tcphdr->urg) + flags[flen++] = 'U'; flags[flen] = 0; char packet[250]; @@ -395,7 +399,7 @@ jboolean handle_tcp(const struct arguments *args, ntohl(tcphdr->seq) - (cur == NULL ? 0 : cur->remote_start), tcphdr->ack ? ntohl(tcphdr->ack_seq) - (cur == NULL ? 0 : cur->local_start) : 0, datalen, ntohs(tcphdr->window), uid); - log_android(ANDROID_LOG_DEBUG, packet); + log_android(tcphdr->urg ? ANDROID_LOG_WARN : ANDROID_LOG_DEBUG, packet); // Check session if (cur == NULL) {