Merged in iktek01/nuttx (pull request #196)
Fixed some issues that prevented ipv6 to work with ipv4 enabled.
This commit is contained in:
commit
b8a715be97
@ -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
|
* 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
|
* 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
|
* holding the size of the entire packet, including the IP header but without
|
||||||
* layer header.
|
* the link layer header.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pktlen = ((uint16_t)ipv6->len[0] << 8) + (uint16_t)ipv6->len[1] +
|
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)
|
if (pktlen <= dev->d_len)
|
||||||
{
|
{
|
||||||
|
@ -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.
|
* 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);
|
tcp_ipv4_select(dev);
|
||||||
#else /* if defined(CONFIG_NET_IPv6) */
|
#else /* if defined(CONFIG_NET_IPv6) */
|
||||||
tcp_ipv6_select(dev);
|
tcp_ipv6_select(dev);
|
||||||
|
@ -228,21 +228,21 @@ static inline void psock_lost_connection(FAR struct socket *psock,
|
|||||||
|
|
||||||
#ifdef NEED_IPDOMAIN_SUPPORT
|
#ifdef NEED_IPDOMAIN_SUPPORT
|
||||||
static inline void send_ipselect(FAR struct net_driver_s *dev,
|
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 */
|
/* Which domain the the socket support */
|
||||||
|
|
||||||
if (psock->s_domain == PF_INET)
|
if (conn->domain == PF_INET)
|
||||||
{
|
{
|
||||||
/* Select the IPv4 domain */
|
/* Select the IPv4 domain */
|
||||||
|
|
||||||
tcp_ipv4_select(dev);
|
tcp_ipv4_select(dev);
|
||||||
}
|
}
|
||||||
else /* if (psock->s_domain == PF_INET6) */
|
else /* if (conn->domain == PF_INET6) */
|
||||||
{
|
{
|
||||||
/* Select the IPv6 domain */
|
/* Select the IPv6 domain */
|
||||||
|
|
||||||
DEBUGASSERT(psock->s_domain == PF_INET6);
|
DEBUGASSERT(conn->domain == PF_INET6);
|
||||||
tcp_ipv4_select(dev);
|
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.
|
* place and we need do nothing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
send_ipselect(dev, psock);
|
send_ipselect(dev, conn);
|
||||||
#endif
|
#endif
|
||||||
/* Then set-up to send that amount of data with the offset
|
/* Then set-up to send that amount of data with the offset
|
||||||
* corresponding to the amount of data already sent. (this
|
* corresponding to the amount of data already sent. (this
|
||||||
|
@ -179,24 +179,21 @@ static inline int send_timeout(FAR struct send_s *pstate)
|
|||||||
|
|
||||||
#ifdef NEED_IPDOMAIN_SUPPORT
|
#ifdef NEED_IPDOMAIN_SUPPORT
|
||||||
static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
|
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 */
|
/* Which domain the the socket support */
|
||||||
|
|
||||||
if (psock->s_domain == PF_INET)
|
if (conn->domain == PF_INET)
|
||||||
{
|
{
|
||||||
/* Select the IPv4 domain */
|
/* Select the IPv4 domain */
|
||||||
|
|
||||||
tcp_ipv4_select(dev);
|
tcp_ipv4_select(dev);
|
||||||
}
|
}
|
||||||
else /* if (psock->s_domain == PF_INET6) */
|
else /* if (conn->domain == PF_INET6) */
|
||||||
{
|
{
|
||||||
/* Select the IPv6 domain */
|
/* Select the IPv6 domain */
|
||||||
|
|
||||||
DEBUGASSERT(psock->s_domain == PF_INET6);
|
DEBUGASSERT(conn->domain == PF_INET6);
|
||||||
tcp_ipv4_select(dev);
|
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.
|
* place and we need do nothing.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcpsend_ipselect(dev, pstate);
|
tcpsend_ipselect(dev, conn);
|
||||||
#endif
|
#endif
|
||||||
/* Then set-up to send that amount of data. (this won't actually
|
/* Then set-up to send that amount of data. (this won't actually
|
||||||
* happen until the polling cycle completes).
|
* happen until the polling cycle completes).
|
||||||
|
Loading…
Reference in New Issue
Block a user