There's no need to initialize whole struct pkt_hdr; we only need to
signalize we have no packet ready by setting pkt_len to 0. Other fields
are either initialized in allocation time or set by packet_adjust() and
packet_process() / packet_set_l3_hdrp() functions.
Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/packet.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/packet.c b/src/packet.c
index 3f1f1da..224b17d 100644
--- a/src/packet.c
+++ b/src/packet.c
@@ -143,7 +143,9 @@ int packet_get(int fd, struct pkt_hdr *pkt, int *ch, WINDOW *win)
ss = poll(pfds, nfds, DEFAULT_UPDATE_DELAY);
} while ((ss == -1) && (errno == EINTR));
- PACKET_INIT_STRUCT(pkt);
+ /* no packet ready yet */
+ pkt->pkt_len = 0;
+
if ((ss > 0) && (pfds[0].revents & POLLIN) != 0) {
struct sockaddr_ll from;
struct iovec iov;
--
1.9.1