mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-20 04:56:32 +00:00
Bump smoltcp to newest git version
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7db9ae23a3
commit
bb4751741a
46
Cargo.lock
generated
46
Cargo.lock
generated
@ -284,15 +284,6 @@ dependencies = [
|
|||||||
"bytemuck",
|
"bytemuck",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atomic-polyfill"
|
|
||||||
version = "0.1.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28"
|
|
||||||
dependencies = [
|
|
||||||
"critical-section",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -440,12 +431,6 @@ dependencies = [
|
|||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "critical-section"
|
|
||||||
version = "1.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.8.16"
|
version = "0.8.16"
|
||||||
@ -661,9 +646,9 @@ checksum = "e2e1d97fbe9722ba9bbd0c97051c2956e726562b61f86a25a4360398a40edfc9"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hash32"
|
name = "hash32"
|
||||||
version = "0.2.1"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67"
|
checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
@ -680,14 +665,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heapless"
|
name = "heapless"
|
||||||
version = "0.7.16"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743"
|
checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atomic-polyfill",
|
|
||||||
"hash32",
|
"hash32",
|
||||||
"rustc_version",
|
|
||||||
"spin 0.9.8",
|
|
||||||
"stable_deref_trait",
|
"stable_deref_trait",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1305,15 +1287,6 @@ dependencies = [
|
|||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustversion"
|
name = "rustversion"
|
||||||
version = "1.0.14"
|
version = "1.0.14"
|
||||||
@ -1326,12 +1299,6 @@ version = "1.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "1.0.18"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.196"
|
version = "1.0.196"
|
||||||
@ -1369,9 +1336,8 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smoltcp"
|
name = "smoltcp"
|
||||||
version = "0.9.1"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/smoltcp-rs/smoltcp?rev=dc08e0b#dc08e0b42e668c331bb2b6f8d80016301d0efe03"
|
||||||
checksum = "7e9786ac45091b96f946693e05bfa4d8ca93e2d3341237d97a380107a6b38dea"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 1.3.2",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
|
@ -27,7 +27,7 @@ ascii = { version = "1.1", default-features = false, features = ["alloc"] }
|
|||||||
intrusive-collections = "0.9.5"
|
intrusive-collections = "0.9.5"
|
||||||
paste = "1.0"
|
paste = "1.0"
|
||||||
time = { version = "0.3", default-features = false, features = ["alloc"] }
|
time = { version = "0.3", default-features = false, features = ["alloc"] }
|
||||||
smoltcp = { version = "0.9.1", default-features = false, features = [
|
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||||
"alloc",
|
"alloc",
|
||||||
"log",
|
"log",
|
||||||
"medium-ethernet",
|
"medium-ethernet",
|
||||||
@ -60,7 +60,10 @@ lru = "0.12.3"
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
bitvec = { version = "1.0", default-features = false, features = ["alloc"] }
|
bitvec = { version = "1.0", default-features = false, features = ["alloc"] }
|
||||||
hashbrown = "0.14"
|
hashbrown = "0.14"
|
||||||
rand = { version = "0.8.5", default-features = false, features = ["small_rng", "std_rng"] }
|
rand = { version = "0.8.5", default-features = false, features = [
|
||||||
|
"small_rng",
|
||||||
|
"std_rng",
|
||||||
|
] }
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
inherit-methods-macro = { git = "https://github.com/asterinas/inherit-methods-macro", rev = "98f7e3e" }
|
inherit-methods-macro = { git = "https://github.com/asterinas/inherit-methods-macro", rev = "98f7e3e" }
|
||||||
getset = "0.1.2"
|
getset = "0.1.2"
|
||||||
|
@ -164,7 +164,9 @@ impl IfaceCommon {
|
|||||||
let mut has_events = false;
|
let mut has_events = false;
|
||||||
let mut poll_at;
|
let mut poll_at;
|
||||||
loop {
|
loop {
|
||||||
has_events |= interface.poll(timestamp, device, &mut sockets);
|
while interface.poll(timestamp, device, &mut sockets) {
|
||||||
|
has_events = true;
|
||||||
|
}
|
||||||
poll_at = interface.poll_at(timestamp, &sockets);
|
poll_at = interface.poll_at(timestamp, &sockets);
|
||||||
let Some(instant) = poll_at else {
|
let Some(instant) = poll_at else {
|
||||||
break;
|
break;
|
||||||
|
@ -8,7 +8,10 @@ use smoltcp::{
|
|||||||
|
|
||||||
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
||||||
use crate::{
|
use crate::{
|
||||||
net::socket::ip::{IpAddress, Ipv4Address},
|
net::{
|
||||||
|
iface::time::get_network_timestamp,
|
||||||
|
socket::ip::{IpAddress, Ipv4Address},
|
||||||
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -28,8 +31,10 @@ impl IfaceLoopback {
|
|||||||
pub fn new() -> Arc<Self> {
|
pub fn new() -> Arc<Self> {
|
||||||
let mut loopback = Loopback::new(Medium::Ip);
|
let mut loopback = Loopback::new(Medium::Ip);
|
||||||
let interface = {
|
let interface = {
|
||||||
let config = Config::new();
|
let config = Config::new(smoltcp::wire::HardwareAddress::Ip);
|
||||||
let mut interface = smoltcp::iface::Interface::new(config, &mut loopback);
|
let now = get_network_timestamp();
|
||||||
|
|
||||||
|
let mut interface = smoltcp::iface::Interface::new(config, &mut loopback, now);
|
||||||
interface.update_ip_addrs(|ip_addrs| {
|
interface.update_ip_addrs(|ip_addrs| {
|
||||||
debug_assert!(ip_addrs.is_empty());
|
debug_assert!(ip_addrs.is_empty());
|
||||||
let ip_addr = IpCidr::new(LOOPBACK_ADDRESS, LOOPBACK_ADDRESS_PREFIX_LEN);
|
let ip_addr = IpCidr::new(LOOPBACK_ADDRESS, LOOPBACK_ADDRESS_PREFIX_LEN);
|
||||||
|
@ -9,7 +9,7 @@ use smoltcp::{
|
|||||||
wire::{self, IpCidr},
|
wire::{self, IpCidr},
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{common::IfaceCommon, internal::IfaceInternal, Iface};
|
use super::{common::IfaceCommon, internal::IfaceInternal, time::get_network_timestamp, Iface};
|
||||||
use crate::prelude::*;
|
use crate::prelude::*;
|
||||||
|
|
||||||
pub struct IfaceVirtio {
|
pub struct IfaceVirtio {
|
||||||
@ -25,14 +25,13 @@ impl IfaceVirtio {
|
|||||||
let interface = {
|
let interface = {
|
||||||
let mac_addr = virtio_net.lock().mac_addr();
|
let mac_addr = virtio_net.lock().mac_addr();
|
||||||
let ip_addr = IpCidr::new(wire::IpAddress::Ipv4(wire::Ipv4Address::UNSPECIFIED), 0);
|
let ip_addr = IpCidr::new(wire::IpAddress::Ipv4(wire::Ipv4Address::UNSPECIFIED), 0);
|
||||||
let config = {
|
let config = Config::new(wire::HardwareAddress::Ethernet(wire::EthernetAddress(
|
||||||
let mut config = Config::new();
|
mac_addr.0,
|
||||||
config.hardware_addr = Some(wire::HardwareAddress::Ethernet(
|
)));
|
||||||
wire::EthernetAddress(mac_addr.0),
|
let now = get_network_timestamp();
|
||||||
));
|
|
||||||
config
|
let mut interface =
|
||||||
};
|
smoltcp::iface::Interface::new(config, &mut *virtio_net.lock(), now);
|
||||||
let mut interface = smoltcp::iface::Interface::new(config, &mut *virtio_net.lock());
|
|
||||||
interface.update_ip_addrs(|ip_addrs| {
|
interface.update_ip_addrs(|ip_addrs| {
|
||||||
debug_assert!(ip_addrs.is_empty());
|
debug_assert!(ip_addrs.is_empty());
|
||||||
ip_addrs.push(ip_addr).unwrap();
|
ip_addrs.push(ip_addr).unwrap();
|
||||||
@ -110,6 +109,7 @@ impl Iface for IfaceVirtio {
|
|||||||
let hardware_addr = interface.hardware_addr();
|
let hardware_addr = interface.hardware_addr();
|
||||||
match hardware_addr {
|
match hardware_addr {
|
||||||
wire::HardwareAddress::Ethernet(ethe_address) => Some(ethe_address),
|
wire::HardwareAddress::Ethernet(ethe_address) => Some(ethe_address),
|
||||||
|
wire::HardwareAddress::Ip => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,10 +43,13 @@ impl BoundDatagram {
|
|||||||
.bound_socket
|
.bound_socket
|
||||||
.raw_with(|socket: &mut RawUdpSocket| socket.recv_slice(buf));
|
.raw_with(|socket: &mut RawUdpSocket| socket.recv_slice(buf));
|
||||||
match result {
|
match result {
|
||||||
Ok((recv_len, endpoint)) => Ok((recv_len, endpoint)),
|
Ok((recv_len, udp_metadata)) => Ok((recv_len, udp_metadata.endpoint)),
|
||||||
Err(RecvError::Exhausted) => {
|
Err(RecvError::Exhausted) => {
|
||||||
return_errno_with_message!(Errno::EAGAIN, "the receive buffer is empty")
|
return_errno_with_message!(Errno::EAGAIN, "the receive buffer is empty")
|
||||||
}
|
}
|
||||||
|
Err(RecvError::Truncated) => {
|
||||||
|
todo!();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,5 +16,18 @@ int-to-c-enum = { path = "../../libs/int-to-c-enum" }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
ostd = { path = "../../../ostd" }
|
ostd = { path = "../../../ostd" }
|
||||||
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
|
ringbuf = { version = "0.3.2", default-features = false, features = ["alloc"] }
|
||||||
smoltcp = { version = "0.9.1", default-features = false, features = ["alloc", "log", "medium-ethernet", "medium-ip", "proto-dhcpv4", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw", "socket-dhcpv4"] }
|
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||||
|
"alloc",
|
||||||
|
"log",
|
||||||
|
"medium-ethernet",
|
||||||
|
"medium-ip",
|
||||||
|
"proto-dhcpv4",
|
||||||
|
"proto-ipv4",
|
||||||
|
"proto-igmp",
|
||||||
|
"socket-icmp",
|
||||||
|
"socket-udp",
|
||||||
|
"socket-tcp",
|
||||||
|
"socket-raw",
|
||||||
|
"socket-dhcpv4",
|
||||||
|
] }
|
||||||
spin = "0.9.4"
|
spin = "0.9.4"
|
||||||
|
@ -37,12 +37,12 @@ pub struct RxToken(RxBuffer);
|
|||||||
impl phy::RxToken for RxToken {
|
impl phy::RxToken for RxToken {
|
||||||
fn consume<R, F>(self, f: F) -> R
|
fn consume<R, F>(self, f: F) -> R
|
||||||
where
|
where
|
||||||
F: FnOnce(&mut [u8]) -> R,
|
F: FnOnce(&[u8]) -> R,
|
||||||
{
|
{
|
||||||
let mut packet = self.0.packet();
|
let mut packet = self.0.packet();
|
||||||
let mut buffer = vec![0u8; packet.remain()];
|
let mut buffer = vec![0u8; packet.remain()];
|
||||||
packet.read(&mut VmWriter::from(&mut buffer as &mut [u8]));
|
packet.read(&mut VmWriter::from(&mut buffer as &mut [u8]));
|
||||||
f(&mut buffer)
|
f(&buffer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ component = { path = "../../libs/comp-sys/component" }
|
|||||||
log = "0.4"
|
log = "0.4"
|
||||||
bit_field = "0.10.1"
|
bit_field = "0.10.1"
|
||||||
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
|
int-to-c-enum = { path = "../../libs/int-to-c-enum" }
|
||||||
smoltcp = { version = "0.9.1", default-features = false, features = [
|
smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev = "dc08e0b", default-features = false, features = [
|
||||||
"alloc",
|
"alloc",
|
||||||
"log",
|
"log",
|
||||||
"medium-ethernet",
|
"medium-ethernet",
|
||||||
|
Reference in New Issue
Block a user