// not MIME data, valid SLIP (checked)
pub type RoutedPacketData = Box<[u8]>;
+// loop prevention
+mod may_route {
+ #[derive(Clone,Debug)]
+ pub struct MayRoute(());
+ impl MayRoute {
+ pub fn came_from_outside_hippotatd() -> Self { Self(()) }
+ }
+}
+pub use may_route::MayRoute;
+
#[throws(PacketError)]
pub async fn route_packet(global: &Global,
conn: &str, source: Option<&ClientName>,
- packet: RoutedPacketData, daddr: IpAddr)
+ packet: RoutedPacketData, daddr: IpAddr,
+ _may_route: MayRoute)
{
let c = &global.config;
let len = packet.len();
let WebRequest {
initial, initial_remaining, length_hint, mut body,
boundary_finder,
- reply_to, conn, mut warnings,
+ reply_to, conn, mut warnings, may_route,
} = req.ok_or_else(|| anyhow!("webservers all shut down!"))?;
match async {
let daddr = ip_packet_addr::<true>(header)?;
Ok(daddr)
}, |(daddr,packet)| route_packet(
- &global, &conn, Some(&ic.link.client), daddr,packet
+ &global, &conn, Some(&ic.link.client), daddr,
+ packet, may_route.clone(),
),
|e| Ok::<_,SlipFramesError<_>>({ warnings.add(&e)?; })
).await?;
pub reply_to: oneshot::Sender<WebResponse>,
pub warnings: Warnings,
pub conn: Arc<String>,
+ pub may_route: MayRoute,
}
/// Reply from client task to hyper worker pool task
warnings: mem::take(&mut warnings),
reply_to,
conn: conn.clone(),
+ may_route: MayRoute::came_from_outside_hippotatd(),
};
client.web.try_send(wreq)