sync with OpenBSD -current

This commit is contained in:
purplerain 2024-02-28 20:57:49 +00:00
parent 8d80bb2dde
commit 0f90c06c31
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
15 changed files with 176 additions and 142 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_purp.c,v 1.35 2024/01/07 16:22:46 tb Exp $ */ /* $OpenBSD: x509_purp.c,v 1.36 2024/02/28 16:26:08 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2001. * project 2001.
*/ */
@ -177,10 +177,12 @@ X509_check_purpose(X509 *x, int id, int ca)
if (id == -1) if (id == -1)
return 1; return 1;
idx = X509_PURPOSE_get_by_id(id);
if (idx == -1) if ((idx = X509_PURPOSE_get_by_id(id)) == -1)
return -1; return -1;
pt = X509_PURPOSE_get0(idx); if ((pt = X509_PURPOSE_get0(idx)) == NULL)
return -1;
return pt->check_purpose(pt, x, ca); return pt->check_purpose(pt, x, ca);
} }
LCRYPTO_ALIAS(X509_check_purpose); LCRYPTO_ALIAS(X509_check_purpose);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: x509_vfy.c,v 1.140 2024/02/23 09:50:19 tb Exp $ */ /* $OpenBSD: x509_vfy.c,v 1.141 2024/02/28 12:21:16 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved. * All rights reserved.
* *
@ -2204,7 +2204,7 @@ X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose_id)
if (ctx->param->purpose == 0) if (ctx->param->purpose == 0)
ctx->param->purpose = purpose_id; ctx->param->purpose = purpose_id;
if (ctx->param->trust == 0) if (ctx->param->trust == 0)
ctx->param->trust = purpose->trust; ctx->param->trust = X509_PURPOSE_get_trust(purpose);
return 1; return 1;
} }

View file

@ -1,28 +1,31 @@
# $OpenBSD: Makefile,v 1.6 2023/10/11 18:07:15 anton Exp $ # $OpenBSD: Makefile,v 1.7 2024/02/28 06:33:39 anton Exp $
REGRESS_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn REGRESS_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn
REGRESS_ROOT_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn REGRESS_ROOT_TARGETS= vxlan_1 vxlan_2.inet vxlan_2.dyn
N1= 11 N1= 11
N2= 12 N2= 12
RDOMAINS= ${N1} ${N2} N3= 13
IFACE_NUMS= 11 12 N4= 14
N5= 15
vxlan_1: vxlan_1:
${SUDO} ksh ${.CURDIR}/$@.sh -R "${RDOMAINS}" -I "${IFACE_NUMS}" ${SUDO} ksh ${.CURDIR}/$@.sh -R "${N1} ${N2}" -I "${N1} ${N2}"
vxlan_2.inet: vxlan_2.inet:
${SUDO} ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet ${SUDO} ksh ${.CURDIR}/${@:R}.sh \
-R "${N1} ${N2} ${N3} ${N4} ${N5}" -f inet
vxlan_2.dyn: vxlan_2.dyn:
env SUDO="${SUDO}" DYNAMIC=1 \ env SUDO="${SUDO}" DYNAMIC=1 \
ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet ksh ${.CURDIR}/${@:R}.sh -R "${N1} ${N2} ${N3} ${N4} ${N5}" -f inet
vxlan_2.inet6: vxlan_2.inet6:
${SUDO} ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet6 ${SUDO} ksh ${.CURDIR}/${@:R}.sh \
-R "${N1} ${N2} ${N3} ${N4} ${N5}" -f inet6
vxlan_2.dyn6: vxlan_2.dyn6:
env SUDO="${SUDO}" DYNAMIC=1 \ env SUDO="${SUDO}" DYNAMIC=1 \
ksh ${.CURDIR}/${@:R}.sh -R "40 41 42 43 44" -f inet6 ksh ${.CURDIR}/${@:R}.sh -R "${N1} ${N2} ${N3} ${N4} ${N5}" -f inet6
.include <bsd.regress.mk> .include <bsd.regress.mk>

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: ppp.4,v 1.16 2015/07/28 14:31:50 sthen Exp $ .\" $OpenBSD: ppp.4,v 1.17 2024/02/28 16:08:34 denis Exp $
.\" .\"
.\" Copyright (c) 1983, 1991, 1993 .\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved. .\" The Regents of the University of California. All rights reserved.
@ -29,7 +29,7 @@
.\" .\"
.\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93 .\" From: @(#)lo.4 8.1 (Berkeley) 6/5/93
.\" .\"
.Dd $Mdocdate: July 28 2015 $ .Dd $Mdocdate: February 28 2024 $
.Dt PPP 4 .Dt PPP 4
.Os .Os
.Sh NAME .Sh NAME
@ -80,11 +80,3 @@ The
.Nm .Nm
device appeared in device appeared in
.Ox 1.2 . .Ox 1.2 .
.Sh BUGS
Currently, only the
.Xr ip 4
protocol is supported by this device.
Note that the
.Xr pppoe 4
device does support
.Xr ip6 4 .

View file

@ -1,4 +1,4 @@
/* $OpenBSD: cpu.c,v 1.105 2024/02/23 21:52:12 kettenis Exp $ */ /* $OpenBSD: cpu.c,v 1.106 2024/02/28 00:53:16 jsg Exp $ */
/* /*
* Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com> * Copyright (c) 2016 Dale Rahn <drahn@dalerahn.com>
@ -766,7 +766,7 @@ cpu_identify(struct cpu_info *ci)
} }
/* /*
* ID_AA64PFR0 * ID_AA64PFR1
*/ */
id = READ_SPECIALREG(id_aa64pfr1_el1); id = READ_SPECIALREG(id_aa64pfr1_el1);
@ -782,6 +782,11 @@ cpu_identify(struct cpu_info *ci)
if (ID_AA64PFR1_SBSS(id) >= ID_AA64PFR1_SBSS_PSTATE_MSR) if (ID_AA64PFR1_SBSS(id) >= ID_AA64PFR1_SBSS_PSTATE_MSR)
printf("+MSR"); printf("+MSR");
if (ID_AA64PFR1_MTE(id) >= ID_AA64PFR1_MTE_IMPL) {
printf("%sMTE", sep);
sep = ",";
}
#ifdef CPU_DEBUG #ifdef CPU_DEBUG
id = READ_SPECIALREG(id_aa64afr0_el1); id = READ_SPECIALREG(id_aa64afr0_el1);
printf("\nID_AA64AFR0_EL1: 0x%016llx", id); printf("\nID_AA64AFR0_EL1: 0x%016llx", id);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: fxp.c,v 1.133 2023/11/10 15:51:20 bluhm Exp $ */ /* $OpenBSD: fxp.c,v 1.134 2024/02/28 12:53:31 miod Exp $ */
/* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */ /* $NetBSD: if_fxp.c,v 1.2 1997/06/05 02:01:55 thorpej Exp $ */
/* /*
@ -1382,11 +1382,12 @@ fxp_init(void *xsc)
else else
bufs = FXP_NRFABUFS_MIN; bufs = FXP_NRFABUFS_MIN;
if (sc->rx_bufs > bufs) { if (sc->rx_bufs > bufs) {
while (sc->rfa_headm != NULL && sc->rx_bufs-- > bufs) { while (sc->rfa_headm != NULL && sc->rx_bufs > bufs) {
rxmap = *((bus_dmamap_t *)sc->rfa_headm->m_ext.ext_buf); rxmap = *((bus_dmamap_t *)sc->rfa_headm->m_ext.ext_buf);
bus_dmamap_unload(sc->sc_dmat, rxmap); bus_dmamap_unload(sc->sc_dmat, rxmap);
FXP_RXMAP_PUT(sc, rxmap); FXP_RXMAP_PUT(sc, rxmap);
sc->rfa_headm = m_free(sc->rfa_headm); sc->rfa_headm = m_free(sc->rfa_headm);
sc->rx_bufs--;
} }
} else if (sc->rx_bufs < bufs) { } else if (sc->rx_bufs < bufs) {
int err, tmp_rx_bufs = sc->rx_bufs; int err, tmp_rx_bufs = sc->rx_bufs;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_sched.c,v 1.94 2024/01/24 19:23:38 cheloha Exp $ */ /* $OpenBSD: kern_sched.c,v 1.95 2024/02/28 13:43:44 mpi Exp $ */
/* /*
* Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org> * Copyright (c) 2007, 2008 Artur Grabowski <art@openbsd.org>
* *
@ -293,8 +293,7 @@ setrunqueue(struct cpu_info *ci, struct proc *p, uint8_t prio)
if (cpuset_isset(&sched_idle_cpus, p->p_cpu)) if (cpuset_isset(&sched_idle_cpus, p->p_cpu))
cpu_unidle(p->p_cpu); cpu_unidle(p->p_cpu);
else if (prio < spc->spc_curpriority)
if (prio < spc->spc_curpriority)
need_resched(ci); need_resched(ci);
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_ppp.c,v 1.117 2020/08/21 22:59:27 kn Exp $ */ /* $OpenBSD: if_ppp.c,v 1.118 2024/02/28 16:08:34 denis Exp $ */
/* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */ /* $NetBSD: if_ppp.c,v 1.39 1997/05/17 21:11:59 christos Exp $ */
/* /*
@ -494,6 +494,11 @@ pppioctl(struct ppp_softc *sc, u_long cmd, caddr_t data, int flag,
case PPP_IP: case PPP_IP:
npx = NP_IP; npx = NP_IP;
break; break;
#ifdef INET6
case PPP_IPV6:
npx = NP_IPV6;
break;
#endif
default: default:
return EINVAL; return EINVAL;
} }
@ -579,15 +584,19 @@ pppsioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
break; break;
case SIOCSIFADDR: case SIOCSIFADDR:
if (ifa->ifa_addr->sa_family != AF_INET)
error = EAFNOSUPPORT;
break;
case SIOCSIFDSTADDR: case SIOCSIFDSTADDR:
if (ifa->ifa_addr->sa_family != AF_INET) switch (ifa->ifa_addr->sa_family) {
case AF_INET:
break;
#ifdef INET6
case AF_INET6:
break;
#endif
default:
error = EAFNOSUPPORT; error = EAFNOSUPPORT;
break;
}
break; break;
case SIOCSIFMTU: case SIOCSIFMTU:
sc->sc_if.if_mtu = ifr->ifr_mtu; sc->sc_if.if_mtu = ifr->ifr_mtu;
break; break;
@ -674,6 +683,14 @@ pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
protocol = PPP_IP; protocol = PPP_IP;
mode = sc->sc_npmode[NP_IP]; mode = sc->sc_npmode[NP_IP];
break; break;
#ifdef INET6
case AF_INET6:
address = PPP_ALLSTATIONS;
control = PPP_UI;
protocol = PPP_IPV6;
mode = sc->sc_npmode[NP_IPV6];
break;
#endif
case AF_UNSPEC: case AF_UNSPEC:
address = PPP_ADDRESS(dst->sa_data); address = PPP_ADDRESS(dst->sa_data);
control = PPP_CONTROL(dst->sa_data); control = PPP_CONTROL(dst->sa_data);
@ -804,6 +821,11 @@ ppp_requeue(struct ppp_softc *sc)
case PPP_IP: case PPP_IP:
mode = sc->sc_npmode[NP_IP]; mode = sc->sc_npmode[NP_IP];
break; break;
#ifdef INET6
case PPP_IPV6:
mode = sc->sc_npmode[NP_IPV6];
break;
#endif
default: default:
mode = NPMODE_PASS; mode = NPMODE_PASS;
} }
@ -1391,7 +1413,25 @@ ppp_inproc(struct ppp_softc *sc, struct mbuf *m)
ipv4_input(ifp, m); ipv4_input(ifp, m);
rv = 1; rv = 1;
break; break;
#ifdef INET6
case PPP_IPV6:
/*
* IPv6 packet - take off the ppp header and pass it up to IPv6.
*/
if ((ifp->if_flags & IFF_UP) == 0 ||
sc->sc_npmode[NP_IPV6] != NPMODE_PASS) {
/* interface is down - drop the packet. */
m_freem(m);
return;
}
m->m_pkthdr.len -= PPP_HDRLEN;
m->m_data += PPP_HDRLEN;
m->m_len -= PPP_HDRLEN;
ipv6_input(ifp, m);
rv = 1;
break;
#endif
default: default:
/* /*
* Some other protocol - place on input queue for read(). * Some other protocol - place on input queue for read().

View file

@ -1,4 +1,4 @@
/* $OpenBSD: if_pppvar.h,v 1.20 2020/05/20 06:44:30 mpi Exp $ */ /* $OpenBSD: if_pppvar.h,v 1.21 2024/02/28 16:08:34 denis Exp $ */
/* $NetBSD: if_pppvar.h,v 1.5 1997/01/03 07:23:29 mikel Exp $ */ /* $NetBSD: if_pppvar.h,v 1.5 1997/01/03 07:23:29 mikel Exp $ */
/* /*
* if_pppvar.h - private structures and declarations for PPP. * if_pppvar.h - private structures and declarations for PPP.
@ -81,7 +81,8 @@
* indexing sc_npmode. * indexing sc_npmode.
*/ */
#define NP_IP 0 /* Internet Protocol */ #define NP_IP 0 /* Internet Protocol */
#define NUM_NP 1 /* Number of NPs. */ #define NP_IPV6 1 /* Internet Protocol v6 */
#define NUM_NP 2 /* Number of NPs. */
struct ppp_pkt; struct ppp_pkt;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip_input.c,v 1.390 2024/02/22 14:25:58 bluhm Exp $ */ /* $OpenBSD: ip_input.c,v 1.391 2024/02/28 10:57:20 bluhm Exp $ */
/* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */
/* /*
@ -391,7 +391,10 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
struct rtentry *rt = NULL; struct rtentry *rt = NULL;
struct ip *ip; struct ip *ip;
int hlen; int hlen;
in_addr_t pfrdr = 0; #if NPF > 0
struct in_addr odst;
#endif
int pfrdr = 0;
KASSERT(*offp == 0); KASSERT(*offp == 0);
@ -412,7 +415,7 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
/* /*
* Packet filter * Packet filter
*/ */
pfrdr = ip->ip_dst.s_addr; odst = ip->ip_dst;
if (pf_test(AF_INET, PF_IN, ifp, mp) != PF_PASS) if (pf_test(AF_INET, PF_IN, ifp, mp) != PF_PASS)
goto bad; goto bad;
m = *mp; m = *mp;
@ -420,7 +423,7 @@ ip_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
goto bad; goto bad;
ip = mtod(m, struct ip *); ip = mtod(m, struct ip *);
pfrdr = (pfrdr != ip->ip_dst.s_addr); pfrdr = odst.s_addr != ip->ip_dst.s_addr;
#endif #endif
hlen = ip->ip_hl << 2; hlen = ip->ip_hl << 2;
@ -1472,7 +1475,7 @@ const u_char inetctlerrmap[PRC_NCMDS] = {
void void
ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt) ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
{ {
struct mbuf mfake, *mcopy = NULL; struct mbuf mfake, *mcopy;
struct ip *ip = mtod(m, struct ip *); struct ip *ip = mtod(m, struct ip *);
struct route ro; struct route ro;
int error = 0, type = 0, code = 0, destmtu = 0, fake = 0, len; int error = 0, type = 0, code = 0, destmtu = 0, fake = 0, len;
@ -1482,11 +1485,11 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) { if (m->m_flags & (M_BCAST|M_MCAST) || in_canforward(ip->ip_dst) == 0) {
ipstat_inc(ips_cantforward); ipstat_inc(ips_cantforward);
m_freem(m); m_freem(m);
goto freecopy; goto done;
} }
if (ip->ip_ttl <= IPTTLDEC) { if (ip->ip_ttl <= IPTTLDEC) {
icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, dest, 0); icmp_error(m, ICMP_TIMXCEED, ICMP_TIMXCEED_INTRANS, dest, 0);
goto freecopy; goto done;
} }
ro.ro_rt = NULL; ro.ro_rt = NULL;
@ -1563,10 +1566,10 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
if (type) if (type)
ipstat_inc(ips_redirectsent); ipstat_inc(ips_redirectsent);
else else
goto freecopy; goto done;
} }
if (!fake) if (!fake)
goto freecopy; goto done;
switch (error) { switch (error) {
case 0: /* forwarded, but need redirect */ case 0: /* forwarded, but need redirect */
@ -1590,7 +1593,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
} }
ipstat_inc(ips_cantfrag); ipstat_inc(ips_cantfrag);
if (destmtu == 0) if (destmtu == 0)
goto freecopy; goto done;
break; break;
case EACCES: case EACCES:
@ -1598,7 +1601,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
* pf(4) blocked the packet. There is no need to send an ICMP * pf(4) blocked the packet. There is no need to send an ICMP
* packet back since pf(4) takes care of it. * packet back since pf(4) takes care of it.
*/ */
goto freecopy; goto done;
case ENOBUFS: case ENOBUFS:
/* /*
@ -1607,7 +1610,7 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
* source quench could be a big problem under DoS attacks, * source quench could be a big problem under DoS attacks,
* or the underlying interface is rate-limited. * or the underlying interface is rate-limited.
*/ */
goto freecopy; goto done;
case ENETUNREACH: /* shouldn't happen, checked above */ case ENETUNREACH: /* shouldn't happen, checked above */
case EHOSTUNREACH: case EHOSTUNREACH:
@ -1619,10 +1622,10 @@ ip_forward(struct mbuf *m, struct ifnet *ifp, struct rtentry *rt, int srcrt)
break; break;
} }
mcopy = m_copym(&mfake, 0, len, M_DONTWAIT); mcopy = m_copym(&mfake, 0, len, M_DONTWAIT);
if (mcopy) if (mcopy != NULL)
icmp_error(mcopy, type, code, dest, destmtu); icmp_error(mcopy, type, code, dest, destmtu);
freecopy: done:
if (fake) if (fake)
m_tag_delete_chain(&mfake); m_tag_delete_chain(&mfake);
rtfree(rt); rtfree(rt);

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_forward.c,v 1.115 2024/02/22 14:25:58 bluhm Exp $ */ /* $OpenBSD: ip6_forward.c,v 1.116 2024/02/28 10:57:20 bluhm Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */ /* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/* /*
@ -89,7 +89,7 @@ ip6_forward(struct mbuf *m, struct rtentry *rt, int srcrt)
struct route ro; struct route ro;
struct ifnet *ifp = NULL; struct ifnet *ifp = NULL;
int error = 0, type = 0, code = 0, destmtu = 0; int error = 0, type = 0, code = 0, destmtu = 0;
struct mbuf *mcopy = NULL; struct mbuf *mcopy;
#ifdef IPSEC #ifdef IPSEC
struct tdb *tdb = NULL; struct tdb *tdb = NULL;
#endif /* IPSEC */ #endif /* IPSEC */
@ -121,13 +121,13 @@ ip6_forward(struct mbuf *m, struct rtentry *rt, int srcrt)
m->m_pkthdr.ph_ifidx); m->m_pkthdr.ph_ifidx);
} }
m_freem(m); m_freem(m);
goto out; goto done;
} }
if (ip6->ip6_hlim <= IPV6_HLIMDEC) { if (ip6->ip6_hlim <= IPV6_HLIMDEC) {
icmp6_error(m, ICMP6_TIME_EXCEEDED, icmp6_error(m, ICMP6_TIME_EXCEEDED,
ICMP6_TIME_EXCEED_TRANSIT, 0); ICMP6_TIME_EXCEED_TRANSIT, 0);
goto out; goto done;
} }
ip6->ip6_hlim -= IPV6_HLIMDEC; ip6->ip6_hlim -= IPV6_HLIMDEC;
@ -175,12 +175,12 @@ reroute:
m->m_pkthdr.ph_rtableid); m->m_pkthdr.ph_rtableid);
if (rt == NULL) { if (rt == NULL) {
ip6stat_inc(ip6s_noroute); ip6stat_inc(ip6s_noroute);
if (mcopy) { if (mcopy != NULL) {
icmp6_error(mcopy, ICMP6_DST_UNREACH, icmp6_error(mcopy, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_NOROUTE, 0); ICMP6_DST_UNREACH_NOROUTE, 0);
} }
m_freem(m); m_freem(m);
goto out; goto done;
} }
} }
ro.ro_rt = rt; ro.ro_rt = rt;
@ -211,11 +211,11 @@ reroute:
ip6->ip6_nxt, ip6->ip6_nxt,
m->m_pkthdr.ph_ifidx, rt->rt_ifidx); m->m_pkthdr.ph_ifidx, rt->rt_ifidx);
} }
if (mcopy) if (mcopy != NULL)
icmp6_error(mcopy, ICMP6_DST_UNREACH, icmp6_error(mcopy, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_BEYONDSCOPE, 0); ICMP6_DST_UNREACH_BEYONDSCOPE, 0);
m_freem(m); m_freem(m);
goto out; goto done;
} }
#ifdef IPSEC #ifdef IPSEC
@ -270,11 +270,11 @@ reroute:
* type/code is based on suggestion by Rich Draves. * type/code is based on suggestion by Rich Draves.
* not sure if it is the best pick. * not sure if it is the best pick.
*/ */
if (mcopy) if (mcopy != NULL)
icmp6_error(mcopy, ICMP6_DST_UNREACH, icmp6_error(mcopy, ICMP6_DST_UNREACH,
ICMP6_DST_UNREACH_ADDR, 0); ICMP6_DST_UNREACH_ADDR, 0);
m_freem(m); m_freem(m);
goto out; goto done;
} }
type = ND_REDIRECT; type = ND_REDIRECT;
} }
@ -327,18 +327,18 @@ reroute:
if (mcopy != NULL) if (mcopy != NULL)
icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu); icmp6_error(mcopy, ICMP6_PACKET_TOO_BIG, 0, ifp->if_mtu);
m_freem(m); m_freem(m);
goto out; goto done;
senderr: senderr:
if (mcopy == NULL) if (mcopy == NULL)
goto out; goto done;
switch (error) { switch (error) {
case 0: case 0:
if (type == ND_REDIRECT) { if (type == ND_REDIRECT) {
icmp6_redirect_output(mcopy, rt); icmp6_redirect_output(mcopy, rt);
ip6stat_inc(ip6s_redirectsent); ip6stat_inc(ip6s_redirectsent);
goto out; goto done;
} }
goto freecopy; goto freecopy;
@ -383,11 +383,11 @@ senderr:
break; break;
} }
icmp6_error(mcopy, type, code, destmtu); icmp6_error(mcopy, type, code, destmtu);
goto out; goto done;
freecopy: freecopy:
m_freem(mcopy); m_freem(mcopy);
out: done:
rtfree(rt); rtfree(rt);
if_put(ifp); if_put(ifp);
#ifdef IPSEC #ifdef IPSEC

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_input.c,v 1.258 2024/02/22 14:25:58 bluhm Exp $ */ /* $OpenBSD: ip6_input.c,v 1.259 2024/02/28 10:57:20 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/* /*
@ -366,7 +366,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
#if NPF > 0 #if NPF > 0
struct in6_addr odst; struct in6_addr odst;
#endif #endif
int srcrt = 0; int pfrdr = 0;
KASSERT(*offp == 0); KASSERT(*offp == 0);
@ -413,7 +413,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
goto bad; goto bad;
ip6 = mtod(m, struct ip6_hdr *); ip6 = mtod(m, struct ip6_hdr *);
srcrt = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst); pfrdr = !IN6_ARE_ADDR_EQUAL(&odst, &ip6->ip6_dst);
#endif #endif
/* /*
@ -618,7 +618,7 @@ ip6_input_if(struct mbuf **mp, int *offp, int nxt, int af, struct ifnet *ifp)
} }
#endif /* IPSEC */ #endif /* IPSEC */
ip6_forward(m, rt, srcrt); ip6_forward(m, rt, pfrdr);
*mp = NULL; *mp = NULL;
return IPPROTO_DONE; return IPPROTO_DONE;
bad: bad:

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ip6_output.c,v 1.287 2024/02/22 14:25:58 bluhm Exp $ */ /* $OpenBSD: ip6_output.c,v 1.288 2024/02/28 10:57:20 bluhm Exp $ */
/* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */ /* $KAME: ip6_output.c,v 1.172 2001/03/25 09:55:56 itojun Exp $ */
/* /*
@ -748,8 +748,16 @@ reroute:
(error = if_output_ml(ifp, &ml, sin6tosa(dst), ro->ro_rt))) (error = if_output_ml(ifp, &ml, sin6tosa(dst), ro->ro_rt)))
goto done; goto done;
ip6stat_inc(ip6s_fragmented); ip6stat_inc(ip6s_fragmented);
goto done;
done: freehdrs:
m_freem(exthdrs.ip6e_hbh); /* m_freem will check if mbuf is 0 */
m_freem(exthdrs.ip6e_dest1);
m_freem(exthdrs.ip6e_rthdr);
m_freem(exthdrs.ip6e_dest2);
bad:
m_freem(m);
done:
if (ro == &iproute && ro->ro_rt) { if (ro == &iproute && ro->ro_rt) {
rtfree(ro->ro_rt); rtfree(ro->ro_rt);
} else if (ro_pmtu == &iproute && ro_pmtu->ro_rt) { } else if (ro_pmtu == &iproute && ro_pmtu->ro_rt) {
@ -760,16 +768,6 @@ done:
tdb_unref(tdb); tdb_unref(tdb);
#endif /* IPSEC */ #endif /* IPSEC */
return (error); return (error);
freehdrs:
m_freem(exthdrs.ip6e_hbh); /* m_freem will check if mbuf is 0 */
m_freem(exthdrs.ip6e_dest1);
m_freem(exthdrs.ip6e_rthdr);
m_freem(exthdrs.ip6e_dest2);
/* FALLTHROUGH */
bad:
m_freem(m);
goto done;
} }
int int

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pkcs12.c,v 1.26 2023/11/19 09:29:11 tb Exp $ */ /* $OpenBSD: pkcs12.c,v 1.27 2024/02/28 17:04:38 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project. * project.
*/ */
@ -70,6 +70,7 @@
#include <openssl/err.h> #include <openssl/err.h>
#include <openssl/pem.h> #include <openssl/pem.h>
#include <openssl/pkcs12.h> #include <openssl/pkcs12.h>
#include <openssl/x509.h>
#define NOKEYS 0x1 #define NOKEYS 0x1
#define NOCERTS 0x2 #define NOCERTS 0x2
@ -1023,7 +1024,7 @@ alg_print(BIO *x, const X509_ALGOR *alg)
BIO_printf(bio_err, "%s, Iteration %ld\n", BIO_printf(bio_err, "%s, Iteration %ld\n",
OBJ_nid2ln(OBJ_obj2nid(aobj)), OBJ_nid2ln(OBJ_obj2nid(aobj)),
ASN1_INTEGER_get(pbe->iter)); ASN1_INTEGER_get(pbe->iter));
PBEPARAM_free(pbe); ASN1_item_free((ASN1_VALUE *)pbe, &PBEPARAM_it);
return 1; return 1;
} }

View file

@ -1,4 +1,4 @@
/* $OpenBSD: blocks.c,v 1.22 2024/02/27 11:28:30 claudio Exp $ */ /* $OpenBSD: blocks.c,v 1.23 2024/02/28 09:36:11 claudio Exp $ */
/* /*
* Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv>
* *
@ -243,7 +243,7 @@ void
blk_match(struct sess *sess, const struct blkset *blks, blk_match(struct sess *sess, const struct blkset *blks,
const char *path, struct blkstat *st) const char *path, struct blkstat *st)
{ {
off_t last, end, sz; off_t last, end = 0, sz;
int32_t tok; int32_t tok;
size_t i; size_t i;
const struct blk *blk; const struct blk *blk;
@ -265,66 +265,55 @@ blk_match(struct sess *sess, const struct blkset *blks,
*/ */
end = st->mapsz + 1 - blks->blks[blks->blksz - 1].len; end = st->mapsz + 1 - blks->blks[blks->blksz - 1].len;
last = st->offs; }
for (i = 0; st->offs < end; st->offs++, i++) { last = st->offs;
blk = blk_find(sess, st, blks, path, i == 0); for (i = 0; st->offs < end; st->offs++, i++) {
if (blk == NULL) blk = blk_find(sess, st, blks, path, i == 0);
continue; if (blk == NULL)
continue;
sz = st->offs - last; sz = st->offs - last;
st->dirty += sz;
st->total += sz;
LOG4("%s: flushing %jd B before %zu B block %zu",
path, (intmax_t)sz,
blk->len, blk->idx);
tok = -(blk->idx + 1);
hash_file_buf(&st->ctx, st->map + last, sz + blk->len);
/*
* Write the data we have, then follow it with
* the tag of the block that matches.
*/
st->curpos = last;
st->curlen = st->curpos + sz;
st->curtok = tok;
assert(st->curtok != 0);
st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK;
st->total += blk->len;
st->offs += blk->len;
st->hint = blk->idx + 1;
return;
}
/* Emit remaining data and send terminator token. */
sz = st->mapsz - last;
LOG4("%s: flushing remaining %jd B",
path, (intmax_t)sz);
st->total += sz;
st->dirty += sz; st->dirty += sz;
st->total += sz;
LOG4("%s: flushing %jd B before %zu B block %zu",
path, (intmax_t)sz,
blk->len, blk->idx);
tok = -(blk->idx + 1);
hash_file_buf(&st->ctx, st->map + last, sz + blk->len);
/*
* Write the data we have, then follow it with
* the tag of the block that matches.
*/
st->curpos = last; st->curpos = last;
st->curlen = st->curpos + sz; st->curlen = st->curpos + sz;
st->curtok = 0; st->curtok = tok;
assert(st->curtok != 0);
st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK; st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK;
st->total += blk->len;
st->offs += blk->len;
st->hint = blk->idx + 1;
hash_file_buf(&st->ctx, st->map + st->curpos, sz); return;
} else {
st->curpos = 0;
st->curlen = st->mapsz;
st->curtok = 0;
st->curst = st->mapsz ? BLKSTAT_DATA : BLKSTAT_TOK;
st->dirty = st->total = st->mapsz;
hash_file_buf(&st->ctx, st->map, st->mapsz);
LOG4("%s: flushing whole file %zu B",
path, st->mapsz);
} }
/* Emit remaining data and send terminator token. */
sz = st->mapsz - last;
LOG4("%s: flushing %s %jd B", path,
last == 0 ? "whole" : "remaining", (intmax_t)sz);
hash_file_buf(&st->ctx, st->map + last, sz);
st->total += sz;
st->dirty += sz;
st->curpos = last;
st->curlen = st->curpos + sz;
st->curtok = 0;
st->curst = sz ? BLKSTAT_DATA : BLKSTAT_TOK;
} }
/* /*