From db454603eeafd645706a293969e1850895673c9d Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 28 Oct 2021 18:38:02 +0800 Subject: [PATCH] improve resilience to ping flood attack much better, but still eventually the stack can fall over eventually. also, the stack doesn't behave well when you try to initiate new commands in the middle of a flood, because the back-pressure mechanisms are primarily in-stack at the moment. I think i have an idea on how to fix that but this will have to be later. --- services/net/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/services/net/src/main.rs b/services/net/src/main.rs index 925ecda2f..775a54024 100644 --- a/services/net/src/main.rs +++ b/services/net/src/main.rs @@ -618,10 +618,18 @@ fn xmain() -> ! { None => {} //log::info!("pushed {} bytes avail to iface", rxlen), Some(_) => log::warn!("Got more packets, but smoltcp didn't drain them in time"), } - send_message( + match xous::try_send_message( net_conn, Message::new_scalar(Opcode::NetPump.to_usize().unwrap(), 0, 0, 0, 0) - ).expect("WlanRxReady couldn't pump the loop"); + ) { + Ok(_) => {}, + Err(xous::Error::ServerQueueFull) => { + log::warn!("Our net queue runneth over, packets will be dropped."); + }, + Err(e) => { + log::error!("Unhandled error sending NetPump to self: {:?}", e); + } + } } else { log::error!("Got RxReady interrupt but no packet length specified!"); }