Skip site navigation (1)Skip section navigation (2)
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>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]


> 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=779fd05344662aeec79c29470258bf657318eab3
>> 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 != '\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);
> 
> Did you mean to leave this printf in?  I see it when adding a vlan interface now:
No, I didn’t - it slipped through the cracks. Fixed in 656f5031c391.
> 
> root@frodo:~ # ifconfig cxl0.200 create
> CR: cxl0 200
> 
> -- 
> John Baldwin


[-- Attachment #2 --]
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 28 Jan 2022, at 17:34, John Baldwin &lt;<a href="mailto:jhb@FreeBSD.org" class="">jhb@FreeBSD.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta charset="UTF-8" class=""><span style="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="">On 1/17/22 1:35 AM, Alexander V. Chernikov wrote:</span><br style="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=""><blockquote type="cite" style="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="">The branch main has been updated by melifaro:<br class="">URL: <a href="https://cgit.FreeBSD.org/src/commit/?id=779fd05344662aeec79c29470258bf657318eab3" class="">https://cgit.FreeBSD.org/src/commit/?id=779fd05344662aeec79c29470258bf657318eab3</a><br class="">commit 779fd05344662aeec79c29470258bf657318eab3<br class="">Author: &nbsp;&nbsp;&nbsp;&nbsp;Alexander V. Chernikov &lt;<a href="mailto:melifaro@FreeBSD.org" class="">melifaro@FreeBSD.org</a>&gt;<br class="">AuthorDate: 2022-01-17 09:30:26 +0000<br class="">Commit: &nbsp;&nbsp;&nbsp;&nbsp;Alexander V. Chernikov &lt;<a href="mailto:melifaro@FreeBSD.org" class="">melifaro@FreeBSD.org</a>&gt;<br class="">CommitDate: 2022-01-17 09:35:15 +0000<br class="">&nbsp;&nbsp;&nbsp;&nbsp;ifconfig: improve vlan options parsing<br class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PR: &nbsp;&nbsp;&nbsp;&nbsp;261136<br class="">&nbsp;&nbsp;&nbsp;&nbsp;Reported by: &nbsp;&nbsp;&nbsp;Daniel O'Connor<br class="">&nbsp;&nbsp;&nbsp;&nbsp;MFC after: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 weeks<br class="">---<br class="">&nbsp;sbin/ifconfig/ifvlan.c | 21 ++++++++++++++-------<br class="">&nbsp;1 file changed, 14 insertions(+), 7 deletions(-)<br class="">diff --git a/sbin/ifconfig/ifvlan.c b/sbin/ifconfig/ifvlan.c<br class="">index 60f97338ee27..1e74b504fc26 100644<br class="">--- a/sbin/ifconfig/ifvlan.c<br class="">+++ b/sbin/ifconfig/ifvlan.c<br class="">@@ -144,8 +139,20 @@ vlan_parse_ethervid(const char *name)<br class="">&nbsp;<span class="Apple-tab-span" style="white-space: pre;">	</span>if ((*cp != '\0') || (vid &amp; ~0xFFF))<br class="">&nbsp;<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>errx(1, "invalid vlan tag");<br class="">&nbsp;-<span class="Apple-tab-span" style="white-space: pre;">	</span>strlcpy(params.vlr_parent, ifname, IFNAMSIZ);<br class="">-<span class="Apple-tab-span" style="white-space: pre;">	</span>params.vlr_tag = (vid &amp; 0xFFF);<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>/*<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-converted-space">&nbsp;</span>* allow "devX.Y vlandev devX vlan Y" syntax<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-converted-space">&nbsp;</span>*/<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>if (params.vlr_tag == NOTAG || params.vlr_tag == vid)<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>params.vlr_tag = vid;<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>else<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>errx(1, "ambiguous vlan specification");<br class="">+<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>/* Restrict overriding interface name */<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>if (params.vlr_parent[0] == '\0' || !strcmp(params.vlr_parent, ifname))<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>strlcpy(params.vlr_parent, ifname, IFNAMSIZ);<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>else<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span><span class="Apple-tab-span" style="white-space: pre;">	</span>errx(1, "ambiguous vlan specification");<br class="">+<span class="Apple-tab-span" style="white-space: pre;">	</span>printf("CR: %s %d\n", params.vlr_parent, params.vlr_tag);<br class=""></blockquote><br style="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=""><span style="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="">Did you mean to leave this printf in? &nbsp;I see it when adding a vlan interface now:</span><br style="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=""></div></blockquote>No, I didn’t - it slipped through the cracks. Fixed in&nbsp;656f5031c391.</div><div><blockquote type="cite" class=""><div class=""><br style="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=""><span style="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="">root@frodo:~ # ifconfig cxl0.200 create</span><br style="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=""><span style="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="">CR: cxl0 200</span><br style="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=""><br style="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=""><span style="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="">--<span class="Apple-converted-space">&nbsp;</span></span><br style="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=""><span style="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="">John Baldwin</span></div></blockquote></div><br class=""></body></html>
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8F41F011-F47F-43B7-8564-0A625A4010AE>