mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Only split queues based on port number for TCP/UDP/SCTP, rely only on protocol number for other protos to prevent issues with IPIP, GRE, etc
This commit is contained in:
		
							parent
							
								
									f53699367b
								
							
						
					
					
						commit
						3f4295f8cd
					
				
					 1 changed files with 10 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -445,9 +445,16 @@ func (sinfo *sessionInfo) doSend(bs []byte) {
 | 
			
		|||
	coords = append(coords, sinfo.coords...) // Start with the real coords
 | 
			
		||||
	coords = append(coords, 0)               // Add an explicit 0 for the destination's self peer
 | 
			
		||||
	addUint64(bs[6:7])                       // Byte 6, next header type (e.g. TCP vs UDP)
 | 
			
		||||
	// TODO parse headers, in case the next header isn't TCP/UDP for some reason
 | 
			
		||||
	addUint64(bs[40:42]) // Bytes 40-41, source port for TCP/UDP
 | 
			
		||||
	addUint64(bs[42:44]) // Bytes 42-43, destination port for TCP/UDP
 | 
			
		||||
	// Is the next header TCP, UDP, SCTP for finding source port?
 | 
			
		||||
	// 0x06 (6) = TCP, 0x11 (17) = UDP, 0x84 (132) = SCTP
 | 
			
		||||
	// TODO: Perhaps improve this for other protocols
 | 
			
		||||
	// TODO: Consider that the Next Header could be an IPv6 Extension Header instead
 | 
			
		||||
	if bs[6:7][0] == 0x06 || bs[6:7][0] == 0x11 || bs[6:7][0] == 0x84 {
 | 
			
		||||
		if len(bs) > 44 {
 | 
			
		||||
			addUint64(bs[40:42]) // Bytes 40-41, source port for TCP/UDP/SCTP
 | 
			
		||||
			addUint64(bs[42:44]) // Bytes 42-43, destination port for TCP/UDP/SCTP
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	payload, nonce := boxSeal(&sinfo.sharedSesKey, bs, &sinfo.myNonce)
 | 
			
		||||
	defer util_putBytes(payload)
 | 
			
		||||
	p := wire_trafficPacket{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue