summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ring_rx.c9
-rw-r--r--ring_tx.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/ring_rx.c b/ring_rx.c
index c4c6a38..4c5846c 100644
--- a/ring_rx.c
+++ b/ring_rx.c
@@ -21,9 +21,14 @@
void destroy_rx_ring(int sock, struct ring *ring)
{
+ int ret;
+
fmemset(&ring->layout, 0, sizeof(ring->layout));
- setsockopt(sock, SOL_PACKET, PACKET_RX_RING, &ring->layout,
- sizeof(ring->layout));
+
+ ret = setsockopt(sock, SOL_PACKET, PACKET_RX_RING, &ring->layout,
+ sizeof(ring->layout));
+ if (unlikely(ret))
+ panic("Cannot destroy the RX_RING!\n");
munmap(ring->mm_space, ring->mm_len);
ring->mm_len = 0;
diff --git a/ring_tx.c b/ring_tx.c
index dc777e5..9869131 100644
--- a/ring_tx.c
+++ b/ring_tx.c
@@ -31,9 +31,14 @@ void set_packet_loss_discard(int sock)
void destroy_tx_ring(int sock, struct ring *ring)
{
+ int ret;
+
fmemset(&ring->layout, 0, sizeof(ring->layout));
- setsockopt(sock, SOL_PACKET, PACKET_TX_RING, &ring->layout,
- sizeof(ring->layout));
+
+ ret = setsockopt(sock, SOL_PACKET, PACKET_TX_RING, &ring->layout,
+ sizeof(ring->layout));
+ if (unlikely(ret))
+ panic("Cannot destroy the TX_RING!\n");
munmap(ring->mm_space, ring->mm_len);
ring->mm_len = 0;