mirror of
https://github.com/bol-van/zapret.git
synced 2026-01-01 06:08:54 +03:00
tpws --disorder
This commit is contained in:
@@ -172,11 +172,27 @@ bool is_private6(const struct sockaddr_in6* a)
|
||||
|
||||
|
||||
|
||||
int set_keepalive(int fd)
|
||||
bool set_keepalive(int fd)
|
||||
{
|
||||
int yes=1;
|
||||
return setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &yes, sizeof(int))!=-1;
|
||||
}
|
||||
bool set_ttl(int fd, int ttl)
|
||||
{
|
||||
return setsockopt(fd, IPPROTO_IP, IP_TTL, &ttl, sizeof(ttl))!=-1;
|
||||
}
|
||||
bool set_hl(int fd, int hl)
|
||||
{
|
||||
return setsockopt(fd, IPPROTO_IPV6, IPV6_UNICAST_HOPS, &hl, sizeof(hl))!=-1;
|
||||
}
|
||||
bool set_ttl_hl(int fd, int ttl)
|
||||
{
|
||||
bool b1,b2;
|
||||
// try to set both but one may fail if family is wrong
|
||||
b1=set_ttl(fd, ttl);
|
||||
b2=set_hl(fd, ttl);
|
||||
return b1 || b2;
|
||||
}
|
||||
int get_so_error(int fd)
|
||||
{
|
||||
// getsockopt(SO_ERROR) clears error
|
||||
|
||||
Reference in New Issue
Block a user