6loWPAN: Back out part of the last commit. That included two fixes for a problem. One that didn't work and is unnecessary and one that is necessary. The commit removes the former.

This commit is contained in:
Gregory Nutt 2017-04-06 18:11:04 -06:00
parent 494d996826
commit 58d0c1f228
2 changed files with 4 additions and 72 deletions

View File

@ -327,22 +327,6 @@ struct ipv6icmp_hdr_s
struct icmpv6_iphdr_s icmp;
};
/* IPv6 + TCP or UDP or ICMPv6 header */
union ipv6_hdr_u
{
struct ipv6_hdr_s ipv6;
#ifdef CONFIG_NET_TCP
struct ipv6tcp_hdr_s ipv6tcp;
#endif
#ifdef CONFIG_NET_UDP
struct ipv6udp_hdr_s ipv6udp;
#endif
#ifdef CONFIG_NET_ICMPv6
struct ipv6icmp_hdr_s ipv6icmp
#endif
};
/* IEEE802.15.4 Frame Definitions *******************************************/
/* The IEEE 802.15.4 frame has a number of constant/fixed fields that can be
* counted to make frame construction and max payload calculations easier.

View File

@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <string.h>
#include <semaphore.h>
#include <assert.h>
#include <errno.h>
@ -83,10 +82,10 @@ struct sixlowpan_send_s
int s_result; /* The result of the transfer */
uint16_t s_timeout; /* Send timeout in deciseconds */
systime_t s_time; /* Last send time for determining timeout */
FAR const struct ipv6_hdr_s *s_ipv6hdr; /* IPv6 header, followed by UDP or TCP header. */
FAR const struct rimeaddr_s *s_destmac; /* Destination MAC address */
FAR const void *s_buf; /* Data to send */
size_t s_len; /* Length of data in buf */
FAR const union ipv6_hdr_u s_ipv6hdr; /* IPv6 header, followed by UDP, TCP, or ICMPv6 header. */
};
/****************************************************************************
@ -181,8 +180,8 @@ static uint16_t send_interrupt(FAR struct net_driver_s *dev,
sinfo->s_result =
sixlowpan_queue_frames((FAR struct ieee802154_driver_s *)dev,
&sinfo->s_ipv6hdr.ipv6, sinfo->s_buf,
sinfo->s_len, sinfo->s_destmac);
sinfo->s_ipv6hdr, sinfo->s_buf, sinfo->s_len,
sinfo->s_destmac);
flags &= ~WPAN_POLL;
neighbor_reachable(dev);
@ -218,56 +217,6 @@ end_wait:
return flags;
}
/****************************************************************************
* Name: sixlowpan_ipv6_copy
*
* Description:
* Make a copy of the IPv6 + {TCP, UDP, ICMPv6} header structure.
*
* Input Parameters:
* ipv6hdr - IPv6 header followed by TCP or UDP header.
* sinfo - Send state structure reference
*
* Returned Value:
* None
*
****************************************************************************/
static void sixlowpan_ipv6_copy(FAR const struct ipv6_hdr_s *ipv6hdr,
FAR struct sixlowpan_send_s *sinfo)
{
size_t structsize;
switch (ipv6hdr->proto)
{
#ifdef CONFIG_NET_TCP
case IP_PROTO_TCP:
structsize = sizeof(struct ipv6tcp_hdr_s);
break;
#endif
#ifdef CONFIG_NET_UDP
case IP_PROTO_UDP:
structsize = sizeof(struct ipv6udp_hdr_s);
break;
#endif
#ifdef CONFIG_NET_ICMPv6
case IP_PROTO_ICMP6:
structsize = sizeof(struct ipv6icmp_hdr_s);
break;
#endif
default:
nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto);
structsize = sizeof(struct ipv6_hdr_s);
break;
}
memcpy((FAR void *)&sinfo->s_ipv6hdr, (FAR const void *)ipv6hdr,
structsize);
}
/****************************************************************************
* Public Functions
****************************************************************************/
@ -322,12 +271,11 @@ int sixlowpan_send(FAR struct net_driver_s *dev,
sinfo.s_result = -EBUSY;
sinfo.s_timeout = timeout;
sinfo.s_time = clock_systimer();
sinfo.s_ipv6hdr = ipv6hdr;
sinfo.s_destmac = destmac;
sinfo.s_buf = buf;
sinfo.s_len = len;
sixlowpan_ipv6_copy(ipv6hdr, &sinfo);
net_lock();
if (len > 0)
{