Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 May 2010 00:43:14 +0000 (UTC)
From:      Randi Harper <randi@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208407 - head/usr.sbin/sysinstall
Message-ID:  <201005220043.o4M0hELT090344@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: randi
Date: Sat May 22 00:43:14 2010
New Revision: 208407
URL: http://svn.freebsd.org/changeset/base/208407

Log:
  Flush all routes before adding the default route in order to allow
  sysinstall to cleanly re-initialize the network.
  
  PR: bin/145553
  Submitted by: gcooper
  Approved by: cperciva (mentor)
  MFC after: 3 days

Modified:
  head/usr.sbin/sysinstall/network.c

Modified: head/usr.sbin/sysinstall/network.c
==============================================================================
--- head/usr.sbin/sysinstall/network.c	Fri May 21 23:08:53 2010	(r208406)
+++ head/usr.sbin/sysinstall/network.c	Sat May 22 00:43:14 2010	(r208407)
@@ -141,12 +141,22 @@ mediaInitNetwork(Device *dev)
 	    }
 	    rp = variable_get(VAR_GATEWAY);
 	    if (!rp || *rp == '0') {
-		msgConfirm("No gateway has been set. You may be unable to access hosts\n"
+		msgConfirm("No gateway has been set. You will be unable to access hosts\n"
 			   "not on your local network");
 	    }
 	    else {
+		/* 
+		 * Explicitly flush all routes to get back to a known sane
+		 * state. We don't need to check this exit code because if
+		 * anything fails it will show up in the route add below.
+		 */
+		system("route -n flush");
 		msgDebug("Adding default route to %s.\n", rp);
-		vsystem("route -n add default %s", rp);
+		if (vsystem("route -n add default %s", rp) != 0) {
+		    msgConfirm("Failed to add a default route; please check "
+			       "your network configuration");
+		    return FALSE;
+		}
 	    }
 	} else {
 	    msgDebug("A DHCP interface.  Should already be up.\n");



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005220043.o4M0hELT090344>