finetune the RA parsing procedure
Signed-off-by: luojun1 <luojun1@xiaomi.com> Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
parent
423ee67554
commit
7c2986bb34
@ -369,29 +369,47 @@ void icmpv6_input(FAR struct net_driver_s *dev, unsigned int iplen)
|
||||
|
||||
for (ndx = 0; ndx + sizeof(struct icmpv6_prefixinfo_s) <= optlen; )
|
||||
{
|
||||
FAR struct icmpv6_srclladdr_s *sllopt =
|
||||
(FAR struct icmpv6_srclladdr_s *)&options[ndx];
|
||||
FAR struct icmpv6_generic_s *opt =
|
||||
(FAR struct icmpv6_generic_s *)&options[ndx];
|
||||
|
||||
if (sllopt->opttype == ICMPv6_OPT_SRCLLADDR)
|
||||
switch (opt->opttype)
|
||||
{
|
||||
neighbor_add(dev, ipv6->srcipaddr, sllopt->srclladdr);
|
||||
}
|
||||
case ICMPv6_OPT_SRCLLADDR:
|
||||
{
|
||||
FAR struct icmpv6_srclladdr_s *sllopt =
|
||||
(FAR struct icmpv6_srclladdr_s *)opt;
|
||||
neighbor_add(dev, ipv6->srcipaddr, sllopt->srclladdr);
|
||||
}
|
||||
break;
|
||||
|
||||
FAR struct icmpv6_prefixinfo_s *opt =
|
||||
(FAR struct icmpv6_prefixinfo_s *)&options[ndx];
|
||||
case ICMPv6_OPT_PREFIX:
|
||||
{
|
||||
FAR struct icmpv6_prefixinfo_s *prefixopt =
|
||||
(FAR struct icmpv6_prefixinfo_s *)opt;
|
||||
|
||||
/* Is this the sought for prefix? Is it the correct size? Is
|
||||
* the "A" flag set?
|
||||
*/
|
||||
/* Is the "A" flag set? */
|
||||
|
||||
if (opt->opttype == ICMPv6_OPT_PREFIX &&
|
||||
(opt->flags & ICMPv6_PRFX_FLAG_A) != 0)
|
||||
{
|
||||
/* Yes.. Notify any waiting threads */
|
||||
if ((prefixopt->flags & ICMPv6_PRFX_FLAG_A) != 0)
|
||||
{
|
||||
/* Notify any waiting threads */
|
||||
|
||||
icmpv6_rnotify(dev, ipv6->srcipaddr,
|
||||
opt->prefix, opt->preflen);
|
||||
prefix = true;
|
||||
icmpv6_rnotify(dev, ipv6->srcipaddr,
|
||||
prefixopt->prefix, prefixopt->preflen);
|
||||
prefix = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ICMPv6_OPT_MTU:
|
||||
{
|
||||
FAR struct icmpv6_mtu_s *mtuopt =
|
||||
(FAR struct icmpv6_mtu_s *)opt;
|
||||
dev->d_pktsize = mtuopt->mtu;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Skip to the next option (units of octets) */
|
||||
|
Loading…
Reference in New Issue
Block a user