summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1995-12-19 21:24:19 +0000
committerwollman <wollman@FreeBSD.org>1995-12-19 21:24:19 +0000
commit91849f5fa5f7dc38d162a152b0bde4e91639a82c (patch)
tree06c2e60003520bec3bfa0fd1ac50bc72045948e2 /sys
parent1074a27504f0f4e8859a22f45aea55009d7b1f05 (diff)
downloadFreeBSD-src-91849f5fa5f7dc38d162a152b0bde4e91639a82c.zip
FreeBSD-src-91849f5fa5f7dc38d162a152b0bde4e91639a82c.tar.gz
Added a comment about why trying to make a one-behind cache for
the route in ip_output() is a bad idea.
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/ip_output.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index ca058b2..2a463c2 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
- * $Id: ip_output.c,v 1.25 1995/11/14 20:34:19 phk Exp $
+ * $Id: ip_output.c,v 1.26 1995/12/05 17:46:15 wollman Exp $
*/
#include <sys/param.h>
@@ -91,6 +91,23 @@ ip_output(m0, opt, ro, flags, imo)
register struct mbuf *m = m0;
register int hlen = sizeof (struct ip);
int len, off, error = 0;
+ /*
+ * It might seem obvious at first glance that one could easily
+ * make a one-behind cache out of this by simply making `iproute'
+ * static and eliminating the bzero() below. However, this turns
+ * out not to work, for two reasons:
+ *
+ * 1) This routine needs to be reentrant. It can be called
+ * recursively from encapsulating network interfaces, and it
+ * is always called recursively from ip_mforward().
+ *
+ * 2) You turn out not to gain much. There is already a one-
+ * behind cache implemented for the specific case of forwarding,
+ * and sends on a connected socket will use a route associated
+ * with the PCB. The only cases left are sends on unconnected
+ * and raw sockets, and if these cases are really significant,
+ * something is seriously wrong.
+ */
struct route iproute;
struct sockaddr_in *dst;
struct in_ifaddr *ia;
OpenPOWER on IntegriCloud