mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 20:20:53 +03:00
tpws: check for sock4a protocol
This commit is contained in:
parent
bdfeb96a81
commit
dd1ba8218d
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.
@ -756,6 +756,12 @@ static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
|
|||||||
socks4_send_rep(conn->fd, S4_REP_FAILED);
|
socks4_send_rep(conn->fd, S4_REP_FAILED);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (m->ip==htonl(1)) // special ip 0.0.0.1
|
||||||
|
{
|
||||||
|
VPRINT("socks4a protocol not supported")
|
||||||
|
socks4_send_rep(conn->fd, S4_REP_FAILED);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ss.ss_family = AF_INET;
|
ss.ss_family = AF_INET;
|
||||||
((struct sockaddr_in*)&ss)->sin_port = m->port;
|
((struct sockaddr_in*)&ss)->sin_port = m->port;
|
||||||
((struct sockaddr_in*)&ss)->sin_addr.s_addr = m->ip;
|
((struct sockaddr_in*)&ss)->sin_addr.s_addr = m->ip;
|
||||||
@ -810,14 +816,14 @@ static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
|
|||||||
|
|
||||||
if (params.no_resolve)
|
if (params.no_resolve)
|
||||||
{
|
{
|
||||||
DBGPRINT("socks5 hostname resolving disabled")
|
VPRINT("socks5 hostname resolving disabled")
|
||||||
socks5_send_rep(conn->fd,S5_REP_NOT_ALLOWED_BY_RULESET);
|
socks5_send_rep(conn->fd,S5_REP_NOT_ALLOWED_BY_RULESET);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
port=S5_PORT_FROM_DD(m,rd);
|
port=S5_PORT_FROM_DD(m,rd);
|
||||||
if (!port)
|
if (!port)
|
||||||
{
|
{
|
||||||
DBGPRINT("socks5 no port is given")
|
VPRINT("socks5 no port is given")
|
||||||
socks5_send_rep(conn->fd,S5_REP_HOST_UNREACHABLE);
|
socks5_send_rep(conn->fd,S5_REP_HOST_UNREACHABLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -830,13 +836,13 @@ static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
|
|||||||
r=getaddrinfo(sdom,sport,&hints,&ai);
|
r=getaddrinfo(sdom,sport,&hints,&ai);
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
DBGPRINT("socks5 getaddrinfo error %d",r)
|
VPRINT("socks5 getaddrinfo error %d",r)
|
||||||
socks5_send_rep(conn->fd,S5_REP_HOST_UNREACHABLE);
|
socks5_send_rep(conn->fd,S5_REP_HOST_UNREACHABLE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (params.debug>=2)
|
if (params.debug>=2)
|
||||||
{
|
{
|
||||||
printf("socks5 hostname resolved to :\n");
|
printf("socks5 hostname resolved to : \n");
|
||||||
print_addrinfo(ai);
|
print_addrinfo(ai);
|
||||||
}
|
}
|
||||||
memcpy(&ss,ai->ai_addr,ai->ai_addrlen);
|
memcpy(&ss,ai->ai_addr,ai->ai_addrlen);
|
||||||
|
Loading…
Reference in New Issue
Block a user