[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210116185842.322bf3b9@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Sat, 16 Jan 2021 18:58:42 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: menglong8.dong@...il.com
Cc: roopa@...dia.com, nikolay@...dia.com, davem@...emloft.net,
bridge@...ts.linux-foundation.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Menglong Dong <dong.menglong@....com.cn>
Subject: Re: [PATCH v3 net-next] net: bridge: check vlan with
eth_type_vlan() method
On Thu, 14 Jan 2021 20:41:31 -0800 menglong8.dong@...il.com wrote:
> - if (data[IFLA_BR_VLAN_PROTOCOL]) {
> - switch (nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])) {
> - case htons(ETH_P_8021Q):
> - case htons(ETH_P_8021AD):
> - break;
> - default:
> - return -EPROTONOSUPPORT;
> - }
> + if (data[IFLA_BR_VLAN_PROTOCOL] &&
> + !eth_type_vlan(nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL]))) {
> + return -EPROTONOSUPPORT;
> }
The curly brackets are no longer necessary here, since it's a single
line expression.
Powered by blists - more mailing lists