aboutsummaryrefslogtreecommitdiffstats
path: root/src/router/workers.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-09-07 19:19:51 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-09-07 19:19:51 +0200
commiteae915b2e8aacb86392239a984ca2028b4d93630 (patch)
tree44a52a75f319937368f985ace410e1b4df14ab62 /src/router/workers.rs
parentWrite inbound packets to TUN device (diff)
downloadwireguard-rs-eae915b2e8aacb86392239a984ca2028b4d93630.tar.xz
wireguard-rs-eae915b2e8aacb86392239a984ca2028b4d93630.zip
Fixed outbound unittest
Diffstat (limited to '')
-rw-r--r--src/router/workers.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/router/workers.rs b/src/router/workers.rs
index 45e1058..fb22280 100644
--- a/src/router/workers.rs
+++ b/src/router/workers.rs
@@ -35,11 +35,14 @@ pub struct JobBuffer {
}
pub type JobParallel = (oneshot::Sender<JobBuffer>, JobBuffer);
+
+#[allow(type_alias_bounds)]
pub type JobInbound<C, T, B: Bind> = (
Arc<DecryptionState<C, T, B>>,
B::Endpoint,
oneshot::Receiver<JobBuffer>,
);
+
pub type JobOutbound = oneshot::Receiver<JobBuffer>;
#[inline(always)]
@@ -69,7 +72,7 @@ fn check_route<C: Callbacks, T: Tun, B: Bind>(
}
VERSION_IP6 => {
// check length and cast to IPv6 header
- let (header, packet) = LayoutVerified::new_from_prefix(packet)?;
+ let (header, _) = LayoutVerified::new_from_prefix(packet)?;
let header: LayoutVerified<&[u8], IPv6Header> = header;
// check IPv6 source address
@@ -116,7 +119,7 @@ pub fn worker_inbound<C: Callbacks, T: Tun, B: Bind>(
};
let header: LayoutVerified<&[u8], TransportHeader> = header;
debug_assert!(
- packet.len() >= 16,
+ packet.len() >= CHACHA20_POLY1305.tag_len(),
"this should be checked earlier in the pipeline"
);