mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-11 17:29:16 +05:00
tpws: deny connections to 0.0.0.0
This commit is contained in:
parent
dd1ba8218d
commit
a15de18b33
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -155,8 +155,9 @@ bool saconvmapped(struct sockaddr_storage *a)
|
||||
|
||||
bool is_localnet(const struct sockaddr *a)
|
||||
{
|
||||
return a->sa_family==AF_INET && *(char*)&((struct sockaddr_in *)a)->sin_addr.s_addr==127 ||
|
||||
a->sa_family==AF_INET6 && saismapped((struct sockaddr_in6 *)a) && ((struct sockaddr_in6 *)a)->sin6_addr.s6_addr[12]==127;
|
||||
// 0.0.0.0, ::ffff:0.0.0.0 = localhost in linux
|
||||
return a->sa_family==AF_INET && (*(char*)&((struct sockaddr_in *)a)->sin_addr.s_addr==127 || !((struct sockaddr_in *)a)->sin_addr.s_addr) ||
|
||||
a->sa_family==AF_INET6 && saismapped((struct sockaddr_in6 *)a) && (((struct sockaddr_in6 *)a)->sin6_addr.s6_addr[12]==127 || !*(uint32_t*)(((struct sockaddr_in6 *)a)->sin6_addr.s6_addr+12));
|
||||
}
|
||||
bool is_linklocal(const struct sockaddr_in6 *a)
|
||||
{
|
||||
|
@ -842,7 +842,7 @@ static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
|
||||
}
|
||||
if (params.debug>=2)
|
||||
{
|
||||
printf("socks5 hostname resolved to : \n");
|
||||
printf("socks5 hostname resolved to :\n");
|
||||
print_addrinfo(ai);
|
||||
}
|
||||
memcpy(&ss,ai->ai_addr,ai->ai_addrlen);
|
||||
|
Loading…
Reference in New Issue
Block a user