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 <jukka.rissanen@linux.intel.com>
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2018-11-13 16:22:52 +01:00 committed by Anas Nashif
parent 5fb9a7bc4a
commit 10c4841835

View File

@ -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);
}