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 <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
efd03a86d7
commit
89b32a0f5d
|
@ -243,7 +243,7 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
|
||||||
|
|
||||||
context = net_pkt_context(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) &&
|
if (IS_ENABLED(CONFIG_NET_TCP) &&
|
||||||
net_pkt_family(pkt) != AF_UNSPEC) {
|
net_pkt_family(pkt) != AF_UNSPEC) {
|
||||||
net_pkt_set_queued(pkt, false);
|
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);
|
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)) {
|
net_if_flag_is_set(iface, NET_IF_SUSPENDED)) {
|
||||||
/* Drop packet if interface is not up */
|
/* Drop packet if interface is not up */
|
||||||
NET_WARN("iface %p is down", iface);
|
NET_WARN("iface %p is down", iface);
|
||||||
|
|
Loading…
Reference in a new issue