From 6860e4962367a80f2c6e303ea3f73c7d7b4cf1e4 Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 28 Jul 2026 07:02:30 +0900 Subject: [PATCH] =?UTF-8?q?netstack:=20round=2018=20part=203=20=E2=80=94?= =?UTF-8?q?=20fix=20SocketCall::from=20misuse=20(last=20compile=20error)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scheme/tcp.rs:57 — SocketCall::from(metadata[0]) does not exist. SocketCall in the libredox-protocol crate exposes a 'try_from_raw(usize) -> Option' helper (used in scheme/socket.rs:466) but no 'From'. Match on the Option and return EINVAL on unknown verbs; otherwise the same SocketCall::SendMsg arm as before and the catch-all EOPNOTSUPP for any other verb. This is the last of the 13 build errors from the original netstack break cascade. After this commit, netstack compiles clean with only 40 warnings (unused imports/variables and a handful of unreachable-pattern arms left as dead-code defenses). Warnings are tracked for a future cleanup round. --- netstack/src/scheme/tcp.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netstack/src/scheme/tcp.rs b/netstack/src/scheme/tcp.rs index 28da52a70a..c63e32a9a4 100644 --- a/netstack/src/scheme/tcp.rs +++ b/netstack/src/scheme/tcp.rs @@ -54,7 +54,11 @@ impl<'a> SchemeSocket for TcpSocket<'a> { metadata: &[u64], _ctx: &CallerCtx, ) -> SyscallResult { - match SocketCall::from(metadata[0]) { + let verb = match SocketCall::try_from_raw(metadata[0] as usize) { + Some(v) => v, + None => return Err(SyscallError::new(syscall::EINVAL)), + }; + match verb { SocketCall::SendMsg => { let flags = metadata[1] as u16; // smoltcp's TCP socket has no MSG_NOSIGNAL awareness: a