diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-05-04 22:50:19 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2004-05-04 22:50:19 +0000 |
commit | 72845f3045265105d2d545f6afa78ff6c8ce5f3c (patch) | |
tree | e6499af205a35f2e1a7db4001e054e2b6b2ed5c7 /sys/net | |
parent | 710c64d18789eb25fed232f87c40158bfcba7ad3 (diff) |
The tcp specific routing metrics are almost never used so reduce the routing
table from these metrics. struct rt_msghdr used by the routing socket is not
affected and so most userland apps don't need to be changed.
some man page polishing by jmc@
OK henning@ markus@ theo@
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/route.h | 18 | ||||
-rw-r--r-- | sys/net/rtsock.c | 29 |
2 files changed, 33 insertions, 14 deletions
diff --git a/sys/net/route.h b/sys/net/route.h index 963fdd94a30..2b79cd10dbb 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -1,4 +1,4 @@ -/* $OpenBSD: route.h,v 1.20 2004/04/25 02:48:04 itojun Exp $ */ +/* $OpenBSD: route.h,v 1.21 2004/05/04 22:50:18 claudio Exp $ */ /* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */ /* @@ -58,6 +58,16 @@ struct route { * These numbers are used by reliable protocols for determining * retransmission behavior and are included in the routing structure. */ +struct rt_kmetrics { + u_long rmx_locks; /* Kernel must leave these values alone */ + u_long rmx_mtu; /* MTU for this path */ + u_long rmx_expire; /* lifetime for route, e.g. redirect */ + u_long rmx_pksent; /* packets sent using this route */ +}; + +/* + * Huge version for userland compatibility. + */ struct rt_metrics { u_long rmx_locks; /* Kernel must leave these values alone */ u_long rmx_mtu; /* MTU for this path */ @@ -98,12 +108,11 @@ struct rtentry { struct sockaddr *rt_gateway; /* value */ u_int rt_flags; /* up/down?, host/net */ int rt_refcnt; /* # held references */ - u_long rt_use; /* raw # packets forwarded */ struct ifnet *rt_ifp; /* the answer: interface to use */ struct ifaddr *rt_ifa; /* the answer: interface to use */ struct sockaddr *rt_genmask; /* for generation of cloned routes */ caddr_t rt_llinfo; /* pointer to link level info cache */ - struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */ + struct rt_kmetrics rt_rmx; /* metrics used by rx'ing protocols */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ struct rtentry *rt_parent; /* If cloned, parent of this route. */ LIST_HEAD(, rttimer) rt_timer; /* queue of timeouts for misc funcs */ @@ -300,7 +309,8 @@ void rt_missmsg(int, struct rt_addrinfo *, int, int); void rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); -void rt_setmetrics(u_long, struct rt_metrics *, struct rt_metrics *); +void rt_setmetrics(u_long, struct rt_metrics *, struct rt_kmetrics *); +void rt_getmetrics(struct rt_kmetrics *, struct rt_metrics *); int rt_timer_add(struct rtentry *, void(*)(struct rtentry *, struct rttimer *), struct rttimer_queue *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index fce8e94dc74..d0866800614 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.36 2004/04/25 02:48:04 itojun Exp $ */ +/* $OpenBSD: rtsock.c,v 1.37 2004/05/04 22:50:18 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -341,7 +341,7 @@ route_output(struct mbuf *m, ...) (void)rt_msg2(rtm->rtm_type, &info, (caddr_t)rtm, (struct walkarg *)0); rtm->rtm_flags = rt->rt_flags; - rtm->rtm_rmx = rt->rt_rmx; + rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); rtm->rtm_addrs = info.rti_addrs; break; @@ -445,20 +445,29 @@ flush: void rt_setmetrics(which, in, out) u_long which; - struct rt_metrics *in, *out; + struct rt_metrics *in; + struct rt_kmetrics *out; { #define metric(f, e) if (which & (f)) out->e = in->e; - metric(RTV_RPIPE, rmx_recvpipe); - metric(RTV_SPIPE, rmx_sendpipe); - metric(RTV_SSTHRESH, rmx_ssthresh); - metric(RTV_RTT, rmx_rtt); - metric(RTV_RTTVAR, rmx_rttvar); - metric(RTV_HOPCOUNT, rmx_hopcount); metric(RTV_MTU, rmx_mtu); metric(RTV_EXPIRE, rmx_expire); #undef metric } +void +rt_getmetrics(in, out) + struct rt_kmetrics *in; + struct rt_metrics *out; +{ +#define metric(e) out->e = in->e; + bzero(out, sizeof(*out)); + metric(rmx_locks); + metric(rmx_mtu); + metric(rmx_expire); + metric(rmx_pksent); +#undef metric +} + #define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) #define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len)) @@ -793,7 +802,7 @@ sysctl_dumpentry(rn, v) rtm->rtm_flags = rt->rt_flags; rtm->rtm_use = rt->rt_use; - rtm->rtm_rmx = rt->rt_rmx; + rt_getmetrics(&rt->rt_rmx, &rtm->rtm_rmx); rtm->rtm_index = rt->rt_ifp->if_index; rtm->rtm_errno = rtm->rtm_pid = rtm->rtm_seq = 0; rtm->rtm_addrs = info.rti_addrs; |