mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
Fix accidental truncation of addresses ending in 8 on macOS and BSD
This commit is contained in:
parent
fae00e962f
commit
bc899c395a
@ -137,7 +137,7 @@ func (tun *tunDevice) setupAddress(addr string) error {
|
||||
copy(ar.ifr_name[:], tun.iface.Name())
|
||||
ar.ifru_addr.sin6_len = uint8(unsafe.Sizeof(ar.ifru_addr))
|
||||
ar.ifru_addr.sin6_family = unix.AF_INET6
|
||||
parts := strings.Split(strings.TrimRight(addr, "/8"), ":")
|
||||
parts := strings.Split(strings.Split(addr, "/")[0], ":")
|
||||
for i := 0; i < 8; i++ {
|
||||
addr, _ := strconv.ParseUint(parts[i], 16, 16)
|
||||
b := make([]byte, 16)
|
||||
|
@ -84,7 +84,7 @@ func (tun *tunDevice) setupAddress(addr string) error {
|
||||
|
||||
ar.ifra_addr.sin6_len = uint8(unsafe.Sizeof(ar.ifra_addr))
|
||||
ar.ifra_addr.sin6_family = unix.AF_INET6
|
||||
parts := strings.Split(strings.TrimRight(addr, "/8"), ":")
|
||||
parts := strings.Split(strings.Split(addr, "/")[0], ":")
|
||||
for i := 0; i < 8; i++ {
|
||||
addr, _ := strconv.ParseUint(parts[i], 16, 16)
|
||||
b := make([]byte, 16)
|
||||
|
Loading…
Reference in New Issue
Block a user