Browse Source

tests: Add TEST_FAIL() checks in l2_packet

This enables additional test coverage for error paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 8 years ago
parent
commit
fa07d2d463
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/l2_packet/l2_packet_linux.c

+ 6 - 0
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;