ss.py: support nftset
This commit is contained in:
parent
f0c1c36418
commit
91896c5c4a
5 changed files with 74 additions and 37 deletions
7
ss.py
7
ss.py
|
|
@ -163,12 +163,6 @@ def invoke_self_with_sudo():
|
|||
import sys
|
||||
return subprocess.run(["sudo", sys.executable, *sys.argv], check=False).returncode
|
||||
|
||||
def prepare_cgroup_path():
|
||||
CGv2_ROOT = Path('/sys/fs/cgroup')
|
||||
needed_slices = ('ss_bp.slice', 'ss_bp_tcp.slice', 'ss_bp_udp.slice', 'ss_fw.slice', 'ss_fw_tcp.slice', 'ss_fw_udp.slice')
|
||||
for slice in needed_slices:
|
||||
(CGv2_ROOT / slice).mkdir(exist_ok=True)
|
||||
|
||||
def process_nft_rule(configs: dict) -> list:
|
||||
nft_rule, nft_rule_v6 = (nft_rule_redir, nft_rule_v6_redir) \
|
||||
if configs['common']['tcp_redir'] == 'redirect' \
|
||||
|
|
@ -242,7 +236,6 @@ def main():
|
|||
elif args.action == 'up':
|
||||
if os.getuid() != 0:
|
||||
return invoke_self_with_sudo()
|
||||
prepare_cgroup_path()
|
||||
if not args.config:
|
||||
name = print_config_names(do_print=False)
|
||||
args.config = name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue