-/* $OpenBSD: nd6.c,v 1.272 2023/04/05 23:01:03 kn Exp $ */
+/* $OpenBSD: nd6.c,v 1.273 2023/05/02 06:06:13 bluhm Exp $ */
/* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */
/*
if (ln->ln_asked < nd6_mmaxtries) {
ln->ln_asked++;
nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
- nd6_ns_output(ifp, NULL, &dst->sin6_addr, ln, 0);
+ nd6_ns_output(ifp, NULL, &dst->sin6_addr,
+ &ln->ln_saddr6, 0);
} else {
struct mbuf_list ml;
struct mbuf *m;
ln = NULL;
}
break;
+
case ND6_LLINFO_REACHABLE:
if (!ND6_LLINFO_PERMANENT(ln)) {
ln->ln_state = ND6_LLINFO_STALE;
ln->ln_asked = 1;
ln->ln_state = ND6_LLINFO_PROBE;
nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
- nd6_ns_output(ifp, &dst->sin6_addr, &dst->sin6_addr, ln, 0);
+ nd6_ns_output(ifp, &dst->sin6_addr, &dst->sin6_addr,
+ &ln->ln_saddr6, 0);
break;
+
case ND6_LLINFO_PROBE:
if (ln->ln_asked < nd6_umaxtries) {
ln->ln_asked++;
nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
- nd6_ns_output(ifp, &dst->sin6_addr,
- &dst->sin6_addr, ln, 0);
+ nd6_ns_output(ifp, &dst->sin6_addr, &dst->sin6_addr,
+ &ln->ln_saddr6, 0);
} else {
nd6_free(rt);
ln = NULL;
struct sockaddr_dl *sdl;
struct rtentry *rt;
struct llinfo_nd6 *ln = NULL;
+ struct in6_addr saddr6;
time_t uptime;
+ int solicit = 0;
if (m->m_flags & M_MCAST) {
ETHER_MAP_IPV6_MULTICAST(&satosin6(dst)->sin6_addr, desten);
if (!ND6_LLINFO_PERMANENT(ln) && ln->ln_asked == 0) {
ln->ln_asked++;
nd6_llinfo_settimer(ln, RETRANS_TIMER / 1000);
- nd6_ns_output(ifp, NULL, &satosin6(dst)->sin6_addr, ln, 0);
+ saddr6 = ln->ln_saddr6;
+ solicit = 1;
}
KERNEL_UNLOCK();
+
+ if (solicit)
+ nd6_ns_output(ifp, NULL, &satosin6(dst)->sin6_addr, &saddr6, 0);
return (EAGAIN);
bad:
-/* $OpenBSD: nd6.h,v 1.97 2023/04/05 21:51:47 bluhm Exp $ */
+/* $OpenBSD: nd6.h,v 1.98 2023/05/02 06:06:13 bluhm Exp $ */
/* $KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $ */
/*
const struct in6_addr *, u_long, int, struct sockaddr *);
void nd6_ns_input(struct mbuf *, int, int);
void nd6_ns_output(struct ifnet *, const struct in6_addr *,
- const struct in6_addr *, const struct llinfo_nd6 *, int);
+ const struct in6_addr *, const struct in6_addr *, int);
caddr_t nd6_ifptomac(struct ifnet *);
void nd6_dad_start(struct ifaddr *);
void nd6_dad_stop(struct ifaddr *);
-/* $OpenBSD: nd6_nbr.c,v 1.146 2023/04/28 14:09:06 phessler Exp $ */
+/* $OpenBSD: nd6_nbr.c,v 1.147 2023/05/02 06:06:13 bluhm Exp $ */
/* $KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $ */
/*
*/
void
nd6_ns_output(struct ifnet *ifp, const struct in6_addr *daddr6,
- const struct in6_addr *taddr6, const struct llinfo_nd6 *ln, int dad)
+ const struct in6_addr *taddr6, const struct in6_addr *saddr6, int dad)
{
struct mbuf *m;
struct ip6_hdr *ip6;
bzero(&dst_sa, sizeof(dst_sa));
src_sa.sin6_family = dst_sa.sin6_family = AF_INET6;
src_sa.sin6_len = dst_sa.sin6_len = sizeof(struct sockaddr_in6);
- if (daddr6)
+ if (daddr6 != NULL)
dst_sa.sin6_addr = *daddr6;
else {
dst_sa.sin6_addr.s6_addr16[0] = __IPV6_ADDR_INT16_MLL;
* - if taddr is link local saddr6 must be link local as well
* Otherwise, we perform the source address selection as usual.
*/
- if (ln != NULL)
- src_sa.sin6_addr = ln->ln_saddr6;
+ if (saddr6 != NULL)
+ src_sa.sin6_addr = *saddr6;
if (!IN6_IS_ADDR_LINKLOCAL(taddr6) ||
IN6_IS_ADDR_UNSPECIFIED(&src_sa.sin6_addr) ||
IN6_IS_ADDR_LINKLOCAL(&src_sa.sin6_addr) ||
!in6ifa_ifpwithaddr(ifp, &src_sa.sin6_addr)) {
-
struct rtentry *rt;
rt = rtalloc(sin6tosa(&dst_sa), RT_RESOLVE,