From 2522bb0f1bdf65f6c6b3c1e870007c8b844a2167 Mon Sep 17 00:00:00 2001 From: Daniel Mangum Date: Mon, 6 Jan 2025 12:23:53 -0500 Subject: [PATCH] net: support configuring offloaded network device as default interface Adds Kconfig option for making an offloaded network device the default interface. Signed-off-by: Daniel Mangum --- subsys/net/ip/Kconfig | 3 +++ subsys/net/ip/net_if.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/subsys/net/ip/Kconfig b/subsys/net/ip/Kconfig index e3b499ecf9c3b0..6853869a3ccb78 100644 --- a/subsys/net/ip/Kconfig +++ b/subsys/net/ip/Kconfig @@ -930,6 +930,9 @@ config NET_DEFAULT_IF_PPP bool "PPP interface" depends on NET_L2_PPP +config NET_DEFAULT_IF_OFFLOADED_NETDEV + bool "Offloaded network device" + config NET_DEFAULT_IF_WIFI bool "WiFi interface" depends on NET_L2_ETHERNET diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index c86a1d1b9d36f6..096f88458557c6 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -632,6 +632,9 @@ struct net_if *net_if_get_default(void) #if defined(CONFIG_NET_DEFAULT_IF_PPP) iface = net_if_get_first_by_type(&NET_L2_GET_NAME(PPP)); #endif +#if defined(CONFIG_NET_DEFAULT_IF_OFFLOADED_NETDEV) + iface = net_if_get_first_by_type(&NET_L2_GET_NAME(OFFLOADED_NETDEV)); +#endif #if defined(CONFIG_NET_DEFAULT_IF_UP) iface = net_if_get_first_up(); #endif