From 7bfca6c5abaf3718e1f85feb9a29ae6b592750f0 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Wed, 24 Jun 2026 16:56:05 +1000 Subject: [PATCH 1/2] misc(netstack): update `smoltcp` to v0.13.1 Signed-off-by: Anhad Singh --- netstack/Cargo.toml | 2 +- netstack/src/scheme/ip.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/netstack/Cargo.toml b/netstack/Cargo.toml index 7216bde932..520f7d9694 100644 --- a/netstack/Cargo.toml +++ b/netstack/Cargo.toml @@ -22,7 +22,7 @@ scheme-utils = { path = "../scheme-utils" } workspace = true [dependencies.smoltcp] -version = "0.12.0" +version = "0.13.1" default-features = false features = [ "std", diff --git a/netstack/src/scheme/ip.rs b/netstack/src/scheme/ip.rs index 18d0dc6d9a..cab811c0ce 100644 --- a/netstack/src/scheme/ip.rs +++ b/netstack/src/scheme/ip.rs @@ -80,8 +80,8 @@ impl<'a> SchemeSocket for RawSocket<'a> { vec![0; Router::MTU * Smolnetd::SOCKET_BUFFER_SIZE], ); let ip_socket = RawSocket::new( - IpVersion::Ipv4, - IpProtocol::from(proto), + Some(IpVersion::Ipv4), + Some(IpProtocol::from(proto)), rx_buffer, tx_buffer, ); @@ -139,7 +139,7 @@ impl<'a> SchemeSocket for RawSocket<'a> { fn fpath(&self, _file: &SchemeFile, buf: &mut [u8]) -> SyscallResult { FpathWriter::with(buf, "ip", |w| { - write!(w, "{}", self.ip_protocol()).unwrap(); + write!(w, "{}", self.ip_protocol().unwrap()).unwrap(); Ok(()) }) } From cdea75656912bc8001e488fe53f3aaef3a55f143 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Thu, 25 Jun 2026 23:55:00 +1000 Subject: [PATCH 2/2] fix(tcp/write_buf): incorrect return value On success, the number of bytes written should be returned. Previously `buf.len()` was always returned. The function `send_slice` > ... returns the amount of octets actually enqueued, which is limited > by the amount of free space in the transmit buffer; down to zero. "down to zero" is okay as that is checked by `can_send`. Signed-off-by: Anhad Singh --- netstack/src/scheme/tcp.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/netstack/src/scheme/tcp.rs b/netstack/src/scheme/tcp.rs index 435553829d..3536c1bbea 100644 --- a/netstack/src/scheme/tcp.rs +++ b/netstack/src/scheme/tcp.rs @@ -162,8 +162,7 @@ impl<'a> SchemeSocket for TcpSocket<'a> { } else if !self.is_active() { Err(SyscallError::new(syscall::ENOTCONN)) } else if self.can_send() { - self.send_slice(buf).expect("Can't send slice"); - Ok(buf.len()) + Ok(self.send_slice(buf).expect("Can't send slice")) } else if file.flags & syscall::O_NONBLOCK == syscall::O_NONBLOCK { Err(SyscallError::new(syscall::EAGAIN)) } else {