Commit 3e087caa authored by David S. Miller's avatar David S. Miller

Merge branch 'bridge-netlink'

Nikolay Aleksandrov says:

====================
bridge: complete netlink support

This set completes the bridge device's netlink support and makes it
possible to view and configure everything that can be configured via
sysfs. I have tested all of these (setting and getting). There're a few
longer line warnings about the br_get_size() ifla comments but I think we
should have them to know what has been accounted for. I have used the sysfs
interface as a guide of what and how to set. As usual I'll send the
corresponding iproute2 patches later.
The bridge port's netlink interface will be completed after this set gets
applied in some form.

This patch-set is on top of my last vlan cleanups set:
http://www.spinics.net/lists/netdev/msg346005.html
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 68d4e520 0f963b75
...@@ -232,11 +232,47 @@ enum { ...@@ -232,11 +232,47 @@ enum {
IFLA_BR_PRIORITY, IFLA_BR_PRIORITY,
IFLA_BR_VLAN_FILTERING, IFLA_BR_VLAN_FILTERING,
IFLA_BR_VLAN_PROTOCOL, IFLA_BR_VLAN_PROTOCOL,
IFLA_BR_GROUP_FWD_MASK,
IFLA_BR_ROOT_ID,
IFLA_BR_BRIDGE_ID,
IFLA_BR_ROOT_PORT,
IFLA_BR_ROOT_PATH_COST,
IFLA_BR_TOPOLOGY_CHANGE,
IFLA_BR_TOPOLOGY_CHANGE_DETECTED,
IFLA_BR_HELLO_TIMER,
IFLA_BR_TCN_TIMER,
IFLA_BR_TOPOLOGY_CHANGE_TIMER,
IFLA_BR_GC_TIMER,
IFLA_BR_GROUP_ADDR,
IFLA_BR_FDB_FLUSH,
IFLA_BR_MCAST_ROUTER,
IFLA_BR_MCAST_SNOOPING,
IFLA_BR_MCAST_QUERY_USE_IFADDR,
IFLA_BR_MCAST_QUERIER,
IFLA_BR_MCAST_HASH_ELASTICITY,
IFLA_BR_MCAST_HASH_MAX,
IFLA_BR_MCAST_LAST_MEMBER_CNT,
IFLA_BR_MCAST_STARTUP_QUERY_CNT,
IFLA_BR_MCAST_LAST_MEMBER_INTVL,
IFLA_BR_MCAST_MEMBERSHIP_INTVL,
IFLA_BR_MCAST_QUERIER_INTVL,
IFLA_BR_MCAST_QUERY_INTVL,
IFLA_BR_MCAST_QUERY_RESPONSE_INTVL,
IFLA_BR_MCAST_STARTUP_QUERY_INTVL,
IFLA_BR_NF_CALL_IPTABLES,
IFLA_BR_NF_CALL_IP6TABLES,
IFLA_BR_NF_CALL_ARPTABLES,
IFLA_BR_VLAN_DEFAULT_PVID,
__IFLA_BR_MAX, __IFLA_BR_MAX,
}; };
#define IFLA_BR_MAX (__IFLA_BR_MAX - 1) #define IFLA_BR_MAX (__IFLA_BR_MAX - 1)
struct ifla_bridge_id {
__u8 prio[2];
__u8 addr[6]; /* ETH_ALEN */
};
enum { enum {
BRIDGE_MODE_UNSPEC, BRIDGE_MODE_UNSPEC,
BRIDGE_MODE_HAIRPIN, BRIDGE_MODE_HAIRPIN,
......
This diff is collapsed.
...@@ -690,6 +690,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto); ...@@ -690,6 +690,7 @@ int __br_vlan_set_proto(struct net_bridge *br, __be16 proto);
int br_vlan_set_proto(struct net_bridge *br, unsigned long val); int br_vlan_set_proto(struct net_bridge *br, unsigned long val);
int br_vlan_init(struct net_bridge *br); int br_vlan_init(struct net_bridge *br);
int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val); int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val);
int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid);
int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags); int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags);
int nbp_vlan_delete(struct net_bridge_port *port, u16 vid); int nbp_vlan_delete(struct net_bridge_port *port, u16 vid);
void nbp_vlan_flush(struct net_bridge_port *port); void nbp_vlan_flush(struct net_bridge_port *port);
......
...@@ -727,7 +727,7 @@ static void br_vlan_disable_default_pvid(struct net_bridge *br) ...@@ -727,7 +727,7 @@ static void br_vlan_disable_default_pvid(struct net_bridge *br)
br->default_pvid = 0; br->default_pvid = 0;
} }
static int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid) int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
{ {
const struct net_bridge_vlan *pvent; const struct net_bridge_vlan *pvent;
struct net_bridge_port *p; struct net_bridge_port *p;
...@@ -735,6 +735,11 @@ static int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid) ...@@ -735,6 +735,11 @@ static int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)
int err = 0; int err = 0;
unsigned long *changed; unsigned long *changed;
if (!pvid) {
br_vlan_disable_default_pvid(br);
return 0;
}
changed = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long), changed = kcalloc(BITS_TO_LONGS(BR_MAX_PORTS), sizeof(unsigned long),
GFP_KERNEL); GFP_KERNEL);
if (!changed) if (!changed)
...@@ -825,12 +830,7 @@ int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val) ...@@ -825,12 +830,7 @@ int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val)
err = -EPERM; err = -EPERM;
goto unlock; goto unlock;
} }
err = __br_vlan_set_default_pvid(br, pvid);
if (!pvid)
br_vlan_disable_default_pvid(br);
else
err = __br_vlan_set_default_pvid(br, pvid);
unlock: unlock:
rtnl_unlock(); rtnl_unlock();
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment