diff options
author | Randi Harper <randi@FreeBSD.org> | 2010-05-22 00:43:14 +0000 |
---|---|---|
committer | Randi Harper <randi@FreeBSD.org> | 2010-05-22 00:43:14 +0000 |
commit | 00fdbea7b2cbb89f5baf7b30d27a0d460386842a (patch) | |
tree | 80a621e07f565c2b1e52a7c6abc2829bfbe17eeb /usr.sbin | |
parent | 50b8f14f71f97dad28726e1a0f337d0914f51e69 (diff) | |
download | src-00fdbea7b2cbb89f5baf7b30d27a0d460386842a.tar.gz src-00fdbea7b2cbb89f5baf7b30d27a0d460386842a.zip |
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
Notes
Notes:
svn path=/head/; revision=208407
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sysinstall/network.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/usr.sbin/sysinstall/network.c b/usr.sbin/sysinstall/network.c index 20a043064b52..a06c927377f1 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"); |