bridge: complete netlink support
Subsystems (3)
Nikolay Aleksandrov
maintainercover bridge: complete netlink support
From: Nikolay Aleksandrov <[email protected]>
Hi,
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
Cheers,
Nik
Nikolay Aleksandrov (20):
bridge: netlink: add group_fwd_mask support
bridge: netlink: export root id
bridge: netlink: export bridge id
bridge: netlink: export root port
bridge: netlink: export root path cost
bridge: netlink: export topology_change and topology_change_detected
bridge: netlink: export all timers
bridge: netlink: add group_addr support
bridge: netlink: add fdb flush
bridge: netlink: add support for multicast_router
bridge: netlink: add support for multicast_snooping
bridge: netlink: add support for multicast_query_use_ifaddr
bridge: netlink: add support for multicast_querier
bridge: netlink: add support for igmp's hash_elasticity
bridge: netlink: add support for igmp's hash_max
bridge: netlink: add support for multicast_last_member_count
bridge: netlink: add support for multicast_startup_query_count
bridge: netlink: add support for igmp's intervals
bridge: netlink: add support for netfilter tables config
bridge: netlink: add support for default_pvid
include/uapi/linux/if_link.h | 36 ++++++ net/bridge/br_netlink.c | 284 ++++++++++++++++++++++++++++++++++++++++++- net/bridge/br_private.h | 1 + net/bridge/br_vlan.c | 14 +-- 4 files changed, 326 insertions(+), 9 deletions(-)
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 1/20 bridge: netlink: add group_fwd_mask support
From: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_GROUP_FWD_MASK attribute to allow setting and retrieving the group_fwd_mask via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -232,6 +232,7 @@ enum {IFLA_BR_PRIORITY ,IFLA_BR_VLAN_FILTERING ,IFLA_BR_VLAN_PROTOCOL , +IFLA_BR_GROUP_FWD_MASK , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +13 -1
@@ -764,6 +764,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_PRIORITY] = { .type = NLA_U16 }, [IFLA_BR_VLAN_FILTERING] = { .type = NLA_U8 }, [IFLA_BR_VLAN_PROTOCOL] = { .type = NLA_U16 }, + [IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -829,6 +830,14 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], }#endif +if (data[IFLA_BR_GROUP_FWD_MASK ]) { +u16 fwd_mask =nla_get_u16 (data[IFLA_BR_GROUP_FWD_MASK ]); + +if (fwd_mask &BR_GROUPFWD_RESTRICTED ) +return -EINVAL ; + br->group_fwd_mask = fwd_mask; + } +return 0 ; }
@@ -844,6 +853,7 @@ static size_t br_get_size(const struct net_device *brdev)#ifdef CONFIG_BRIDGE_VLAN_FILTERING nla_total_size (sizeof (__be16)) +/* IFLA_BR_VLAN_PROTOCOL */ #endif +nla_total_size (sizeof (u16)) +/* IFLA_BR_GROUP_FWD_MASK */ 0; }
@@ -856,6 +866,7 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)u32 ageing_time =jiffies_to_clock_t (br->ageing_time);u32 stp_enabled = br->stp_enabled;u16 priority = (br->bridge_id.prio[0 ] <<8 ) | br->bridge_id.prio[1 ]; +u16 group_fwd_mask = br->group_fwd_mask;u8 vlan_enabled =br_vlan_enabled (br); if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) ||
@@ -864,7 +875,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u32 (skb,IFLA_BR_AGEING_TIME , ageing_time) ||nla_put_u32 (skb,IFLA_BR_STP_STATE , stp_enabled) ||nla_put_u16 (skb,IFLA_BR_PRIORITY , priority) || - nla_put_u8(skb, IFLA_BR_VLAN_FILTERING, vlan_enabled)) +nla_put_u8 (skb,IFLA_BR_VLAN_FILTERING , vlan_enabled) || + nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 2/20 bridge: netlink: export root id
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_ROOT_ID and export br->designated_root via netlink. For this purpose add struct ifla_bridge_id that would represent struct bridge_id.
--- include/uapi/linux/if_link.h | 6 ++++++ net/bridge/br_netlink.c | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +6 -0
@@ -233,11 +233,17 @@ enum {IFLA_BR_VLAN_FILTERING ,IFLA_BR_VLAN_PROTOCOL ,IFLA_BR_GROUP_FWD_MASK , +IFLA_BR_ROOT_ID , __IFLA_BR_MAX, };#define IFLA_BR_MAX (__IFLA_BR_MAX - 1) +struct ifla_bridge_id { +__u8 prio[2 ]; +__u8 addr[6 ];/* ETH_ALEN */ +}; +enum {BRIDGE_MODE_UNSPEC , BRIDGE_MODE_HAIRPIN,
net/bridge/br_netlink.c +8 -1
@@ -854,6 +854,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (__be16)) +/* IFLA_BR_VLAN_PROTOCOL */ #endifnla_total_size (sizeof (u16)) +/* IFLA_BR_GROUP_FWD_MASK */ +nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_ROOT_ID */ 0; }
@@ -868,6 +869,11 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)u16 priority = (br->bridge_id.prio[0 ] <<8 ) | br->bridge_id.prio[1 ];u16 group_fwd_mask = br->group_fwd_mask;u8 vlan_enabled =br_vlan_enabled (br); +struct ifla_bridge_id root_id; + +memset (&root_id,0 ,sizeof (root_id)); +memcpy (root_id.prio, br->designated_root.prio,sizeof (root_id.prio)); +memcpy (root_id.addr, br->designated_root.addr,sizeof (root_id.addr)); if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) || nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -876,7 +882,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u32 (skb,IFLA_BR_STP_STATE , stp_enabled) ||nla_put_u16 (skb,IFLA_BR_PRIORITY , priority) ||nla_put_u8 (skb,IFLA_BR_VLAN_FILTERING , vlan_enabled) || - nla_put_u16(skb, IFLA_BR_GROUP_FWD_MASK, group_fwd_mask)) +nla_put_u16 (skb,IFLA_BR_GROUP_FWD_MASK , group_fwd_mask) || + nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), &root_id)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 3/20 bridge: netlink: export bridge id
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_BRIDGE_ID and export br->bridge_id via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
include/uapi/linux/if_link.h +1 -0
@@ -234,6 +234,7 @@ enum {IFLA_BR_VLAN_PROTOCOL ,IFLA_BR_GROUP_FWD_MASK ,IFLA_BR_ROOT_ID , +IFLA_BR_BRIDGE_ID , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +7 -2
@@ -855,6 +855,7 @@ static size_t br_get_size(const struct net_device *brdev)#endif nla_total_size (sizeof (u16)) +/* IFLA_BR_GROUP_FWD_MASK */ nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_ROOT_ID */ +nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_BRIDGE_ID */ 0 ; }
@@ -869,11 +870,14 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)u16 priority = (br->bridge_id.prio[0 ] <<8 ) | br->bridge_id.prio[1 ];u16 group_fwd_mask = br->group_fwd_mask;u8 vlan_enabled =br_vlan_enabled (br); -struct ifla_bridge_id root_id; +struct ifla_bridge_id root_id, bridge_id; +memset (&bridge_id,0 ,sizeof (bridge_id));memset (&root_id,0 ,sizeof (root_id));memcpy (root_id.prio, br->designated_root.prio,sizeof (root_id.prio));memcpy (root_id.addr, br->designated_root.addr,sizeof (root_id.addr)); +memcpy (bridge_id.prio, br->bridge_id.prio,sizeof (bridge_id.prio)); +memcpy (bridge_id.addr, br->bridge_id.addr,sizeof (bridge_id.addr)); if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) || nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -883,7 +887,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u16 (skb,IFLA_BR_PRIORITY , priority) ||nla_put_u8 (skb,IFLA_BR_VLAN_FILTERING , vlan_enabled) ||nla_put_u16 (skb,IFLA_BR_GROUP_FWD_MASK , group_fwd_mask) || - nla_put(skb, IFLA_BR_ROOT_ID, sizeof(root_id), &root_id)) +nla_put (skb,IFLA_BR_ROOT_ID ,sizeof (root_id), &root_id) || + nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), &bridge_id)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 4/20 bridge: netlink: export root port
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_ROOT_PORT and export it via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -235,6 +235,7 @@ enum {IFLA_BR_GROUP_FWD_MASK ,IFLA_BR_ROOT_ID ,IFLA_BR_BRIDGE_ID , +IFLA_BR_ROOT_PORT , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +3 -1
@@ -856,6 +856,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u16)) +/* IFLA_BR_GROUP_FWD_MASK */ nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_ROOT_ID */ nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_BRIDGE_ID */ +nla_total_size (sizeof (u16)) +/* IFLA_BR_ROOT_PORT */ 0 ; }
@@ -888,7 +889,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u8 (skb,IFLA_BR_VLAN_FILTERING , vlan_enabled) ||nla_put_u16 (skb,IFLA_BR_GROUP_FWD_MASK , group_fwd_mask) ||nla_put (skb,IFLA_BR_ROOT_ID ,sizeof (root_id), &root_id) || - nla_put(skb, IFLA_BR_BRIDGE_ID, sizeof(bridge_id), &bridge_id)) +nla_put (skb,IFLA_BR_BRIDGE_ID ,sizeof (bridge_id), &bridge_id) || + nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 5/20 bridge: netlink: export root path cost
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_ROOT_PATH_COST and export it via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -236,6 +236,7 @@ enum {IFLA_BR_ROOT_ID ,IFLA_BR_BRIDGE_ID ,IFLA_BR_ROOT_PORT , +IFLA_BR_ROOT_PATH_COST , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +3 -1
@@ -857,6 +857,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_ROOT_ID */ nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_BRIDGE_ID */ nla_total_size (sizeof (u16)) +/* IFLA_BR_ROOT_PORT */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_ROOT_PATH_COST */ 0 ; }
@@ -890,7 +891,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u16 (skb,IFLA_BR_GROUP_FWD_MASK , group_fwd_mask) ||nla_put (skb,IFLA_BR_ROOT_ID ,sizeof (root_id), &root_id) ||nla_put (skb,IFLA_BR_BRIDGE_ID ,sizeof (bridge_id), &bridge_id) || - nla_put_u16(skb, IFLA_BR_ROOT_PORT, br->root_port)) +nla_put_u16 (skb,IFLA_BR_ROOT_PORT , br->root_port) || + nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 6/20 bridge: netlink: export topology_change and topology_change_detected
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_TOPOLOGY_CHANGE and IFLA_BR_TOPOLOGY_CHANGE_DETECTED and export them via netlink.
--- include/uapi/linux/if_link.h | 2 ++ net/bridge/br_netlink.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +2 -0
@@ -237,6 +237,8 @@ enum {IFLA_BR_BRIDGE_ID ,IFLA_BR_ROOT_PORT ,IFLA_BR_ROOT_PATH_COST , +IFLA_BR_TOPOLOGY_CHANGE , +IFLA_BR_TOPOLOGY_CHANGE_DETECTED , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +6 -1
@@ -858,6 +858,8 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_BRIDGE_ID */ nla_total_size (sizeof (u16)) +/* IFLA_BR_ROOT_PORT */ nla_total_size (sizeof (u32)) +/* IFLA_BR_ROOT_PATH_COST */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */ 0 ; }
@@ -892,7 +894,10 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put (skb,IFLA_BR_ROOT_ID ,sizeof (root_id), &root_id) ||nla_put (skb,IFLA_BR_BRIDGE_ID ,sizeof (bridge_id), &bridge_id) ||nla_put_u16 (skb,IFLA_BR_ROOT_PORT , br->root_port) || - nla_put_u32(skb, IFLA_BR_ROOT_PATH_COST, br->root_path_cost)) +nla_put_u32 (skb,IFLA_BR_ROOT_PATH_COST , br->root_path_cost) || +nla_put_u8 (skb,IFLA_BR_TOPOLOGY_CHANGE , br->topology_change) || +nla_put_u8 (skb,IFLA_BR_TOPOLOGY_CHANGE_DETECTED , + br->topology_change_detected)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 7/20 bridge: netlink: export all timers
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Export the following bridge timers (also exported via sysfs):IFLA_BR_HELLO_TIMER, IFLA_BR_TCN_TIMER, IFLA_BR_TOPOLOGY_CHANGE_TIMER, IFLA_BR_GC_TIMER via netlink.
--- include/uapi/linux/if_link.h | 4 ++++ net/bridge/br_netlink.c | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +4 -0
@@ -239,6 +239,10 @@ enum {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_MAX, };
net/bridge/br_netlink.c +15 -1
@@ -860,12 +860,17 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u32)) +/* IFLA_BR_ROOT_PATH_COST */ nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */ nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */ +nla_total_size (sizeof (u64)) +/* IFLA_BR_HELLO_TIMER */ +nla_total_size (sizeof (u64)) +/* IFLA_BR_TCN_TIMER */ +nla_total_size (sizeof (u64)) +/* IFLA_BR_TOPOLOGY_CHANGE_TIMER */ +nla_total_size (sizeof (u64)) +/* IFLA_BR_GC_TIMER */ 0 ; }static int br_fill_info (struct sk_buff *skb,const struct net_device *brdev) {struct net_bridge *br =netdev_priv (brdev); +u64 hello_timer, tcn_timer, topology_change_timer, gc_timer;u32 forward_delay =jiffies_to_clock_t (br->forward_delay);u32 hello_time =jiffies_to_clock_t (br->hello_time);u32 age_time =jiffies_to_clock_t (br->max_age);
@@ -882,6 +887,10 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)memcpy (root_id.addr, br->designated_root.addr,sizeof (root_id.addr));memcpy (bridge_id.prio, br->bridge_id.prio,sizeof (bridge_id.prio));memcpy (bridge_id.addr, br->bridge_id.addr,sizeof (bridge_id.addr)); + hello_timer =br_timer_value (&br->hello_timer); + tcn_timer =br_timer_value (&br->tcn_timer); + topology_change_timer =br_timer_value (&br->topology_change_timer); + gc_timer =br_timer_value (&br->gc_timer); if (nla_put_u32(skb, IFLA_BR_FORWARD_DELAY, forward_delay) || nla_put_u32(skb, IFLA_BR_HELLO_TIME, hello_time) ||
@@ -897,7 +906,12 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u32 (skb,IFLA_BR_ROOT_PATH_COST , br->root_path_cost) ||nla_put_u8 (skb,IFLA_BR_TOPOLOGY_CHANGE , br->topology_change) ||nla_put_u8 (skb,IFLA_BR_TOPOLOGY_CHANGE_DETECTED , - br->topology_change_detected)) + br->topology_change_detected) || +nla_put_u64 (skb,IFLA_BR_HELLO_TIMER , hello_timer) || +nla_put_u64 (skb,IFLA_BR_TCN_TIMER , tcn_timer) || +nla_put_u64 (skb,IFLA_BR_TOPOLOGY_CHANGE_TIMER , + topology_change_timer) || + nla_put_u64(skb, IFLA_BR_GC_TIMER, gc_timer)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 8/20 bridge: netlink: add group_addr support
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_GROUP_ADDR attribute to allow setting and retrieving the group_addr via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 25 ++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -243,6 +243,7 @@ enum {IFLA_BR_TCN_TIMER ,IFLA_BR_TOPOLOGY_CHANGE_TIMER ,IFLA_BR_GC_TIMER , +IFLA_BR_GROUP_ADDR , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +24 -1
@@ -765,6 +765,8 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_VLAN_FILTERING] = { .type = NLA_U8 }, [IFLA_BR_VLAN_PROTOCOL] = { .type = NLA_U16 }, [IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 }, + [IFLA_BR_GROUP_ADDR ] = { .type =NLA_BINARY , + .len = ETH_ALEN }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -838,6 +840,25 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], br->group_fwd_mask = fwd_mask; } +if (data[IFLA_BR_GROUP_ADDR ]) { +u8 new_addr[ETH_ALEN ]; + +if (nla_len (data[IFLA_BR_GROUP_ADDR ]) !=ETH_ALEN ) +return -EINVAL ; +memcpy (new_addr,nla_data (data[IFLA_BR_GROUP_ADDR ]),ETH_ALEN ); +if (!is_link_local_ether_addr (new_addr)) +return -EINVAL ; +if (new_addr[5 ] ==1 ||/* 802.3x Pause address */ + new_addr[5 ] ==2 ||/* 802.3ad Slow protocols */ + new_addr[5 ] ==3 )/* 802.1X PAE address */ +return -EINVAL ; +spin_lock_bh (&br->lock); +memcpy (br->group_addr, new_addr,sizeof (br->group_addr)); +spin_unlock_bh (&br->lock); + br->group_addr_set = true; +br_recalculate_fwd_mask (br); + } +return 0 ; }
@@ -864,6 +885,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u64)) +/* IFLA_BR_TCN_TIMER */ nla_total_size (sizeof (u64)) +/* IFLA_BR_TOPOLOGY_CHANGE_TIMER */ nla_total_size (sizeof (u64)) +/* IFLA_BR_GC_TIMER */ +nla_total_size (ETH_ALEN ) +/* IFLA_BR_GROUP_ADDR */ 0 ; }
@@ -911,7 +933,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u64 (skb,IFLA_BR_TCN_TIMER , tcn_timer) ||nla_put_u64 (skb,IFLA_BR_TOPOLOGY_CHANGE_TIMER , topology_change_timer) || - nla_put_u64(skb, IFLA_BR_GC_TIMER, gc_timer)) +nla_put_u64 (skb,IFLA_BR_GC_TIMER , gc_timer) || + nla_put(skb, IFLA_BR_GROUP_ADDR, ETH_ALEN, br->group_addr)) return -EMSGSIZE;#ifdef CONFIG_BRIDGE_VLAN_FILTERING
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 9/20 bridge: netlink: add fdb flush
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Simple attribute that flushes the bridge's fdb.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 3 +++ 2 files changed, 4 insertions(+)
include/uapi/linux/if_link.h +1 -0
@@ -244,6 +244,7 @@ enum {IFLA_BR_TOPOLOGY_CHANGE_TIMER ,IFLA_BR_GC_TIMER ,IFLA_BR_GROUP_ADDR , +IFLA_BR_FDB_FLUSH , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +3 -0
@@ -859,6 +859,9 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],br_recalculate_fwd_mask (br); } +if (data[IFLA_BR_FDB_FLUSH ]) +br_fdb_flush (br); +return 0 ; }
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 10/20 bridge: netlink: add support for multicast_router
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_ROUTER to allow setting and retrieving br->multicast_router when igmp snooping is enabled.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+)
include/uapi/linux/if_link.h +1 -0
@@ -245,6 +245,7 @@ enum {IFLA_BR_GC_TIMER ,IFLA_BR_GROUP_ADDR ,IFLA_BR_FDB_FLUSH , +IFLA_BR_MCAST_ROUTER , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +19 -0
@@ -767,6 +767,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_GROUP_FWD_MASK] = { .type = NLA_U16 }, [IFLA_BR_GROUP_ADDR ] = { .type =NLA_BINARY , .len = ETH_ALEN }, + [IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -862,6 +863,16 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (data[IFLA_BR_FDB_FLUSH ])br_fdb_flush (br); +#ifdef CONFIG_BRIDGE_IGMP_SNOOPING +if (data[IFLA_BR_MCAST_ROUTER ]) { +u8 multicast_router =nla_get_u8 (data[IFLA_BR_MCAST_ROUTER ]); + + err =br_multicast_set_router (br, multicast_router); +if (err) +return err; + } +#endif +return 0 ; }
@@ -889,6 +900,9 @@ static size_t br_get_size(const struct net_device *brdev) nla_total_size(sizeof(u64)) + /* IFLA_BR_TOPOLOGY_CHANGE_TIMER */ nla_total_size(sizeof(u64)) + /* IFLA_BR_GC_TIMER */ nla_total_size(ETH_ALEN) + /* IFLA_BR_GROUP_ADDR */ +#ifdef CONFIG_BRIDGE_IGMP_SNOOPING + nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */ +#endif 0 ; }
@@ -945,6 +959,11 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)return -EMSGSIZE ;#endif +#ifdef CONFIG_BRIDGE_IGMP_SNOOPING +if (nla_put_u8 (skb,IFLA_BR_MCAST_ROUTER , br->multicast_router)) +return -EMSGSIZE ; +#endif +return 0 ; }
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 11/20 bridge: netlink: add support for multicast_snooping
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_SNOOPING to allow enabling/disabling multicast snooping via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -246,6 +246,7 @@ enum {IFLA_BR_GROUP_ADDR ,IFLA_BR_FDB_FLUSH ,IFLA_BR_MCAST_ROUTER , +IFLA_BR_MCAST_SNOOPING , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +12 -1
@@ -768,6 +768,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_GROUP_ADDR ] = { .type =NLA_BINARY , .len = ETH_ALEN }, [IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 }, + [IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -871,6 +872,14 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (err) return err; } + +if (data[IFLA_BR_MCAST_SNOOPING ]) { +u8 mcast_snooping =nla_get_u8 (data[IFLA_BR_MCAST_SNOOPING ]); + + err =br_multicast_toggle (br, mcast_snooping); +if (err) +return err; + }#endif return 0 ;
@@ -902,6 +911,7 @@ static size_t br_get_size(const struct net_device *brdev) nla_total_size(ETH_ALEN) + /* IFLA_BR_GROUP_ADDR */#ifdef CONFIG_BRIDGE_IGMP_SNOOPING nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_ROUTER */ + nla_total_size(sizeof(u8)) + /* IFLA_BR_MCAST_SNOOPING */#endif 0 ; }
@@ -960,7 +970,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)#endif #ifdef CONFIG_BRIDGE_IGMP_SNOOPING -if (nla_put_u8 (skb,IFLA_BR_MCAST_ROUTER , br->multicast_router)) +if (nla_put_u8 (skb,IFLA_BR_MCAST_ROUTER , br->multicast_router) || +nla_put_u8 (skb,IFLA_BR_MCAST_SNOOPING , !br->multicast_disabled))return -EMSGSIZE ;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 12/20 bridge: netlink: add support for multicast_query_use_ifaddr
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_QUERY_USE_IFADDR to allow setting/getting br->multicast_query_use_ifaddr via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -247,6 +247,7 @@ enum {IFLA_BR_FDB_FLUSH ,IFLA_BR_MCAST_ROUTER ,IFLA_BR_MCAST_SNOOPING , +IFLA_BR_MCAST_QUERY_USE_IFADDR , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +12 -1
@@ -769,6 +769,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { .len = ETH_ALEN }, [IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 }, [IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 }, + [IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -880,6 +881,13 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (err) return err; } + +if (data[IFLA_BR_MCAST_QUERY_USE_IFADDR ]) { +u8 val; + + val =nla_get_u8 (data[IFLA_BR_MCAST_QUERY_USE_IFADDR ]); + br->multicast_query_use_ifaddr = !!val; + }#endif return 0 ;
@@ -912,6 +920,7 @@ static size_t br_get_size(const struct net_device *brdev)#ifdef CONFIG_BRIDGE_IGMP_SNOOPING nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_ROUTER */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_SNOOPING */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERY_USE_IFADDR */ #endif 0; }
@@ -971,7 +980,9 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)#ifdef CONFIG_BRIDGE_IGMP_SNOOPING if (nla_put_u8 (skb,IFLA_BR_MCAST_ROUTER , br->multicast_router) || -nla_put_u8 (skb,IFLA_BR_MCAST_SNOOPING , !br->multicast_disabled)) +nla_put_u8 (skb,IFLA_BR_MCAST_SNOOPING , !br->multicast_disabled) || +nla_put_u8 (skb,IFLA_BR_MCAST_QUERY_USE_IFADDR , + br->multicast_query_use_ifaddr))return -EMSGSIZE ;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 13/20 bridge: netlink: add support for multicast_querier
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_QUERIER to allow setting/getting br->multicast_querier via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -248,6 +248,7 @@ enum {IFLA_BR_MCAST_ROUTER ,IFLA_BR_MCAST_SNOOPING ,IFLA_BR_MCAST_QUERY_USE_IFADDR , +IFLA_BR_MCAST_QUERIER , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +12 -1
@@ -770,6 +770,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_ROUTER] = { .type = NLA_U8 }, [IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 }, [IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 }, + [IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -888,6 +889,14 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], val =nla_get_u8 (data[IFLA_BR_MCAST_QUERY_USE_IFADDR ]); br->multicast_query_use_ifaddr = !!val; } + +if (data[IFLA_BR_MCAST_QUERIER ]) { +u8 mcast_querier =nla_get_u8 (data[IFLA_BR_MCAST_QUERIER ]); + + err =br_multicast_set_querier (br, mcast_querier); +if (err) +return err; + }#endif return 0 ;
@@ -921,6 +930,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_ROUTER */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_SNOOPING */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERY_USE_IFADDR */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERIER */ #endif 0; }
@@ -982,7 +992,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)if (nla_put_u8 (skb,IFLA_BR_MCAST_ROUTER , br->multicast_router) ||nla_put_u8 (skb,IFLA_BR_MCAST_SNOOPING , !br->multicast_disabled) ||nla_put_u8 (skb,IFLA_BR_MCAST_QUERY_USE_IFADDR , - br->multicast_query_use_ifaddr)) + br->multicast_query_use_ifaddr) || +nla_put_u8 (skb,IFLA_BR_MCAST_QUERIER , br->multicast_querier))return -EMSGSIZE ;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 14/20 bridge: netlink: add support for igmp's hash_elasticity
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_HASH_ELASTICITY to allow setting/getting br->hash_elasticity via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -249,6 +249,7 @@ enum {IFLA_BR_MCAST_SNOOPING ,IFLA_BR_MCAST_QUERY_USE_IFADDR ,IFLA_BR_MCAST_QUERIER , +IFLA_BR_MCAST_HASH_ELASTICITY , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +11 -1
@@ -771,6 +771,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_SNOOPING] = { .type = NLA_U8 }, [IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 }, [IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 }, + [IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -897,6 +898,12 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (err) return err; } + +if (data[IFLA_BR_MCAST_HASH_ELASTICITY ]) { +u32 val =nla_get_u32 (data[IFLA_BR_MCAST_HASH_ELASTICITY ]); + + br->hash_elasticity = val; + }#endif return 0 ;
@@ -931,6 +938,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_SNOOPING */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERY_USE_IFADDR */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERIER */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_ELASTICITY */ #endif 0; }
@@ -993,7 +1001,9 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u8 (skb,IFLA_BR_MCAST_SNOOPING , !br->multicast_disabled) ||nla_put_u8 (skb,IFLA_BR_MCAST_QUERY_USE_IFADDR , br->multicast_query_use_ifaddr) || - nla_put_u8(skb, IFLA_BR_MCAST_QUERIER, br->multicast_querier)) +nla_put_u8 (skb,IFLA_BR_MCAST_QUERIER , br->multicast_querier) || +nla_put_u32 (skb,IFLA_BR_MCAST_HASH_ELASTICITY , + br->hash_elasticity)) return -EMSGSIZE;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 15/20 bridge: netlink: add support for igmp's hash_max
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_HASH_MAX to allow setting/getting br->hash_max via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -250,6 +250,7 @@ enum {IFLA_BR_MCAST_QUERY_USE_IFADDR ,IFLA_BR_MCAST_QUERIER ,IFLA_BR_MCAST_HASH_ELASTICITY , +IFLA_BR_MCAST_HASH_MAX , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +12 -1
@@ -772,6 +772,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_QUERY_USE_IFADDR] = { .type = NLA_U8 }, [IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 }, [IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 }, + [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -904,6 +905,14 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], br->hash_elasticity = val; } + +if (data[IFLA_BR_MCAST_HASH_MAX ]) { +u32 hash_max =nla_get_u32 (data[IFLA_BR_MCAST_HASH_MAX ]); + + err =br_multicast_set_hash_max (br, hash_max); +if (err) +return err; + }#endif return 0 ;
@@ -939,6 +948,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERY_USE_IFADDR */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERIER */ nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_ELASTICITY */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_MAX */ #endif 0; }
@@ -1003,7 +1013,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev) br->multicast_query_use_ifaddr) ||nla_put_u8 (skb,IFLA_BR_MCAST_QUERIER , br->multicast_querier) ||nla_put_u32 (skb,IFLA_BR_MCAST_HASH_ELASTICITY , - br->hash_elasticity)) + br->hash_elasticity) || + nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max)) return -EMSGSIZE;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 16/20 bridge: netlink: add support for multicast_last_member_count
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_LAST_MEMBER_CNT to allow setting/getting br->multicast_last_member_count via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +1 -0
@@ -251,6 +251,7 @@ enum {IFLA_BR_MCAST_QUERIER ,IFLA_BR_MCAST_HASH_ELASTICITY ,IFLA_BR_MCAST_HASH_MAX , +IFLA_BR_MCAST_LAST_MEMBER_CNT , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +11 -1
@@ -773,6 +773,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_QUERIER] = { .type = NLA_U8 }, [IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 }, [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 }, + [IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -913,6 +914,12 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (err) return err; } + +if (data[IFLA_BR_MCAST_LAST_MEMBER_CNT ]) { +u32 val =nla_get_u32 (data[IFLA_BR_MCAST_LAST_MEMBER_CNT ]); + + br->multicast_last_member_count = val; + }#endif return 0 ;
@@ -949,6 +956,7 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERIER */ nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_ELASTICITY */ nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_MAX */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_LAST_MEMBER_CNT */ #endif 0; }
@@ -1014,7 +1022,9 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)nla_put_u8 (skb,IFLA_BR_MCAST_QUERIER , br->multicast_querier) ||nla_put_u32 (skb,IFLA_BR_MCAST_HASH_ELASTICITY , br->hash_elasticity) || - nla_put_u32(skb, IFLA_BR_MCAST_HASH_MAX, br->hash_max)) +nla_put_u32 (skb,IFLA_BR_MCAST_HASH_MAX , br->hash_max) || +nla_put_u32 (skb,IFLA_BR_MCAST_LAST_MEMBER_CNT , + br->multicast_last_member_count)) return -EMSGSIZE;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 17/20 bridge: netlink: add support for multicast_startup_query_count
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_MCAST_STARTUP_QUERY_CNT to allow setting/getting br->multicast_startup_query_count via netlink. Also align the ifla comments.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-)
include/uapi/linux/if_link.h +1 -0
@@ -252,6 +252,7 @@ enum {IFLA_BR_MCAST_HASH_ELASTICITY ,IFLA_BR_MCAST_HASH_MAX ,IFLA_BR_MCAST_LAST_MEMBER_CNT , +IFLA_BR_MCAST_STARTUP_QUERY_CNT , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +16 -6
@@ -774,6 +774,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_HASH_ELASTICITY] = { .type = NLA_U32 }, [IFLA_BR_MCAST_HASH_MAX] = { .type = NLA_U32 }, [IFLA_BR_MCAST_LAST_MEMBER_CNT] = { .type = NLA_U32 }, + [IFLA_BR_MCAST_STARTUP_QUERY_CNT] = { .type = NLA_U32 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -920,6 +921,12 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], br->multicast_last_member_count = val; } + +if (data[IFLA_BR_MCAST_STARTUP_QUERY_CNT ]) { +u32 val =nla_get_u32 (data[IFLA_BR_MCAST_STARTUP_QUERY_CNT ]); + + br->multicast_startup_query_count = val; + }#endif return 0 ;
@@ -942,8 +949,8 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (struct ifla_bridge_id )) +/* IFLA_BR_BRIDGE_ID */ nla_total_size (sizeof (u16)) +/* IFLA_BR_ROOT_PORT */ nla_total_size (sizeof (u32)) +/* IFLA_BR_ROOT_PATH_COST */ -nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */ -nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */ nla_total_size (sizeof (u64)) +/* IFLA_BR_HELLO_TIMER */ nla_total_size (sizeof (u64)) +/* IFLA_BR_TCN_TIMER */ nla_total_size(sizeof(u64)) + /* IFLA_BR_TOPOLOGY_CHANGE_TIMER */
@@ -954,9 +961,10 @@ static size_t br_get_size(const struct net_device *brdev)nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_SNOOPING */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERY_USE_IFADDR */ nla_total_size (sizeof (u8)) +/* IFLA_BR_MCAST_QUERIER */ -nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_ELASTICITY */ -nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_MAX */ -nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_LAST_MEMBER_CNT */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_ELASTICITY */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_HASH_MAX */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_LAST_MEMBER_CNT */ +nla_total_size (sizeof (u32)) +/* IFLA_BR_MCAST_STARTUP_QUERY_CNT */ #endif 0; }
@@ -1024,7 +1032,9 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev) br->hash_elasticity) ||nla_put_u32 (skb,IFLA_BR_MCAST_HASH_MAX , br->hash_max) ||nla_put_u32 (skb,IFLA_BR_MCAST_LAST_MEMBER_CNT , - br->multicast_last_member_count)) + br->multicast_last_member_count) || +nla_put_u32 (skb,IFLA_BR_MCAST_STARTUP_QUERY_CNT , + br->multicast_startup_query_count)) return -EMSGSIZE;#endif
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 18/20 bridge: netlink: add support for igmp's intervals
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add support to set/get all of the igmp's configurable intervals via netlink. These currently are:IFLA_BR_MCAST_LAST_MEMBER_INTVL IFLA_BR_MCAST_MEMBERSHIP_INTVL IFLA_BR_MCAST_QUERIER_INTVLIFLA_BR_MCAST_QUERY_INTVL IFLA_BR_MCAST_QUERY_RESPONSE_INTVL IFLA_BR_MCAST_STARTUP_QUERY_INTVL
--- include/uapi/linux/if_link.h | 6 ++++ net/bridge/br_netlink.c | 70 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 75 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +6 -0
@@ -253,6 +253,12 @@ enum {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_MAX, };
net/bridge/br_netlink.c +69 -1
106 lines not on this page · raw message
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 19/20 bridge: netlink: add support for netfilter tables config
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add support to allow getting/setting netfilter tables settings. Currently these are IFLA_BR_NF_CALL_IPTABLES, IFLA_BR_NF_CALL_IP6TABLES and IFLA_BR_NF_CALL_ARPTABLES.
--- include/uapi/linux/if_link.h | 3 +++ net/bridge/br_netlink.c | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-)
include/uapi/linux/if_link.h +3 -0
@@ -259,6 +259,9 @@ enum {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_MAX, };
net/bridge/br_netlink.c +36 -1
@@ -781,6 +781,9 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_MCAST_QUERY_INTVL] = { .type = NLA_U64 }, [IFLA_BR_MCAST_QUERY_RESPONSE_INTVL] = { .type = NLA_U64 }, [IFLA_BR_MCAST_STARTUP_QUERY_INTVL] = { .type = NLA_U64 }, + [IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 }, + [IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 }, + [IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -970,6 +973,25 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[], br->multicast_startup_query_interval = clock_t_to_jiffies(val); }#endif +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER ) +if (data[IFLA_BR_NF_CALL_IPTABLES ]) { +u8 val =nla_get_u8 (data[IFLA_BR_NF_CALL_IPTABLES ]); + + br->nf_call_iptables = val ? true : false; + } + +if (data[IFLA_BR_NF_CALL_IP6TABLES ]) { +u8 val =nla_get_u8 (data[IFLA_BR_NF_CALL_IP6TABLES ]); + + br->nf_call_ip6tables = val ? true : false; + } + +if (data[IFLA_BR_NF_CALL_ARPTABLES ]) { +u8 val =nla_get_u8 (data[IFLA_BR_NF_CALL_ARPTABLES ]); + + br->nf_call_arptables = val ? true : false; + } +#endif return 0 ; }
@@ -1014,6 +1036,11 @@ static size_t br_get_size(const struct net_device *brdev) nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_QUERY_RESPONSE_INTVL */ nla_total_size(sizeof(u64)) + /* IFLA_BR_MCAST_STARTUP_QUERY_INTVL */#endif +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER ) +nla_total_size (sizeof (u8)) +/* IFLA_BR_NF_CALL_IPTABLES */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_NF_CALL_IP6TABLES */ +nla_total_size (sizeof (u8)) +/* IFLA_BR_NF_CALL_ARPTABLES */ +#endif 0; }
@@ -1070,7 +1097,6 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)if (nla_put_be16 (skb,IFLA_BR_VLAN_PROTOCOL , br->vlan_proto))return -EMSGSIZE ;#endif -#ifdef CONFIG_BRIDGE_IGMP_SNOOPING if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) || nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING, !br->multicast_disabled) ||
@@ -1105,6 +1131,15 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)if (nla_put_u64 (skb,IFLA_BR_MCAST_STARTUP_QUERY_INTVL , clockval))return -EMSGSIZE ;#endif +#if IS_ENABLED (CONFIG_BRIDGE_NETFILTER ) +if (nla_put_u8 (skb,IFLA_BR_NF_CALL_IPTABLES , + br->nf_call_iptables ?1 :0 ) || +nla_put_u8 (skb,IFLA_BR_NF_CALL_IP6TABLES , + br->nf_call_ip6tables ?1 :0 ) || +nla_put_u8 (skb,IFLA_BR_NF_CALL_ARPTABLES , + br->nf_call_arptables ?1 :0 )) +return -EMSGSIZE ; +#endif return 0 ; }
Signature · 1 line
2.4.3
Nikolay Aleksandrov
maintainerPATCH 20/20 bridge: netlink: add support for default_pvid
In reply to Nikolay AleksandrovFrom: Nikolay Aleksandrov <[email protected]>
Add IFLA_BR_VLAN_DEFAULT_PVID to allow setting/getting bridge's default_pvid via netlink.
--- include/uapi/linux/if_link.h | 1 + net/bridge/br_netlink.c | 13 ++++++++++++- net/bridge/br_private.h | 1 + net/bridge/br_vlan.c | 14 +++++++------- 4 files changed, 21 insertions(+), 8 deletions(-)
include/uapi/linux/if_link.h +1 -0
@@ -262,6 +262,7 @@ enum {IFLA_BR_NF_CALL_IPTABLES ,IFLA_BR_NF_CALL_IP6TABLES ,IFLA_BR_NF_CALL_ARPTABLES , +IFLA_BR_VLAN_DEFAULT_PVID , __IFLA_BR_MAX, };
net/bridge/br_netlink.c +12 -1
@@ -784,6 +784,7 @@ static const struct nla_policy br_policy[IFLA_BR_MAX + 1] = { [IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 }, [IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 }, [IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 }, + [IFLA_BR_VLAN_DEFAULT_PVID] = { .type = NLA_U16 }, }; static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
@@ -847,6 +848,14 @@ static int br_changelink(struct net_device *brdev, struct nlattr *tb[],if (err) return err; } + +if (data[IFLA_BR_VLAN_DEFAULT_PVID ]) { +__u16 defpvid =nla_get_u16 (data[IFLA_BR_VLAN_DEFAULT_PVID ]); + + err =__br_vlan_set_default_pvid (br, defpvid); +if (err) +return err; + }#endif if (data[IFLA_BR_GROUP_FWD_MASK ]) {
@@ -1007,6 +1016,7 @@ static size_t br_get_size(const struct net_device *brdev) nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_FILTERING */#ifdef CONFIG_BRIDGE_VLAN_FILTERING nla_total_size (sizeof (__be16)) +/* IFLA_BR_VLAN_PROTOCOL */ +nla_total_size (sizeof (u16)) +/* IFLA_BR_VLAN_DEFAULT_PVID */ #endifnla_total_size (sizeof (u16)) +/* IFLA_BR_GROUP_FWD_MASK */ nla_total_size(sizeof(struct ifla_bridge_id)) + /* IFLA_BR_ROOT_ID */
@@ -1094,7 +1104,8 @@ static int br_fill_info(struct sk_buff *skb, const struct net_device *brdev)return -EMSGSIZE ;#ifdef CONFIG_BRIDGE_VLAN_FILTERING -if (nla_put_be16 (skb,IFLA_BR_VLAN_PROTOCOL , br->vlan_proto)) +if (nla_put_be16 (skb,IFLA_BR_VLAN_PROTOCOL , br->vlan_proto) || +nla_put_u16 (skb,IFLA_BR_VLAN_DEFAULT_PVID , br->default_pvid))return -EMSGSIZE ;#endif #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
net/bridge/br_private.h +1 -0
@@ -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_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,u16 pvid);int nbp_vlan_add (struct net_bridge_port *port,u16 vid,u16 flags);int nbp_vlan_delete (struct net_bridge_port *port,u16 vid);void nbp_vlan_flush (struct net_bridge_port *port);
net/bridge/br_vlan.c +7 -7
@@ -727,7 +727,7 @@ static void br_vlan_disable_default_pvid(struct net_bridge *br) 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;struct net_bridge_port *p;
@@ -735,6 +735,11 @@ static int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid)int err =0 ;unsigned long *changed; +if (!pvid) { +br_vlan_disable_default_pvid (br); +return 0 ; + } + changed =kcalloc (BITS_TO_LONGS (BR_MAX_PORTS ),sizeof (unsigned long ),GFP_KERNEL );if (!changed)
@@ -825,12 +830,7 @@ int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val) err = -EPERM ; goto unlock; } - -if (!pvid) -br_vlan_disable_default_pvid (br); -else - err =__br_vlan_set_default_pvid (br, pvid); - + err =__br_vlan_set_default_pvid (br, pvid); unlock:rtnl_unlock ();return err;
Signature · 1 line
2.4.3
David Miller
maintainerFrom: Nikolay Aleksandrov <[email protected]>
Date: Sun, 4 Oct 2015 14:23:27 +0200
Quoted 10 lines
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.
Quoted 2 lines
This patch-set is on top of my last vlan cleanups set:
http://www.spinics.net/lists/netdev/msg346005.html
Series applied, thanks.