From nobody Thu Jul 21 16:36:47 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 4LpdWM3d4zz4X1hk; Thu, 21 Jul 2022 16:36:47 +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 4LpdWM35X8z4NKK; Thu, 21 Jul 2022 16:36:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658421407; 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=lPNq6NHPM3Y3aeUFf+d1FvHXJhrm89Pd+xDXQHyaL7A=; b=SwL2s/hznsxH8wOIHMHqAbVYdNpHwCJSc7Idt0UweO6gAWhZlGyvfOoUrtJ+SbXdLVS/qg 32QeViUnA4q5FklephXwcRsIK4JSXs47c8g2l2ulW9j7joHXxeOFrdZM+0T45zBVkRZUPk VvK+VMtmQUJM7K12ndo1C5jCYhOBZmqGHhzAH5L1v6kz6Pn35T9Zf3mNWnNVQ/YQpLMDcE vOkn5XoIhQCYnPspROKMB5arCGJcn3GmnOY2wkIUFCdoBnC/pKl8LYTq+pbT5xKZFojT7g 6ti+mw5GgClxjg/OpALBBJgLHChN/t3pRM9jUsmaCXx5Z7cXm1Z6HrwEzID4Zg== 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 4LpdWM29hkzSpQ; Thu, 21 Jul 2022 16:36:47 +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 26LGalCj034400; Thu, 21 Jul 2022 16:36:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 26LGalfh034399; Thu, 21 Jul 2022 16:36:47 GMT (envelope-from git) Date: Thu, 21 Jul 2022 16:36:47 GMT Message-Id: <202207211636.26LGalfh034399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 663f556b03a8 - main - if_vlan: allow vlan and vlanproto to be changed 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 663f556b03a86b66ce6a9af1edf229ef74775676 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658421407; 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=lPNq6NHPM3Y3aeUFf+d1FvHXJhrm89Pd+xDXQHyaL7A=; b=szZPqm250xtRVNBNFJXLWvP1YqraCBbXLggQa4bo6nBJz0N+qJflUNXP5ninPgEFNbOnp8 V8n9FrKGQ4hp7nHpWjx7+qZXMzFmhIHU4X+BMHhlYYvuF5oCQBAADsqXMyEVKXl5aXBQ8p Th5jkbnbEMiUErFFqOFw2TAvvmuQ4jQ2X682EbeSiJowJ3A8j1JGftL9mfQ5IaFeJi7sZK AH56Zf7YRfNNMEmjmkzBknrMl6NPkAN02WRpWaYTcDCLMOqP1U2pIzNdNHwAZ9cneD6lRz pQYkaP6jjeYuCTO6jn8IBtLYHfMHzAWugSVRTe0ShMIDtx2tJk5MkwmkzqlnLA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658421407; a=rsa-sha256; cv=none; b=dyi76etdJFbxd1QoWmQfBJsBPGau1P1g3xh+jGCGOtSPIA/nExafeRV4tsX/XJRIFVfUYf 2IWXLvAQSlY3YXr/dpxRkLj35Cn9MgpIXuXgDs+51x6y2S6oSZPUUOZU131S8wQuYsbSOa ztfbdBqufrA37FUwEANZDCDZrhQzqvylguJAluaSScyJ+w5ilHwcyQwwumZ5dK0zh7A2Ts PeUxfiX2vi4H50ZipDjIbs93HktPbacmTSWiGCC0QmyKb4RDQAQtwIqfJmg8W+j8hrBjf+ hEXq7UavuLpLxCaqqX8DpRBJV7jfvjkx6vE8urUO6r0C8Uqd3sygmAMtt1sz2g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=663f556b03a86b66ce6a9af1edf229ef74775676 commit 663f556b03a86b66ce6a9af1edf229ef74775676 Author: Kristof Provost AuthorDate: 2022-07-18 22:23:50 +0000 Commit: Kristof Provost CommitDate: 2022-07-21 16:36:01 +0000 if_vlan: allow vlan and vlanproto to be changed It's currently not possible to change the vlan ID or vlan protocol (i.e. 802.1q vs. 802.1ad) without de-configuring the interface (i.e. ifconfig vlanX -vlandev). Add a specific flow for this, allowing both the protocol and id (but not parent interface) to be changed without going through the '-vlandev' step. Reviewed by: glebius Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D35846 --- sys/net/if_vlan.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index f8af0fd3d915..03a06f09c541 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1538,8 +1538,24 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid, */ if (vid == 0 || vid == 0xFFF || (vid & ~EVL_VLID_MASK)) return (EINVAL); - if (ifv->ifv_trunk) - return (EBUSY); + if (ifv->ifv_trunk) { + trunk = ifv->ifv_trunk; + if (trunk->parent != p) + return (EBUSY); + + VLAN_XLOCK(); + + ifv->ifv_proto = proto; + + if (ifv->ifv_vid != vid) { + /* Re-hash */ + vlan_remhash(trunk, ifv); + ifv->ifv_vid = vid; + error = vlan_inshash(trunk, ifv); + } + /* Will unlock */ + goto done; + } VLAN_XLOCK(); if (p->if_vlantrunk == NULL) {