From dddf36f0b747dde13fe6af4d368c927c8d1c76c9 Mon Sep 17 00:00:00 2001 From: Daniel Borkmann Date: Thu, 29 Oct 2015 23:06:40 +0100 Subject: 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 --- ring.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'ring.c') 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) -- cgit v1.2.3-54-g00ecf