runner: Ignore dtlsFlushHandshake failures.

This is consistent with ignoring writeRecord failures. Without doing this, the
DTLS MinimumVersion test now flakily fails with:

  FAILED (MinimumVersion-Client-TLS12-TLS1-DTLS)
  bad error (wanted ':UNSUPPORTED_PROTOCOL:' / 'remote error: protocol version not supported'): local error 'write unix @: broken pipe', child error 'exit status 2', stdout:
  2092242157:error:1007b1a7:SSL routines:ssl3_get_server_hello:UNSUPPORTED_PROTOCOL:../ssl/s3_clnt.c:783:

This is because the MinimumVersion tests assert on /both/ expectedError and
expectedLocalError. The latter is valuable as it asserts on the alert the peer
returned. (I would like us to add more such assertions to our tests where
appropriate.) However, after we send ServerHello, we also send a few messages
following it. This races with the peer shutdown and we sometimes get EPIPE
before reading the alert.

Change-Id: I3fe37940a6a531379673a00976035f8e76e0f825
Reviewed-on: https://boringssl-review.googlesource.com/3337
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-02-09 00:18:20 -05:00 committed by Adam Langley
parent ccf74f8085
commit 95695c8d88
2 changed files with 9 additions and 27 deletions

View File

@ -214,9 +214,7 @@ NextCipherSuite:
helloBytes = hello.marshal()
c.writeRecord(recordTypeHandshake, helloBytes)
}
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
if err := c.simulatePacketLoss(nil); err != nil {
return err
@ -240,9 +238,7 @@ NextCipherSuite:
hello.cookie = helloVerifyRequest.cookie
helloBytes = hello.marshal()
c.writeRecord(recordTypeHandshake, helloBytes)
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
if err := c.simulatePacketLoss(nil); err != nil {
return err
@ -621,9 +617,7 @@ func (hs *clientHandshakeState) doFullHandshake() error {
hs.writeClientHash(certVerify.marshal())
c.writeRecord(recordTypeHandshake, certVerify.marshal())
}
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
hs.finishedHash.discardHandshakeBuffer()
@ -859,9 +853,7 @@ func (hs *clientHandshakeState) sendFinished(isResume bool) error {
c.writeRecord(recordTypeHandshake, postCCSBytes[:5])
postCCSBytes = postCCSBytes[5:]
}
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
if !c.config.Bugs.SkipChangeCipherSpec &&
c.config.Bugs.EarlyChangeCipherSpec == 0 {
@ -874,9 +866,7 @@ func (hs *clientHandshakeState) sendFinished(isResume bool) error {
if !c.config.Bugs.SkipFinished {
c.writeRecord(recordTypeHandshake, postCCSBytes)
if err := c.dtlsFlushHandshake(false); err != nil {
return err
}
c.dtlsFlushHandshake(false)
}
return nil
}

View File

@ -149,9 +149,7 @@ func (hs *serverHandshakeState) readClientHello() (isResume bool, err error) {
return false, errors.New("dtls: short read from Rand: " + err.Error())
}
c.writeRecord(recordTypeHandshake, helloVerifyRequest.marshal())
if err := c.dtlsFlushHandshake(true); err != nil {
return false, err
}
c.dtlsFlushHandshake(true)
if err := c.simulatePacketLoss(nil); err != nil {
return false, err
@ -549,9 +547,7 @@ func (hs *serverHandshakeState) doFullHandshake() error {
helloDone := new(serverHelloDoneMsg)
hs.writeServerHash(helloDone.marshal())
c.writeRecord(recordTypeHandshake, helloDone.marshal())
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
var pub crypto.PublicKey // public key for client auth, if any
@ -845,9 +841,7 @@ func (hs *serverHandshakeState) sendFinished() error {
c.writeRecord(recordTypeHandshake, postCCSBytes[:5])
postCCSBytes = postCCSBytes[5:]
}
if err := c.dtlsFlushHandshake(true); err != nil {
return err
}
c.dtlsFlushHandshake(true)
if !c.config.Bugs.SkipChangeCipherSpec {
c.writeRecord(recordTypeChangeCipherSpec, []byte{1})
@ -859,9 +853,7 @@ func (hs *serverHandshakeState) sendFinished() error {
if !c.config.Bugs.SkipFinished {
c.writeRecord(recordTypeHandshake, postCCSBytes)
if err := c.dtlsFlushHandshake(false); err != nil {
return err
}
c.dtlsFlushHandshake(false)
}
c.cipherSuite = hs.suite.id