From 89b32a0f5db56851fd178acbcbba8d625b5f42b3 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Thu, 6 Oct 2022 15:31:51 +0200 Subject: [PATCH] net: if: Verify actual interface state instead of admin state on TX When packet is passed to transmit at the net_if level, verify the carrier state (NET_IF_LOWER_UP) instead of administrative state (NET_IF_UP). The administrative state is checked anyway at higher level (net_context) so no need to verify it again. This will allow to still transmit control packets for example when interface is in a dormant state. Signed-off-by: Robert Lubos --- subsys/net/ip/net_if.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index af450bf01d..5fe24ef789 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -243,7 +243,7 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt) context = net_pkt_context(pkt); - if (net_if_flag_is_set(iface, NET_IF_UP)) { + if (net_if_flag_is_set(iface, NET_IF_LOWER_UP)) { if (IS_ENABLED(CONFIG_NET_TCP) && net_pkt_family(pkt) != AF_UNSPEC) { net_pkt_set_queued(pkt, false); @@ -445,7 +445,7 @@ enum net_verdict net_if_send_data(struct net_if *iface, struct net_pkt *pkt) k_mutex_lock(&lock, K_FOREVER); - if (!net_if_flag_is_set(iface, NET_IF_UP) || + if (!net_if_flag_is_set(iface, NET_IF_LOWER_UP) || net_if_flag_is_set(iface, NET_IF_SUSPENDED)) { /* Drop packet if interface is not up */ NET_WARN("iface %p is down", iface);