summaryrefslogtreecommitdiff
path: root/ring.c
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2015-10-29 23:06:40 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2015-10-29 23:07:30 +0100
commitdddf36f0b747dde13fe6af4d368c927c8d1c76c9 (patch)
treeb3ce38367937e0f25dfd432aaf7b7713a8f0866f /ring.c
parentb1a4a6fa7b233abbca763178095b076d409cce80 (diff)
ring, bind_ring_generic: no need to nullify members twice
We already do a memset before, no need to set members to null twice, just some minor cleanup. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'ring.c')
-rw-r--r--ring.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/ring.c b/ring.c
index 2a0a6b5..4ef0f78 100644
--- a/ring.c
+++ b/ring.c
@@ -61,6 +61,7 @@ void alloc_ring_frames_generic(struct ring *ring, size_t num, size_t size)
void bind_ring_generic(int sock, struct ring *ring, int ifindex, bool tx_only)
{
int ret;
+
/* The {TX,RX}_RING registers itself to the networking stack with
* dev_add_pack(), so we have one single RX_RING for all devs
* otherwise you'll get the packet twice.
@@ -68,14 +69,8 @@ void bind_ring_generic(int sock, struct ring *ring, int ifindex, bool tx_only)
fmemset(&ring->s_ll, 0, sizeof(ring->s_ll));
ring->s_ll.sll_family = AF_PACKET;
- if (tx_only)
- ring->s_ll.sll_protocol = 0;
- else
- ring->s_ll.sll_protocol = htons(ETH_P_ALL);
ring->s_ll.sll_ifindex = ifindex;
- ring->s_ll.sll_hatype = 0;
- ring->s_ll.sll_halen = 0;
- ring->s_ll.sll_pkttype = 0;
+ ring->s_ll.sll_protocol = tx_only ? 0 : htons(ETH_P_ALL);
ret = bind(sock, (struct sockaddr *) &ring->s_ll, sizeof(ring->s_ll));
if (ret < 0)