diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2022-05-21 15:21:25 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2022-12-20 09:09:33 -0500 |
commit | 1d9166c8c915c14f67612ace8a9449aa3049c2f9 (patch) | |
tree | 5b626e0750521852e25034bb16c982d7f6ae08b2 /src/lib | |
parent | da48104c99aa5def05bfcd72018a967805146a7b (diff) | |
download | tor-1d9166c8c915c14f67612ace8a9449aa3049c2f9.tar.gz tor-1d9166c8c915c14f67612ace8a9449aa3049c2f9.zip |
Enable IP_BIND_ADDRESS_NO_PORT if supported
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/sandbox/sandbox.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/sandbox/sandbox.c b/src/lib/sandbox/sandbox.c index cc00d2048f..6800fa062b 100644 --- a/src/lib/sandbox/sandbox.c +++ b/src/lib/sandbox/sandbox.c @@ -954,6 +954,14 @@ sb_setsockopt(scmp_filter_ctx ctx, sandbox_cfg_t *filter) return rc; #endif /* defined(IPV6_V6ONLY) */ +#ifdef IP_BIND_ADDRESS_NO_PORT + rc = seccomp_rule_add_2(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt), + SCMP_CMP(1, SCMP_CMP_EQ, SOL_IP), + SCMP_CMP(2, SCMP_CMP_EQ, IP_BIND_ADDRESS_NO_PORT)); + if (rc) + return rc; +#endif + return 0; } |