SSU2: Fix test/relay response code for banned IP

This commit is contained in:
zzz
2022-06-10 09:08:08 -04:00
parent 9de618d644
commit bfdf75f45b
2 changed files with 6 additions and 6 deletions

View File

@@ -912,12 +912,12 @@ class IntroductionManager {
PeerState aps = _transport.getPeerState(alice);
if (aps != null && aps.isIPv6() == isIPv6) {
rcode = SSU2Util.RELAY_REJECT_CHARLIE_CONNECTED;
} else if (_context.banlist().isBanlisted(alice)) {
} else if (_context.banlist().isBanlisted(alice) ||
_context.blocklist().isBlocklisted(testIP)) {
rcode = SSU2Util.RELAY_REJECT_CHARLIE_BANNED;
} else if (!TransportUtil.isValidPort(testPort) ||
!_transport.isValid(testIP) ||
_transport.isTooClose(testIP) ||
_context.blocklist().isBlocklisted(testIP)) {
_transport.isTooClose(testIP)) {
rcode = SSU2Util.RELAY_REJECT_CHARLIE_ADDRESS;
} else {
// bob should have sent it to us. Don't bother to lookup

View File

@@ -1074,12 +1074,12 @@ class PeerTestManager {
} else if (_transport.getEstablisher().getInboundState(from) != null ||
_transport.getEstablisher().getOutboundState(from) != null) {
rcode = SSU2Util.TEST_REJECT_CHARLIE_CONNECTED;
} else if (_context.banlist().isBanlisted(h)) {
} else if (_context.banlist().isBanlisted(h) ||
_context.blocklist().isBlocklisted(testIP)) {
rcode = SSU2Util.TEST_REJECT_CHARLIE_BANNED;
} else if (!TransportUtil.isValidPort(testPort) ||
!_transport.isValid(testIP) ||
_transport.isTooClose(testIP) ||
_context.blocklist().isBlocklisted(testIP)) {
_transport.isTooClose(testIP)) {
rcode = SSU2Util.TEST_REJECT_CHARLIE_ADDRESS;
} else {
// bob should have sent it to us. Don't bother to lookup