Add support for fdb flush filtering based on vlan id. Signed-off-by: Nikolay Aleksandrov <razor@xxxxxxxxxxxxx> --- include/uapi/linux/if_bridge.h | 1 + net/bridge/br_fdb.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index 67ee12586844..7f6730812916 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h @@ -820,6 +820,7 @@ enum { FDB_FLUSH_NDM_FLAGS, FDB_FLUSH_NDM_FLAGS_MASK, FDB_FLUSH_PORT_IFINDEX, + FDB_FLUSH_VLAN_ID, __FDB_FLUSH_MAX }; #define FDB_FLUSH_MAX (__FDB_FLUSH_MAX - 1) diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 53208adf7474..bc8b5cbde8ed 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -626,6 +626,7 @@ static const struct nla_policy br_fdb_flush_policy[FDB_FLUSH_MAX + 1] = { [FDB_FLUSH_UNSPEC] = { .type = NLA_REJECT }, [FDB_FLUSH_NDM_STATE] = { .type = NLA_U16 }, [FDB_FLUSH_NDM_FLAGS] = { .type = NLA_U16 }, + [FDB_FLUSH_VLAN_ID] = { .type = NLA_U16 }, [FDB_FLUSH_NDM_STATE_MASK] = { .type = NLA_U16 }, [FDB_FLUSH_NDM_FLAGS_MASK] = { .type = NLA_U16 }, [FDB_FLUSH_PORT_IFINDEX] = { .type = NLA_S32 }, @@ -671,6 +672,11 @@ int br_fdb_flush_nlattr(struct net_bridge *br, struct nlattr *fdb_flush_attr, port_ifidx = nla_get_u32(fdb_flush_tb[FDB_FLUSH_PORT_IFINDEX]); desc.port_ifindex = port_ifidx; } + if (fdb_flush_tb[FDB_FLUSH_VLAN_ID]) { + desc.vlan_id = nla_get_u16(fdb_flush_tb[FDB_FLUSH_VLAN_ID]); + if (!br_vlan_valid_id(desc.vlan_id, extack)) + return -EINVAL; + } br_debug(br, "flushing port ifindex: %d vlan id: %u flags: 0x%lx flags mask: 0x%lx\n", desc.port_ifindex, desc.vlan_id, desc.flags, desc.flags_mask); -- 2.35.1