net/lwip: fix the exception order
According to RFC 4862 clause 5.4.5.
If DAD is failed, interface SHOULD be disabled, but it was not processed
because of the exception order.
@@ -418,16 +418,6 @@ void nd6_input(struct pbuf *p, struct netif *inp)
/* Check for ANY address in src (DAD algorithm). */
if (ip6_addr_isany(ip6_current_src_addr())) {
- if (lladdr_opt != NULL) {
- /* RFC 7.1.1.
- * If the IP source address is the unspecified address, there is no
- * source link-layer address option in the message. */
- pbuf_free(p);
- ND6_STATS_INC(nd6.proterr);
- ND6_STATS_INC(nd6.drop);
- return;
- }
-
if (ip6_addr_issolicitednode(ip6_current_dest_addr())) {
/* Sender is validating this address. */
for (i = 0; i < LWIP_IPV6_NUM_ADDRESSES; ++i) {
@@ -449,6 +439,16 @@ void nd6_input(struct pbuf *p, struct netif *inp)
ND6_STATS_INC(nd6.drop);
return;
}
+
+ if (lladdr_opt != NULL) {
+ /* RFC 7.1.1.
+ * If the IP source address is the unspecified address, there is no
+ * source link-layer address option in the message. */
+ pbuf_free(p);
+ ND6_STATS_INC(nd6.proterr);
+ ND6_STATS_INC(nd6.drop);
+ return;
+ }
} else {
ip6_addr_t target_address;
