From 10c4841835249bfc61d47f18f1908e77fca77377 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Tue, 13 Nov 2018 16:22:52 +0100 Subject: [PATCH] net/net_if: Do not set TCP related flags on non-INET/6 family Such sent flag is in a union in net_pkt, shared with a gptp flag. Tweaking it when the family is not AF_INET or AF_INET6 will generate corrupted gptp packets. Signed-off-by: Jukka Rissanen Signed-off-by: Tomasz Bursztyka --- subsys/net/ip/net_if.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c index 752ae83e580..5573be9e545 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -164,7 +164,8 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt) context_token = net_pkt_token(pkt); if (atomic_test_bit(iface->if_dev->flags, NET_IF_UP)) { - if (IS_ENABLED(CONFIG_NET_TCP)) { + if (IS_ENABLED(CONFIG_NET_TCP) && + net_pkt_family(pkt) != AF_UNSPEC) { net_pkt_set_sent(pkt, true); net_pkt_set_queued(pkt, false); } @@ -177,7 +178,8 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt) } if (status < 0) { - if (IS_ENABLED(CONFIG_NET_TCP)) { + if (IS_ENABLED(CONFIG_NET_TCP) + && net_pkt_family(pkt) != AF_UNSPEC) { net_pkt_set_sent(pkt, false); }