From fa07d2d463a5ea3442185b57e4fadc8fb3c83309 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 4 Mar 2017 11:43:58 +0200 Subject: [PATCH] tests: Add TEST_FAIL() checks in l2_packet This enables additional test coverage for error paths. Signed-off-by: Jouni Malinen --- src/l2_packet/l2_packet_linux.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/l2_packet/l2_packet_linux.c b/src/l2_packet/l2_packet_linux.c index a7a300e56..65b490679 100644 --- a/src/l2_packet/l2_packet_linux.c +++ b/src/l2_packet/l2_packet_linux.c @@ -96,6 +96,9 @@ int l2_packet_send(struct l2_packet_data *l2, const u8 *dst_addr, u16 proto, const u8 *buf, size_t len) { int ret; + + if (TEST_FAIL()) + return -1; if (l2 == NULL) return -1; if (l2->l2_hdr) { @@ -458,6 +461,9 @@ int l2_packet_set_packet_filter(struct l2_packet_data *l2, { const struct sock_fprog *sock_filter; + if (TEST_FAIL()) + return -1; + switch (type) { case L2_PACKET_FILTER_DHCP: sock_filter = &dhcp_sock_filter;