From nobody Sat Jan 29 11:20:41 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 88F2E197B78D; Sat, 29 Jan 2022 11:20:53 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward501o.mail.yandex.net (forward501o.mail.yandex.net [37.140.190.203]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JmBhg6hdcz4pQc; Sat, 29 Jan 2022 11:20:51 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from iva5-09aef7c12260.qloud-c.yandex.net (iva5-09aef7c12260.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:7f93:0:640:9ae:f7c1]) by forward501o.mail.yandex.net (Yandex) with ESMTP id 1CDD145C4A47; Sat, 29 Jan 2022 14:20:44 +0300 (MSK) Received: from iva4-b3ebd202b141.qloud-c.yandex.net (iva4-b3ebd202b141.qloud-c.yandex.net [2a02:6b8:c0c:4e8e:0:640:b3eb:d202]) by iva5-09aef7c12260.qloud-c.yandex.net (mxback/Yandex) with ESMTP id uxiChR0HBS-KhdKHUgg; Sat, 29 Jan 2022 14:20:44 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1643455244; bh=CzQA+ctPlk7QlDcNCUceeMt6euofruXTqysDt1FmlBU=; h=In-Reply-To:Subject:Cc:From:Message-Id:To:References:Date; b=F4+cN8d0QN3h1oIx8jbHI3sgUOuXMf25v3EdRNkb8UbMHd2FtUAL7E6cCJifWvJYK 64YjyWFfYeD30Vqxb3dM8Kye/NZUzVVZVJQLIO+Hz0UxYyub6S+ZE8Blsh52ti0Ils fXqkz2Nk9iBZa+JM9/aoWiSExfBdp/KYv/VBO8oQ= Received: by iva4-b3ebd202b141.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id SxHeeTN6Yn-KgIaXtsO; Sat, 29 Jan 2022 14:20:43 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Yandex-Fwd: 2 From: "Alexander V. Chernikov" Message-Id: <8F41F011-F47F-43B7-8564-0A625A4010AE@ipfw.ru> Content-Type: multipart/alternative; boundary="Apple-Mail=_4B23CA0C-BF92-44B4-AC85-08BEE0A3EE1D" 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 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Subject: Re: git: 779fd0534466 - main - ifconfig: improve vlan options parsing Date: Sat, 29 Jan 2022 11:20:41 +0000 In-Reply-To: Cc: "Alexander V. Chernikov" , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" To: John Baldwin References: <202201170935.20H9ZOpr069571@gitrepo.freebsd.org> X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Rspamd-Queue-Id: 4JmBhg6hdcz4pQc X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ipfw.ru header.s=mail header.b=F4+cN8d0; dmarc=none; spf=pass (mx1.freebsd.org: domain of melifaro@ipfw.ru designates 37.140.190.203 as permitted sender) smtp.mailfrom=melifaro@ipfw.ru X-Spamd-Result: default: False [-1.00 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ipfw.ru:s=mail]; FREEFALL_USER(0.00)[melifaro]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; R_SPF_ALLOW(-0.20)[+ip4:37.140.128.0/18]; DMARC_NA(0.00)[ipfw.ru]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; RWL_MAILSPIKE_EXCELLENT(0.00)[37.140.190.203:from]; NEURAL_SPAM_SHORT(1.00)[1.000]; DKIM_TRACE(0.00)[ipfw.ru:+]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; MLMMJ_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:13238, ipnet:37.140.128.0/18, country:RU]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_4B23CA0C-BF92-44B4-AC85-08BEE0A3EE1D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 28 Jan 2022, at 17:34, John Baldwin wrote: >=20 > On 1/17/22 1:35 AM, Alexander V. Chernikov wrote: >> The branch main has been updated by melifaro: >> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D779fd05344662aeec79c29470258bf65= 7318eab3 >> commit 779fd05344662aeec79c29470258bf657318eab3 >> Author: Alexander V. Chernikov >> AuthorDate: 2022-01-17 09:30:26 +0000 >> Commit: Alexander V. Chernikov >> CommitDate: 2022-01-17 09:35:15 +0000 >> ifconfig: improve vlan options parsing >> PR: 261136 >> Reported by: Daniel O'Connor >> MFC after: 2 weeks >> --- >> 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 >> @@ -144,8 +139,20 @@ vlan_parse_ethervid(const char *name) >> if ((*cp !=3D '\0') || (vid & ~0xFFF)) >> errx(1, "invalid vlan tag"); >> - strlcpy(params.vlr_parent, ifname, IFNAMSIZ); >> - params.vlr_tag =3D (vid & 0xFFF); >> + /* >> + * allow "devX.Y vlandev devX vlan Y" syntax >> + */ >> + if (params.vlr_tag =3D=3D NOTAG || params.vlr_tag =3D=3D vid) >> + params.vlr_tag =3D vid; >> + else >> + errx(1, "ambiguous vlan specification"); >> + >> + /* Restrict overriding interface name */ >> + if (params.vlr_parent[0] =3D=3D '\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); >=20 > Did you mean to leave this printf in? I see it when adding a vlan = interface now: No, I didn=E2=80=99t - it slipped through the cracks. Fixed in = 656f5031c391. >=20 > root@frodo:~ # ifconfig cxl0.200 create > CR: cxl0 200 >=20 > --=20 > John Baldwin --Apple-Mail=_4B23CA0C-BF92-44B4-AC85-08BEE0A3EE1D Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 28 Jan 2022, at 17:34, John Baldwin <jhb@FreeBSD.org> = wrote:

On 1/17/22 1:35 AM, Alexander V. Chernikov wrote:
The = branch main has been updated by melifaro:
URL: https://cgit.FreeBSD.org/src/commit/?id=3D779fd05344662aeec79c2= 9470258bf657318eab3
commit = 779fd05344662aeec79c29470258bf657318eab3
Author: =     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: = 2022-01-17 09:30:26 +0000
Commit: =     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: = 2022-01-17 09:35:15 +0000
    ifconfig: = improve vlan options parsing
         PR: =     261136
    Reported by:    Daniel = O'Connor
    MFC after: =      2 weeks
---
 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
@@ -144,8 +139,20 @@ = vlan_parse_ethervid(const char *name)
  if ((*cp = !=3D '\0') || (vid & ~0xFFF))
  errx(1, = "invalid vlan tag");
 - strlcpy(params.vlr_parent, = ifname, IFNAMSIZ);
- params.vlr_tag =3D (vid & = 0xFFF);
+ /*
+  * allow "devX.Y vlandev = devX vlan Y" syntax
+  */
+ if = (params.vlr_tag =3D=3D NOTAG || params.vlr_tag =3D=3D vid)
+ = = params.vlr_tag =3D vid;
+ else
+ = = errx(1, "ambiguous vlan specification");
+
+ = /* Restrict overriding interface name */
+ if = (params.vlr_parent[0] =3D=3D '\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);

Did you mean to leave this printf in?  I see it when = adding a vlan interface now:
No, I didn=E2=80=99t= - it slipped through the cracks. Fixed = in 656f5031c391.

root@frodo:~ = # ifconfig cxl0.200 create
CR: cxl0 200

-- John = Baldwin

= --Apple-Mail=_4B23CA0C-BF92-44B4-AC85-08BEE0A3EE1D--