Deleted Added
full compact
in_rmx.c (34914) in_rmx.c (34961)
1/*
2 * Copyright 1994, 1995 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright 1994, 1995 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $Id: in_rmx.c,v 1.32 1998/02/06 12:13:50 eivind Exp $
29 * $Id: in_rmx.c,v 1.33 1998/03/27 14:30:18 peter Exp $
30 */
31
32/*
33 * This code does two things necessary for the enhanced TCP metrics to
34 * function in a useful manner:
35 * 1) It marks all non-host routes as `cloning', thus ensuring that
36 * every actual reference to such a route actually gets turned
37 * into a reference to a host route to the specific destination

--- 159 unchanged lines hidden (view full) ---

197
198 /*
199 * As requested by David Greenman:
200 * If rtq_reallyold is 0, just delete the route without
201 * waiting for a timeout cycle to kill it.
202 */
203 if(rtq_reallyold != 0) {
204 rt->rt_flags |= RTPRF_OURS;
30 */
31
32/*
33 * This code does two things necessary for the enhanced TCP metrics to
34 * function in a useful manner:
35 * 1) It marks all non-host routes as `cloning', thus ensuring that
36 * every actual reference to such a route actually gets turned
37 * into a reference to a host route to the specific destination

--- 159 unchanged lines hidden (view full) ---

197
198 /*
199 * As requested by David Greenman:
200 * If rtq_reallyold is 0, just delete the route without
201 * waiting for a timeout cycle to kill it.
202 */
203 if(rtq_reallyold != 0) {
204 rt->rt_flags |= RTPRF_OURS;
205 rt->rt_rmx.rmx_expire = time.tv_sec + rtq_reallyold;
205 rt->rt_rmx.rmx_expire = time_second + rtq_reallyold;
206 } else {
207 rtrequest(RTM_DELETE,
208 (struct sockaddr *)rt_key(rt),
209 rt->rt_gateway, rt_mask(rt),
210 rt->rt_flags, 0);
211 }
212}
213

--- 16 unchanged lines hidden (view full) ---

230{
231 struct rtqk_arg *ap = rock;
232 struct rtentry *rt = (struct rtentry *)rn;
233 int err;
234
235 if(rt->rt_flags & RTPRF_OURS) {
236 ap->found++;
237
206 } else {
207 rtrequest(RTM_DELETE,
208 (struct sockaddr *)rt_key(rt),
209 rt->rt_gateway, rt_mask(rt),
210 rt->rt_flags, 0);
211 }
212}
213

--- 16 unchanged lines hidden (view full) ---

230{
231 struct rtqk_arg *ap = rock;
232 struct rtentry *rt = (struct rtentry *)rn;
233 int err;
234
235 if(rt->rt_flags & RTPRF_OURS) {
236 ap->found++;
237
238 if(ap->draining || rt->rt_rmx.rmx_expire <= time.tv_sec) {
238 if(ap->draining || rt->rt_rmx.rmx_expire <= time_second) {
239 if(rt->rt_refcnt > 0)
240 panic("rtqkill route really not free");
241
242 err = rtrequest(RTM_DELETE,
243 (struct sockaddr *)rt_key(rt),
244 rt->rt_gateway, rt_mask(rt),
245 rt->rt_flags, 0);
246 if(err) {
247 log(LOG_WARNING, "in_rtqkill: error %d\n", err);
248 } else {
249 ap->killed++;
250 }
251 } else {
252 if(ap->updating
239 if(rt->rt_refcnt > 0)
240 panic("rtqkill route really not free");
241
242 err = rtrequest(RTM_DELETE,
243 (struct sockaddr *)rt_key(rt),
244 rt->rt_gateway, rt_mask(rt),
245 rt->rt_flags, 0);
246 if(err) {
247 log(LOG_WARNING, "in_rtqkill: error %d\n", err);
248 } else {
249 ap->killed++;
250 }
251 } else {
252 if(ap->updating
253 && (rt->rt_rmx.rmx_expire - time.tv_sec
253 && (rt->rt_rmx.rmx_expire - time_second
254 > rtq_reallyold)) {
254 > rtq_reallyold)) {
255 rt->rt_rmx.rmx_expire = time.tv_sec
255 rt->rt_rmx.rmx_expire = time_second
256 + rtq_reallyold;
257 }
258 ap->nextstop = lmin(ap->nextstop,
259 rt->rt_rmx.rmx_expire);
260 }
261 }
262
263 return 0;

--- 8 unchanged lines hidden (view full) ---

272 struct radix_node_head *rnh = rock;
273 struct rtqk_arg arg;
274 struct timeval atv;
275 static time_t last_adjusted_timeout = 0;
276 int s;
277
278 arg.found = arg.killed = 0;
279 arg.rnh = rnh;
256 + rtq_reallyold;
257 }
258 ap->nextstop = lmin(ap->nextstop,
259 rt->rt_rmx.rmx_expire);
260 }
261 }
262
263 return 0;

--- 8 unchanged lines hidden (view full) ---

272 struct radix_node_head *rnh = rock;
273 struct rtqk_arg arg;
274 struct timeval atv;
275 static time_t last_adjusted_timeout = 0;
276 int s;
277
278 arg.found = arg.killed = 0;
279 arg.rnh = rnh;
280 arg.nextstop = time.tv_sec + rtq_timeout;
280 arg.nextstop = time_second + rtq_timeout;
281 arg.draining = arg.updating = 0;
282 s = splnet();
283 rnh->rnh_walktree(rnh, in_rtqkill, &arg);
284 splx(s);
285
286 /*
287 * Attempt to be somewhat dynamic about this:
288 * If there are ``too many'' routes sitting around taking up space,
289 * then crank down the timeout, and see if we can't make some more
290 * go away. However, we make sure that we will never adjust more
291 * than once in rtq_timeout seconds, to keep from cranking down too
292 * hard.
293 */
294 if((arg.found - arg.killed > rtq_toomany)
281 arg.draining = arg.updating = 0;
282 s = splnet();
283 rnh->rnh_walktree(rnh, in_rtqkill, &arg);
284 splx(s);
285
286 /*
287 * Attempt to be somewhat dynamic about this:
288 * If there are ``too many'' routes sitting around taking up space,
289 * then crank down the timeout, and see if we can't make some more
290 * go away. However, we make sure that we will never adjust more
291 * than once in rtq_timeout seconds, to keep from cranking down too
292 * hard.
293 */
294 if((arg.found - arg.killed > rtq_toomany)
295 && (time.tv_sec - last_adjusted_timeout >= rtq_timeout)
295 && (time_second - last_adjusted_timeout >= rtq_timeout)
296 && rtq_reallyold > rtq_minreallyold) {
297 rtq_reallyold = 2*rtq_reallyold / 3;
298 if(rtq_reallyold < rtq_minreallyold) {
299 rtq_reallyold = rtq_minreallyold;
300 }
301
296 && rtq_reallyold > rtq_minreallyold) {
297 rtq_reallyold = 2*rtq_reallyold / 3;
298 if(rtq_reallyold < rtq_minreallyold) {
299 rtq_reallyold = rtq_minreallyold;
300 }
301
302 last_adjusted_timeout = time.tv_sec;
302 last_adjusted_timeout = time_second;
303#ifdef DIAGNOSTIC
304 log(LOG_DEBUG, "in_rtqtimo: adjusted rtq_reallyold to %d\n",
305 rtq_reallyold);
306#endif
307 arg.found = arg.killed = 0;
308 arg.updating = 1;
309 s = splnet();
310 rnh->rnh_walktree(rnh, in_rtqkill, &arg);

--- 103 unchanged lines hidden ---
303#ifdef DIAGNOSTIC
304 log(LOG_DEBUG, "in_rtqtimo: adjusted rtq_reallyold to %d\n",
305 rtq_reallyold);
306#endif
307 arg.found = arg.killed = 0;
308 arg.updating = 1;
309 s = splnet();
310 rnh->rnh_walktree(rnh, in_rtqkill, &arg);

--- 103 unchanged lines hidden ---