diff options
author | jiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-01 00:00:19 +0000 |
---|---|---|
committer | jiayl@webrtc.org <jiayl@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2014-05-01 00:00:19 +0000 |
commit | b9a6b71b8a8db9a3a8e8888448529f9b4624ab32 (patch) | |
tree | 9cd2ea8c0baeca2b084ca111bc33ab3ec0a41f21 /p2p | |
parent | a00076bd69084cb5091df8e007f34236d9647b65 (diff) | |
download | talk-b9a6b71b8a8db9a3a8e8888448529f9b4624ab32.tar.gz |
Ignore identical remote fingerprint in DtlsTransportChannelWrapper::SetRemoteFingerprint.
Trying to set the same remote fingerprint could happen during renegotiation and should not fail.
BUG=crbug/362431
R=juberti@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/12449005
git-svn-id: http://webrtc.googlecode.com/svn/trunk/talk@6035 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'p2p')
-rw-r--r-- | p2p/base/dtlstransportchannel.cc | 7 | ||||
-rw-r--r-- | p2p/base/dtlstransportchannel_unittest.cc | 19 |
2 files changed, 24 insertions, 2 deletions
diff --git a/p2p/base/dtlstransportchannel.cc b/p2p/base/dtlstransportchannel.cc index 1b3a779..416e6e9 100644 --- a/p2p/base/dtlstransportchannel.cc +++ b/p2p/base/dtlstransportchannel.cc @@ -211,8 +211,11 @@ bool DtlsTransportChannelWrapper::SetRemoteFingerprint( talk_base::Buffer remote_fingerprint_value(digest, digest_len); - if ((dtls_state_ == STATE_OPEN) && - (remote_fingerprint_value_ == remote_fingerprint_value)) { + if (dtls_state_ != STATE_NONE && + remote_fingerprint_value_ == remote_fingerprint_value && + !digest_alg.empty()) { + // This may happen during renegotiation. + LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint"; return true; } diff --git a/p2p/base/dtlstransportchannel_unittest.cc b/p2p/base/dtlstransportchannel_unittest.cc index 88f1439..5727ac4 100644 --- a/p2p/base/dtlstransportchannel_unittest.cc +++ b/p2p/base/dtlstransportchannel_unittest.cc @@ -776,6 +776,25 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) { TestTransfer(1, 1000, 100, true); } +// Test that re-negotiation can be started before the clients become connected +// in the first negotiation. +TEST_F(DtlsTransportChannelTest, TestRenegotiateBeforeConnect) { + MAYBE_SKIP_TEST(HaveDtlsSrtp); + SetChannelCount(2); + PrepareDtls(true, true); + PrepareDtlsSrtp(true, true); + Negotiate(); + + Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS, + cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER); + bool rv = client1_.Connect(&client2_); + EXPECT_TRUE(rv); + EXPECT_TRUE_WAIT(client1_.writable() && client2_.writable(), 10000); + + TestTransfer(0, 1000, 100, true); + TestTransfer(1, 1000, 100, true); +} + // Test Certificates state after negotiation but before connection. TEST_F(DtlsTransportChannelTest, TestCertificatesBeforeConnect) { MAYBE_SKIP_TEST(HaveDtls); |