From nobody Fri Jan 07 13:30:49 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9FBFC194024A; Fri, 7 Jan 2022 13:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JVkcn2WZXz4hLL; Fri, 7 Jan 2022 13:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 369E14047; Fri, 7 Jan 2022 13:30:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 207DUnvq030473; Fri, 7 Jan 2022 13:30:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 207DUnja030472; Fri, 7 Jan 2022 13:30:49 GMT (envelope-from git) Date: Fri, 7 Jan 2022 13:30:49 GMT Message-Id: <202201071330.207DUnja030472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: a8aaed141731 - stable/13 - ifconfig(8): Don't set network interface capabilities when there is no change. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a8aaed141731d895b63b239c3a63a9052142ee41 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641562249; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TUNnULHXVRPKpydxCbNRU1ofwxIQXZj5pyyN4tmMdKo=; b=d5NNEvnzNoAcj+8tuGpYE1X/yc8CNpYoWiSKXvvBR4kVj/jJVXaHLVs+NumHs9yx9Jrt2F f+AZLzRe82MHdt5LLmIUowFdFXDJyh7fBWPineo75LboJBBlWn2KycCf3yCjuosoFU0zIO N0I8Tt6+mZu89ZFHzNdtKzCS3jrYYQZxDRsMmM80Ghtfa1TVTJHLAIN9dCI6mS6SBP7Bc9 lTi/ZW/n4ZiS1SYQl12ZbghBwqbEtnjnt9mJx0/bqMVTtmJ943U/WMr/e1zefddnNuZ3AZ Yk2/ajqnTh0xCGZaAaErEKS0cje8ytgGWniWNQgq1JfBbL1o3+/9HhYbzlQFiA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641562249; a=rsa-sha256; cv=none; b=WKN9pqrP5f3+VLTLrC4vleo0eGDt+e1TIi2nDZQ5LcGI9o9rsGBVHxsfUyU2i8em5iFI/7 I7S9HP4i0m2ZkKuL9aYfewATQjsc/C0/BRDjmSdEl64IOoOWlgOvix5BCTUQI6i8yhYsht HVbUL7lVl9EzBs4YrHgw2dG0lA1oXz67ImbVHhgFcDcqc206ijKodgIzYo77XhkCYVjyWO 0sPL2HoqvhcEBWBFZ2JbrHLAWif71+sWHAM86nNV2pAZpUDEAjAn7kp2VpxNWOZntjLpug oFG3yGTHX6LDOwmbH9XQ1Ero9f+vur6MVZxsGExJZ9IRzXe6whfZ3fQbFSRH7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=a8aaed141731d895b63b239c3a63a9052142ee41 commit a8aaed141731d895b63b239c3a63a9052142ee41 Author: Hans Petter Selasky AuthorDate: 2021-11-09 21:07:43 +0000 Commit: Hans Petter Selasky CommitDate: 2022-01-07 13:11:32 +0000 ifconfig(8): Don't set network interface capabilities when there is no change. A quick grep through the kernel code shows network drivers compute the changed bits of network capabilities after a SIOCSIFCAP IOCTL(2) by using the bitwise exclusive or operation. When the set capabilities are equal to the already read capabilities, no action will be taken. Let ifconfig(8) predict this case and skip the SIOCSIFCAP IOCTL(2) system call. Discussed with: kib@ (revert change in case of issues) Sponsored by: NVIDIA Networking (cherry picked from commit ad8f078f66e51212cdccd91fe8b22fb81235018e) --- sbin/ifconfig/ifconfig.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 0423b3593504..9e7d38d4c2a4 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1243,6 +1243,9 @@ setifcap(const char *vname, int value, int s, const struct afswtch *afp) } else flags |= value; flags &= ifr.ifr_reqcap; + /* Check for no change in capabilities. */ + if (ifr.ifr_curcap == flags) + return; ifr.ifr_reqcap = flags; if (ioctl(s, SIOCSIFCAP, (caddr_t)&ifr) < 0) Perror(vname);