Fixed uid for sni

This commit is contained in:
M66B 2023-08-28 22:10:33 +02:00
parent c54e00a3a5
commit 04980b7e5f
1 changed files with 14 additions and 11 deletions

View File

@ -281,17 +281,6 @@ void handle_ip(const struct arguments *args,
}
}
// Get uid
jint uid = -1;
if (protocol == IPPROTO_ICMP || protocol == IPPROTO_ICMPV6 ||
(protocol == IPPROTO_UDP && !has_udp_session(args, pkt, payload)) ||
(protocol == IPPROTO_TCP && syn)) {
if (args->ctx->sdk <= 28) // Android 9 Pie
uid = get_uid(version, protocol, saddr, sport, daddr, dport);
else
uid = get_uid_q(args, version, protocol, source, sport, dest, dport);
}
// Get server name
char server_name[TLS_SNI_LENGTH + 1];
*server_name = 0;
@ -307,6 +296,20 @@ void handle_ip(const struct arguments *args,
}
}
if (*server_name != 0)
strcpy(data, "sni");
// Get uid
jint uid = -1;
if (protocol == IPPROTO_ICMP || protocol == IPPROTO_ICMPV6 ||
(protocol == IPPROTO_UDP && !has_udp_session(args, pkt, payload)) ||
(protocol == IPPROTO_TCP && (syn || *server_name != 0))) {
if (args->ctx->sdk <= 28) // Android 9 Pie
uid = get_uid(version, protocol, saddr, sport, daddr, dport);
else
uid = get_uid_q(args, version, protocol, source, sport, dest, dport);
}
log_android(ANDROID_LOG_DEBUG,
"Packet v%d %s/%u > %s/%u proto %d flags %s uid %d sni %s",
version, source, sport, dest, dport, protocol, flags, uid, server_name);