Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 39 additions & 13 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,48 @@ env:

jobs:
build_n_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: rustfmt
run: cargo fmt --all -- --check
- name: check
run: cargo check --verbose
- name: clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: build
run: cargo build --verbose --examples --tests --all-features
- name: test
run: cargo test --all-features --examples
- name: Default-feature tests
run: cargo test
- name: All-feature build
run: cargo build --all-targets --all-features
- name: All-feature library tests
run: cargo test --all-features --lib
- name: All-feature documentation tests
run: cargo test --all-features --doc

packetdrill:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install packetdrill dependencies
run: |
sudo apt-get update
sudo apt-get install -y git gcc make bison flex python3 net-tools iptables
- name: Build pinned packetdrill
run: |
packetdrill_bin="$(bash scripts/setup_packetdrill.sh)"
echo "PACKETDRILL_BIN=${packetdrill_bin}" >> "$GITHUB_ENV"
- name: Build tcp_ip packetdrill harness
run: cargo build --example packetdrill_harness
- name: Run IPv4 and IPv6 packetdrill suites
run: sudo --preserve-env=PACKETDRILL_BIN env HOME="$HOME" TCP_IP_PD_SKIP_BUILD=1 bash scripts/run_packetdrill.sh
- name: Upload packetdrill failure logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: packetdrill-logs
path: target/packetdrill/logs
if-no-files-found: ignore
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ anyhow = "1"
env_logger = "0.11"
tun-rs = { version = "2.8.6", features = ["async"] }
clap = { version = "4", features = ["derive"] }
libc = "0.2"

[[example]]
name = "tcp"
Expand All @@ -49,4 +50,4 @@ name = "tcp_proxy"
required-features = ["global-ip-stack"]
[[example]]
name = "tcp_connect"
required-features = ["global-ip-stack"]
required-features = ["global-ip-stack"]
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,31 @@ Use TcpListener and TcpStream. Supported over IPv4 and IPv6.
- The timeout waiting time is fixed and can be configured
- Selective acknowledgements permitted. (Proactively ACK the need for improvement)

### packetdrill TCP conformance tests

The Linux-only suite under `tests/packetdrill` drives the userspace stack through
packetdrill's local TUN mode. It covers IPv4 and IPv6 handshake negotiation, data
and ACK behavior, reassembly/SACK, retransmission and fast recovery, zero-window
probing, close/TIME_WAIT paths, and RST/duplicate-SYN handling.

On Ubuntu, run as root because the harness needs TUN, raw-socket, and firewall
access:

```bash
sudo -E bash scripts/setup_packetdrill.sh --install-deps
sudo -E bash scripts/run_packetdrill.sh
```

On Windows with WSL2 Ubuntu 24.04:

```powershell
pwsh scripts/run_packetdrill_wsl.ps1
```

The setup script checks out the pinned upstream packetdrill revision into the
user cache. It does not vendor packetdrill into this repository. Per-case verbose
logs are written to `target/packetdrill/logs`.

#### Other

Using IpSocket to send and receive packets of other protocols.(Handles all IP upper-layer protocols without requiring
Expand Down
Loading
Loading