- while (optlen > 0) {
- size_t l = opt->len << 3;
-
- if (optlen < sizeof(*opt))
- return 0;
-
- if (l > optlen || l == 0)
- return 0;
-
- if (opt->type == ND_OPT_SOURCE_LINKADDR && IN6_IS_ADDR_UNSPECIFIED(&source->sin6_addr) &&
- hdr->icmp6_type == ND_ROUTER_SOLICIT) {
- return 0;
- }
-
- opt = (struct icmpv6_opt *)(((uint8_t *)opt) + l);
-
- optlen -= l;
- }
+ icmpv6_for_each_option(opt, opt, end)
+ if (opt->type == ND_OPT_SOURCE_LINKADDR &&
+ IN6_IS_ADDR_UNSPECIFIED(&source->sin6_addr) &&
+ hdr->icmp6_type == ND_ROUTER_SOLICIT)
+ return false;