diff options
author | dg <dg@FreeBSD.org> | 1998-05-19 14:04:36 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1998-05-19 14:04:36 +0000 |
commit | 5f8a4130d8dd1d4441beb5fba01ab53b331a9111 (patch) | |
tree | aaed0538d112feb998dd062f62a7e8e220668f46 /sys/net | |
parent | c3415a2524903047d0a79dad7753c33f98e0f235 (diff) | |
download | FreeBSD-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/net')
-rw-r--r-- | sys/net/if_ethersubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_fddisubr.c | 4 | ||||
-rw-r--r-- | sys/net/if_ppp.c | 6 |
3 files changed, 11 insertions, 3 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 3266f18..d5fba1b 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_ethersubr.c 8.1 (Berkeley) 6/10/93 - * $Id: if_ethersubr.c,v 1.46 1998/03/18 01:40:11 wollman Exp $ + * $Id: if_ethersubr.c,v 1.47 1998/03/30 09:51:39 phk Exp $ */ #include "opt_atalk.h" @@ -501,6 +501,8 @@ ether_input(ifp, eh, m) switch (ether_type) { #ifdef INET case ETHERTYPE_IP: + if (ipflow_fastforward(m)) + return; schednetisr(NETISR_IP); inq = &ipintrq; break; diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c index 5f54878..140ef0d 100644 --- a/sys/net/if_fddisubr.c +++ b/sys/net/if_fddisubr.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * from: if_ethersubr.c,v 1.5 1994/12/13 22:31:45 wollman Exp - * $Id: if_fddisubr.c,v 1.26 1998/02/20 13:11:49 bde Exp $ + * $Id: if_fddisubr.c,v 1.27 1998/03/30 09:51:44 phk Exp $ */ #include "opt_atalk.h" @@ -533,6 +533,8 @@ fddi_input(ifp, fh, m) switch (type) { #ifdef INET case ETHERTYPE_IP: + if (ipflow(fastforward(m)) + return; schednetisr(NETISR_IP); inq = &ipintrq; break; diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index 8e65245..bf43b64 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -69,7 +69,7 @@ * Paul Mackerras (paulus@cs.anu.edu.au). */ -/* $Id: if_ppp.c,v 1.55 1998/03/30 09:51:52 phk Exp $ */ +/* $Id: if_ppp.c,v 1.56 1998/04/06 11:43:10 phk Exp $ */ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ @@ -1488,6 +1488,10 @@ ppp_inproc(sc, m) m->m_pkthdr.len -= PPP_HDRLEN; m->m_data += PPP_HDRLEN; m->m_len -= PPP_HDRLEN; + if (ipflow_fastforward(m)) { + sc->sc_last_recv = time_second; + return; + } schednetisr(NETISR_IP); inq = &ipintrq; sc->sc_last_recv = time_second; /* update time of last pkt rcvd */ |