ICMPv6 w/Autoconfiguration: Fix a compile issue introduced with recent change for 6LoWPAN support.

This commit is contained in:
Gregory Nutt 2017-07-11 14:59:42 -06:00
parent 1e0560b22f
commit e105454937

View File

@ -224,6 +224,7 @@ void icmpv6_input(FAR struct net_driver_s *dev)
case ICMPV6_ROUTER_ADVERTISE: case ICMPV6_ROUTER_ADVERTISE:
{ {
FAR struct icmpv6_router_advertise_s *adv; FAR struct icmpv6_router_advertise_s *adv;
FAR uint8_t uint8_t *options;
uint16_t pktlen; uint16_t pktlen;
uint16_t optlen; uint16_t optlen;
int ndx; int ndx;
@ -241,14 +242,17 @@ void icmpv6_input(FAR struct net_driver_s *dev)
optlen = ICMPv6_RADV_OPTLEN(pktlen); optlen = ICMPv6_RADV_OPTLEN(pktlen);
/* We need to have a valid router advertisement with a Prefix and /* We need to have a valid router advertisement with a Prefix and
* with the "A" bit set in the flags. * with the "A" bit set in the flags. Options immediately follow
* the ICMPv6 router advertisement.
*/ */
adv = ICMPv6RADVERTISE; adv = ICMPv6RADVERTISE;
options = (FAR uint8_t *)adv + sizeof(struct icmpv6_router_advertise_s);
for (ndx = 0; ndx + sizeof(struct icmpv6_prefixinfo_s) <= optlen; ) for (ndx = 0; ndx + sizeof(struct icmpv6_prefixinfo_s) <= optlen; )
{ {
FAR struct icmpv6_prefixinfo_s *opt = FAR struct icmpv6_prefixinfo_s *opt =
(FAR struct icmpv6_prefixinfo_s *)&adv->options[ndx]; (FAR struct icmpv6_prefixinfo_s *)&options[ndx];
/* Is this the sought for prefix? Is it the correct size? Is /* Is this the sought for prefix? Is it the correct size? Is
* the "A" flag set? * the "A" flag set?