Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vlan: Fix build error wth vlan_get_encap_level()

The new function vlan_get_encap_level() uses vlan_dev_priv()
which is only conditionally avaialble when VLAN support is
enabled. Make vlan_get_encap_level() conditionally available
as well.

Fixes: 44a4085538c8 ("bonding: Fix stacked device detection in arp monitoring")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vlad Yasevich <vyasevic@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vlad Yasevich and committed by
David S. Miller
e1618d46 4f337ed5

+11 -5
+11 -5
include/linux/if_vlan.h
··· 198 198 const struct net_device *by_dev); 199 199 200 200 extern bool vlan_uses_dev(const struct net_device *dev); 201 + 202 + static inline int vlan_get_encap_level(struct net_device *dev) 203 + { 204 + BUG_ON(!is_vlan_dev(dev)); 205 + return vlan_dev_priv(dev)->nest_level; 206 + } 201 207 #else 202 208 static inline struct net_device * 203 209 __vlan_find_dev_deep(struct net_device *real_dev, ··· 269 263 static inline bool vlan_uses_dev(const struct net_device *dev) 270 264 { 271 265 return false; 266 + } 267 + static inline int vlan_get_encap_level(struct net_device *dev) 268 + { 269 + BUG(); 270 + return 0; 272 271 } 273 272 #endif 274 273 ··· 496 485 skb->protocol = htons(ETH_P_802_2); 497 486 } 498 487 499 - static inline int vlan_get_encap_level(struct net_device *dev) 500 - { 501 - BUG_ON(!is_vlan_dev(dev)); 502 - return vlan_dev_priv(dev)->nest_level; 503 - } 504 488 #endif /* !(_LINUX_IF_VLAN_H_) */