sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-01 02:39:06 +00:00
parent fe0bbab526
commit 6d4aa64db6
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
32 changed files with 551 additions and 517 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in6.h,v 1.112 2024/01/27 21:13:46 bluhm Exp $ */
/* $OpenBSD: in6.h,v 1.113 2024/01/31 14:56:43 bluhm Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@ -145,10 +145,11 @@ extern const struct in6_addr in6addr_linklocal_allrouters;
#if __BSD_VISIBLE
/*
* IPv6 route structure
* IPv6 route structure, keep fields in sync with struct route
*/
struct route_in6 {
struct rtentry *ro_rt;
u_long ro_generation;
u_long ro_tableid; /* padded to long for alignment */
struct sockaddr_in6 ro_dst;
};

View file

@ -1,4 +1,4 @@
/* $OpenBSD: in6_pcb.c,v 1.133 2024/01/28 20:34:25 bluhm Exp $ */
/* $OpenBSD: in6_pcb.c,v 1.134 2024/01/31 12:27:57 bluhm Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -561,6 +561,35 @@ in6_pcbnotify(struct inpcbtable *table, const struct sockaddr_in6 *dst,
rw_exit_write(&table->inpt_notify);
}
struct rtentry *
in6_pcbrtentry(struct inpcb *inp)
{
struct route_in6 *ro = &inp->inp_route6;
/* check if route is still valid */
if (!rtisvalid(ro->ro_rt)) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}
/*
* No route yet, so try to acquire one.
*/
if (ro->ro_rt == NULL) {
memset(ro, 0, sizeof(struct route_in6));
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_faddr6))
return (NULL);
ro->ro_dst.sin6_family = AF_INET6;
ro->ro_dst.sin6_len = sizeof(struct sockaddr_in6);
ro->ro_dst.sin6_addr = inp->inp_faddr6;
ro->ro_tableid = inp->inp_rtableid;
ro->ro_rt = rtalloc_mpath(sin6tosa(&ro->ro_dst),
&inp->inp_laddr6.s6_addr32[0], ro->ro_tableid);
}
return (ro->ro_rt);
}
struct inpcb *
in6_pcbhash_lookup(struct inpcbtable *table, uint64_t hash, u_int rdomain,
const struct in6_addr *faddr, u_short fport,

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_output.c,v 1.283 2024/01/18 11:03:16 claudio Exp $ */
/* $OpenBSD: ip6_output.c,v 1.284 2024/01/31 12:27:57 bluhm Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/*
@ -1486,7 +1486,7 @@ do { \
if (!(so->so_state & SS_ISCONNECTED))
return (ENOTCONN);
rt = in_pcbrtentry(inp);
rt = in6_pcbrtentry(inp);
if (!rtisvalid(rt))
return (EHOSTUNREACH);