From owner-freebsd-bugs@FreeBSD.ORG Fri Apr 9 05:31:27 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBB691065674 for ; Fri, 9 Apr 2010 05:31:26 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B99238FC1E for ; Fri, 9 Apr 2010 05:31:26 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o395VQeG043813 for ; Fri, 9 Apr 2010 05:31:26 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o395VQKY043812; Fri, 9 Apr 2010 05:31:26 GMT (envelope-from gnats) Resent-Date: Fri, 9 Apr 2010 05:31:26 GMT Resent-Message-Id: <201004090531.o395VQKY043812@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E2C07106566B for ; Fri, 9 Apr 2010 05:23:03 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id D28228FC0A for ; Fri, 9 Apr 2010 05:23:03 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o395N3PU032574 for ; Fri, 9 Apr 2010 05:23:03 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o395N37B032573; Fri, 9 Apr 2010 05:23:03 GMT (envelope-from nobody) Message-Id: <201004090523.o395N37B032573@www.freebsd.org> Date: Fri, 9 Apr 2010 05:23:03 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/145553: [patch] [sysinstall] fix default route X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2010 05:31:27 -0000 >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@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: