]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Add TEST_FAIL() checks in l2_packet
authorJouni Malinen <j@w1.fi>
Sat, 4 Mar 2017 09:43:58 +0000 (11:43 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Mar 2017 09:43:58 +0000 (11:43 +0200)
This enables additional test coverage for error paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/l2_packet/l2_packet_linux.c

index a7a300e568e6d8dc88d195fd8aaa072d476e90e8..65b490679a08cfcf03514d1c5f50d0dae4e78d2a 100644 (file)
@@ -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;