فهرست منبع

Fix: ensure tunnel protocol port maps back to correct protocol

Rod Hynes 5 سال پیش
والد
کامیت
bf8e89abd6
1فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 6 2
      psiphon/server/packetman.go

+ 6 - 2
psiphon/server/packetman.go

@@ -119,15 +119,19 @@ func selectPacketManipulationSpec(
 	protocolPort int,
 	protocolPort int,
 	clientIP net.IP) (string, interface{}, error) {
 	clientIP net.IP) (string, interface{}, error) {
 
 
-	// First check for reply, then check tactics.
+	// First check for replay, then check tactics.
 
 
 	// The intercepted packet source/protocol port is used to determine the
 	// The intercepted packet source/protocol port is used to determine the
 	// tunnel protocol name, which is used to lookup first replay and then
 	// tunnel protocol name, which is used to lookup first replay and then
 	// enabled packet manipulation specs in ServerProtocolPacketManipulations.
 	// enabled packet manipulation specs in ServerProtocolPacketManipulations.
+	//
+	// This assumes that all TunnelProtocolMayUseServerPacketManipulation
+	// protocols run on distinct ports, which is true when all such protocols run
+	// over TCP.
 
 
 	targetTunnelProtocol := ""
 	targetTunnelProtocol := ""
 	for tunnelProtocol, port := range support.Config.TunnelProtocolPorts {
 	for tunnelProtocol, port := range support.Config.TunnelProtocolPorts {
-		if port == protocolPort {
+		if port == protocolPort && protocol.TunnelProtocolMayUseServerPacketManipulation(tunnelProtocol) {
 			targetTunnelProtocol = tunnelProtocol
 			targetTunnelProtocol = tunnelProtocol
 			break
 			break
 		}
 		}