mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
go.mod: bump inet.af/netstack
Updates #2642 (I'd hoped, but doesn't seem to fix it) Change-Id: Id54af7c90a1206bc7018215957e20e954782b911 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
def659d1ec
commit
2ea765e5d8
@@ -241,13 +241,21 @@ func (ns *Impl) addSubnetAddress(ip netaddr.IP) {
|
||||
ns.mu.Unlock()
|
||||
// Only register address into netstack for first concurrent connection.
|
||||
if needAdd {
|
||||
var pn tcpip.NetworkProtocolNumber
|
||||
if ip.Is4() {
|
||||
pn = ipv4.ProtocolNumber
|
||||
} else if ip.Is6() {
|
||||
pn = ipv6.ProtocolNumber
|
||||
pa := tcpip.ProtocolAddress{
|
||||
AddressWithPrefix: tcpip.AddressWithPrefix{
|
||||
Address: tcpip.Address(ip.IPAddr().IP),
|
||||
PrefixLen: int(ip.BitLen()),
|
||||
},
|
||||
}
|
||||
ns.ipstack.AddAddress(nicID, pn, tcpip.Address(ip.IPAddr().IP))
|
||||
if ip.Is4() {
|
||||
pa.Protocol = ipv4.ProtocolNumber
|
||||
} else if ip.Is6() {
|
||||
pa.Protocol = ipv6.ProtocolNumber
|
||||
}
|
||||
ns.ipstack.AddProtocolAddress(nicID, pa, stack.AddressProperties{
|
||||
PEB: stack.CanBePrimaryEndpoint, // zero value default
|
||||
ConfigType: stack.AddressConfigStatic, // zero value default
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,12 +326,19 @@ func (ns *Impl) updateIPs(nm *netmap.NetworkMap) {
|
||||
}
|
||||
}
|
||||
for ipp := range ipsToBeAdded {
|
||||
var err tcpip.Error
|
||||
if ipp.Address.To4() == "" {
|
||||
err = ns.ipstack.AddAddressWithPrefix(nicID, ipv6.ProtocolNumber, ipp)
|
||||
} else {
|
||||
err = ns.ipstack.AddAddressWithPrefix(nicID, ipv4.ProtocolNumber, ipp)
|
||||
pa := tcpip.ProtocolAddress{
|
||||
AddressWithPrefix: ipp,
|
||||
}
|
||||
if ipp.Address.To4() == "" {
|
||||
pa.Protocol = ipv6.ProtocolNumber
|
||||
} else {
|
||||
pa.Protocol = ipv4.ProtocolNumber
|
||||
}
|
||||
var err tcpip.Error
|
||||
err = ns.ipstack.AddProtocolAddress(nicID, pa, stack.AddressProperties{
|
||||
PEB: stack.CanBePrimaryEndpoint, // zero value default
|
||||
ConfigType: stack.AddressConfigStatic, // zero value default
|
||||
})
|
||||
if err != nil {
|
||||
ns.logf("netstack: could not register IP %s: %v", ipp, err)
|
||||
} else {
|
||||
@@ -572,8 +587,8 @@ func (ns *Impl) forwardTCP(client *gonet.TCPConn, clientRemoteIP netaddr.IP, wq
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
waitEntry, notifyCh := waiter.NewChannelEntry(nil)
|
||||
wq.EventRegister(&waitEntry, waiter.EventHUp)
|
||||
waitEntry, notifyCh := waiter.NewChannelEntry(waiter.EventHUp) // TODO(bradfitz): right EventMask?
|
||||
wq.EventRegister(&waitEntry)
|
||||
defer wq.EventUnregister(&waitEntry)
|
||||
done := make(chan bool)
|
||||
// netstack doesn't close the notification channel automatically if there was no
|
||||
|
Reference in New Issue
Block a user