summaryrefslogtreecommitdiff
path: root/sys/netinet/ip_input.c
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>1998-05-01 03:23:24 +0000
committerthorpej <thorpej@NetBSD.org>1998-05-01 03:23:24 +0000
commit4452bc9a21ea0861ad2ba4daeb6d30fc9af01034 (patch)
treed0124022362d0811074740a970f34ca8e81f0946 /sys/netinet/ip_input.c
parentf5f5ea4fde3891123908895e1440866a3a7d5196 (diff)
Allow packet filters to prevent a packet from creating a fast-forwarding
flow, by setting the "can fast forward" flag in the packet header, and giving a chance for filters to clear the flag. If the flag is still set after the filters have given it a chance, the packet will be used to create a fast-forward flow entry.
Diffstat (limited to 'sys/netinet/ip_input.c')
-rw-r--r--sys/netinet/ip_input.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index 0a2d00293be..2f3100e629c 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ip_input.c,v 1.63 1998/04/29 21:37:55 matt Exp $ */
+/* $NetBSD: ip_input.c,v 1.64 1998/05/01 03:23:24 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -309,9 +309,19 @@ next:
m_adj(m, len - m->m_pkthdr.len);
}
+ /*
+ * Assume that we can create a fast-forward IP flow entry
+ * based on this packet.
+ */
+ m->m_flags |= M_CANFASTFWD;
+
#ifdef PFIL_HOOKS
/*
- * Run through list of hooks for input packets.
+ * Run through list of hooks for input packets. If there are any
+ * filters which require that additional packets in the flow are
+ * not fast-forwarded, they must clear the M_CANFASTFWD flag.
+ * Note that filters must _never_ set this flag, as another filter
+ * in the list may have previously cleared it.
*/
m0 = m;
for (pfh = pfil_hook_get(PFIL_IN); pfh; pfh = pfh->pfil_link.tqe_next)
@@ -1197,7 +1207,8 @@ ip_forward(m, srcrt)
else {
if (mcopy) {
#ifdef GATEWAY
- ipflow_create(&ipforward_rt, mcopy);
+ if (mcopy->m_flags & M_CANFASTFWD)
+ ipflow_create(&ipforward_rt, mcopy);
#endif
m_freem(mcopy);
}