Thread (2 messages) 2 messages, 2 authors, 2021-01-17

Re: [Bridge] [PATCH v3 net-next] net: bridge: check vlan with eth_type_vlan() method

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-01-17 02:59:44
Also in: lkml, netdev

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help