Page MenuHomeFreeBSD

D54845.diff
No OneTemporary

D54845.diff

diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -11961,11 +11961,11 @@
pf_is_loopback(af, pd.dst))
pd.m->m_flags |= M_SKIP_FIREWALL;
- if (af == AF_INET && __predict_false(ip_divert_ptr != NULL) &&
- action == PF_PASS && r->divert.port && !PACKET_LOOPED(&pd)) {
+ if (af == AF_INET && action == PF_PASS && r->divert.port &&
+ !PACKET_LOOPED(&pd)) {
mtag = m_tag_alloc(MTAG_PF_DIVERT, 0,
sizeof(struct pf_divert_mtag), M_NOWAIT | M_ZERO);
- if (mtag != NULL) {
+ if (__predict_true(mtag != NULL && ip_divert_ptr != NULL)) {
((struct pf_divert_mtag *)(mtag+1))->port =
ntohs(r->divert.port);
((struct pf_divert_mtag *)(mtag+1))->idir =
@@ -11994,15 +11994,20 @@
}
ip_divert_ptr(*m0, dir == PF_IN);
*m0 = NULL;
-
return (action);
- } else {
+ } else if (mtag == NULL) {
/* XXX: ipfw has the same behaviour! */
action = PF_DROP;
REASON_SET(&reason, PFRES_MEMORY);
pd.act.log = PF_LOG_FORCE;
DPFPRINTF(PF_DEBUG_MISC,
"pf: failed to allocate divert tag");
+ } else {
+ action = PF_DROP;
+ REASON_SET(&reason, PFRES_MATCH);
+ pd.act.log = PF_LOG_FORCE;
+ DPFPRINTF(PF_DEBUG_MISC,
+ "pf: divert(4) is not loaded");
}
}
/* XXX: Anybody working on it?! */

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 25, 11:07 AM (8 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27909788
Default Alt Text
D54845.diff (1 KB)

Event Timeline