Compare commits

..

No commits in common. "e8a940148aa52906439fdbfa617628ef50d0a7f7" and "b5837e844e4120f9df126031567363a48ec4ddf3" have entirely different histories.

8 changed files with 15 additions and 5 deletions

View File

@ -200,6 +200,7 @@ static void ConntrackFeedPacket(t_ctrack *t, bool bReverse, const struct tcphdr
static bool ConntrackPoolDoubleSearchPool(t_conntrack_pool **pp, const struct ip *ip, const struct ip6_hdr *ip6, const struct tcphdr *tcphdr, const struct udphdr *udphdr, t_ctrack **ctrack, bool *bReverse) static bool ConntrackPoolDoubleSearchPool(t_conntrack_pool **pp, const struct ip *ip, const struct ip6_hdr *ip6, const struct tcphdr *tcphdr, const struct udphdr *udphdr, t_ctrack **ctrack, bool *bReverse)
{ {
bool b_rev;
t_conn conn,connswp; t_conn conn,connswp;
t_conntrack_pool *ctr; t_conntrack_pool *ctr;

View File

@ -121,8 +121,8 @@ static void fill_tcphdr(
tcpopt[t] = 8; // kind tcpopt[t] = 8; // kind
tcpopt[t+1] = 10; // len tcpopt[t+1] = 10; // len
// forge only TSecr if orig timestamp is present // forge only TSecr if orig timestamp is present
*(uint32_t*)(tcpopt+t+2) = timestamps ? timestamps[0] : 0xFFFFFFFF; *(uint32_t*)(tcpopt+t+2) = timestamps ? timestamps[0] : -1;
*(uint32_t*)(tcpopt+t+6) = (timestamps && !(fooling & FOOL_TS)) ? timestamps[1] : 0xFFFFFFFF; *(uint32_t*)(tcpopt+t+6) = (timestamps && !(fooling & FOOL_TS)) ? timestamps[1] : -1;
t+=10; t+=10;
} }
if (scale_factor!=SCALE_NONE) if (scale_factor!=SCALE_NONE)
@ -1610,6 +1610,7 @@ static bool set_socket_fwmark(int sock, uint32_t fwmark)
static int rawsend_socket(sa_family_t family) static int rawsend_socket(sa_family_t family)
{ {
int yes=1;
int *sock = rawsend_family_sock(family); int *sock = rawsend_family_sock(family);
if (!sock) return -1; if (!sock) return -1;

View File

@ -1262,6 +1262,7 @@ static uint8_t dpi_desync_udp_packet_play(bool replay, size_t reasm_offset, uint
uint8_t clean[16384], *pclean; uint8_t clean[16384], *pclean;
size_t clean_len; size_t clean_len;
bool bIsHello = false;
if (replay) if (replay)
{ {

View File

@ -741,7 +741,7 @@ static bool wf_make_filter(
const char *pf_tcp_src, const char *pf_tcp_dst, const char *pf_tcp_src, const char *pf_tcp_dst,
const char *pf_udp_src, const char *pf_udp_dst) const char *pf_udp_src, const char *pf_udp_dst)
{ {
char pf_dst_buf[512],iface[64]; char pf_src_buf[512],pf_dst_buf[512],iface[64];
const char *pf_dst; const char *pf_dst;
const char *f_tcpin = *pf_tcp_src ? *params.hostlist_auto_filename ? "(" DIVERT_TCP_INBOUNDS " or (" DIVERT_HTTP_REDIRECT "))" : DIVERT_TCP_INBOUNDS : ""; const char *f_tcpin = *pf_tcp_src ? *params.hostlist_auto_filename ? "(" DIVERT_TCP_INBOUNDS " or (" DIVERT_HTTP_REDIRECT "))" : DIVERT_TCP_INBOUNDS : "";

View File

@ -210,7 +210,7 @@ bool TLSFindExtInHandshake(const uint8_t *data, size_t len, uint16_t type, const
// <CompressionMethods> // <CompressionMethods>
// u16 ExtensionsLength // u16 ExtensionsLength
size_t l; size_t l, ll;
if (!bPartialIsOK && !IsTLSHandshakeFull(data,len)) return false; if (!bPartialIsOK && !IsTLSHandshakeFull(data,len)) return false;

View File

@ -15,6 +15,7 @@ void tamper_out(t_ctrack *ctrack, uint8_t *segment,size_t segment_buffer_size,si
size_t method_len = 0, pos; size_t method_len = 0, pos;
const char *method; const char *method;
bool bBypass = false, bHaveHost = false, bHostExcluded = false; bool bBypass = false, bHaveHost = false, bHostExcluded = false;
char bRemovedHostSpace = 0;
char *pc, Host[256]; char *pc, Host[256];
DBGPRINT("tamper_out") DBGPRINT("tamper_out")
@ -118,6 +119,7 @@ void tamper_out(t_ctrack *ctrack, uint8_t *segment,size_t segment_buffer_size,si
VPRINT("Removing space before host name at pos %zu", pos) VPRINT("Removing space before host name at pos %zu", pos)
memmove(p - 1, p, *size - pos); memmove(p - 1, p, *size - pos);
(*size)--; // block will shrink by 1 byte (*size)--; // block will shrink by 1 byte
bRemovedHostSpace = 1;
} }
if (params.hostcase && HttpFindHost(&pHost,segment,*size)) if (params.hostcase && HttpFindHost(&pHost,segment,*size))
{ {
@ -183,6 +185,7 @@ void tamper_out(t_ctrack *ctrack, uint8_t *segment,size_t segment_buffer_size,si
else if (IsTLSClientHello(segment,*size,false)) else if (IsTLSClientHello(segment,*size,false))
{ {
size_t tpos=0,spos=0; size_t tpos=0,spos=0;
const uint8_t *ext;
if (!ctrack->l7proto) ctrack->l7proto=TLS; if (!ctrack->l7proto) ctrack->l7proto=TLS;

View File

@ -850,6 +850,7 @@ static bool find_listen_addr(struct sockaddr_storage *salisten, const char *bind
{ {
struct ifaddrs *addrs,*a; struct ifaddrs *addrs,*a;
bool found=false; bool found=false;
bool bindll_want = bindll==prefer || bindll==force;
if (getifaddrs(&addrs)<0) if (getifaddrs(&addrs)<0)
return false; return false;

View File

@ -336,7 +336,7 @@ static bool proxy_remote_conn_ack(tproxy_conn_t *conn, int sock_err)
//Returns -1 if something fails, >0 on success (socket fd). //Returns -1 if something fails, >0 on success (socket fd).
static int connect_remote(const struct sockaddr *remote_addr, bool bApplyConnectionFooling) static int connect_remote(const struct sockaddr *remote_addr, bool bApplyConnectionFooling)
{ {
int remote_fd = 0, yes = 1, no = 0; int remote_fd = 0, yes = 1, no = 0, v;
if((remote_fd = socket(remote_addr->sa_family, SOCK_STREAM, 0)) < 0) if((remote_fd = socket(remote_addr->sa_family, SOCK_STREAM, 0)) < 0)
@ -876,7 +876,10 @@ static bool handle_proxy_mode(tproxy_conn_t *conn, struct tailhead *conn_list)
break; break;
case S5_ATYP_DOM: case S5_ATYP_DOM:
{ {
struct addrinfo *ai,hints;
int r;
uint16_t port; uint16_t port;
char sport[6];
if (params.no_resolve) if (params.no_resolve)
{ {