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: ip_output.c,v 1.393 2024/01/18 11:03:16 claudio Exp $ */
/* $OpenBSD: ip_output.c,v 1.394 2024/01/31 14:56:43 bluhm Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
@ -159,28 +159,15 @@ reroute:
*/
if (ro == NULL) {
ro = &iproute;
memset(ro, 0, sizeof(*ro));
ro->ro_rt = NULL;
}
dst = satosin(&ro->ro_dst);
/*
* If there is a cached route, check that it is to the same
* destination and is still up. If not, free it and try again.
*/
if (!rtisvalid(ro->ro_rt) ||
dst->sin_addr.s_addr != ip->ip_dst.s_addr ||
ro->ro_tableid != m->m_pkthdr.ph_rtableid) {
rtfree(ro->ro_rt);
ro->ro_rt = NULL;
}
if (ro->ro_rt == NULL) {
dst->sin_family = AF_INET;
dst->sin_len = sizeof(*dst);
dst->sin_addr = ip->ip_dst;
ro->ro_tableid = m->m_pkthdr.ph_rtableid;
}
route_cache(ro, ip->ip_dst, m->m_pkthdr.ph_rtableid);
dst = satosin(&ro->ro_dst);
if ((IN_MULTICAST(ip->ip_dst.s_addr) ||
(ip->ip_dst.s_addr == INADDR_BROADCAST)) &&