Skip to content

Commit

Permalink
Sync Latest - 11/27/19 (#14)
Browse files Browse the repository at this point in the history
Lots of documentation changes and some fairly minor bug fixes and clean up.
  • Loading branch information
nibanks authored Nov 27, 2019
1 parent 69a2cf9 commit ddb0055
Show file tree
Hide file tree
Showing 49 changed files with 1,709 additions and 359 deletions.
60 changes: 38 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
MsQuic
======

MsQuic is an implementation of the [IETF QUIC](https://tools.ietf.org/html/draft-ietf-quic-transport)
protocol by Microsoft. It is a cross platform, general purpose QUIC library written in C.
MsQuic is a Microsoft implementation of the [IETF QUIC](https://tools.ietf.org/html/draft-ietf-quic-transport)
protocol. It is cross platform, written in C and designed to be a general purpose QUIC library.

> **Important** The MsQuic library, as well as the protocol itself, is still a work in progress. Version 1 is not yet finalized and may continue to experience breaking changes until it is finalized.
[![Build Status](https://microsoft.visualstudio.com/OS/_apis/build/status/microsoft.msquic?branchName=master)](https://microsoft.visualstudio.com/OS/_build/latest?definitionId=45975&branchName=master)

Expand All @@ -14,42 +16,56 @@ QUIC has many benefits when compared to existing TLS over TCP scenarios:
* All packets are encrypted
* Parallel streams of application data.
* Improved (compared to TCP) congestion control and loss recovery.
* 0-RTT (_support depends on TLS library_)

**Note** - Several QUIC protocol features are still unimplemented:

* NAT Rebinding
* Client Migration
* Server Preferred Address
* Full Path MTU Discovery
* Exchange application data in the first round trip (0-RTT).
* Survives a change in the clients IP address or port.
* Easily extendable for new features (such as unreliable delivery).

> **Important** Several QUIC protocol features are not fully implemented:
>
> * 0-RTT with Schannel and OpenSSL
> * NAT Rebinding
> * Client Migration
> * Server Preferred Address
> * Path MTU Discovery
## Library Features

* Optimized for throughput performance and minimal latency.
* Optimized for maximal throughput and minimal latency.
* Asychronous IO.
* Receive side scaling (RSS).
* UDP send and receive coalescing.
* UDP send and receive coalescing support.

## Building

You can find detailed instructions for building the library [here](./docs/BUILD.md).

## Documentation

# Source Code
You can find more detailed information on how to use MsQuic in the [the API documentation](./docs/API.md).

## Source Code

The source is divided into several directories:

* `bin` - Packages up all static libraries into the platform specific binaries.
* `core` - The platform independent code that implements the QUIC protocol.
* `core` - Platform independent code that implements the QUIC protocol.
* `docs` - All MsQuic documentation.
* `inc` - Header files used by all the other directories.
* `manifest` - Windows [ETW manifest](https://docs.microsoft.com/en-us/windows/win32/wes/writing-an-instrumentation-manifest) and related files.
* `platform` - Platform specific code for OS types, sockets and TLS.
* `submodules` - All the modules that MsQuic depends on.
* `test` - Test code for the MsQuic API / protocol.
* `tools` - Several tools for exercising MsQuic.

You can find more detailed information on how to use MsQuic in the [the API documentation](./docs/API.md).

# Building

You can find detailed instructions [here](./docs/BUILD.md).
* `tools` - Tools for exercising MsQuic.
* `attack` - Adversarial tool for exploiting protocol weaknesses.
* `etw` - Windows specific tool for processing MsQuic ETW logs.
* `interop` - Runs through the [IETF interop scenarios](https://github.com/quicwg/base-drafts/wiki/15th-Implementation-Draft).
* `ping` - Simple tool for gathering throughput measurements. Read more [here](./tools/ping/readme.md).
* `sample` - Minimal example of how to use the MsQuic API.
* `spin` - Randomly executes the MsQuic API to discover bugs.

# Contributing

For the near future, **external contributions will not be accepted**. We are still
For the time being, **external contributions will not be accepted**. We are still
working on setting up internal repository sycnhronization and continuous integration,
and until that happens, this repository will be a simple copy of the Microsoft internal
one.
Expand Down
17 changes: 13 additions & 4 deletions core/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,7 @@ QuicConnHandshakeConfigure(
}

if (Connection->OrigCID != NULL) {
QUIC_DBG_ASSERT(Connection->OrigCID->Length <= QUIC_MAX_CONNECTION_ID_LENGTH_V1);
LocalTP.Flags |= QUIC_TP_FLAG_ORIGINAL_CONNECTION_ID;
LocalTP.OriginalConnectionIDLength = Connection->OrigCID->Length;
QuicCopyMemory(
Expand Down Expand Up @@ -1699,7 +1700,7 @@ QuicConnHandshakeConfigure(
}

LocalTP.MaxAckDelay =
Connection->MaxAckDelayMs + MsQuicLib.TimerResolutionMs; // TODO - Include queue delay?
Connection->MaxAckDelayMs + MsQuicLib.TimerResolutionMs;

if (Connection->AckDelayExponent != QUIC_DEFAULT_ACK_DELAY_EXPONENT) {
LocalTP.Flags |= QUIC_TP_FLAG_ACK_DELAY_EXPONENT;
Expand Down Expand Up @@ -2130,6 +2131,8 @@ QuicConnRecvRetry(
return;
}

QUIC_DBG_ASSERT(OrigDestCIDLength <= QUIC_MAX_CONNECTION_ID_LENGTH_V1);

//
// Cache the Retry token.
//
Expand Down Expand Up @@ -2354,19 +2357,22 @@ QuicConnRecvHeader(
return FALSE;
}

if (!Connection->Paths[0].IsPeerValidated && Packet->ValidToken) {
QUIC_PATH* Path = &Connection->Paths[0];
if (!Path->IsPeerValidated && Packet->ValidToken) {

QUIC_DBG_ASSERT(TokenBuffer == NULL);
QuicPacketDecodeRetryTokenV1(Packet, &TokenBuffer, &TokenLength);
QUIC_DBG_ASSERT(TokenLength == sizeof(QUIC_RETRY_TOKEN_CONTENTS));

QUIC_RETRY_TOKEN_CONTENTS Token;
if (!QuicRetryTokenDecrypt(Packet, TokenBuffer, &Token)) {
QUIC_DBG_ASSERT(FALSE);
QUIC_DBG_ASSERT(FALSE); // Was already decrypted sucessfully once.
QuicPacketLogDrop(Connection, Packet, "Retry token decrypt failure");
return FALSE;
}

QUIC_DBG_ASSERT(Token.OrigConnIdLength <= sizeof(Token.OrigConnId));
QUIC_DBG_ASSERT(QuicAddrCompare(&Path->RemoteAddress, &Token.RemoteAddress));

Connection->OrigCID =
QUIC_ALLOC_NONPAGED(
Expand All @@ -2383,7 +2389,7 @@ QuicConnRecvHeader(
Token.OrigConnId,
Token.OrigConnIdLength);

QuicPathSetValid(Connection, &Connection->Paths[0], QUIC_PATH_VALID_INITIAL_TOKEN);
QuicPathSetValid(Connection, Path, QUIC_PATH_VALID_INITIAL_TOKEN);
}

Packet->KeyType = QuicPacketTypeToKeyType(Packet->LH->Type);
Expand Down Expand Up @@ -3882,6 +3888,9 @@ QuicConnResetIdleTimeout(
}

QuicConnTimerSet(Connection, QUIC_CONN_TIMER_IDLE, IdleTimeoutMs);

} else {
QuicConnTimerCancel(Connection, QUIC_CONN_TIMER_IDLE);
}

if (Connection->KeepAliveIntervalMs != 0) {
Expand Down
Loading

0 comments on commit ddb0055

Please sign in to comment.