mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-26 02:31:37 +00:00
Modify source address check for CKR
This commit is contained in:
parent
7218b5a56c
commit
cfdbc481a5
@ -99,7 +99,7 @@ func (c *cryptokey) getPublicKeyForAddress(addr address) (boxPubKey, error) {
|
|||||||
// Check if the address is a valid Yggdrasil address - if so it
|
// Check if the address is a valid Yggdrasil address - if so it
|
||||||
// is exempt from all CKR checking
|
// is exempt from all CKR checking
|
||||||
if addr.isValid() {
|
if addr.isValid() {
|
||||||
return
|
return boxPubKey{}, errors.New("Cannot look up CKR for Yggdrasil addresses")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if there's a cache entry for this addr
|
// Check if there's a cache entry for this addr
|
||||||
|
@ -124,14 +124,11 @@ func (r *router) sendPacket(bs []byte) {
|
|||||||
}
|
}
|
||||||
var sourceAddr address
|
var sourceAddr address
|
||||||
var sourceSubnet subnet
|
var sourceSubnet subnet
|
||||||
|
var dest address
|
||||||
|
var snet subnet
|
||||||
copy(sourceAddr[:], bs[8:])
|
copy(sourceAddr[:], bs[8:])
|
||||||
copy(sourceSubnet[:], bs[8:])
|
copy(sourceSubnet[:], bs[8:])
|
||||||
if !sourceAddr.isValid() && !sourceSubnet.isValid() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var dest address
|
|
||||||
copy(dest[:], bs[24:])
|
copy(dest[:], bs[24:])
|
||||||
var snet subnet
|
|
||||||
copy(snet[:], bs[24:])
|
copy(snet[:], bs[24:])
|
||||||
if !dest.isValid() && !snet.isValid() {
|
if !dest.isValid() && !snet.isValid() {
|
||||||
if key, err := r.cryptokey.getPublicKeyForAddress(dest); err == nil {
|
if key, err := r.cryptokey.getPublicKeyForAddress(dest); err == nil {
|
||||||
@ -144,6 +141,10 @@ func (r *router) sendPacket(bs []byte) {
|
|||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if !sourceAddr.isValid() && !sourceSubnet.isValid() {
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
doSearch := func(packet []byte) {
|
doSearch := func(packet []byte) {
|
||||||
var nodeID, mask *NodeID
|
var nodeID, mask *NodeID
|
||||||
|
Loading…
Reference in New Issue
Block a user