From 894e42d0258f47046f0e6f19c0a25fae04b143a1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Thu, 16 Jun 2016 12:09:42 +0300 Subject: [PATCH] net: tests: Fix IP address test so that it will not crash The driver_api pointer was set to NULL and send() pointer was missing which caused a crash in TX fiber. Change-Id: I7204c975691476dd9ab2c61bfd11b7664343e47c Signed-off-by: Jukka Rissanen --- tests/net/ip-addr/src/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/net/ip-addr/src/main.c b/tests/net/ip-addr/src/main.c index b5195b7ae6f..f015244ab94 100644 --- a/tests/net/ip-addr/src/main.c +++ b/tests/net/ip-addr/src/main.c @@ -116,7 +116,6 @@ int net_test_init(struct device *dev) { struct net_test_context *net_test_context = dev->driver_data; - dev->driver_api = NULL; net_test_context = net_test_context; return 0; @@ -146,17 +145,20 @@ static void net_test_iface_init(struct net_if *iface) net_if_set_link_addr(iface, mac, 8); } +static int tester_send(struct net_if *iface, struct net_buf *buf) +{ + net_nbuf_unref(buf); + return 0; +} + struct net_test_context net_test_context_data; static struct net_if_api net_test_if_api = { - .init = net_test_iface_init + .init = net_test_iface_init, + .send = tester_send, }; -#if defined(CONFIG_NET_L2_ETHERNET) -#define _ETH_L2_LAYER ETHERNET_L2 -#else #define _ETH_L2_LAYER DUMMY_L2 -#endif NET_DEVICE_INIT(net_addr_test, "net_addr_test", net_test_init, &net_test_context_data, NULL,