From 2ec0894c3564446263f4598f5155a8fcadb90cb3 Mon Sep 17 00:00:00 2001
From: zzz <zzz@i2pmail.org>
Date: Sat, 11 Jun 2022 13:06:29 -0400
Subject: [PATCH] SSU2: Relay WIP part 13

Reject SSU1/SSU2 relay request mismatch as Bob
---
 .../i2p/router/transport/udp/IntroductionManager.java  | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java
index 14037d435d..ce344b19ac 100644
--- a/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java
+++ b/router/java/src/net/i2p/router/transport/udp/IntroductionManager.java
@@ -726,6 +726,11 @@ class IntroductionManager {
             _context.statManager().addRateData("udp.receiveRelayRequestBadTag", 1);
             return;
         }
+        if (charlie.getVersion() != 1) {
+            if (_log.shouldWarn())
+                _log.warn("Receive SSU1 relay request from " + alice  + " for SSU2 " + charlie);
+            return;
+        }
         if (_log.shouldDebug())
             _log.debug("Receive relay request from " + alice 
                       + " for tag " + tag
@@ -798,7 +803,10 @@ class IntroductionManager {
                 _log.warn("Relay tag not found " + tag + " from " + alice);
             rcode = SSU2Util.RELAY_REJECT_BOB_NO_TAG;
         } else if (charlie.getVersion() != 2) {
-            return;
+            if (_log.shouldWarn())
+                _log.warn("Receive SSU2 relay request from " + alice  + " for SSU1 " + charlie);
+            // add a code for this?
+            rcode = SSU2Util.RELAY_REJECT_BOB_NO_TAG;
         } else {
             aliceRI = _context.netDb().lookupRouterInfoLocally(alice.getRemotePeer());
             if (aliceRI != null) {
-- 
GitLab