fix: tun udp with 4in6 ip
This commit is contained in:
parent
e6d16e458f
commit
d00d83abd4
1 changed files with 6 additions and 5 deletions
|
@ -44,11 +44,12 @@ func handleUDPToLocal(packet C.UDPPacket, pc net.PacketConn, key string, oAddr,
|
|||
}
|
||||
|
||||
fromUDPAddr := from.(*net.UDPAddr)
|
||||
if fAddr.IsValid() {
|
||||
fromAddr, _ := netip.AddrFromSlice(fromUDPAddr.IP)
|
||||
fromAddr.Unmap()
|
||||
if oAddr == fromAddr {
|
||||
fromUDPAddr.IP = fAddr.AsSlice()
|
||||
fromUDPAddr = &(*fromUDPAddr) // make a copy
|
||||
if fromAddr, ok := netip.AddrFromSlice(fromUDPAddr.IP); ok {
|
||||
if fAddr.IsValid() && (oAddr.Unmap() == fromAddr.Unmap()) {
|
||||
fromUDPAddr.IP = fAddr.Unmap().AsSlice()
|
||||
} else {
|
||||
fromUDPAddr.IP = fromAddr.Unmap().AsSlice()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue