changeset 3725:06a7db15387f

6494556 in.routed leaks memory via rt_spares 6498249 ripv2 client not updating network route with lower metric
author sowmini
date Tue, 27 Feb 2007 13:44:50 -0800
parents e9369c0865be
children dfabc2cbe34c
files usr/src/cmd/cmd-inet/usr.sbin/in.routed/input.c usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c
diffstat 2 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/input.c	Tue Feb 27 07:19:57 2007 -0800
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/input.c	Tue Feb 27 13:44:50 2007 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Copyright (c) 1983, 1988, 1993
@@ -1164,11 +1164,13 @@
 		 * then note it.
 		 */
 		if (i == rt->rt_num_spares) {
+			uint8_t old_metric = rts->rts_metric;
+
 			rtchange(rt, rt->rt_state | rt_state, new, 0);
 			/*
 			 * If the route got worse, check for something better.
 			 */
-			if (new->rts_metric != rts->rts_metric)
+			if (new->rts_metric != old_metric)
 				rtswitch(rt, 0);
 			return;
 		}
--- a/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c	Tue Feb 27 07:19:57 2007 -0800
+++ b/usr/src/cmd/cmd-inet/usr.sbin/in.routed/table.c	Tue Feb 27 13:44:50 2007 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  *
  * Copyright (c) 1983, 1988, 1993
@@ -2465,6 +2465,7 @@
 			free(deleted_rt);
 	}
 	total_routes--;
+	free(rt->rt_spares);
 	free(rt);
 
 	if (dst_sock.sin_addr.s_addr == RIP_DEFAULT) {