From nobody Mon Mar 28 15:26:04 2022 X-Original-To: dev-commits-src-branches@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 3776E1A31AE8; Mon, 28 Mar 2022 15:26:05 +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 4KRxNr6qKdz3QJP; Mon, 28 Mar 2022 15:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481165; 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=d+v2SLhajyQ11JnmzEPr1804/Mm8k3arJIiM8KdJPFY=; b=tprUdc85GaKBOQ2ycaEec3r4mwVLO6SvYDDzlvkOav/Hq5wOYMRDG/5/zTbei9+rpcwr4y AjFAsRcKFxt5UBy1pMFGqQUmsgF4VaEUQnZCbJYbN9vw4U7D0k1hf7j9doiByHHjpneQmi tJCd9WBGWrMWdv646CwzZg8mES/oXEetL7w7xWbt+0gQVPAjr5fiuZ63Tsl8nKzVf1EWwb PKFrc+m/Q8iDJ1B5nTjHHpClvz6c5g7iSf5TmoZmDWTckEoZ0lVxSDpqrC19OHCcwBzI+h rDFAWdGH4fquPDHSKae8CtWykb/n+x9vtqqPFE6xxLlM+AitmYDVYpTItoZ8lA== 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 A6F9E473D; Mon, 28 Mar 2022 15:26:04 +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 22SFQ4E9086992; Mon, 28 Mar 2022 15:26:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22SFQ4xG086991; Mon, 28 Mar 2022 15:26:04 GMT (envelope-from git) Date: Mon, 28 Mar 2022 15:26:04 GMT Message-Id: <202203281526.22SFQ4xG086991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: 2eb4ac1e6fc9 - releng/13.1 - ifconfig: improve vlan options parsing List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 2eb4ac1e6fc946ca8d175863b16602885fae61b7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648481165; 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=d+v2SLhajyQ11JnmzEPr1804/Mm8k3arJIiM8KdJPFY=; b=v1b+luCrQ6GiyJgZZBqOl7N5NMVHN+Q8K1eaTI/QK0KpCPV0r4iuW5+vpBhitygLVZZZzE d0+zRedqNYy+sRfoSaJ+uvmaCrPD/IAJBjfevt3f76l2/T5/VU1q8xYzLTjseX8y2l7OeL hn2YNBLH4JOFtTwYs3pZVc9fJ4YL/xx/AHJdVfkMHhMzeWWTIu4LJS8voP/nteMuyWhl7P 0zN0uLnEku7j+IgPc9qvzj0+eUZCp5vI0mrJNRXlhMpzFpC6ZO20e9WNiFcG+ai9pov1wv SFsknlnSUfoteAwn7vQT3GIonHbUa1vEfdrpIjvpEm7YsilCvfu6epv6aPr/UQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648481165; a=rsa-sha256; cv=none; b=le94vFRKzjW0M3eRzM8tIL7Ac7+Ly+Va/Aoixkdgco/GTlZ1k8KSokeFibOTLSLrwfu3C2 5yxvQ9g1nMRhuqh8UoOuAbCkaejOrrfkU7eI5Q8G7honuQKDQ8ODH+kLQ/ZfdEIRzyt2Ao 6lODyx6gvMXAJ6soiEVlwcQGfsFPBCFj1MgNUanxGnRMnQifM6Cbh4S1F/pA0qVKjy8VxB XvMWzjPoPWntUvKYrZhCBlHatwAVRDWauwyPVkq4qN6dDcAD/o4fhv+P/dPU9DNBofHxx6 SS0GmYFMrpI0oZW2ozAeYMtiCufnJgbUfkYD5j8Eq7N7gxBJqRFtCUJEJ7IL6w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2eb4ac1e6fc946ca8d175863b16602885fae61b7 commit 2eb4ac1e6fc946ca8d175863b16602885fae61b7 Author: Alexander V. Chernikov AuthorDate: 2022-01-17 09:30:26 +0000 Commit: Alexander V. Chernikov CommitDate: 2022-03-28 15:25:23 +0000 ifconfig: improve vlan options parsing PR: 261136 Reported by: Daniel O'Connor Approved by: re(gjb) MFC after: 2 weeks (cherry picked from commit 779fd05344662aeec79c29470258bf657318eab3) (cherry picked from commit 157bf2c9964a54124e05bb7c354d8e5ad784802a) --- sbin/ifconfig/ifvlan.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c index 60f97338ee27..1e74b504fc26 100644 --- a/sbin/ifconfig/ifvlan.c +++ b/sbin/ifconfig/ifvlan.c @@ -126,11 +126,6 @@ vlan_parse_ethervid(const char *name) strlcpy(ifname, name, IFNAMSIZ); if ((cp = strrchr(ifname, '.')) == NULL) return; - /* - * Don't mix vlan/vlandev parameters with dot notation. - */ - if (params.vlr_tag != NOTAG || params.vlr_parent[0] != '\0') - errx(1, "ambiguous vlan specification"); /* * Derive params from interface name: "parent.vid". */ @@ -144,8 +139,20 @@ vlan_parse_ethervid(const char *name) if ((*cp != '\0') || (vid & ~0xFFF)) errx(1, "invalid vlan tag"); - strlcpy(params.vlr_parent, ifname, IFNAMSIZ); - params.vlr_tag = (vid & 0xFFF); + /* + * allow "devX.Y vlandev devX vlan Y" syntax + */ + if (params.vlr_tag == NOTAG || params.vlr_tag == vid) + params.vlr_tag = vid; + else + errx(1, "ambiguous vlan specification"); + + /* Restrict overriding interface name */ + if (params.vlr_parent[0] == '\0' || !strcmp(params.vlr_parent, ifname)) + strlcpy(params.vlr_parent, ifname, IFNAMSIZ); + else + errx(1, "ambiguous vlan specification"); + printf("CR: %s %d\n", params.vlr_parent, params.vlr_tag); } static void