summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/platform/linux/rxring.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/platform/linux/rxring.rs b/src/platform/linux/rxring.rs
index 5f378b2..694f05e 100644
--- a/src/platform/linux/rxring.rs
+++ b/src/platform/linux/rxring.rs
@@ -28,6 +28,9 @@ pub struct RxRing {
fn setup_rxring(sockfd: RawFd,
tp_block_size: u32, tp_block_nr: u32, tp_frame_size: u32
) -> Result<tpacket_req, Error> {
+ if tp_frame_size == 0 { // to prevent div0
+ return Err(Error::from_raw_os_error(EINVAL));
+ }
let req = tpacket_req {
tp_block_size,