Date: Mon, 13 Feb 2023 08:20:53 +0000 From: bugzilla-noreply@freebsd.org To: net@FreeBSD.org Subject: [Bug 268246] crash and panic using pfsync on 13.1-RELEASE Message-ID: <bug-268246-7501-EBBXBGSfG0@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-268246-7501@https.bugs.freebsd.org/bugzilla/> References: <bug-268246-7501@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268246 --- Comment #72 from Kristof Provost <kp@freebsd.org> --- I'm still failing to reproduce, but this should be close to a real fix: diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 47c3217f399c..4ebd304b1c13 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -102,6 +102,9 @@ __FBSDID("$FreeBSD$"); #include <netinet/tcp_fsm.h> #include <netinet/tcp_seq.h> +#include <netinet/ip6.h> +#include <netinet6/ip6_var.h> + #define PFSYNC_MINPKT ( \ sizeof(struct ip) + \ sizeof(struct pfsync_header) + \ @@ -2325,7 +2328,8 @@ pfsyncintr(void *arg) struct pfsync_softc *sc =3D arg; struct pfsync_bucket *b; struct mbuf *m, *n; - int c; + struct ip *ip; + int c, error; NET_EPOCH_ENTER(et); CURVNET_SET(sc->sc_ifp->if_vnet); @@ -2345,15 +2349,26 @@ pfsyncintr(void *arg) n =3D m->m_nextpkt; m->m_nextpkt =3D NULL; + ip =3D mtod(m, struct ip *); + /* * We distinguish between a deferral packet and our * own pfsync packet based on M_SKIP_FIREWALL * flag. This is XXX. */ - if (m->m_flags & M_SKIP_FIREWALL) - ip_output(m, NULL, NULL, 0, NULL, NULL); - else if (ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, - NULL) =3D=3D 0) + if (m->m_flags & M_SKIP_FIREWALL) { + if (ip->ip_v =3D=3D IPVERSION) + error =3D ip_output(m, NULL, NULL, = 0, NULL, NULL); + else + error =3D ip6_output(m, NULL, NULL,= 0, NULL, NULL, NULL); + } else { + if (ip->ip_v =3D=3D IPVERSION) + error =3D ip_output(m, NULL, NULL, IP_RAWOUTPUT, &sc->sc_imo, + NULL); + else + error =3D ENOTSUP; // When we add p= fsync over IPv6 + } + if (error =3D=3D 0) V_pfsyncstats.pfsyncs_opackets++; else V_pfsyncstats.pfsyncs_oerrors++; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268246-7501-EBBXBGSfG0>