Date: Sat, 29 Jan 2022 11:20:41 +0000 From: "Alexander V. Chernikov" <melifaro@ipfw.ru> To: John Baldwin <jhb@FreeBSD.org> Cc: "Alexander V. Chernikov" <melifaro@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org> Subject: Re: git: 779fd0534466 - main - ifconfig: improve vlan options parsing Message-ID: <8F41F011-F47F-43B7-8564-0A625A4010AE@ipfw.ru> In-Reply-To: <fd5ac517-934c-d38a-a536-0ff10733db44@FreeBSD.org> References: <202201170935.20H9ZOpr069571@gitrepo.freebsd.org> <fd5ac517-934c-d38a-a536-0ff10733db44@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <jhb@FreeBSD.org> 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 <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); >=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 <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; = charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><br = class=3D""><div><br class=3D""><blockquote type=3D"cite" class=3D""><div = class=3D"">On 28 Jan 2022, at 17:34, John Baldwin <<a = href=3D"mailto:jhb@FreeBSD.org" class=3D"">jhb@FreeBSD.org</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><div class=3D""><meta = charset=3D"UTF-8" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">On 1/17/22 1:35 AM, Alexander V. Chernikov wrote:</span><br = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" = class=3D""><blockquote type=3D"cite" style=3D"font-family: Helvetica; = font-size: 12px; font-style: normal; font-variant-caps: normal; = font-weight: normal; letter-spacing: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D"">The = branch main has been updated by melifaro:<br class=3D"">URL: <a = href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D779fd05344662aeec79c2947= 0258bf657318eab3" = class=3D"">https://cgit.FreeBSD.org/src/commit/?id=3D779fd05344662aeec79c2= 9470258bf657318eab3</a><br class=3D"">commit = 779fd05344662aeec79c29470258bf657318eab3<br class=3D"">Author: = Alexander V. Chernikov <<a = href=3D"mailto:melifaro@FreeBSD.org" = class=3D"">melifaro@FreeBSD.org</a>><br class=3D"">AuthorDate: = 2022-01-17 09:30:26 +0000<br class=3D"">Commit: = Alexander V. Chernikov <<a = href=3D"mailto:melifaro@FreeBSD.org" = class=3D"">melifaro@FreeBSD.org</a>><br class=3D"">CommitDate: = 2022-01-17 09:35:15 +0000<br class=3D""> ifconfig: = improve vlan options parsing<br = class=3D""> PR: = 261136<br = class=3D""> Reported by: Daniel = O'Connor<br class=3D""> MFC after: = 2 weeks<br class=3D"">---<br = class=3D""> sbin/ifconfig/ifvlan.c | 21 ++++++++++++++-------<br = class=3D""> 1 file changed, 14 insertions(+), 7 deletions(-)<br = class=3D"">diff --git a/sbin/ifconfig/ifvlan.c = b/sbin/ifconfig/ifvlan.c<br class=3D"">index 60f97338ee27..1e74b504fc26 = 100644<br class=3D"">--- a/sbin/ifconfig/ifvlan.c<br class=3D"">+++ = b/sbin/ifconfig/ifvlan.c<br class=3D"">@@ -144,8 +139,20 @@ = vlan_parse_ethervid(const char *name)<br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if ((*cp = !=3D '\0') || (vid & ~0xFFF))<br class=3D""> <span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>errx(1, = "invalid vlan tag");<br class=3D""> -<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>strlcpy(params.vlr_parent, = ifname, IFNAMSIZ);<br class=3D"">-<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>params.vlr_tag =3D (vid & = 0xFFF);<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>/*<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span>* allow "devX.Y vlandev = devX vlan Y" syntax<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span = class=3D"Apple-converted-space"> </span>*/<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (params.vlr_tag =3D=3D NOTAG || params.vlr_tag =3D=3D vid)<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>params.vlr_tag =3D vid;<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>else<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span><span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>errx(1, "ambiguous vlan specification");<br class=3D"">+<br = class=3D"">+<span class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>/* Restrict overriding interface name */<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>if = (params.vlr_parent[0] =3D=3D '\0' || !strcmp(params.vlr_parent, = ifname))<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span><span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>strlcpy(params.vlr_parent, = ifname, IFNAMSIZ);<br class=3D"">+<span class=3D"Apple-tab-span" = style=3D"white-space: pre;"> </span>else<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span><span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> </span>errx(1, = "ambiguous vlan specification");<br class=3D"">+<span = class=3D"Apple-tab-span" style=3D"white-space: pre;"> = </span>printf("CR: %s %d\n", params.vlr_parent, params.vlr_tag);<br = class=3D""></blockquote><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">Did you mean to leave this printf in? I see it when = adding a vlan interface now:</span><br style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""></div></blockquote>No, I didn=E2=80=99t= - it slipped through the cracks. Fixed = in 656f5031c391.</div><div><blockquote type=3D"cite" class=3D""><div = class=3D""><br style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none;" class=3D""><span style=3D"caret-color: rgb(0, 0, 0); font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant-caps: = normal; font-weight: normal; letter-spacing: normal; text-align: start; = text-indent: 0px; text-transform: none; white-space: normal; = word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: = none; float: none; display: inline !important;" class=3D"">root@frodo:~ = # ifconfig cxl0.200 create</span><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">CR: cxl0 200</span><br style=3D"caret-color: rgb(0, 0, 0); = font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><br style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none;" class=3D""><span style=3D"caret-color: rgb(0, 0, = 0); font-family: Helvetica; font-size: 12px; font-style: normal; = font-variant-caps: normal; font-weight: normal; letter-spacing: normal; = text-align: start; text-indent: 0px; text-transform: none; white-space: = normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; = text-decoration: none; float: none; display: inline !important;" = class=3D"">--<span class=3D"Apple-converted-space"> </span></span><br= style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none;" class=3D""><span = style=3D"caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: = 12px; font-style: normal; font-variant-caps: normal; font-weight: = normal; letter-spacing: normal; text-align: start; text-indent: 0px; = text-transform: none; white-space: normal; word-spacing: 0px; = -webkit-text-stroke-width: 0px; text-decoration: none; float: none; = display: inline !important;" class=3D"">John = Baldwin</span></div></blockquote></div><br class=3D""></body></html>= --Apple-Mail=_4B23CA0C-BF92-44B4-AC85-08BEE0A3EE1D--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F41F011-F47F-43B7-8564-0A625A4010AE>