mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 05:13:58 -07:00
.
This commit is contained in:
parent
105023bd87
commit
9c37fc1a5f
3 changed files with 19 additions and 0 deletions
|
@ -196,6 +196,7 @@ func (n *Network) SetLocalSettings(ls *NetworkLocalSettings) { n.updateConfig(ni
|
|||
|
||||
// MulticastSubscribe subscribes to a multicast group
|
||||
func (n *Network) MulticastSubscribe(mg *MulticastGroup) {
|
||||
n.node.log.Printf("%.16x joined multicast group %s", mg.String())
|
||||
k := mg.key()
|
||||
n.multicastSubscriptionsLock.Lock()
|
||||
if _, have := n.multicastSubscriptions[k]; have {
|
||||
|
@ -209,6 +210,7 @@ func (n *Network) MulticastSubscribe(mg *MulticastGroup) {
|
|||
|
||||
// MulticastUnsubscribe removes a subscription to a multicast group
|
||||
func (n *Network) MulticastUnsubscribe(mg *MulticastGroup) {
|
||||
n.node.log.Printf("%.16x left multicast group %s", mg.String())
|
||||
n.multicastSubscriptionsLock.Lock()
|
||||
delete(n.multicastSubscriptions, mg.key())
|
||||
n.multicastSubscriptionsLock.Unlock()
|
||||
|
@ -297,6 +299,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
|||
k := ipNetToKey(&ip)
|
||||
wantAssignedIPs[k] = true
|
||||
if _, have := haveAssignedIPs[k]; !have {
|
||||
n.node.log.Printf("%.16x adding managed IP %s", n.ID, ip.String())
|
||||
n.tap.AddIP(&ip)
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +307,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
|||
}
|
||||
for k, ip := range haveAssignedIPs {
|
||||
if _, want := wantAssignedIPs[k]; !want {
|
||||
n.node.log.Printf("%.16x removing managed IP %s", n.ID, ip.String())
|
||||
n.tap.RemoveIP(ip)
|
||||
}
|
||||
}
|
||||
|
@ -324,6 +328,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
|||
k := r.key()
|
||||
wantManagedRoutes[k] = true
|
||||
if _, have := haveManagedRoutes[k]; !have {
|
||||
n.node.log.Printf("%.16x adding managed route %s", n.ID, r.Target.String())
|
||||
n.tap.AddRoute(&r)
|
||||
}
|
||||
}
|
||||
|
@ -331,6 +336,7 @@ func (n *Network) updateConfig(nc *NetworkConfig, ls *NetworkLocalSettings) {
|
|||
}
|
||||
for k, r := range haveManagedRoutes {
|
||||
if _, want := wantManagedRoutes[k]; !want {
|
||||
n.node.log.Printf("%.16x removing managed route %s", n.ID, r.Target.String())
|
||||
n.tap.RemoveRoute(r)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue