Skip to content

Commit f92ada0

Browse files
committed
build(deps): Bump smoltcp from 0.11.0 to 0.12.0
1 parent b0889d7 commit f92ada0

File tree

5 files changed

+27
-23
lines changed

5 files changed

+27
-23
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ volatile = "0.6"
134134
zerocopy = { version = "0.8", default-features = false }
135135

136136
[dependencies.smoltcp]
137-
version = "0.11"
137+
version = "0.12"
138138
optional = true
139139
default-features = false
140140
features = [

src/executor/device.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,25 @@ impl<'a> NetworkInterface<'a> {
116116
// calculate the netmask length
117117
// => count the number of contiguous 1 bits,
118118
// starting at the most significant bit in the first octet
119-
let mut prefix_len = (!mymask.as_bytes()[0]).trailing_zeros();
119+
let mut prefix_len = (!mymask.octets()[0]).trailing_zeros();
120120
if prefix_len == 8 {
121-
prefix_len += (!mymask.as_bytes()[1]).trailing_zeros();
121+
prefix_len += (!mymask.octets()[1]).trailing_zeros();
122122
}
123123
if prefix_len == 16 {
124-
prefix_len += (!mymask.as_bytes()[2]).trailing_zeros();
124+
prefix_len += (!mymask.octets()[2]).trailing_zeros();
125125
}
126126
if prefix_len == 24 {
127-
prefix_len += (!mymask.as_bytes()[3]).trailing_zeros();
127+
prefix_len += (!mymask.octets()[3]).trailing_zeros();
128128
}
129129

130130
let ethernet_addr = EthernetAddress([mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]]);
131131
let hardware_addr = HardwareAddress::Ethernet(ethernet_addr);
132132
let ip_addrs = [IpCidr::new(
133133
IpAddress::v4(
134-
myip.as_bytes()[0],
135-
myip.as_bytes()[1],
136-
myip.as_bytes()[2],
137-
myip.as_bytes()[3],
134+
myip.octets()[0],
135+
myip.octets()[1],
136+
myip.octets()[2],
137+
myip.octets()[3],
138138
),
139139
prefix_len.try_into().unwrap(),
140140
)];
@@ -157,10 +157,10 @@ impl<'a> NetworkInterface<'a> {
157157
ip_addrs
158158
.push(IpCidr::new(
159159
IpAddress::v4(
160-
myip.as_bytes()[0],
161-
myip.as_bytes()[1],
162-
myip.as_bytes()[2],
163-
myip.as_bytes()[3],
160+
myip.octets()[0],
161+
myip.octets()[1],
162+
myip.octets()[2],
163+
myip.octets()[3],
164164
),
165165
prefix_len.try_into().unwrap(),
166166
))
@@ -228,11 +228,11 @@ impl RxToken {
228228
}
229229

230230
impl phy::RxToken for RxToken {
231-
fn consume<R, F>(mut self, f: F) -> R
231+
fn consume<R, F>(self, f: F) -> R
232232
where
233-
F: FnOnce(&mut [u8]) -> R,
233+
F: FnOnce(&[u8]) -> R,
234234
{
235-
f(&mut self.buffer[..])
235+
f(&self.buffer[..])
236236
}
237237
}
238238

src/executor/network.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use core::sync::atomic::{AtomicU16, Ordering};
66
use core::task::Poll;
77

88
use hermit_sync::InterruptTicketMutex;
9-
use smoltcp::iface::{SocketHandle, SocketSet};
9+
use smoltcp::iface::{PollResult, SocketHandle, SocketSet};
1010
#[cfg(feature = "dhcpv4")]
1111
use smoltcp::socket::dhcpv4;
1212
#[cfg(feature = "dns")]
@@ -263,7 +263,7 @@ impl<'a> NetworkInterface<'a> {
263263
Ok(tcp_handle)
264264
}
265265

266-
pub(crate) fn poll_common(&mut self, timestamp: Instant) -> bool {
266+
pub(crate) fn poll_common(&mut self, timestamp: Instant) -> PollResult {
267267
self.iface
268268
.poll(timestamp, &mut self.device, &mut self.sockets)
269269
}

src/syscalls/socket.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl From<IpEndpoint> for sockaddr_in {
192192
match endpoint.addr {
193193
IpAddress::Ipv4(ip) => {
194194
let sin_addr = in_addr {
195-
s_addr: u32::from_ne_bytes(ip.as_bytes().try_into().unwrap()),
195+
s_addr: u32::from_ne_bytes(ip.octets()),
196196
};
197197

198198
Self {
@@ -267,7 +267,7 @@ impl From<IpEndpoint> for sockaddr_in6 {
267267
match endpoint.addr {
268268
IpAddress::Ipv6(ip) => {
269269
let mut in6_addr = in6_addr::default();
270-
in6_addr.s6_addr.copy_from_slice(ip.as_bytes());
270+
in6_addr.s6_addr.copy_from_slice(&ip.octets());
271271

272272
Self {
273273
sin6_len: core::mem::size_of::<sockaddr_in6>().try_into().unwrap(),
@@ -400,7 +400,11 @@ pub unsafe extern "C" fn sys_getaddrbyname(
400400
match block_on(get_query_result(query), None) {
401401
Ok(addr_vec) => {
402402
let slice = unsafe { core::slice::from_raw_parts_mut(inaddr, len) };
403-
slice.copy_from_slice(addr_vec[0].as_bytes());
403+
404+
match addr_vec[0] {
405+
IpAddress::Ipv4(ipv4_addr) => slice.copy_from_slice(&ipv4_addr.octets()),
406+
IpAddress::Ipv6(ipv6_addr) => slice.copy_from_slice(&ipv6_addr.octets()),
407+
}
404408

405409
0
406410
}

0 commit comments

Comments
 (0)