tests: Add TEST_FAIL() checks in l2_packet

This enables additional test coverage for error paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-03-04 11:43:58 +02:00
parent d4359923e1
commit fa07d2d463

View 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) const u8 *buf, size_t len)
{ {
int ret; int ret;
if (TEST_FAIL())
return -1;
if (l2 == NULL) if (l2 == NULL)
return -1; return -1;
if (l2->l2_hdr) { 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; const struct sock_fprog *sock_filter;
if (TEST_FAIL())
return -1;
switch (type) { switch (type) {
case L2_PACKET_FILTER_DHCP: case L2_PACKET_FILTER_DHCP:
sock_filter = &dhcp_sock_filter; sock_filter = &dhcp_sock_filter;