diff --git a/net/tcp/tcp_send.c b/net/tcp/tcp_send.c index ae231b161e..041b07fc1a 100644 --- a/net/tcp/tcp_send.c +++ b/net/tcp/tcp_send.c @@ -477,7 +477,7 @@ void tcp_reset(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn) ipv6_build_header(ipv6, dev->d_len - IPv6_HDRLEN, IP_PROTO_TCP, dev->d_ipv6addr, ipv6->srcipaddr, - IP_TTL_DEFAULT, conn->sconn.s_tclass); + IP_TTL_DEFAULT, conn ? conn->sconn.s_tclass : 0); tcp->tcpchksum = 0; tcp->tcpchksum = ~tcp_ipv6_chksum(dev); @@ -493,7 +493,7 @@ void tcp_reset(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn) ipv4_build_header(IPv4BUF, dev->d_len, IP_PROTO_TCP, &dev->d_ipaddr, (FAR in_addr_t *)ipv4->srcipaddr, - IP_TTL_DEFAULT, conn->sconn.s_tos, NULL); + IP_TTL_DEFAULT, conn ? conn->sconn.s_tos : 0, NULL); tcp->tcpchksum = 0; tcp->tcpchksum = ~tcp_ipv4_chksum(dev);