Skip to content

Commit

Permalink
Android API level <= 25 fails sendmmsg ECN with InvalidInput
Browse files Browse the repository at this point in the history
When running the `quinn-udp` `ecn_*` unit tests `sendmsg` fails with:

```
2024-08-22T14:41:30.636494Z  WARN quinn_udp: sendmsg error: Os { code: 22, kind: InvalidInput, message: "Invalid argument" }, Transmit: { destination: 127.0.0.1:50196, src_ip: None, enc: Some(Ect0), len: 5, segment_size: None }
```

https://github.com/quinn-rs/quinn/blob/cef42cccef6fb6f02527ae4b2f42d7f7da878f62/quinn-udp/tests/tests.rs#L34-L153
  • Loading branch information
mxinden committed Aug 23, 2024
1 parent d75959e commit 5e9a77f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/rust-android-run-tests-on-emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ while [[ -z "$(adb shell getprop sys.boot_completed | tr -d '\r')" ]]; do sleep
any_failures=0
for test in $(find target/$TARGET/debug/deps/ -type f -executable ! -name "*.so" -name "*-*"); do
adb push "$test" /data/local/tmp/
adb shell chmod +x /data/local/tmp/$(basename "$test")
adb shell /data/local/tmp/$(basename "$test") || any_failures=1
adb shell RUST_LOG=debug /data/local/tmp/$(basename "$test") --nocapture || any_failures=1
done

exit $any_failures
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ jobs:
emulator-arch: x86_64
# Note that x86_64 image is only available for API 21+. See
# https://github.com/ReactiveCircus/android-emulator-runner?tab=readme-ov-file#configurations.
api-level: 26
api-level: 25
- target: i686-linux-android
emulator-arch: x86
api-level: 26
api-level: 25

steps:
- name: Checkout code
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
run: cargo install cargo-ndk

- name: Build unit tests for Android
run: cargo ndk -t ${{ matrix.target }} test --no-run
run: cargo ndk -t ${{ matrix.target }} test -p quinn-udp --no-run

- name: Enable KVM group perms
run: |
Expand Down
1 change: 1 addition & 0 deletions quinn-udp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ windows-sys = { workspace = true }

[dev-dependencies]
criterion = "0.5"
tracing-subscriber = { workspace = true }

[target.'cfg(any(target_os = "linux", target_os = "windows"))'.bench]
name = "throughput"
Expand Down
3 changes: 3 additions & 0 deletions quinn-udp/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ fn basic() {

#[test]
fn ecn_v6() {
let _ = tracing_subscriber::fmt::try_init();
let send = Socket::from(UdpSocket::bind("[::1]:0").unwrap());
let recv = Socket::from(UdpSocket::bind("[::1]:0").unwrap());
for codepoint in [EcnCodepoint::Ect0, EcnCodepoint::Ect1] {
Expand All @@ -53,6 +54,7 @@ fn ecn_v6() {
#[test]
#[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "solaris")))]
fn ecn_v4() {
let _ = tracing_subscriber::fmt::try_init();
let send = Socket::from(UdpSocket::bind("127.0.0.1:0").unwrap());
let recv = Socket::from(UdpSocket::bind("127.0.0.1:0").unwrap());
for codepoint in [EcnCodepoint::Ect0, EcnCodepoint::Ect1] {
Expand All @@ -73,6 +75,7 @@ fn ecn_v4() {
#[test]
#[cfg(not(any(target_os = "openbsd", target_os = "netbsd", target_os = "solaris")))]
fn ecn_v6_dualstack() {
let _ = tracing_subscriber::fmt::try_init();
let recv = socket2::Socket::new(
socket2::Domain::IPV6,
socket2::Type::DGRAM,
Expand Down

0 comments on commit 5e9a77f

Please sign in to comment.