// not MIME data, valid SLIP (checked)
pub type RoutedPacketData = Box<[u8]>;
-#[throws(PacketError)]
+// loop prevention
+// we don't decrement the ttl (naughty) but loops cannot arise
+// because only the server has any routing code, and server
+// has no internal loops, so worst case is
+// client if -> client -> server -> client' -> client if'
+// and the ifs will decrement the ttl.
+mod may_route {
+ #[derive(Clone,Debug)]
+ pub struct MayRoute(());
+ impl MayRoute {
+ pub fn came_from_outside_hippotatd() -> Self { Self(()) }
+ }
+}
+pub use may_route::MayRoute;
+
pub async fn route_packet(global: &Global,
- conn: &str, source: Option<&ClientName>,
- packet: RoutedPacketData, daddr: IpAddr)
+ transport_conn: &str, source: Option<&ClientName>,
+ packet: RoutedPacketData, daddr: IpAddr,
+ _may_route: MayRoute)
{
let c = &global.config;
let len = packet.len();
let trace = |how: &str, why: &str| {
- trace!("{} {} {} {} {:?} len={}",
- conn,
+ trace!("{} {} {} {} daddr={:?} len={}",
+ transport_conn,
match source {
Some(s) => (s as &dyn Display),
None => &"local",