bin/145553: [patch] [sysinstall] fix default route
Garrett Cooper
gcooper at FreeBSD.org
Fri Apr 9 05:31:27 UTC 2010
>Number: 145553
>Category: bin
>Synopsis: [patch] [sysinstall] fix default route
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 09 05:31:26 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Garrett Cooper
>Release: 9-CURRENT
>Organization:
Cisco Systems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #3 r206173M: Mon Apr 5 12:12:29 PDT 2010 root at bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA amd64
>Description:
If a route has already been setup, and the network interface is `reinitialized', the old route won't be deleted beforehand like it should, causing networking problems.
This fixes that.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
Index: network.c
===================================================================
--- network.c (revision 206173)
+++ network.c (working copy)
@@ -132,8 +132,7 @@
*/
if (strstr(cp, "DHCP") == NULL) {
msgDebug("Not a DHCP interface.\n");
- i = vsystem("ifconfig %s %s", dev->name, cp);
- if (i) {
+ if (vsystem("ifconfig %s %s", dev->name, cp) != 0) {
msgConfirm("Unable to configure the %s interface!\n"
"This installation method cannot be used.",
dev->name);
@@ -141,12 +140,22 @@
}
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");
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list