4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-04 17:07:47 +00:00

Support IPv4 in ckr.go

This commit is contained in:
Neil Alexander
2018-11-06 20:04:49 +00:00
parent cb7a5f17d9
commit 424faa1c51
4 changed files with 113 additions and 67 deletions

View File

@ -134,7 +134,7 @@ func (r *router) sendPacket(bs []byte) {
copy(dest[:], bs[24:])
copy(snet[:], bs[24:])
if !dest.isValid() && !snet.isValid() {
if key, err := r.cryptokey.getPublicKeyForAddress(dest); err == nil {
if key, err := r.cryptokey.getPublicKeyForAddress(dest, 16); err == nil {
addr := *address_addrForNodeID(getNodeID(&key))
copy(dest[:], addr[:])
copy(snet[:], addr[:])
@ -273,7 +273,7 @@ func (r *router) recvPacket(bs []byte, sinfo *sessionInfo) {
case source.isValid() && source == sinfo.theirAddr:
case snet.isValid() && snet == sinfo.theirSubnet:
default:
key, err := r.cryptokey.getPublicKeyForAddress(source)
key, err := r.cryptokey.getPublicKeyForAddress(source, 16)
if err != nil || key != sinfo.theirPermPub {
util_putBytes(bs)
return