summaryrefslogtreecommitdiffstats
path: root/sys/netinet/ip_var.h
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1998-05-19 14:04:36 +0000
committerdg <dg@FreeBSD.org>1998-05-19 14:04:36 +0000
commit5f8a4130d8dd1d4441beb5fba01ab53b331a9111 (patch)
treeaaed0538d112feb998dd062f62a7e8e220668f46 /sys/netinet/ip_var.h
parentc3415a2524903047d0a79dad7753c33f98e0f235 (diff)
downloadFreeBSD-src-5f8a4130d8dd1d4441beb5fba01ab53b331a9111.zip
FreeBSD-src-5f8a4130d8dd1d4441beb5fba01ab53b331a9111.tar.gz
Added fast IP forwarding code by Matt Thomas <matt@3am-software.com> via
NetBSD, ported to FreeBSD by Pierre Beyssac <pb@fasterix.freenix.org> and minorly tweaked by me. This is a standard part of FreeBSD, but must be enabled with: "sysctl -w net.inet.ip.fastforwarding=1" ...and of course forwarding must also be enabled. This should probably be modified to use the zone allocator for speed and space efficiency. The current algorithm also appears to lose if the number of active paths exceeds IPFLOW_MAX (256), in which case it wastes lots of time trying to figure out which cache entry to drop.
Diffstat (limited to 'sys/netinet/ip_var.h')
-rw-r--r--sys/netinet/ip_var.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index f80a353..5bd7257 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_var.h 8.2 (Berkeley) 1/9/95
- * $Id: ip_var.h,v 1.33 1997/05/25 06:09:23 peter Exp $
+ * $Id: ip_var.h,v 1.34 1997/09/07 05:26:46 bde Exp $
*/
#ifndef _NETINET_IP_VAR_H_
@@ -132,6 +132,7 @@ struct ipstat {
u_long ips_fragdropped; /* frags dropped (dups, out of space) */
u_long ips_fragtimeout; /* fragments timed out */
u_long ips_forward; /* packets forwarded */
+ u_long ips_fastforward; /* packets fast forwarded */
u_long ips_cantforward; /* packets rcvd for unreachable dest */
u_long ips_redirectsent; /* packets forwarded on same net */
u_long ips_noproto; /* unknown or unsupported protocol */
@@ -150,6 +151,22 @@ struct ipstat {
u_long ips_notmember; /* multicasts for unregistered grps */
};
+#define IPFLOW_HASHBITS 6 /* should not be a multiple of 8 */
+struct ipflow {
+ LIST_ENTRY(ipflow) ipf_next; /* next ipflow in bucket */
+ struct in_addr ipf_dst; /* destination address */
+ struct in_addr ipf_src; /* source address */
+
+ u_int8_t ipf_tos; /* type-of-service */
+ struct route ipf_ro; /* associated route entry */
+ u_long ipf_uses; /* number of uses in this period */
+
+ int ipf_timer; /* remaining lifetime of this entry */
+ u_long ipf_dropped; /* ENOBUFS returned by if_output */
+ u_long ipf_errors; /* other errors returned by if_output */
+ u_long ipf_last_uses; /* number of uses in last period */
+};
+
#ifdef KERNEL
/* flags passed to ip_output as last parameter */
#define IP_FORWARDING 0x1 /* most of ip header exists */
@@ -163,6 +180,7 @@ struct route;
extern struct ipstat ipstat;
extern u_short ip_id; /* ip packet ctr, for ids */
extern int ip_defttl; /* default IP ttl */
+extern int ipforwarding; /* ip forwarding */
extern u_char ip_protox[];
extern struct socket *ip_rsvpd; /* reservation protocol daemon */
extern struct socket *ip_mrouter; /* multicast routing daemon */
OpenPOWER on IntegriCloud