diff options
Diffstat (limited to 'sys/net')
| -rw-r--r-- | sys/net/if_faith.c | 13 | ||||
| -rw-r--r-- | sys/net/if_loop.c | 13 | ||||
| -rw-r--r-- | sys/net/route.h | 10 | ||||
| -rw-r--r-- | sys/net/rtsock.c | 38 |
4 files changed, 33 insertions, 41 deletions
diff --git a/sys/net/if_faith.c b/sys/net/if_faith.c index 07216b527b1b..a8da4ad26c45 100644 --- a/sys/net/if_faith.c +++ b/sys/net/if_faith.c @@ -270,17 +270,8 @@ faithrtrequest(cmd, rt, info) struct rt_addrinfo *info; { RT_LOCK_ASSERT(rt); - - if (rt) { - rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; /* for ISO */ - /* - * For optimal performance, the send and receive buffers - * should be at least twice the MTU plus a little more for - * overhead. - */ - rt->rt_rmx.rmx_recvpipe = - rt->rt_rmx.rmx_sendpipe = 3 * FAITHMTU; - } + if (rt) + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; } /* diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index afe0a733cdb7..9a54af471f4d 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -329,17 +329,8 @@ lortrequest(cmd, rt, info) struct rt_addrinfo *info; { RT_LOCK_ASSERT(rt); - - if (rt) { - rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; /* for ISO */ - /* - * For optimal performance, the send and receive buffers - * should be at least twice the MTU plus a little more for - * overhead. - */ - rt->rt_rmx.rmx_recvpipe = - rt->rt_rmx.rmx_sendpipe = 3 * LOMTU; - } + if (rt) + rt->rt_rmx.rmx_mtu = rt->rt_ifp->if_mtu; } /* diff --git a/sys/net/route.h b/sys/net/route.h index 8fff56058dfd..34c33eb265e5 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -58,6 +58,12 @@ struct route { * These numbers are used by reliable protocols for determining * retransmission behavior and are included in the routing structure. */ +struct rt_metrics_lite { + 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 */ +}; + struct rt_metrics { u_long rmx_locks; /* Kernel must leave these values alone */ u_long rmx_mtu; /* MTU for this path */ @@ -104,10 +110,10 @@ struct rtentry { long rt_refcnt; /* # held references */ u_long rt_flags; /* up/down?, host/net */ struct ifnet *rt_ifp; /* the answer: interface to use */ - struct ifaddr *rt_ifa; /* the answer: interface to use */ + struct ifaddr *rt_ifa; /* the answer: interface address 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_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */ struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ int (*rt_output)(struct ifnet *, struct mbuf *, struct sockaddr *, struct rtentry *); diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 4fba1a2779ae..3290c0ce2617 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -87,7 +87,8 @@ static int sysctl_dumpentry(struct radix_node *rn, void *vw); static int sysctl_iflist(int af, struct walkarg *w); static int sysctl_ifmalist(int af, struct walkarg *w); static int route_output(struct mbuf *, struct socket *); -static void rt_setmetrics(u_long, struct rt_metrics *, struct rt_metrics *); +static void rt_setmetrics(u_long, struct rt_metrics *, struct rt_metrics_lite *); +static void rt_getmetrics(struct rt_metrics_lite *, struct rt_metrics *); static void rt_dispatch(struct mbuf *, struct sockaddr *); /* @@ -355,9 +356,6 @@ route_output(m, so) RT_LOCK(saved_nrt); rt_setmetrics(rtm->rtm_inits, &rtm->rtm_rmx, &saved_nrt->rt_rmx); - saved_nrt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); - saved_nrt->rt_rmx.rmx_locks |= - (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); RT_REMREF(saved_nrt); saved_nrt->rt_genmask = info.rti_info[RTAX_GENMASK]; RT_UNLOCK(saved_nrt); @@ -428,7 +426,7 @@ route_output(m, so) (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; @@ -478,9 +476,7 @@ route_output(m, so) rt->rt_genmask = info.rti_info[RTAX_GENMASK]; /* FALLTHROUGH */ case RTM_LOCK: - rt->rt_rmx.rmx_locks &= ~(rtm->rtm_inits); - rt->rt_rmx.rmx_locks |= - (rtm->rtm_inits & rtm->rtm_rmx.rmx_locks); + /* We don't support locks anymore */ break; } RT_UNLOCK(rt); @@ -542,20 +538,28 @@ flush: } static void -rt_setmetrics(u_long which, struct rt_metrics *in, struct rt_metrics *out) +rt_setmetrics(u_long which, struct rt_metrics *in, struct rt_metrics_lite *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); + /* + * Only these are stored in the routing entry since introduction + * of tcp hostcache. The rest is ignored. + */ metric(RTV_MTU, rmx_mtu); metric(RTV_EXPIRE, rmx_expire); #undef metric } +static void +rt_getmetrics(struct rt_metrics_lite *in, struct rt_metrics *out) +{ +#define metric(e) out->e = in->e; + bzero(out, sizeof(*out)); + metric(rmx_mtu); + metric(rmx_expire); +#undef metric +} + #define ROUNDUP(a) \ ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) @@ -948,8 +952,8 @@ sysctl_dumpentry(struct radix_node *rn, void *vw) struct rt_msghdr *rtm = (struct rt_msghdr *)w->w_tmem; rtm->rtm_flags = rt->rt_flags; - rtm->rtm_use = rt->rt_use; - rtm->rtm_rmx = rt->rt_rmx; + rtm->rtm_use = rt->rt_rmx.rmx_pksent; + 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; |
