lkml.org 
[lkml]   [2021]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 net-next] net: bridge: check vlan with eth_type_vlan() method
On Thu, 14 Jan 2021 20:41:31 -0800 menglong8.dong@gmail.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.

\
 
 \ /
  Last update: 2021-01-17 04:01    [W:0.277 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site