summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorrandi <randi@FreeBSD.org>2010-05-22 00:43:14 +0000
committerrandi <randi@FreeBSD.org>2010-05-22 00:43:14 +0000
commitda53a80ad4644ffb775fc0591018929c05569460 (patch)
tree80a621e07f565c2b1e52a7c6abc2829bfbe17eeb /usr.sbin
parent4928a940d2246a848434dbe078f5a2952dde5c2e (diff)
downloadFreeBSD-src-da53a80ad4644ffb775fc0591018929c05569460.zip
FreeBSD-src-da53a80ad4644ffb775fc0591018929c05569460.tar.gz
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
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/sysinstall/network.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c
index 20a0430..a06c927 100644
--- a/usr.sbin/sysinstall/network.c
+++ b/usr.sbin/sysinstall/network.c
@@ -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");
OpenPOWER on IntegriCloud