Skip to content

Commit 31aed46

Browse files
wenxuummakynes
authored andcommitted
bridge: add br_vlan_get_proto()
This new function allows you to fetch the bridge port vlan protocol. Signed-off-by: wenxu <[email protected]> Acked-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent c54c7c6 commit 31aed46

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

include/linux/if_bridge.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static inline bool br_multicast_router(const struct net_device *dev)
8989
bool br_vlan_enabled(const struct net_device *dev);
9090
int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid);
9191
int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid);
92+
int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto);
9293
int br_vlan_get_info(const struct net_device *dev, u16 vid,
9394
struct bridge_vlan_info *p_vinfo);
9495
#else
@@ -102,6 +103,11 @@ static inline int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
102103
return -EINVAL;
103104
}
104105

106+
static inline int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
107+
{
108+
return -EINVAL;
109+
}
110+
105111
static inline int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
106112
{
107113
return -EINVAL;

net/bridge/br_vlan.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,16 @@ bool br_vlan_enabled(const struct net_device *dev)
797797
}
798798
EXPORT_SYMBOL_GPL(br_vlan_enabled);
799799

800+
int br_vlan_get_proto(const struct net_device *dev, u16 *p_proto)
801+
{
802+
struct net_bridge *br = netdev_priv(dev);
803+
804+
*p_proto = ntohs(br->vlan_proto);
805+
806+
return 0;
807+
}
808+
EXPORT_SYMBOL_GPL(br_vlan_get_proto);
809+
800810
int __br_vlan_set_proto(struct net_bridge *br, __be16 proto)
801811
{
802812
int err = 0;

0 commit comments

Comments
 (0)