mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-31 22:45:45 +00:00
Reduce the side effects
This commit is contained in:
@@ -74,7 +74,7 @@ init_iptables()
|
||||
char cli[256];
|
||||
sprintf(cli, "iptables -N SHADOWSOCKS_LIBEV; \
|
||||
iptables -F SHADOWSOCKS_LIBEV; \
|
||||
iptables -A OUTPUT -p tcp --tcp-flags FIN FIN -j SHADOWSOCKS_LIBEV");
|
||||
iptables -A OUTPUT -p tcp --tcp-flags RST RST -j SHADOWSOCKS_LIBEV");
|
||||
return run_cmd(cli);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ clean_iptables()
|
||||
if (geteuid() != 0)
|
||||
return -1;
|
||||
char cli[256];
|
||||
sprintf(cli, "iptables -D OUTPUT -p tcp --tcp-flags FIN FIN -j SHADOWSOCKS_LIBEV; \
|
||||
sprintf(cli, "iptables -D OUTPUT -p tcp --tcp-flags RST RST -j SHADOWSOCKS_LIBEV; \
|
||||
iptables -F SHADOWSOCKS_LIBEV; \
|
||||
iptables -X SHADOWSOCKS_LIBEV");
|
||||
return run_cmd(cli);
|
||||
|
||||
@@ -315,6 +315,14 @@ reset_addr(int fd)
|
||||
static void
|
||||
report_addr(int fd, int err_level)
|
||||
{
|
||||
|
||||
#ifdef __linux__
|
||||
struct linger so_linger;
|
||||
so_linger.l_onoff = 1;
|
||||
so_linger.l_linger = 0;
|
||||
setsockopt(fd, SOL_SOCKET, SO_LINGER, &so_linger, sizeof so_linger);
|
||||
#endif
|
||||
|
||||
char *peer_name;
|
||||
peer_name = get_peer_name(fd);
|
||||
if (peer_name != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user