From owner-svn-src-head@freebsd.org Tue Apr 17 13:47:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8ED8AFA4CC9; Tue, 17 Apr 2018 13:47:49 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl0-x242.google.com (mail-pl0-x242.google.com [IPv6:2607:f8b0:400e:c01::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0739270994; Tue, 17 Apr 2018 13:47:49 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl0-x242.google.com with SMTP id w12-v6so11099199plp.0; Tue, 17 Apr 2018 06:47:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:openpgp:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Pvm5yiIzcT/AyjHAODlI6YCdYAwjRZdMlXnNKO0g+XU=; b=ZA1u9F016L5AphpUutfa2NW0F11pIVArUgxms+57CLtmb6DJyCUKvBBvywPgWfnn0g iS+0TnEzPCytXl0sLNfx7BDOG1FXq+yeu10yf3FNii94Mktskw1hn1jbB2IWND1ff8jz GGaKnVmfDVzMnw7SFvmyNvebKhwTr9drTqBgUeBu0tqfga0mPtBA3/FYfX2m/PqM9urQ kS/5wIcUtgWsMBZbH2OR/Bcfc6GPCuqMTrX0Fa0e/oKsXWGLp3Dxh0pqZi66iBEgtlmG RnNRG50ZhLz4k+VQjay5EUrkuIhSw/KQsk2GdnrRHGu6iMNTlcm653kpdIe9HDs2wf0+ vMIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :openpgp:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Pvm5yiIzcT/AyjHAODlI6YCdYAwjRZdMlXnNKO0g+XU=; b=IuofoVql0GEe0M40BstF1MSnE84otT4rbKCaIA32HOPdlGdnSePWzDqLsazo6oyOW3 bv1kQU2LhT72Cd9gi84+4/XVTF9CSbAlxv5gPOnBR0fKNxBnIutFyaE7vJEvBgOk65Sp kVzbQWKhjmc82fOKqeAaEmYnlEORi/9l7rGyGMnpqDR5pdjeWp3zj7/zqdqnWokuMnYB cnOqOcMdqZZQu1093Q940tpcFO9mwIvAR1022h8BGdD5fjHTZJNASJVO0+96F6AAJztb 0fy4lVhpLLJGgeGcrHxhANZZv+XfzfjGjxDY9d5BsnsaxfKLKOZC9J9yEuQLGABXTF4/ 5bcg== X-Gm-Message-State: ALQs6tBS3Fmrv9Zl91f2ZEEBKblYDk3c/ZzR8S7s/n63VXSoIdvOWwd2 eMeHhDtsAqAighjY/qSc5Kx+lcV2 X-Google-Smtp-Source: AIpwx49nv4pdDoDqN2GHkra1TsLFTLz/P00N4/Tw1do7sNhq/Yo8pKEviLvTK4gKp+Eki22Dan5/bg== X-Received: by 2002:a17:902:8f95:: with SMTP id z21-v6mr2126931plo.304.1523972867822; Tue, 17 Apr 2018 06:47:47 -0700 (PDT) Received: from [192.168.1.135] (7.69.220.111.sta.wbroadband.net.au. [111.220.69.7]) by smtp.gmail.com with ESMTPSA id f69sm20256257pgc.27.2018.04.17.06.47.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 06:47:47 -0700 (PDT) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r332645 - head/sbin/ifconfig To: Andrew Gallatin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201804171254.w3HCsxPx024349@repo.freebsd.org> From: Kubilay Kocak Openpgp: preference=signencrypt Message-ID: Date: Tue, 17 Apr 2018 23:47:19 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <201804171254.w3HCsxPx024349@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2018 13:47:49 -0000 On 17/04/2018 10:54 pm, Andrew Gallatin wrote: > Author: gallatin > Date: Tue Apr 17 12:54:58 2018 > New Revision: 332645 > URL: https://svnweb.freebsd.org/changeset/base/332645 > > Log: > Make lagg creation more fault tolerant > > - Warn, don't exit, when SIOCSLAGGPORT returns an error. > > When we exit with an error during lagg creation, a single > failed NIC (which no longer attaches) can prevent lagg > creation and other configuration, such as adding an IPv4 > address, and thus leave a machine unreachable. > > - Preserve non-EEXISTS errors for exit status from SIOCSLAGGPORT, > in case scripts are looking for it. Hopefully this can be > extended if other parts of ifconfig can allow a "soft" failure. > > - Improve the warning message to mention what lagg and what > member are problematic. > > Reviewed by: jtl, glebius > Sponsored by: Netflix > Differential Revision: https://reviews.freebsd.org/D15046 MFC please? > Modified: > head/sbin/ifconfig/ifclone.c > head/sbin/ifconfig/ifconfig.c > head/sbin/ifconfig/ifconfig.h > head/sbin/ifconfig/ifgroup.c > head/sbin/ifconfig/iflagg.c > > Modified: head/sbin/ifconfig/ifclone.c > ============================================================================== > --- head/sbin/ifconfig/ifclone.c Tue Apr 17 12:52:30 2018 (r332644) > +++ head/sbin/ifconfig/ifclone.c Tue Apr 17 12:54:58 2018 (r332645) > @@ -181,7 +181,7 @@ static void > clone_Copt_cb(const char *optarg __unused) > { > list_cloners(); > - exit(0); > + exit(exit_code); > } > static struct option clone_Copt = { .opt = "C", .opt_usage = "[-C]", .cb = clone_Copt_cb }; > > > Modified: head/sbin/ifconfig/ifconfig.c > ============================================================================== > --- head/sbin/ifconfig/ifconfig.c Tue Apr 17 12:52:30 2018 (r332644) > +++ head/sbin/ifconfig/ifconfig.c Tue Apr 17 12:54:58 2018 (r332645) > @@ -99,6 +99,7 @@ int printifname = 0; > > int supmedia = 0; > int printkeys = 0; /* Print keying material for interfaces. */ > +int exit_code = 0; > > /* Formatter Strings */ > char *f_inet, *f_inet6, *f_ether, *f_addr; > @@ -485,7 +486,7 @@ main(int argc, char *argv[]) > errx(1, "%s: cloning name too long", > ifname); > ifconfig(argc, argv, 1, NULL); > - exit(0); > + exit(exit_code); > } > #ifdef JAIL > /* > @@ -499,7 +500,7 @@ main(int argc, char *argv[]) > errx(1, "%s: interface name too long", > ifname); > ifconfig(argc, argv, 0, NULL); > - exit(0); > + exit(exit_code); > } > #endif > errx(1, "interface %s does not exist", ifname); > @@ -597,7 +598,7 @@ main(int argc, char *argv[]) > freeifaddrs(ifap); > > freeformat(); > - exit(0); > + exit(exit_code); > } > > static struct afswtch *afs = NULL; > > Modified: head/sbin/ifconfig/ifconfig.h > ============================================================================== > --- head/sbin/ifconfig/ifconfig.h Tue Apr 17 12:52:30 2018 (r332644) > +++ head/sbin/ifconfig/ifconfig.h Tue Apr 17 12:54:58 2018 (r332645) > @@ -136,6 +136,7 @@ extern int printkeys; > extern int newaddr; > extern int verbose; > extern int printifname; > +extern int exit_code; > > void setifcap(const char *, int value, int s, const struct afswtch *); > > > Modified: head/sbin/ifconfig/ifgroup.c > ============================================================================== > --- head/sbin/ifconfig/ifgroup.c Tue Apr 17 12:52:30 2018 (r332644) > +++ head/sbin/ifconfig/ifgroup.c Tue Apr 17 12:54:58 2018 (r332645) > @@ -140,7 +140,7 @@ printgroup(const char *groupname) > if (ioctl(s, SIOCGIFGMEMB, (caddr_t)&ifgr) == -1) { > if (errno == EINVAL || errno == ENOTTY || > errno == ENOENT) > - exit(0); > + exit(exit_code); > else > err(1, "SIOCGIFGMEMB"); > } > @@ -159,7 +159,7 @@ printgroup(const char *groupname) > } > free(ifgr.ifgr_groups); > > - exit(0); > + exit(exit_code); > } > > static struct cmd group_cmds[] = { > > Modified: head/sbin/ifconfig/iflagg.c > ============================================================================== > --- head/sbin/ifconfig/iflagg.c Tue Apr 17 12:52:30 2018 (r332644) > +++ head/sbin/ifconfig/iflagg.c Tue Apr 17 12:54:58 2018 (r332645) > @@ -41,9 +41,17 @@ setlaggport(const char *val, int d, int s, const struc > strlcpy(rp.rp_ifname, name, sizeof(rp.rp_ifname)); > strlcpy(rp.rp_portname, val, sizeof(rp.rp_portname)); > > - /* Don't choke if the port is already in this lagg. */ > - if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST) > - err(1, "SIOCSLAGGPORT"); > + /* > + * Do not exit with an error here. Doing so permits a > + * failed NIC to take down an entire lagg. > + * > + * Don't error at all if the port is already in the lagg. > + */ > + if (ioctl(s, SIOCSLAGGPORT, &rp) && errno != EEXIST) { > + warnx("%s %s: SIOCSLAGGPORT: %s", > + name, val, strerror(errno)); > + exit_code = 1; > + } > } > > static void > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" >