feat: added the ability to respond to ARP requests

This commit is contained in:
Andrew Rioux
2023-09-26 01:57:10 -04:00
parent 0bda72491c
commit 0bb2871568
4 changed files with 219 additions and 45 deletions

View File

@@ -6,7 +6,9 @@ fn main() -> anyhow::Result<()> {
loop {
let mut buf = [0u8; 4];
let Ok((amount, src)) = input.recv_from(&mut buf[..]) else { continue; };
let Ok((amount, src)) = input.recv_from(&mut buf[..]) else {
continue;
};
if amount != 4 {
continue;
@@ -14,6 +16,8 @@ fn main() -> anyhow::Result<()> {
println!("Received packet: {}", i32::from_be_bytes(buf));
let Ok(_) = input.send_to(&buf, src) else { continue; };
let Ok(_) = input.send_to(&buf, src) else {
continue;
};
}
}