Compare commits

...

3 Commits

Author SHA1 Message Date
bol-van
5b8a38e30e blockcheck: reduce default CURL_MAX_TIME from 3 to 2 2024-05-11 17:34:19 +03:00
bol-van
4febb74b0d winws: handle signals when busy, pass impostor and loopback 2024-05-11 16:48:51 +03:00
bol-van
23f2de8014 blockcheck: support cygwin native ping 2024-05-11 16:11:06 +03:00
6 changed files with 32 additions and 12 deletions

Binary file not shown.

View File

@ -24,7 +24,7 @@ DESYNC_MARK=0x10000000
IPFW_RULE_NUM=${IPFW_RULE_NUM:-1}
IPFW_DIVERT_PORT=${IPFW_DIVERT_PORT:-59780}
DOMAINS=${DOMAINS:-rutracker.org}
CURL_MAX_TIME=${CURL_MAX_TIME:-3}
CURL_MAX_TIME=${CURL_MAX_TIME:-2}
CURL_MAX_TIME_QUIC=${CURL_MAX_TIME_QUIC:-$CURL_MAX_TIME}
MIN_TTL=${MIN_TTL:-1}
MAX_TTL=${MAX_TTL:-12}
@ -1353,8 +1353,13 @@ pingtest()
ping -c 1 -w 1 $1 >/dev/null
;;
CYGWIN)
if starts_with "$(which ping)" /cygdrive; then
# cygwin does not have own PING by default. use windows PING.
ping -n 1 -w 1000 $1 >/dev/null
else
# they have installed cygwin ping
ping -c 1 -W 1 $1 >/dev/null
fi
;;
*)
ping -c 1 -W 1 $1 >/dev/null

View File

@ -49,6 +49,17 @@ contains()
# check if substring $2 contains in $1
[ "${1#*$2}" != "$1" ]
}
starts_with()
{
# $1 : what
# $2 : starts with
case "$1" in
"$2"*)
return 0
;;
esac
return 1
}
find_str_in_list()
{
[ -n "$1" ] && {
@ -290,7 +301,7 @@ shell_name()
SHELL_NAME=$(ps -p $$ -o comm=)
fi
[ -n "$SHELL_NAME" ] || SHELL_NAME=$(basename "$SHELL")
[ -n "$SHELL_NAME" ] || SHELL_NAME="$(basename "$SHELL")"
}
}

View File

@ -1037,6 +1037,7 @@ static bool windivert_recv_filter(HANDLE hFilter, uint8_t *packet, size_t *len,
errno=EINTR;
return false;
}
usleep(0);
if (WinDivertRecvEx(hFilter, packet, *len, &recv_len, 0, wa, NULL, &ovl))
{
*len = recv_len;

View File

@ -444,17 +444,20 @@ static int win_main(const char *windivert_filter)
DLOG("packet: id=%u len=%zu %s IPv6=%u IPChecksum=%u TCPChecksum=%u UDPChecksum=%u IfIdx=%u.%u\n", id, len, wa.Outbound ? "outbound" : "inbound", wa.IPv6, wa.IPChecksum, wa.TCPChecksum, wa.UDPChecksum, wa.Network.IfIdx, wa.Network.SubIfIdx)
if (wa.Impostor)
{
DLOG("windivert: skipping impostor packet\n")
continue;
DLOG("windivert: passing impostor packet\n")
verdict = VERDICT_PASS;
}
if (wa.Loopback)
else if (wa.Loopback)
{
DLOG("windivert: skipping loopback packet\n")
continue;
DLOG("windivert: passing loopback packet\n")
verdict = VERDICT_PASS;
}
else
{
mark=0;
// pseudo interface id IfIdx.SubIfIdx
verdict = processPacketData(&mark, ifout, packet, &len);
}
switch (verdict & VERDICT_MASK)
{
case VERDICT_PASS: