handshake_ix.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  1. package nebula
  2. import (
  3. "time"
  4. "github.com/flynn/noise"
  5. "github.com/sirupsen/logrus"
  6. "github.com/slackhq/nebula/header"
  7. "github.com/slackhq/nebula/iputil"
  8. "github.com/slackhq/nebula/udp"
  9. )
  10. // NOISE IX Handshakes
  11. // This function constructs a handshake packet, but does not actually send it
  12. // Sending is done by the handshake manager
  13. func ixHandshakeStage0(f *Interface, hh *HandshakeHostInfo) bool {
  14. err := f.handshakeManager.allocateIndex(hh)
  15. if err != nil {
  16. f.l.WithError(err).WithField("vpnIp", hh.hostinfo.vpnIp).
  17. WithField("handshake", m{"stage": 0, "style": "ix_psk0"}).Error("Failed to generate index")
  18. return false
  19. }
  20. certState := f.pki.GetCertState()
  21. ci := NewConnectionState(f.l, f.cipher, certState, true, noise.HandshakeIX, []byte{}, 0)
  22. hh.hostinfo.ConnectionState = ci
  23. hsProto := &NebulaHandshakeDetails{
  24. InitiatorIndex: hh.hostinfo.localIndexId,
  25. Time: uint64(time.Now().UnixNano()),
  26. Cert: certState.RawCertificateNoKey,
  27. }
  28. hsBytes := []byte{}
  29. hs := &NebulaHandshake{
  30. Details: hsProto,
  31. }
  32. hsBytes, err = hs.Marshal()
  33. if err != nil {
  34. f.l.WithError(err).WithField("vpnIp", hh.hostinfo.vpnIp).
  35. WithField("handshake", m{"stage": 0, "style": "ix_psk0"}).Error("Failed to marshal handshake message")
  36. return false
  37. }
  38. h := header.Encode(make([]byte, header.Len), header.Version, header.Handshake, header.HandshakeIXPSK0, 0, 1)
  39. ci.messageCounter.Add(1)
  40. msg, _, _, err := ci.H.WriteMessage(h, hsBytes)
  41. if err != nil {
  42. f.l.WithError(err).WithField("vpnIp", hh.hostinfo.vpnIp).
  43. WithField("handshake", m{"stage": 0, "style": "ix_psk0"}).Error("Failed to call noise.WriteMessage")
  44. return false
  45. }
  46. // We are sending handshake packet 1, so we don't expect to receive
  47. // handshake packet 1 from the responder
  48. ci.window.Update(f.l, 1)
  49. hh.hostinfo.HandshakePacket[0] = msg
  50. hh.ready = true
  51. return true
  52. }
  53. func ixHandshakeStage1(f *Interface, addr *udp.Addr, via *ViaSender, packet []byte, h *header.H) {
  54. certState := f.pki.GetCertState()
  55. ci := NewConnectionState(f.l, f.cipher, certState, false, noise.HandshakeIX, []byte{}, 0)
  56. // Mark packet 1 as seen so it doesn't show up as missed
  57. ci.window.Update(f.l, 1)
  58. msg, _, _, err := ci.H.ReadMessage(nil, packet[header.Len:])
  59. if err != nil {
  60. f.l.WithError(err).WithField("udpAddr", addr).
  61. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Failed to call noise.ReadMessage")
  62. return
  63. }
  64. hs := &NebulaHandshake{}
  65. err = hs.Unmarshal(msg)
  66. /*
  67. l.Debugln("GOT INDEX: ", hs.Details.InitiatorIndex)
  68. */
  69. if err != nil || hs.Details == nil {
  70. f.l.WithError(err).WithField("udpAddr", addr).
  71. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Failed unmarshal handshake message")
  72. return
  73. }
  74. remoteCert, err := RecombineCertAndValidate(ci.H, hs.Details.Cert, f.pki.GetCAPool())
  75. if err != nil {
  76. e := f.l.WithError(err).WithField("udpAddr", addr).
  77. WithField("handshake", m{"stage": 1, "style": "ix_psk0"})
  78. if f.l.Level > logrus.DebugLevel {
  79. e = e.WithField("cert", remoteCert)
  80. }
  81. e.Info("Invalid certificate from host")
  82. return
  83. }
  84. vpnIp := iputil.Ip2VpnIp(remoteCert.Details.Ips[0].IP)
  85. certName := remoteCert.Details.Name
  86. fingerprint, _ := remoteCert.Sha256Sum()
  87. issuer := remoteCert.Details.Issuer
  88. if vpnIp == f.myVpnIp {
  89. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  90. WithField("certName", certName).
  91. WithField("fingerprint", fingerprint).
  92. WithField("issuer", issuer).
  93. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Refusing to handshake with myself")
  94. return
  95. }
  96. if addr != nil {
  97. if !f.lightHouse.GetRemoteAllowList().Allow(vpnIp, addr.IP) {
  98. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).Debug("lighthouse.remote_allow_list denied incoming handshake")
  99. return
  100. }
  101. }
  102. myIndex, err := generateIndex(f.l)
  103. if err != nil {
  104. f.l.WithError(err).WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  105. WithField("certName", certName).
  106. WithField("fingerprint", fingerprint).
  107. WithField("issuer", issuer).
  108. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Failed to generate index")
  109. return
  110. }
  111. hostinfo := &HostInfo{
  112. ConnectionState: ci,
  113. localIndexId: myIndex,
  114. remoteIndexId: hs.Details.InitiatorIndex,
  115. vpnIp: vpnIp,
  116. HandshakePacket: make(map[uint8][]byte, 0),
  117. lastHandshakeTime: hs.Details.Time,
  118. relayState: RelayState{
  119. relays: map[iputil.VpnIp]struct{}{},
  120. relayForByIp: map[iputil.VpnIp]*Relay{},
  121. relayForByIdx: map[uint32]*Relay{},
  122. },
  123. }
  124. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  125. WithField("certName", certName).
  126. WithField("fingerprint", fingerprint).
  127. WithField("issuer", issuer).
  128. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  129. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).
  130. Info("Handshake message received")
  131. hs.Details.ResponderIndex = myIndex
  132. hs.Details.Cert = certState.RawCertificateNoKey
  133. // Update the time in case their clock is way off from ours
  134. hs.Details.Time = uint64(time.Now().UnixNano())
  135. hsBytes, err := hs.Marshal()
  136. if err != nil {
  137. f.l.WithError(err).WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  138. WithField("certName", certName).
  139. WithField("fingerprint", fingerprint).
  140. WithField("issuer", issuer).
  141. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Failed to marshal handshake message")
  142. return
  143. }
  144. nh := header.Encode(make([]byte, header.Len), header.Version, header.Handshake, header.HandshakeIXPSK0, hs.Details.InitiatorIndex, 2)
  145. msg, dKey, eKey, err := ci.H.WriteMessage(nh, hsBytes)
  146. if err != nil {
  147. f.l.WithError(err).WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  148. WithField("certName", certName).
  149. WithField("fingerprint", fingerprint).
  150. WithField("issuer", issuer).
  151. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Failed to call noise.WriteMessage")
  152. return
  153. } else if dKey == nil || eKey == nil {
  154. f.l.WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  155. WithField("certName", certName).
  156. WithField("fingerprint", fingerprint).
  157. WithField("issuer", issuer).
  158. WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).Error("Noise did not arrive at a key")
  159. return
  160. }
  161. hostinfo.HandshakePacket[0] = make([]byte, len(packet[header.Len:]))
  162. copy(hostinfo.HandshakePacket[0], packet[header.Len:])
  163. // Regardless of whether you are the sender or receiver, you should arrive here
  164. // and complete standing up the connection.
  165. hostinfo.HandshakePacket[2] = make([]byte, len(msg))
  166. copy(hostinfo.HandshakePacket[2], msg)
  167. // We are sending handshake packet 2, so we don't expect to receive
  168. // handshake packet 2 from the initiator.
  169. ci.window.Update(f.l, 2)
  170. ci.peerCert = remoteCert
  171. ci.dKey = NewNebulaCipherState(dKey)
  172. ci.eKey = NewNebulaCipherState(eKey)
  173. hostinfo.remotes = f.lightHouse.QueryCache(vpnIp)
  174. hostinfo.SetRemote(addr)
  175. hostinfo.CreateRemoteCIDR(remoteCert)
  176. existing, err := f.handshakeManager.CheckAndComplete(hostinfo, 0, f)
  177. if err != nil {
  178. switch err {
  179. case ErrAlreadySeen:
  180. // Update remote if preferred
  181. if existing.SetRemoteIfPreferred(f.hostMap, addr) {
  182. // Send a test packet to ensure the other side has also switched to
  183. // the preferred remote
  184. f.SendMessageToVpnIp(header.Test, header.TestRequest, vpnIp, []byte(""), make([]byte, 12, 12), make([]byte, mtu))
  185. }
  186. msg = existing.HandshakePacket[2]
  187. f.messageMetrics.Tx(header.Handshake, header.MessageSubType(msg[1]), 1)
  188. if addr != nil {
  189. err := f.outside.WriteTo(msg, addr)
  190. if err != nil {
  191. f.l.WithField("vpnIp", existing.vpnIp).WithField("udpAddr", addr).
  192. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).WithField("cached", true).
  193. WithError(err).Error("Failed to send handshake message")
  194. } else {
  195. f.l.WithField("vpnIp", existing.vpnIp).WithField("udpAddr", addr).
  196. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).WithField("cached", true).
  197. Info("Handshake message sent")
  198. }
  199. return
  200. } else {
  201. if via == nil {
  202. f.l.Error("Handshake send failed: both addr and via are nil.")
  203. return
  204. }
  205. hostinfo.relayState.InsertRelayTo(via.relayHI.vpnIp)
  206. f.SendVia(via.relayHI, via.relay, msg, make([]byte, 12), make([]byte, mtu), false)
  207. f.l.WithField("vpnIp", existing.vpnIp).WithField("relay", via.relayHI.vpnIp).
  208. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).WithField("cached", true).
  209. Info("Handshake message sent")
  210. return
  211. }
  212. case ErrExistingHostInfo:
  213. // This means there was an existing tunnel and this handshake was older than the one we are currently based on
  214. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  215. WithField("certName", certName).
  216. WithField("oldHandshakeTime", existing.lastHandshakeTime).
  217. WithField("newHandshakeTime", hostinfo.lastHandshakeTime).
  218. WithField("fingerprint", fingerprint).
  219. WithField("issuer", issuer).
  220. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  221. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).
  222. Info("Handshake too old")
  223. // Send a test packet to trigger an authenticated tunnel test, this should suss out any lingering tunnel issues
  224. f.SendMessageToVpnIp(header.Test, header.TestRequest, vpnIp, []byte(""), make([]byte, 12, 12), make([]byte, mtu))
  225. return
  226. case ErrLocalIndexCollision:
  227. // This means we failed to insert because of collision on localIndexId. Just let the next handshake packet retry
  228. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  229. WithField("certName", certName).
  230. WithField("fingerprint", fingerprint).
  231. WithField("issuer", issuer).
  232. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  233. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).
  234. WithField("localIndex", hostinfo.localIndexId).WithField("collision", existing.vpnIp).
  235. Error("Failed to add HostInfo due to localIndex collision")
  236. return
  237. default:
  238. // Shouldn't happen, but just in case someone adds a new error type to CheckAndComplete
  239. // And we forget to update it here
  240. f.l.WithError(err).WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  241. WithField("certName", certName).
  242. WithField("fingerprint", fingerprint).
  243. WithField("issuer", issuer).
  244. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  245. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 1, "style": "ix_psk0"}).
  246. Error("Failed to add HostInfo to HostMap")
  247. return
  248. }
  249. }
  250. // Do the send
  251. f.messageMetrics.Tx(header.Handshake, header.MessageSubType(msg[1]), 1)
  252. if addr != nil {
  253. err = f.outside.WriteTo(msg, addr)
  254. if err != nil {
  255. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  256. WithField("certName", certName).
  257. WithField("fingerprint", fingerprint).
  258. WithField("issuer", issuer).
  259. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  260. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  261. WithError(err).Error("Failed to send handshake")
  262. } else {
  263. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  264. WithField("certName", certName).
  265. WithField("fingerprint", fingerprint).
  266. WithField("issuer", issuer).
  267. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  268. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  269. Info("Handshake message sent")
  270. }
  271. } else {
  272. if via == nil {
  273. f.l.Error("Handshake send failed: both addr and via are nil.")
  274. return
  275. }
  276. hostinfo.relayState.InsertRelayTo(via.relayHI.vpnIp)
  277. f.SendVia(via.relayHI, via.relay, msg, make([]byte, 12), make([]byte, mtu), false)
  278. f.l.WithField("vpnIp", vpnIp).WithField("relay", via.relayHI.vpnIp).
  279. WithField("certName", certName).
  280. WithField("fingerprint", fingerprint).
  281. WithField("issuer", issuer).
  282. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  283. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  284. Info("Handshake message sent")
  285. }
  286. f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
  287. hostinfo.ConnectionState.messageCounter.Store(2)
  288. hostinfo.remotes.ResetBlockedRemotes()
  289. return
  290. }
  291. func ixHandshakeStage2(f *Interface, addr *udp.Addr, via *ViaSender, hh *HandshakeHostInfo, packet []byte, h *header.H) bool {
  292. if hh == nil {
  293. // Nothing here to tear down, got a bogus stage 2 packet
  294. return true
  295. }
  296. hh.Lock()
  297. defer hh.Unlock()
  298. hostinfo := hh.hostinfo
  299. if addr != nil {
  300. if !f.lightHouse.GetRemoteAllowList().Allow(hostinfo.vpnIp, addr.IP) {
  301. f.l.WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).Debug("lighthouse.remote_allow_list denied incoming handshake")
  302. return false
  303. }
  304. }
  305. ci := hostinfo.ConnectionState
  306. msg, eKey, dKey, err := ci.H.ReadMessage(nil, packet[header.Len:])
  307. if err != nil {
  308. f.l.WithError(err).WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  309. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).WithField("header", h).
  310. Error("Failed to call noise.ReadMessage")
  311. // We don't want to tear down the connection on a bad ReadMessage because it could be an attacker trying
  312. // to DOS us. Every other error condition after should to allow a possible good handshake to complete in the
  313. // near future
  314. return false
  315. } else if dKey == nil || eKey == nil {
  316. f.l.WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  317. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  318. Error("Noise did not arrive at a key")
  319. // This should be impossible in IX but just in case, if we get here then there is no chance to recover
  320. // the handshake state machine. Tear it down
  321. return true
  322. }
  323. hs := &NebulaHandshake{}
  324. err = hs.Unmarshal(msg)
  325. if err != nil || hs.Details == nil {
  326. f.l.WithError(err).WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  327. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).Error("Failed unmarshal handshake message")
  328. // The handshake state machine is complete, if things break now there is no chance to recover. Tear down and start again
  329. return true
  330. }
  331. remoteCert, err := RecombineCertAndValidate(ci.H, hs.Details.Cert, f.pki.GetCAPool())
  332. if err != nil {
  333. e := f.l.WithError(err).WithField("vpnIp", hostinfo.vpnIp).WithField("udpAddr", addr).
  334. WithField("handshake", m{"stage": 2, "style": "ix_psk0"})
  335. if f.l.Level > logrus.DebugLevel {
  336. e = e.WithField("cert", remoteCert)
  337. }
  338. e.Error("Invalid certificate from host")
  339. // The handshake state machine is complete, if things break now there is no chance to recover. Tear down and start again
  340. return true
  341. }
  342. vpnIp := iputil.Ip2VpnIp(remoteCert.Details.Ips[0].IP)
  343. certName := remoteCert.Details.Name
  344. fingerprint, _ := remoteCert.Sha256Sum()
  345. issuer := remoteCert.Details.Issuer
  346. // Ensure the right host responded
  347. if vpnIp != hostinfo.vpnIp {
  348. f.l.WithField("intendedVpnIp", hostinfo.vpnIp).WithField("haveVpnIp", vpnIp).
  349. WithField("udpAddr", addr).WithField("certName", certName).
  350. WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  351. Info("Incorrect host responded to handshake")
  352. // Release our old handshake from pending, it should not continue
  353. f.handshakeManager.DeleteHostInfo(hostinfo)
  354. // Create a new hostinfo/handshake for the intended vpn ip
  355. f.handshakeManager.StartHandshake(hostinfo.vpnIp, func(newHH *HandshakeHostInfo) {
  356. //TODO: this doesnt know if its being added or is being used for caching a packet
  357. // Block the current used address
  358. newHH.hostinfo.remotes = hostinfo.remotes
  359. newHH.hostinfo.remotes.BlockRemote(addr)
  360. // Get the correct remote list for the host we did handshake with
  361. hostinfo.remotes = f.lightHouse.QueryCache(vpnIp)
  362. f.l.WithField("blockedUdpAddrs", newHH.hostinfo.remotes.CopyBlockedRemotes()).WithField("vpnIp", vpnIp).
  363. WithField("remotes", newHH.hostinfo.remotes.CopyAddrs(f.hostMap.GetPreferredRanges())).
  364. Info("Blocked addresses for handshakes")
  365. // Swap the packet store to benefit the original intended recipient
  366. newHH.packetStore = hh.packetStore
  367. hh.packetStore = []*cachedPacket{}
  368. // Finally, put the correct vpn ip in the host info, tell them to close the tunnel, and return true to tear down
  369. hostinfo.vpnIp = vpnIp
  370. f.sendCloseTunnel(hostinfo)
  371. })
  372. return true
  373. }
  374. // Mark packet 2 as seen so it doesn't show up as missed
  375. ci.window.Update(f.l, 2)
  376. duration := time.Since(hh.startTime).Nanoseconds()
  377. f.l.WithField("vpnIp", vpnIp).WithField("udpAddr", addr).
  378. WithField("certName", certName).
  379. WithField("fingerprint", fingerprint).
  380. WithField("issuer", issuer).
  381. WithField("initiatorIndex", hs.Details.InitiatorIndex).WithField("responderIndex", hs.Details.ResponderIndex).
  382. WithField("remoteIndex", h.RemoteIndex).WithField("handshake", m{"stage": 2, "style": "ix_psk0"}).
  383. WithField("durationNs", duration).
  384. WithField("sentCachedPackets", len(hh.packetStore)).
  385. Info("Handshake message received")
  386. hostinfo.remoteIndexId = hs.Details.ResponderIndex
  387. hostinfo.lastHandshakeTime = hs.Details.Time
  388. // Store their cert and our symmetric keys
  389. ci.peerCert = remoteCert
  390. ci.dKey = NewNebulaCipherState(dKey)
  391. ci.eKey = NewNebulaCipherState(eKey)
  392. // Make sure the current udpAddr being used is set for responding
  393. if addr != nil {
  394. hostinfo.SetRemote(addr)
  395. } else {
  396. hostinfo.relayState.InsertRelayTo(via.relayHI.vpnIp)
  397. }
  398. // Build up the radix for the firewall if we have subnets in the cert
  399. hostinfo.CreateRemoteCIDR(remoteCert)
  400. // Complete our handshake and update metrics, this will replace any existing tunnels for this vpnIp
  401. f.handshakeManager.Complete(hostinfo, f)
  402. f.connectionManager.AddTrafficWatch(hostinfo.localIndexId)
  403. hostinfo.ConnectionState.messageCounter.Store(2)
  404. if f.l.Level >= logrus.DebugLevel {
  405. hostinfo.logger(f.l).Debugf("Sending %d stored packets", len(hh.packetStore))
  406. }
  407. if len(hh.packetStore) > 0 {
  408. nb := make([]byte, 12, 12)
  409. out := make([]byte, mtu)
  410. for _, cp := range hh.packetStore {
  411. cp.callback(cp.messageType, cp.messageSubType, hostinfo, cp.packet, nb, out)
  412. }
  413. f.cachedPacketMetrics.sent.Inc(int64(len(hh.packetStore)))
  414. }
  415. hostinfo.remotes.ResetBlockedRemotes()
  416. f.metricHandshakes.Update(duration)
  417. return false
  418. }