diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 8f0169d5132c..356f27f31c0f 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -2277,7 +2277,7 @@ icmp6_redirect_input(struct mbuf *m, int off) in6_splitscope(&reddst6, &kdst, &scopeid); NET_EPOCH_ASSERT(); nh = fib6_lookup(ifp->if_fib, &kdst, scopeid, 0, 0); - if (nh == NULL) { + if (nh != NULL) { struct in6_addr nh_addr; nh_addr = ifatoia6(nh->nh_ifa)->ia_addr.sin6_addr; if ((nh->nh_flags & NHF_GATEWAY) == 0) { diff --git a/tests/sys/netinet6/redirect.sh b/tests/sys/netinet6/redirect.sh index acf0f501034d..f2c869544dff 100644 --- a/tests/sys/netinet6/redirect.sh +++ b/tests/sys/netinet6/redirect.sh @@ -87,7 +87,15 @@ valid_redirect_body() { local_ll_mac=`jexec ${jname} ifconfig ${epair}b ether | awk '$1~/ether/{print$2}'` # wait for DAD to complete - sleep 2 + while [ `ifconfig ${epair}a inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + while [ `jexec ${jname}b ifconfig ${epair}b inet6 | grep -c tentative` != "0" ]; do + sleep 0.1 + done + + # enable ND debugging in the target jail to ease catching errors + jexec ${jname} sysctl net.inet6.icmp6.nd6_debug=1 # echo "LOCAL: ${local_ll_ip} ${local_ll_mac}" # echo "REMOTE: ${remote_rtr_ll_ip} ${remote_rtr_mac}"