Back out most of previous commit

This commit is contained in:
Gregory Nutt 2016-02-26 06:45:37 -06:00
parent b0ea870bcc
commit 8db55f6493
15 changed files with 28 additions and 54 deletions

View File

@ -11523,6 +11523,4 @@
data buffers (2016-02-22). data buffers (2016-02-22).
* fs/fat: Add an option to force all transfers to be performed indirectly * fs/fat: Add an option to force all transfers to be performed indirectly
using the FAT file system's internal sector buffers (2016-02-22). using the FAT file system's internal sector buffers (2016-02-22).
* net/: Add basic support for IEEE 802.15-4 sockets. Compiles but still
missing a few things (2016-02-25).

View File

@ -216,8 +216,7 @@ int netdev_register(FAR struct net_driver_s *dev, enum net_lltype_e lltype)
#ifdef CONFIG_NET_IEEE802154 #ifdef CONFIG_NET_IEEE802154
case NET_LL_IEEE802154: /* IEEE802.15-4 */ case NET_LL_IEEE802154: /* IEEE802.15-4 */
# warning Missing IEEE 802.15-4 logic: Header length dev->d_llhdrlen = 0; /* REVISIT */
//dev->d_llhdrlen = ???;
dev->d_mtu = CONFIG_NET_IEEE802154_MTU; dev->d_mtu = CONFIG_NET_IEEE802154_MTU;
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
dev->d_recvwndo = CONFIG_NET_IEEE802154_TCP_RECVWNDO; dev->d_recvwndo = CONFIG_NET_IEEE802154_TCP_RECVWNDO;

View File

@ -301,12 +301,12 @@ static inline void netclose_txnotify(FAR struct socket *psock,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
{ {
/* Notify the device driver that send data is available */ /* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154); DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else #else

View File

@ -175,8 +175,7 @@ static uint16_t ack_interrupt(FAR struct net_driver_s *dev, FAR void *pvconn,
if (IFF_IS_IPv6(dev->d_flags)) if (IFF_IS_IPv6(dev->d_flags))
#endif #endif
{ {
DEBUGASSERT(pstate->snd_sock == PF_INET6 || DEBUGASSERT(pstate->snd_sock == PF_INET6);
pstate->snd_sock == PF_IEEE802154);
tcp = TCPIPv6BUF; tcp = TCPIPv6BUF;
} }
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
@ -515,14 +514,12 @@ static inline void sendfile_txnotify(FAR struct socket *psock,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
{ {
/* Notify the device driver that send data is available */ /* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else #else

View File

@ -1024,7 +1024,7 @@ static inline void recvfrom_udpsender(struct net_driver_s *dev, struct recvfrom_
* class of addresses, the IPv4-mapped IPv6 addresses. * class of addresses, the IPv4-mapped IPv6 addresses.
*/ */
if (conn->domain == PF_INET6 || conn->domain == PF_IEEE802154) if (conn->domain == PF_INET6)
{ {
FAR struct sockaddr_in6 *infrom6 = (FAR struct sockaddr_in6 *)infrom; FAR struct sockaddr_in6 *infrom6 = (FAR struct sockaddr_in6 *)infrom;
FAR socklen_t *fromlen = pstate->rf_fromlen; FAR socklen_t *fromlen = pstate->rf_fromlen;
@ -1350,12 +1350,12 @@ static inline void recvfrom_udp_rxnotify(FAR struct socket *psock,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_INET6) */ else /* if (psock->s_domain == PF_INET6) */
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
{ {
/* Notify the device driver of the receive ready */ /* Notify the device driver of the receive ready */
DEBUGASSERT(psock->s_domain == PF_INET6 || psock->s_domain == PF_INET6); DEBUGASSERT(psock->s_domain == PF_INET6);
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_rxnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); netdev_ipv6_rxnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else #else
@ -1892,9 +1892,6 @@ ssize_t psock_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
case PF_INET6: case PF_INET6:
#ifdef CONFIG_NET_IEEE802145
case PF_IEEE802154:
#endif
{ {
minlen = sizeof(struct sockaddr_in6); minlen = sizeof(struct sockaddr_in6);
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* net/socket/socket.c * net/socket/socket.c
* *
* Copyright (C) 2007-2009, 2012, 2014-2016 Gregory Nutt. All rights reserved. * Copyright (C) 2007-2009, 2012, 2014-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -250,7 +250,7 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
int ret; int ret;
int err; int err;
/* Only PF_INET, PF_INET6, PF_PACKET, PF_IEEE802154 domains supported */ /* Only PF_INET, PF_INET6 or PF_PACKET domains supported */
switch (domain) switch (domain)
{ {
@ -265,9 +265,6 @@ int psock_socket(int domain, int type, int protocol, FAR struct socket *psock)
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
case PF_INET6: case PF_INET6:
#ifdef CONFIG_NET_IEEE802154
case PF_IEEE802154:
#endif
#ifdef CONFIG_NET_LOCAL #ifdef CONFIG_NET_LOCAL
ipdomain = true; ipdomain = true;
#endif #endif

View File

@ -149,7 +149,7 @@ struct tcp_conn_s
uint8_t sndseq[4]; /* The sequence number that was last sent by us */ uint8_t sndseq[4]; /* The sequence number that was last sent by us */
uint8_t crefs; /* Reference counts on this instance */ uint8_t crefs; /* Reference counts on this instance */
#if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6) #if defined(CONFIG_NET_IPv4) && defined(CONFIG_NET_IPv6)
uint8_t domain; /* IP domain: PF_INET, PF_INET6, or PF_IEEE802154 */ uint8_t domain; /* IP domain: PF_INET or PF_INET6 */
#endif #endif
uint8_t sa; /* Retransmission time-out calculation state uint8_t sa; /* Retransmission time-out calculation state
* variable */ * variable */

View File

@ -139,9 +139,7 @@ static inline void accept_tcpsender(FAR struct socket *psock,
{ {
FAR struct sockaddr_in6 *inaddr = (FAR struct sockaddr_in6 *)addr; FAR struct sockaddr_in6 *inaddr = (FAR struct sockaddr_in6 *)addr;
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
inaddr->sin6_family = AF_INET6; inaddr->sin6_family = AF_INET6;
inaddr->sin6_port = conn->rport; inaddr->sin6_port = conn->rport;
net_ipv6addr_copy(inaddr->sin6_addr.s6_addr, conn->u.ipv6.raddr); net_ipv6addr_copy(inaddr->sin6_addr.s6_addr, conn->u.ipv6.raddr);

View File

@ -977,8 +977,6 @@ FAR struct tcp_conn_s *tcp_alloc_accept(FAR struct net_driver_s *dev,
domain = ipv6 ? PF_INET6 : PF_INET; domain = ipv6 ? PF_INET6 : PF_INET;
#elif defined(CONFIG_NET_IPv4) #elif defined(CONFIG_NET_IPv4)
domain = PF_INET; domain = PF_INET;
#elif defined(CONFIG_NET_IEEE802154)
domain = PF_IEEE80254;
#else /* defined(CONFIG_NET_IPv6) */ #else /* defined(CONFIG_NET_IPv6) */
domain = PF_INET6; domain = PF_INET6;
#endif #endif

View File

@ -241,13 +241,11 @@ static inline void send_ipselect(FAR struct net_driver_s *dev,
tcp_ipv4_select(dev); tcp_ipv4_select(dev);
} }
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
{ {
/* Select the IPv6 domain */ /* Select the IPv6 domain */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
tcp_ipv4_select(dev); tcp_ipv4_select(dev);
} }
} }
@ -859,14 +857,12 @@ static inline void send_txnotify(FAR struct socket *psock,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
{ {
/* Notify the device driver that send data is available */ /* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else #else

View File

@ -190,13 +190,11 @@ static inline void tcpsend_ipselect(FAR struct net_driver_s *dev,
tcp_ipv4_select(dev); tcp_ipv4_select(dev);
} }
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
{ {
/* Select the IPv6 domain */ /* Select the IPv6 domain */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
tcp_ipv4_select(dev); tcp_ipv4_select(dev);
} }
} }
@ -639,14 +637,12 @@ static inline void send_txnotify(FAR struct socket *psock,
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
#endif /* CONFIG_NET_IPv4 */ #endif /* CONFIG_NET_IPv4 */
{ {
/* Notify the device driver that send data is available */ /* Notify the device driver that send data is available */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
#ifdef CONFIG_NETDEV_MULTINIC #ifdef CONFIG_NETDEV_MULTINIC
netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr); netdev_ipv6_txnotify(conn->u.ipv6.laddr, conn->u.ipv6.raddr);
#else #else

View File

@ -85,7 +85,7 @@ struct udp_conn_s
union ip_binding_u u; /* IP address binding */ union ip_binding_u u; /* IP address binding */
uint16_t lport; /* Bound local port number (network byte order) */ uint16_t lport; /* Bound local port number (network byte order) */
uint16_t rport; /* Remote port number (network byte order) */ uint16_t rport; /* Remote port number (network byte order) */
uint8_t domain; /* IP domain: PF_INET, PF_INET6, or PF_IEEE802145 */ uint8_t domain; /* IP domain: PF_INET or PF_INET6 */
uint8_t ttl; /* Default time-to-live */ uint8_t ttl; /* Default time-to-live */
uint8_t crefs; /* Reference counts on this instance */ uint8_t crefs; /* Reference counts on this instance */

View File

@ -130,7 +130,7 @@ static uint16_t udp_datahandler(FAR struct net_driver_s *dev, FAR struct udp_con
* class of addresses, the IPv4-mapped IPv6 addresses. * class of addresses, the IPv4-mapped IPv6 addresses.
*/ */
if (conn->domain == PF_INET6 || conn->domain == PF_IEEE802154) if (conn->domain == PF_INET6)
{ {
FAR struct udp_hdr_s *udp = UDPIPv6BUF; FAR struct udp_hdr_s *udp = UDPIPv6BUF;
FAR struct ipv6_hdr_s *ipv6 = IPv6BUF; FAR struct ipv6_hdr_s *ipv6 = IPv6BUF;

View File

@ -188,13 +188,11 @@ static inline void sendto_ipselect(FAR struct net_driver_s *dev,
udp_ipv4_select(dev); udp_ipv4_select(dev);
} }
else /* if (psock->s_domain == PF_INET6 || psock->s_domain == PF_IEEE802154) */ else /* if (psock->s_domain == PF_INET6) */
{ {
/* Select the IPv6 domain */ /* Select the IPv6 domain */
DEBUGASSERT(psock->s_domain == PF_INET6 || DEBUGASSERT(psock->s_domain == PF_INET6);
psock->s_domain == PF_IEEE802154);
udp_ipv4_select(dev); udp_ipv4_select(dev);
} }
} }

View File

@ -109,7 +109,7 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn)
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET || if (conn->domain == PF_INET ||
((conn->domain == PF_INET6 || conn->domain == PF_IEEE802154) && (conn->domain == PF_INET6 &&
ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))) ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr)))
#endif #endif
{ {
@ -135,7 +135,7 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn)
net_ipv4addr_hdrcopy(ipv4->srcipaddr, &dev->d_ipaddr); net_ipv4addr_hdrcopy(ipv4->srcipaddr, &dev->d_ipaddr);
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
if ((conn->domain == PF_INET6 || conn->domain == PF_IEEE802154) && if (conn->domain == PF_INET6 &&
ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr)) ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))
{ {
in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr); in_addr_t raddr = ip6_get_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr);
@ -229,7 +229,7 @@ void udp_send(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn)
#ifdef CONFIG_NET_IPv4 #ifdef CONFIG_NET_IPv4
#ifdef CONFIG_NET_IPv6 #ifdef CONFIG_NET_IPv6
if (conn->domain == PF_INET || if (conn->domain == PF_INET ||
((conn->domain == PF_INET6 || conn->domain == PF_IEEE802154) && (conn->domain == PF_INET6 &&
ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr))) ip6_is_ipv4addr((FAR struct in6_addr *)conn->u.ipv6.raddr)))
#endif #endif
{ {