From 92499fc9d1458678b42ecea14182f9971a17c758 Mon Sep 17 00:00:00 2001 From: David Komel Date: Mon, 21 Sep 2020 07:26:51 +0300 Subject: [PATCH] drivers: net: slip: Allow slip to co-exist with other interfaces This commit fixes the following issue: When using slip without TAP, i.e. CONFIG_SLIP_TAP=n (default), while another ethernet interface is enabled and sets CONFIG_NET_L2_ETHERNET=y. This causes ethernet_init() to be wrongly called with struct dummy_api instead of struct ethernet_api. ethernet_init() expects struct ethernet_api (by cast), so we end up with the get_capabilities field pointing to garbage! Actually, as we are using the dummy api, we don't need to call ethernet_init() at all. Sole dependency on CONFIG_NET_L2_ETHERNET is wrong because it can be enabled by another interface. Signed-off-by: David Komel --- drivers/net/slip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 1e0dbe89cc0..615725743fd 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -395,7 +395,7 @@ static void slip_iface_init(struct net_if *iface) struct slip_context *slip = net_if_get_device(iface)->data; struct net_linkaddr *ll_addr; -#if defined(CONFIG_NET_L2_ETHERNET) +#if defined(CONFIG_SLIP_TAP) && defined(CONFIG_NET_L2_ETHERNET) ethernet_init(iface); #endif