mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
tpws: check for kernel version in fixseg
This commit is contained in:
parent
e12dd237c2
commit
cc30a90556
@ -105,6 +105,7 @@ struct params_s
|
|||||||
|
|
||||||
uint8_t proxy_type;
|
uint8_t proxy_type;
|
||||||
unsigned int fix_seg;
|
unsigned int fix_seg;
|
||||||
|
bool fix_seg_avail;
|
||||||
bool no_resolve;
|
bool no_resolve;
|
||||||
bool skip_nodelay;
|
bool skip_nodelay;
|
||||||
bool droproot;
|
bool droproot;
|
||||||
|
@ -538,6 +538,8 @@ void parse_params(int argc, char *argv[])
|
|||||||
params.pf_enable = true; // OpenBSD and MacOS have no other choice
|
params.pf_enable = true; // OpenBSD and MacOS have no other choice
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
params.fix_seg_avail = socket_supports_notsent();
|
||||||
|
|
||||||
LIST_INIT(¶ms.hostlists);
|
LIST_INIT(¶ms.hostlists);
|
||||||
LIST_INIT(¶ms.ipsets);
|
LIST_INIT(¶ms.ipsets);
|
||||||
|
|
||||||
@ -1236,7 +1238,7 @@ void parse_params(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 65: /* fix-seg */
|
case 65: /* fix-seg */
|
||||||
if (!socket_supports_notsent())
|
if (!params.fix_seg_avail)
|
||||||
{
|
{
|
||||||
DLOG_ERR("--fix-seg is supported since kernel 4.6\n");
|
DLOG_ERR("--fix-seg is supported since kernel 4.6\n");
|
||||||
exit_clean(1);
|
exit_clean(1);
|
||||||
|
@ -1248,19 +1248,22 @@ static bool handle_epoll(tproxy_conn_t *conn, struct tailhead *conn_list, uint32
|
|||||||
bApplyOOB = i==0 && (split_flags & SPLIT_FLAG_OOB);
|
bApplyOOB = i==0 && (split_flags & SPLIT_FLAG_OOB);
|
||||||
len = to-from;
|
len = to-from;
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if (params.fix_seg)
|
if (params.fix_seg_avail)
|
||||||
{
|
{
|
||||||
unsigned int wasted;
|
if (params.fix_seg)
|
||||||
bool bWaitOK = socket_wait_notsent(conn->partner->fd, params.fix_seg, &wasted);
|
{
|
||||||
if (wasted)
|
unsigned int wasted;
|
||||||
VPRINT("WARNING ! wasted %u ms to fix segmenation\n", wasted);
|
bool bWaitOK = socket_wait_notsent(conn->partner->fd, params.fix_seg, &wasted);
|
||||||
if (!bWaitOK)
|
if (wasted)
|
||||||
report_segfail();
|
VPRINT("WARNING ! wasted %u ms to fix segmenation\n", wasted);
|
||||||
}
|
if (!bWaitOK)
|
||||||
else
|
report_segfail();
|
||||||
{
|
}
|
||||||
if (socket_has_notsent(conn->partner->fd))
|
else
|
||||||
report_segfail();
|
{
|
||||||
|
if (socket_has_notsent(conn->partner->fd))
|
||||||
|
report_segfail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
VPRINT("Sending multisplit part %d %zd-%zd (len %zd)%s%s : ", i+1, from, to, len, bApplyDisorder ? " with disorder" : "", bApplyOOB ? " with OOB" : "");
|
VPRINT("Sending multisplit part %d %zd-%zd (len %zd)%s%s : ", i+1, from, to, len, bApplyDisorder ? " with disorder" : "", bApplyOOB ? " with OOB" : "");
|
||||||
|
Loading…
Reference in New Issue
Block a user