Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106096372
D27018.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D27018.diff
View Options
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
@@ -5488,10 +5488,29 @@
}
if (r->rt == PF_DUPTO) {
- if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) {
- if (s)
+ if ((pd->pf_mtag->flags & PF_DUPLICATED)) {
+ if (s == NULL) {
+ ifp = r->rpool.cur->kif ?
+ r->rpool.cur->kif->pfik_ifp : NULL;
+ } else {
+ ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL;
PF_STATE_UNLOCK(s);
- return;
+ }
+ if (ifp == oifp) {
+ /* When the 2nd interface is not skipped */
+ return;
+ } else {
+ m0 = *m;
+ *m = NULL;
+ goto bad;
+ }
+ } else {
+ pd->pf_mtag->flags |= PF_DUPLICATED;
+ if (((m0 = m_dup(*m, M_NOWAIT)) == NULL)) {
+ if (s)
+ PF_STATE_UNLOCK(s);
+ return;
+ }
}
} else {
if ((r->rt == PF_REPLYTO) == (r->direction == dir)) {
@@ -5649,10 +5668,29 @@
}
if (r->rt == PF_DUPTO) {
- if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) {
- if (s)
+ if ((pd->pf_mtag->flags & PF_DUPLICATED)) {
+ if (s == NULL) {
+ ifp = r->rpool.cur->kif ?
+ r->rpool.cur->kif->pfik_ifp : NULL;
+ } else {
+ ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL;
PF_STATE_UNLOCK(s);
- return;
+ }
+ if (ifp == oifp) {
+ /* When the 2nd interface is not skipped */
+ return;
+ } else {
+ m0 = *m;
+ *m = NULL;
+ goto bad;
+ }
+ } else {
+ pd->pf_mtag->flags |= PF_DUPLICATED;
+ if (((m0 = m_dup(*m, M_NOWAIT)) == NULL)) {
+ if (s)
+ PF_STATE_UNLOCK(s);
+ return;
+ }
}
} else {
if ((r->rt == PF_REPLYTO) == (r->direction == dir)) {
diff --git a/sys/netpfil/pf/pf_mtag.h b/sys/netpfil/pf/pf_mtag.h
--- a/sys/netpfil/pf/pf_mtag.h
+++ b/sys/netpfil/pf/pf_mtag.h
@@ -42,6 +42,7 @@
#define PF_PACKET_LOOPED 0x08
#define PF_FASTFWD_OURS_PRESENT 0x10
#define PF_REASSEMBLED 0x20
+#define PF_DUPLICATED 0x40
struct pf_mtag {
void *hdr; /* saved hdr pos in mbuf, for ECN */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 8:27 AM (12 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15602834
Default Alt Text
D27018.diff (1 KB)
Attached To
Mode
D27018: Duplicate frames only once when using dup-to pf rule
Attached
Detach File
Event Timeline
Log In to Comment