mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Don't send ICMPv6 back when tun disabled
This commit is contained in:
		
							parent
							
								
									9eaa2566c1
								
							
						
					
					
						commit
						2a38ad07cd
					
				
					 1 changed files with 0 additions and 19 deletions
				
			
		| 
						 | 
					@ -270,25 +270,6 @@ func (r *router) sendPacket(bs []byte) {
 | 
				
			||||||
		// Drop packets if the session MTU is 0 - this means that one or other
 | 
							// Drop packets if the session MTU is 0 - this means that one or other
 | 
				
			||||||
		// side probably has their TUN adapter disabled
 | 
							// side probably has their TUN adapter disabled
 | 
				
			||||||
		if sinfo.getMTU() == 0 {
 | 
							if sinfo.getMTU() == 0 {
 | 
				
			||||||
			// Get the size of the oversized payload, up to a max of 900 bytes
 | 
					 | 
				
			||||||
			window := 900
 | 
					 | 
				
			||||||
			if len(bs) < window {
 | 
					 | 
				
			||||||
				window = len(bs)
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			// Create the Destination Unreachable response
 | 
					 | 
				
			||||||
			ptb := &icmp.DstUnreach{
 | 
					 | 
				
			||||||
				Data: bs[:window],
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			// Create the ICMPv6 response from it
 | 
					 | 
				
			||||||
			icmpv6Buf, err := r.tun.icmpv6.create_icmpv6_tun(
 | 
					 | 
				
			||||||
				bs[8:24], bs[24:40],
 | 
					 | 
				
			||||||
				ipv6.ICMPTypeDestinationUnreachable, 1, ptb)
 | 
					 | 
				
			||||||
			if err == nil {
 | 
					 | 
				
			||||||
				r.recv <- icmpv6Buf
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			// Don't continue - drop the packet
 | 
								// Don't continue - drop the packet
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue