tcp_reset: check the conn is exist when tcp_reset
tcp_input:
If we didn't find an active connection that expected the packet,
If the SYN flag isn't set,
It is an old packet and we send a RST.
conn is NULL when this case
@@ -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);
