Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Jun 13, 2024
1 parent 906b59a commit 7b0256c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.x86_64-unknown-linux-gnu]
runner = 'sudo -E'
21 changes: 4 additions & 17 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,9 @@
"profile": "minimal"
}
},
// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
"runArgs": [
// TODO: figure out the exact cap-add ?
"--privileged"
],
"remoteUser": "root"
}
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
mod platform;
mod utils;

#[derive(PartialEq)]
#[derive(PartialEq, Clone, Copy, Debug)]
#[repr(u8)]
pub enum NetworkProtocol {
TCP = 6,
UDP = 17,
Expand Down
5 changes: 3 additions & 2 deletions src/platform/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ fn resolve_uid_inode(
// Before calling serialize, it is important to check that the buffer in
// which we're emitting is big enough for the packet, other
// `serialize()` panics.
assert_eq!(buf.len(), packet.buffer_len());
assert_eq!(buf.len(), packet.buffer_len(), "Buffer is too small");

packet.serialize(&mut buf[..]);

if socket.send(&buf[..], 0).is_err() {
if let Err(e) = socket.send(&buf[..], 0) {
eprintln!("Failed to send packet: {:?}", e);
return None;
}

Expand Down

0 comments on commit 7b0256c

Please sign in to comment.