diff --git a/net/devif/ipv6_input.c b/net/devif/ipv6_input.c index d51d7aa805..bb6c210bd1 100644 --- a/net/devif/ipv6_input.c +++ b/net/devif/ipv6_input.c @@ -174,12 +174,12 @@ int ipv6_input(FAR struct net_driver_s *dev) * * The length reported in the IPv6 header is the length of the payload * that follows the header. The device interface uses the d_len variable for - * holding the size of the entire packet, including the IP header and link - * layer header. + * holding the size of the entire packet, including the IP header but without + * the link layer header. */ pktlen = ((uint16_t)ipv6->len[0] << 8) + (uint16_t)ipv6->len[1] + - IPv6_HDRLEN + netdev_ipv6_hdrlen(dev); + IPv6_HDRLEN; if (pktlen <= dev->d_len) { diff --git a/net/tcp/tcp_devpoll.c b/net/tcp/tcp_devpoll.c index 6fce807934..2a3fdcbdf3 100644 --- a/net/tcp/tcp_devpoll.c +++ b/net/tcp/tcp_devpoll.c @@ -105,7 +105,13 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn) * setup may not actually be used. */ -#if defined(CONFIG_NET_IPv4) +#if defined(CONFIG_NET_IPv6) && defined(CONFIG_NET_IPv4) + if(conn->domain == PF_INET) { + tcp_ipv4_select(dev); + } else { + tcp_ipv6_select(dev); + } +#elif defined(CONFIG_NET_IPv4) tcp_ipv4_select(dev); #else /* if defined(CONFIG_NET_IPv6) */ tcp_ipv6_select(dev); diff --git a/net/tcp/tcp_send_buffered.c b/net/tcp/tcp_send_buffered.c index dbb2f28087..160be02213 100644 --- a/net/tcp/tcp_send_buffered.c +++ b/net/tcp/tcp_send_buffered.c @@ -228,21 +228,21 @@ static inline void psock_lost_connection(FAR struct socket *psock, #ifdef NEED_IPDOMAIN_SUPPORT static inline void send_ipselect(FAR struct net_driver_s *dev, - FAR struct socket *psock) + FAR struct tcp_conn_s *conn) { /* Which domain the the socket support */ - if (psock->s_domain == PF_INET) + if (conn->domain == PF_INET) { /* Select the IPv4 domain */ tcp_ipv4_select(dev); } - else /* if (psock->s_domain == PF_INET6) */ + else /* if (conn->domain == PF_INET6) */ { /* Select the IPv6 domain */ - DEBUGASSERT(psock->s_domain == PF_INET6); + DEBUGASSERT(conn->domain == PF_INET6); tcp_ipv4_select(dev); } } @@ -754,7 +754,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev, * place and we need do nothing. */ - send_ipselect(dev, psock); + send_ipselect(dev, conn); #endif /* Then set-up to send that amount of data with the offset * corresponding to the amount of data already sent. (this diff --git a/net/tcp/tcp_send_unbuffered.c b/net/tcp/tcp_send_unbuffered.c index 385c385a29..114fd80355 100644 --- a/net/tcp/tcp_send_unbuffered.c +++ b/net/tcp/tcp_send_unbuffered.c @@ -179,24 +179,21 @@ static inline int send_timeout(FAR struct send_s *pstate) #ifdef NEED_IPDOMAIN_SUPPORT static inline void tcpsend_ipselect(FAR struct net_driver_s *dev, - FAR struct send_s *pstate) + FAR struct tcp_conn_s *conn) { - FAR struct socket *psock = pstate->snd_sock; - DEBUGASSERT(psock); - /* Which domain the the socket support */ - if (psock->s_domain == PF_INET) + if (conn->domain == PF_INET) { /* Select the IPv4 domain */ tcp_ipv4_select(dev); } - else /* if (psock->s_domain == PF_INET6) */ + else /* if (conn->domain == PF_INET6) */ { /* Select the IPv6 domain */ - DEBUGASSERT(psock->s_domain == PF_INET6); + DEBUGASSERT(conn->domain == PF_INET6); tcp_ipv4_select(dev); } } @@ -538,7 +535,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev, * place and we need do nothing. */ - tcpsend_ipselect(dev, pstate); + tcpsend_ipselect(dev, conn); #endif /* Then set-up to send that amount of data. (this won't actually * happen until the polling cycle completes).