Merge branch 'replay-timestamp'

This commit is contained in:
Davide De Rosa 2019-04-24 17:47:40 +02:00
commit 3d914f72c4
3 changed files with 12 additions and 3 deletions

View File

@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed ### Fixed
- SoftEther sends an incomplete PUSH_REPLY. [#86](https://github.com/keeshux/tunnelkit/issues/86) - SoftEther sends an incomplete PUSH_REPLY. [#86](https://github.com/keeshux/tunnelkit/issues/86)
- Authentication/Decrypt errors with TLS wrapping. [#88](https://github.com/keeshux/tunnelkit/issues/88), [#61](https://github.com/keeshux/tunnelkit/issues/61)
## 1.6.2 (2019-04-17) ## 1.6.2 (2019-04-17)

View File

@ -144,6 +144,8 @@ extension ControlChannel {
private var currentReplayId: BidirectionalState<UInt32> private var currentReplayId: BidirectionalState<UInt32>
private let timestamp: UInt32
private let plain: PlainSerializer private let plain: PlainSerializer
init(withKey key: StaticKey, digest: SessionProxy.Digest) throws { init(withKey key: StaticKey, digest: SessionProxy.Digest) throws {
@ -163,6 +165,7 @@ extension ControlChannel {
preambleLength = prefixLength + authLength preambleLength = prefixLength + authLength
currentReplayId = BidirectionalState(withResetValue: 1) currentReplayId = BidirectionalState(withResetValue: 1)
timestamp = UInt32(Date().timeIntervalSince1970)
plain = PlainSerializer() plain = PlainSerializer()
} }
@ -171,7 +174,7 @@ extension ControlChannel {
} }
func serialize(packet: ControlPacket) throws -> Data { func serialize(packet: ControlPacket) throws -> Data {
return try serialize(packet: packet, timestamp: UInt32(Date().timeIntervalSince1970)) return try serialize(packet: packet, timestamp: timestamp)
} }
func serialize(packet: ControlPacket, timestamp: UInt32) throws -> Data { func serialize(packet: ControlPacket, timestamp: UInt32) throws -> Data {
@ -219,6 +222,8 @@ extension ControlChannel {
private var currentReplayId: BidirectionalState<UInt32> private var currentReplayId: BidirectionalState<UInt32>
private let timestamp: UInt32
private let plain: PlainSerializer private let plain: PlainSerializer
init(withKey key: StaticKey) throws { init(withKey key: StaticKey) throws {
@ -237,6 +242,7 @@ extension ControlChannel {
tagLength = crypto.tagLength() tagLength = crypto.tagLength()
currentReplayId = BidirectionalState(withResetValue: 1) currentReplayId = BidirectionalState(withResetValue: 1)
timestamp = UInt32(Date().timeIntervalSince1970)
plain = PlainSerializer() plain = PlainSerializer()
} }
@ -245,7 +251,7 @@ extension ControlChannel {
} }
func serialize(packet: ControlPacket) throws -> Data { func serialize(packet: ControlPacket) throws -> Data {
return try serialize(packet: packet, timestamp: UInt32(Date().timeIntervalSince1970)) return try serialize(packet: packet, timestamp: timestamp)
} }
func serialize(packet: ControlPacket, timestamp: UInt32) throws -> Data { func serialize(packet: ControlPacket, timestamp: UInt32) throws -> Data {

View File

@ -407,7 +407,9 @@ public class SessionProxy {
} }
pushRequest() pushRequest()
flushControlQueue() if !isReliableLink {
flushControlQueue()
}
guard negotiationKey.controlState == .connected else { guard negotiationKey.controlState == .connected else {
queue.asyncAfter(deadline: .now() + CoreConfiguration.tickInterval) { [weak self] in queue.asyncAfter(deadline: .now() + CoreConfiguration.tickInterval) { [weak self] in