/// Adds a route to the forwarding table.
Adds a route to the forwarding table.
Adds a route to the forwarding table .
pub fn add_route<D: EventDispatcher>(
    ctx: &mut Ctx<D>,
    entry: EntryEither<DeviceId>,
) -> Result<(), error::NetstackError> {
    let (subnet, dest) = entry.into_subnet_dest();
    match dest {
        EntryDest::Local { device } => map_addr_version!(
            subnet: SubnetEither;
            crate::ip::add_device_route(ctx, subnet, device)
        )
        .map_err(From::from),
        EntryDest::Remote { next_hop } => {
            let next_hop = next_hop.into();
            map_addr_version!(
                (subnet: SubnetEither, next_hop: IpAddr);
                crate::ip::add_route(ctx, subnet, next_hop),
                unreachable!(),
            )
            .map_err(From::from)
        }
    }
}
pub fn add_route < D : EventDispatcher > ( ctx : & mut Ctx < D > , entry : EntryEither < DeviceId > , ) -> Result < ( ) , error :: NetstackError > { let ( subnet , dest ) = entry . into_subnet_dest ( ) ; match dest { EntryDest :: Local { device } => map_addr_version ! ( subnet SubnetEither crate ip add_device_route ( ctx subnet device ) ) . map_err ( From :: from ) , EntryDest :: Remote { next_hop } => { let next_hop = next_hop . into ( ) ; map_addr_version ! ( ( subnet SubnetEither next_hop IpAddr ) crate ip add_route ( ctx subnet next_hop ) unreachable ( ) ) . map_err ( From :: from ) } } }
Adds a route to the forwarding table.
Adds a route to the forwarding table .
ctx
&mut Ctx<D>
entry
EntryEither<DeviceId>