mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 18:26:48 +00:00
fmt
This commit is contained in:
parent
c9806be704
commit
acd348572d
@ -38,7 +38,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
exception::{irqdesc::IrqReturn, IrqNumber},
|
exception::{irqdesc::IrqReturn, IrqNumber},
|
||||||
filesystem::{kernfs::KernFSInode, mbr::MbrDiskPartionTable, sysfs::AttributeGroup},
|
filesystem::{kernfs::KernFSInode, mbr::MbrDiskPartionTable},
|
||||||
init::initcall::INITCALL_POSTCORE,
|
init::initcall::INITCALL_POSTCORE,
|
||||||
libs::{
|
libs::{
|
||||||
rwlock::{RwLockReadGuard, RwLockWriteGuard},
|
rwlock::{RwLockReadGuard, RwLockWriteGuard},
|
||||||
|
@ -286,7 +286,9 @@ impl LoopbackInterface {
|
|||||||
smoltcp::iface::Interface::new(iface_config, &mut driver, Instant::now().into());
|
smoltcp::iface::Interface::new(iface_config, &mut driver, Instant::now().into());
|
||||||
//设置网卡地址为127.0.0.1
|
//设置网卡地址为127.0.0.1
|
||||||
iface.update_ip_addrs(|ip_addrs| {
|
iface.update_ip_addrs(|ip_addrs| {
|
||||||
ip_addrs.push(IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8)).expect("Push ipCidr failed: full");
|
ip_addrs
|
||||||
|
.push(IpCidr::new(IpAddress::v4(127, 0, 0, 1), 8))
|
||||||
|
.expect("Push ipCidr failed: full");
|
||||||
});
|
});
|
||||||
|
|
||||||
Arc::new(LoopbackInterface {
|
Arc::new(LoopbackInterface {
|
||||||
|
@ -10,9 +10,9 @@ use crate::{driver::net::Iface, libs::rwlock::RwLock};
|
|||||||
|
|
||||||
pub mod event_poll;
|
pub mod event_poll;
|
||||||
pub mod net_core;
|
pub mod net_core;
|
||||||
|
pub mod posix;
|
||||||
pub mod socket;
|
pub mod socket;
|
||||||
pub mod syscall;
|
pub mod syscall;
|
||||||
pub mod posix;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// # 所有网络接口的列表
|
/// # 所有网络接口的列表
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//
|
//
|
||||||
// posix.rs 记录了系统调用时用到的结构
|
// posix.rs 记录了系统调用时用到的结构
|
||||||
//
|
//
|
||||||
|
|
||||||
bitflags::bitflags! {
|
bitflags::bitflags! {
|
||||||
// #[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
// #[derive(PartialEq, Eq, Debug, Clone, Copy)]
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
use crate::net::socket::*;
|
|
||||||
use crate::net::posix::MsgHdr;
|
use crate::net::posix::MsgHdr;
|
||||||
|
use crate::net::socket::*;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use core::any::Any;
|
use core::any::Any;
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
@ -14,16 +14,14 @@ fn create_inet_socket(
|
|||||||
// log::debug!("type: {:?}, protocol: {:?}", socket_type, protocol);
|
// log::debug!("type: {:?}, protocol: {:?}", socket_type, protocol);
|
||||||
use smoltcp::wire::IpProtocol::*;
|
use smoltcp::wire::IpProtocol::*;
|
||||||
match socket_type {
|
match socket_type {
|
||||||
PSOCK::Datagram => {
|
PSOCK::Datagram => match protocol {
|
||||||
match protocol {
|
HopByHop | Udp => {
|
||||||
HopByHop | Udp => {
|
return Ok(UdpSocket::new(false));
|
||||||
return Ok(UdpSocket::new(false));
|
|
||||||
}
|
|
||||||
_ => {
|
|
||||||
return Err(EPROTONOSUPPORT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
_ => {
|
||||||
|
return Err(EPROTONOSUPPORT);
|
||||||
|
}
|
||||||
|
},
|
||||||
PSOCK::Stream => match protocol {
|
PSOCK::Stream => match protocol {
|
||||||
HopByHop | Tcp => {
|
HopByHop | Tcp => {
|
||||||
return Ok(TcpSocket::new(false));
|
return Ok(TcpSocket::new(false));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user