6944720 upgrade with ephemeral location causes network/location to go into maintenance on boot
authorAnurag S. Maskey <Anurag.Maskey@Oracle.COM>
Wed, 28 Apr 2010 09:54:03 -0400
changeset 12274 8a6217ddb91a
parent 12273 63678502e95e
child 12275 ee283d4affa1
6944720 upgrade with ephemeral location causes network/location to go into maintenance on boot
usr/src/cmd/cmd-inet/lib/nwamd/loc.c
usr/src/cmd/svc/milestone/net-loc
--- a/usr/src/cmd/cmd-inet/lib/nwamd/loc.c	Wed Apr 28 10:01:37 2010 +0200
+++ b/usr/src/cmd/cmd-inet/lib/nwamd/loc.c	Wed Apr 28 09:54:03 2010 -0400
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <arpa/inet.h>
@@ -174,10 +173,9 @@
 			nwamd_object_t eobj = nwamd_object_find
 			    (NWAM_OBJECT_TYPE_LOC, enabled);
 			if (eobj == NULL) {
-				nlog(LOG_ERR, "nwamd_loc_activate: cannot "
+				nlog(LOG_INFO, "nwamd_loc_activate: could not "
 				    "find old location %s", enabled);
-				free(enabled);
-				return;
+				goto skip_disable;
 			}
 			/*
 			 * Disable if the old location was manual, since the
@@ -208,12 +206,13 @@
 			}
 		}
 	}
+skip_disable:
 	free(enabled);
 
 	if (nwamd_set_string_property(NET_LOC_FMRI, NET_LOC_PG,
 	    NET_LOC_SELECTED_PROP, object_name) == 0) {
 		char *state = smf_get_state(NET_LOC_FMRI);
-		nlog(LOG_INFO, "nwam_loc_activate: set %s/%s to %s; "
+		nlog(LOG_INFO, "nwamd_loc_activate: set %s/%s to %s; "
 		    "service is in %s state", NET_LOC_PG, NET_LOC_SELECTED_PROP,
 		    object_name, state == NULL ? "unknown" : state);
 		free(state);
--- a/usr/src/cmd/svc/milestone/net-loc	Wed Apr 28 10:01:37 2010 +0200
+++ b/usr/src/cmd/svc/milestone/net-loc	Wed Apr 28 09:54:03 2010 -0400
@@ -20,8 +20,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
 #
 
 . /lib/svc/share/smf_include.sh
@@ -689,8 +688,16 @@
 		# location hasn't been selected; default to NoNet
 		activate_loc NoNet
 	else
-		# activate selected location
-		activate_loc $sel_loc
+		# check if the selected location exists
+		$NWAMCFG list loc $sel_loc >/dev/null 2>&1
+		if [ $? -eq 1 ]; then
+			echo "location $sel_loc doesn't exist, revert to NoNet"
+			set_smf_prop $SMF_FMRI location/selected NoNet
+			refresh_svc $SMF_FMRI
+		else
+			# activate selected location
+			activate_loc $sel_loc
+		fi
 	fi
 fi