mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
move sessionfirewall into the tuntap. this needs testing. the name is also slightly wrong, since a crypto session can still be set up, packets are just accepted/rejected at the tun/tap level instead
This commit is contained in:
parent
7e10025ef0
commit
5b00273dfc
4 changed files with 29 additions and 27 deletions
|
@ -115,6 +115,18 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo {
|
|||
info.address = *address.AddrForKey(ed25519.PublicKey(info.key[:]))
|
||||
info.subnet = *address.SubnetForKey(ed25519.PublicKey(info.key[:]))
|
||||
info.mtu = MTU(^uint16(0)) // TODO
|
||||
var isOutgoing bool
|
||||
if k.addrBuffer[info.address] != nil {
|
||||
isOutgoing = true
|
||||
}
|
||||
if k.subnetBuffer[info.subnet] != nil {
|
||||
isOutgoing = true
|
||||
}
|
||||
if !k.tun.gatekeeper(key, isOutgoing) {
|
||||
// Blocked by the gatekeeper, so don't create an entry for this
|
||||
k.mutex.Unlock()
|
||||
return nil
|
||||
}
|
||||
k.keyToInfo[info.key] = info
|
||||
k.addrToInfo[info.address] = info
|
||||
k.subnetToInfo[info.subnet] = info
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue