Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151115745
D38586.id117286.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D38586.id117286.diff
View Options
diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -103,6 +103,9 @@
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
+#include <netinet/ip6.h>
+#include <netinet6/ip6_var.h>
+
#include <netpfil/pf/pfsync_nv.h>
struct pfsync_bucket;
@@ -2326,6 +2329,56 @@
}
}
+static void
+pfsync_tx(struct pfsync_softc *sc, struct mbuf *m)
+{
+ struct ip *ip;
+ int error, af;
+
+ ip = mtod(m, struct ip *);
+ MPASS(ip->ip_v == IPVERSION || ip->ip_v == (IPV6_VERSION >> 4));
+
+ af = ip->ip_v == IPVERSION ? AF_INET : AF_INET6;
+
+ /*
+ * We distinguish between a deferral packet and our
+ * own pfsync packet based on M_SKIP_FIREWALL
+ * flag. This is XXX.
+ */
+ switch (af) {
+#ifdef INET
+ case AF_INET:
+ if (m->m_flags & M_SKIP_FIREWALL) {
+ error = ip_output(m, NULL, NULL, 0,
+ NULL, NULL);
+ } else {
+ error = ip_output(m, NULL, NULL,
+ IP_RAWOUTPUT, &sc->sc_imo, NULL);
+ }
+ break;
+#endif
+#ifdef INET6
+ case AF_INET6:
+ if (m->m_flags & M_SKIP_FIREWALL) {
+ error = ip6_output(m, NULL, NULL, 0,
+ NULL, NULL, NULL);
+ } else {
+ MPASS(false);
+ /* We don't support pfsync over IPv6. */
+ /*error = ip6_output(m, NULL, NULL,
+ IP_RAWOUTPUT, &sc->sc_imo6, NULL);*/
+ }
+ break;
+#endif
+ }
+
+ if (error == 0)
+ V_pfsyncstats.pfsyncs_opackets++;
+ else
+ V_pfsyncstats.pfsyncs_oerrors++;
+
+}
+
static void
pfsyncintr(void *arg)
{
@@ -2333,7 +2386,7 @@
struct pfsync_softc *sc = arg;
struct pfsync_bucket *b;
struct mbuf *m, *n;
- int c, error;
+ int c;
NET_EPOCH_ENTER(et);
CURVNET_SET(sc->sc_ifp->if_vnet);
@@ -2353,29 +2406,7 @@
n = m->m_nextpkt;
m->m_nextpkt = NULL;
- /*
- * We distinguish between a deferral packet and our
- * own pfsync packet based on M_SKIP_FIREWALL
- * flag. This is XXX.
- */
- switch (sc->sc_sync_peer.ss_family) {
-#ifdef INET
- case AF_INET:
- if (m->m_flags & M_SKIP_FIREWALL) {
- error = ip_output(m, NULL, NULL, 0,
- NULL, NULL);
- } else {
- error = ip_output(m, NULL, NULL,
- IP_RAWOUTPUT, &sc->sc_imo, NULL);
- }
- break;
-#endif
- }
-
- if (error == 0)
- V_pfsyncstats.pfsyncs_opackets++;
- else
- V_pfsyncstats.pfsyncs_oerrors++;
+ pfsync_tx(sc, m);
}
}
CURVNET_RESTORE();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 4:37 AM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31011356
Default Alt Text
D38586.id117286.diff (2 KB)
Attached To
Mode
D38586: pfsync: support deferring IPv6 packets
Attached
Detach File
Event Timeline
Log In to Comment