mirror of
				https://github.com/yggdrasil-network/yggdrasil-go.git
				synced 2025-11-04 03:05:07 +03:00 
			
		
		
		
	Use ICMPv6 NDP target instead of source address when populating peermacs
This commit is contained in:
		
							parent
							
								
									4e5906bf23
								
							
						
					
					
						commit
						9eeb482587
					
				
					 1 changed files with 4 additions and 1 deletions
				
			
		| 
						 | 
					@ -175,10 +175,13 @@ func (i *icmpv6) parse_packet_tun(datain []byte, datamac *[]byte) ([]byte, error
 | 
				
			||||||
	case ipv6.ICMPTypeNeighborAdvertisement:
 | 
						case ipv6.ICMPTypeNeighborAdvertisement:
 | 
				
			||||||
		if datamac != nil {
 | 
							if datamac != nil {
 | 
				
			||||||
			var addr address.Address
 | 
								var addr address.Address
 | 
				
			||||||
 | 
								var target address.Address
 | 
				
			||||||
			var mac macAddress
 | 
								var mac macAddress
 | 
				
			||||||
			copy(addr[:], ipv6Header.Src[:])
 | 
								copy(addr[:], ipv6Header.Src[:])
 | 
				
			||||||
 | 
								copy(target[:], datain[48:64])
 | 
				
			||||||
			copy(mac[:], (*datamac)[:])
 | 
								copy(mac[:], (*datamac)[:])
 | 
				
			||||||
			neighbor := i.peermacs[addr]
 | 
								// i.tun.core.log.Println("Learning peer MAC", mac, "for", target)
 | 
				
			||||||
 | 
								neighbor := i.peermacs[target]
 | 
				
			||||||
			neighbor.mac = mac
 | 
								neighbor.mac = mac
 | 
				
			||||||
			neighbor.learned = true
 | 
								neighbor.learned = true
 | 
				
			||||||
			neighbor.lastadvertisement = time.Now()
 | 
								neighbor.lastadvertisement = time.Now()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue