aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-07-26 16:37:12 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-07-26 16:37:12 +0200
commit9b34c456e05b2ece92deed35987f5c66c02d774d (patch)
tree1d4ef01c6f8efe236431778e27e8fe6340ca1eb9 /src
parent7676e48a2e461725044cd4887771fcb3ce1c655b (diff)
add CHAP Challenge deserialization test
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c5b33ba..9c768c8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1105,4 +1105,27 @@ mod tests {
);
Ok(())
}
+
+ #[test]
+ fn test_deserialize_chap_challenge() -> Result<()> {
+ let mut challenge = PppoePkt::default();
+
+ let buf = [
+ 0x00, 0x00, 0x5e, 0x00, 0x53, 0x02, 0x00, 0x00, 0x5e, 0x00, 0x53, 0x01, 0x88, 0x64,
+ 0x11, 0x00, 0x00, 0x01, 0x00, 0x0c, 0xc2, 0x23, 0x01, 0x41, 0x00, 0x0a, 0x02, 0x13,
+ 0x37, 0x66, 0x6f, 0x6f,
+ ];
+ challenge.deserialize(&mut buf.as_ref())?;
+
+ assert_eq!(
+ challenge,
+ PppoePkt::new_ppp(
+ [0x00, 0x00, 0x5e, 0x00, 0x53, 0x02].into(),
+ [0x00, 0x00, 0x5e, 0x00, 0x53, 0x01].into(),
+ 1,
+ PppPkt::new_chap(ChapPkt::new_challenge(0x41, vec![0x13, 0x37], "foo".into()))
+ )
+ );
+ Ok(())
+ }
}