Skip to content

Commit

Permalink
Merge branch 'main' into 0rtt-tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert authored Sep 5, 2024
2 parents 53c7bc7 + 28f60bd commit d8f6a24
Show file tree
Hide file tree
Showing 26 changed files with 335 additions and 113 deletions.
16 changes: 1 addition & 15 deletions .github/actions/nss/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,6 @@ runs:
git clone --depth=1 https://github.com/nss-dev/nspr "${{ github.workspace }}/nspr" || \
hg clone https://hg.mozilla.org/projects/nspr "${{ github.workspace }}/nspr"
- name: Cache NSS
if: env.BUILD_NSS == '1'
id: cache-nss
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
${{ github.workspace }}/dist
${{ github.workspace }}/nss/out
${{ github.workspace }}/nspr/Debug
${{ github.workspace }}/nspr/Release
key: nss-${{ runner.os }}-${{ runner.arch }}-${{ inputs.type }}-${{ hashFiles('nss/lib/nss/nss.h', 'nspr/pr/include/prinit.h') }}

- name: Install build dependencies (Linux)
shell: bash
if: runner.os == 'Linux' && env.BUILD_NSS == '1' && runner.environment == 'github-hosted'
Expand Down Expand Up @@ -153,9 +141,7 @@ runs:
echo "DYLD_FALLBACK_LIBRARY_PATH=$NSS_OUT/lib" >> "$GITHUB_ENV"
echo "$NSS_OUT/lib" >> "$GITHUB_PATH"
echo "NSS_DIR=$NSS_DIR" >> "$GITHUB_ENV"
if [ "${{ steps.cache-nss.outputs.cache-hit }}" != "true" ]; then
$NSS_DIR/build.sh -g -Ddisable_tests=1 $OPT --static
fi
$NSS_DIR/build.sh -g -Ddisable_tests=1 $OPT --static
env:
NSS_DIR: ${{ github.workspace }}/nss
NSPR_DIR: ${{ github.workspace }}/nspr
2 changes: 1 addition & 1 deletion .github/actions/pr-comment-data-export/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ runs:
echo "${{ inputs.log-url }}" > comment-data/log-url
fi
- if: github.event_name == 'pull_request'
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ inputs.name }}
path: comment-data
Expand Down
15 changes: 12 additions & 3 deletions .github/actions/quic-interop-runner/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,35 @@ runs:
if grep -q 'RUST_BACKTRACE=full' "$log"; then
echo "Panic detected in $log"
tail -n 50 "$log"
exit 1
FAILED=1
fi
done
# Remove all log files > $MAX_SIZE to make the artifacts smaller.
MAX_SIZE=5M
echo "Removed log file > $MAX_SIZE during GitHub workflow" > note.txt
echo "Removing these log files > $MAX_SIZE:"
find ../logs -type f -size +$MAX_SIZE -ls -exec cp note.txt {} \;
exit $FAILED
shell: bash

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
id: upload-logs
with:
name: '${{ inputs.client }} vs. ${{ inputs.server }} logs'
path: logs
compression-level: 9

- name: Store log URL
if: always()
run: |
jq '. + {log_url: "${{ steps.upload-logs.outputs.artifact-url }}"}' \
< result.json > result.json.tmp && \
mv result.json.tmp result.json
shell: bash

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
name: '${{ inputs.client }} vs. ${{ inputs.server }} results'
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ jobs:

- name: Export perf data
id: export
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ github.event.repository.name }}-${{ github.sha }}
path: |
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/firefox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
workflow_dispatch:
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, ready_for_review]
paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"]

concurrency:
Expand All @@ -18,6 +19,7 @@ env:
jobs:
firefox:
name: Build Firefox
if: github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -113,7 +115,7 @@ jobs:
- name: Export binary
id: upload
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: ${{ runner.os }}-${{ env.FIREFOX }}-${{ matrix.type }}.tgz
path: ${{ env.FIREFOX }}.tar
Expand All @@ -122,7 +124,7 @@ jobs:
- run: echo "${{ steps.upload.outputs.artifact-url }}" >> artifact

- name: Export artifact URL
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: artifact-${{ runner.os }}-${{ env.FIREFOX }}-${{ matrix.type }}
path: artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mutants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
} > "$GITHUB_STEP_SUMMARY"
- name: Archive mutants.out
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
name: mutants.out
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/qns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
platforms: 'linux/amd64'
outputs: type=docker,dest=/tmp/${{ env.LATEST }}.tar

- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: '${{ env.LATEST }} Docker image'
path: /tmp/${{ env.LATEST }}.tar
Expand Down Expand Up @@ -212,7 +212,7 @@ jobs:
echo "#### $LATEST as server"
cat server.failed.md
else
echo -n "None"
echo -n "None "
if [ -e "client.succeeded.md" ] || [ -e "server.succeeded.md" ] || [ -e "client.unsupported.md" ] || [ -e "server.unsupported.md" ]; then
echo ":tada:"
else
Expand Down
4 changes: 2 additions & 2 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

This repository is governed by Mozilla's code of conduct and etiquette
guidelines. For more details, please read the [Mozilla Community Participation
Guidelines](https://www.mozilla.org/about/governance/policies/participation/).
Guidelines](https://www.mozilla.org/about/governance/policies/participation/).

## How to Report

For more information on how to report violations of the Community Participation
Guidelines, please read our '[How to
Report](https://www.mozilla.org/about/governance/policies/participation/reporting/)'
Expand All @@ -15,4 +16,3 @@ page.
Please consider the advice in the [Bugzilla etiquette
guide](https://bugzilla.mozilla.org/page.cgi?id=etiquette.html) when
contributing to this project.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ description = "Neqo, the Mozilla implementation of QUIC in Rust."
keywords = ["quic", "http3", "neqo", "mozilla", "ietf", "firefox"]
categories = ["network-programming", "web-programming"]
readme = "README.md"
version = "0.8.2"
version = "0.9.0"
# Keep in sync with `.rustfmt.toml` `edition`.
edition = "2021"
license = "MIT OR Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ something has changed.
1. Run `neqo-server` via `cargo run --bin neqo-server -- 'localhost:12345' --db ./test-fixture/db`.
2. On Firefox, set `about:config` preference `network.http.http3.alt-svc-mapping-for-testing` to `localhost;h3=":12345"`.
3. Optionally enable logging via `about:logging` or profiling via https://profiler.firefox.com/.
4. Navigate to https://localhost:12345 and accept self-signed certificate.
3. Optionally enable logging via `about:logging` or profiling via <https://profiler.firefox.com/>.
4. Navigate to <https://localhost:12345> and accept self-signed certificate.
[NSS]: https://hg.mozilla.org/projects/nss
[NSPR]: https://hg.mozilla.org/projects/nspr
Expand Down
20 changes: 11 additions & 9 deletions docs/linux_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
2. [Installation Steps](#installation-steps)

## System Details

<!-- markdownlint-disable no-inline-html -->
<details>
<summary><b>Ubuntu:</b> 18.04 (expand for details)</summary>

Expand Down Expand Up @@ -77,7 +77,9 @@ cargo clippy --version
```output
clippy 0.0.212 (69f99e7 2019-12-14)
```

</details>
<!-- markdownlint-enable no-inline-html -->

## Installation Steps

Expand All @@ -94,51 +96,51 @@ build-essential clang llvm libclang-dev gyp ninja-build \
pkg-config zlib1g-dev sudo
```

2. Remove orphaned packages and clear local repository (optional)
1. Remove orphaned packages and clear local repository (optional)

```shell
sudo apt-get autoremove -y && sudo apt-get clean -y
```

3. Install rust. Follow the steps from [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)
1. Install rust. Follow the steps from [https://www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install)

4. Export following path variables. `$HOME` is your home directory which is usually `/home/{username}`. `LD_LIBRARY_PATH` will be `$NSS_DIR/../dist/Debug/lib`
1. Export following path variables. `$HOME` is your home directory which is usually `/home/{username}`. `LD_LIBRARY_PATH` will be `$NSS_DIR/../dist/Debug/lib`

```shell
export NSS_DIR=$HOME/nss
export NSPR_DIR=$HOME/nspr
export LD_LIBRARY_PATH=$NSS_DIR/../dist/Debug/lib
```

5. Clone **NSS** and **NSPR**
1. Clone **NSS** and **NSPR**

```shell
hg clone https://hg.mozilla.org/projects/nss "$NSS_DIR"
hg clone -u NSPR_4_25_RTM https://hg.mozilla.org/projects/nspr "$NSPR_DIR"
```

6. Build **NSS**
1. Build **NSS**

```shell
cd $NSS_DIR
./build.sh --static -Ddisable_tests=1
```

7. Navigate to your workspace and checkout **Neqo**
1. Navigate to your workspace and checkout **Neqo**

```shell
git clone https://github.com/mozilla/neqo.git
```

8. Build neqo and run all tests
1. Build neqo and run all tests

```shell
cd neqo
cargo build -v --all-targets --tests
cargo test -v
```

9. Run HTTP/3 programs
1. Run HTTP/3 programs

```shell
#Start server
Expand Down
1 change: 1 addition & 0 deletions neqo-bin/src/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::{io, net::SocketAddr};
use neqo_common::Datagram;

/// Ideally this would live in [`neqo-udp`]. [`neqo-udp`] is used in Firefox.
///
/// Firefox uses `cargo vet`. [`tokio`] the dependency of [`neqo-udp`] is not
/// audited as `safe-to-deploy`. `cargo vet` will require `safe-to-deploy` for
/// [`tokio`] even when behind a feature flag.
Expand Down
8 changes: 4 additions & 4 deletions neqo-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ hex = { version = "0.4", default-features = false, features = ["alloc"], optiona
log = { workspace = true }
qlog = { workspace = true }

[target."cfg(windows)".dependencies]
# Sync with https://searchfox.org/mozilla-central/source/Cargo.lock 2024-02-08
windows = { version = "0.58", default-features = false, features = ["Win32_Media"] }

[dev-dependencies]
test-fixture = { path = "../test-fixture" }

[features]
ci = []
build-fuzzing-corpus = ["hex"]

[target."cfg(windows)".dependencies.winapi]
version = "0.3"
features = ["timeapi"]

[lib]
# See https://github.com/bheisler/criterion.rs/blob/master/book/src/faq.md#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false
12 changes: 5 additions & 7 deletions neqo-common/src/hrtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ use std::{
};

#[cfg(windows)]
use winapi::shared::minwindef::UINT;
#[cfg(windows)]
use winapi::um::timeapi::{timeBeginPeriod, timeEndPeriod};
use windows::Win32::Media::{timeBeginPeriod, timeEndPeriod};

/// A quantized `Duration`. This currently just produces 16 discrete values
/// corresponding to whole milliseconds. Future implementations might choose
Expand All @@ -26,8 +24,8 @@ impl Period {
const MIN: Self = Self(1);

#[cfg(windows)]
fn as_uint(self) -> UINT {
UINT::from(self.0)
fn as_u32(self) -> u32 {
u32::from(self.0)
}

#[cfg(target_os = "macos")]
Expand Down Expand Up @@ -299,7 +297,7 @@ impl Time {
#[cfg(target_os = "windows")]
fn start(&self) {
if let Some(p) = self.active {
_ = unsafe { timeBeginPeriod(p.as_uint()) };
_ = unsafe { timeBeginPeriod(p.as_u32()) };
}
}

Expand All @@ -310,7 +308,7 @@ impl Time {
#[cfg(windows)]
fn stop(&self) {
if let Some(p) = self.active {
_ = unsafe { timeEndPeriod(p.as_uint()) };
_ = unsafe { timeEndPeriod(p.as_u32()) };
}
}

Expand Down
2 changes: 1 addition & 1 deletion neqo-crypto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn is_debug() -> bool {
// Rather than download the 400Mb+ files, like gecko does, let's just reuse their work.
fn setup_clang() {
// If this isn't Windows, or we're in CI, then we don't need to do anything.
if env::consts::OS != "windows" || env::var("GITHUB_WORKFLOW").unwrap() == "CI" {
if env::consts::OS != "windows" || env::var("GITHUB_WORKFLOW").unwrap_or_default() == "CI" {
return;
}
println!("rerun-if-env-changed=LIBCLANG_PATH");
Expand Down
1 change: 1 addition & 0 deletions neqo-crypto/src/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ scoped_ptr!(
);

/// `AntiReplay` is used by servers when processing 0-RTT handshakes.
///
/// It limits the exposure of servers to replay attack by rejecting 0-RTT
/// if it appears to be a replay. There is a false-positive rate that can be
/// managed by tuning the parameters used to create the context.
Expand Down
Loading

0 comments on commit d8f6a24

Please sign in to comment.