summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-11-02 04:41:39 +0000
committerwollman <wollman@FreeBSD.org>1994-11-02 04:41:39 +0000
commit1414f0bd248c5ca6172f3fcabc3136e287e18530 (patch)
tree6d16aaedb84ab97688d73043e6fee0204a157554 /sys
parent08d6168872f2417e5666243ce4ea5c6abb7bcf4b (diff)
downloadFreeBSD-src-1414f0bd248c5ca6172f3fcabc3136e287e18530.zip
FreeBSD-src-1414f0bd248c5ca6172f3fcabc3136e287e18530.tar.gz
Add code to be a bit smarter about IP routes, conditioned on the option
IN_RMX. (Eventually this will be standard, but I just wrote the code today and don't want to break anyone.)
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files1
-rw-r--r--sys/net/radix.h4
-rw-r--r--sys/net/route.c25
-rw-r--r--sys/netinet/in_proto.c13
4 files changed, 21 insertions, 22 deletions
diff --git a/sys/conf/files b/sys/conf/files
index e0b293c..3e72305 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -175,6 +175,7 @@ netinet/igmp.c optional inet
netinet/in.c optional inet
netinet/in_pcb.c optional inet
netinet/in_proto.c optional inet
+netinet/in_rmx.c optional in_rmx
netinet/ip_icmp.c optional inet
netinet/ip_input.c optional inet
netinet/ip_mroute.c optional inet
diff --git a/sys/net/radix.h b/sys/net/radix.h
index 2909924..89895d0 100644
--- a/sys/net/radix.h
+++ b/sys/net/radix.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)radix.h 8.1 (Berkeley) 6/10/93
- * $Id: radix.h,v 1.2 1994/08/02 07:46:31 davidg Exp $
+ * $Id: radix.h,v 1.3 1994/08/21 05:11:45 paul Exp $
*/
#ifndef _NET_RADIX_H_
@@ -118,6 +118,8 @@ struct radix_node_head {
__P((void *v, struct radix_node_head *head));
int (*rnh_walktree) /* traverse tree */
__P((struct radix_node_head *head, int (*f)(), void *w));
+ void (*rnh_close) /* do something when the last ref drops */
+ __P((struct radix_node *rn, struct radix_node_head *head));
struct radix_node rnh_nodes[3]; /* empty tree for common case */
};
diff --git a/sys/net/route.c b/sys/net/route.c
index 84fc40a..ad8629f 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)route.c 8.2 (Berkeley) 11/15/93
- * $Id: route.c,v 1.8 1994/10/02 17:48:26 phk Exp $
+ * $Id: route.c,v 1.9 1994/10/11 23:16:27 wollman Exp $
*/
#include <sys/param.h>
@@ -136,11 +136,16 @@ void
rtfree(rt)
register struct rtentry *rt;
{
+ register struct radix_node_head *rnh =
+ rt_tables[rt_key(rt)->sa_family];
register struct ifaddr *ifa;
if (rt == 0)
panic("rtfree");
rt->rt_refcnt--;
+ if(rnh->rnh_close && rt->rt_refcnt == 0) {
+ rnh->rnh_close((struct radix_node *)rt, rnh);
+ }
if (rt->rt_refcnt <= 0 && (rt->rt_flags & RTF_UP) == 0) {
if (rt->rt_nodes->rn_flags & (RNF_ACTIVE | RNF_ROOT))
panic ("rtfree 2");
@@ -344,7 +349,6 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
register struct radix_node_head *rnh;
struct ifaddr *ifa;
struct sockaddr *ndst;
- int doexpire = 0;
#define senderr(x) { error = x ; goto bad; }
if ((rnh = rt_tables[dst->sa_family]) == 0)
@@ -383,21 +387,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
if ((netmask = rt->rt_genmask) == 0)
flags |= RTF_HOST;
if (flags & RTF_STATIC) {
- /*
- * We make a few assumptions here which are not
- * necessarily valid for everybody.
- * 1) static cloning routes want this treatment
- * 2) somebody's link layer out there is
- * timing these things out
- *
- * (2) in particular is not presently true for any
- * p2p links, but we hope that this will not cause
- * problems. (I believe that these extra routes
- * can never cause incorrect operation, but they
- * really should get timed out to free the memory.)
- */
flags &= ~RTF_STATIC;
- doexpire = 1;
}
goto makeroute;
@@ -438,9 +428,6 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt)
rt->rt_ifp = ifa->ifa_ifp;
if (req == RTM_RESOLVE)
rt->rt_rmx = (*ret_nrt)->rt_rmx; /* copy metrics */
- if (doexpire)
- rt->rt_rmx.rmx_expire =
- time.tv_sec + 1200; /* XXX MAGIC CONSTANT */
if (ifa->ifa_rtrequest)
ifa->ifa_rtrequest(req, rt, SA(ret_nrt ? *ret_nrt : 0));
if (ret_nrt) {
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c
index 13bf148..d397b64 100644
--- a/sys/netinet/in_proto.c
+++ b/sys/netinet/in_proto.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)in_proto.c 8.1 (Berkeley) 6/10/93
- * $Id: in_proto.c,v 1.5 1994/09/14 03:10:08 wollman Exp $
+ * $Id: in_proto.c,v 1.6 1994/09/15 10:36:52 davidg Exp $
*/
#include <sys/param.h>
@@ -154,10 +154,19 @@ struct protosw inetsw[] = {
},
};
+#ifdef IN_RMX
+extern int in_inithead(void **, int);
+#endif
+
struct domain inetdomain =
{ AF_INET, "internet", 0, 0, 0,
inetsw, &inetsw[sizeof(inetsw)/sizeof(inetsw[0])], 0,
- rn_inithead, 32, sizeof(struct sockaddr_in) };
+#ifdef IN_RMX
+ in_inithead, 32, sizeof(struct sockaddr_in)
+#else
+ rn_inithead, 32, sizeof(struct sockaddr_in)
+#endif
+ };
#include "imp.h"
#if NIMP > 0
OpenPOWER on IntegriCloud