bridge: Add vlan support to static neighbors
When a user adds bridge neighbors, allow him to specify VLAN id. If the VLAN id is not specified, the neighbor will be added for VLANs currently in the ports filter list. If no VLANs are configured on the port, we use vlan 0 and only add 1 entry. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Acked-by: Jitendra Kalsaria <jitendra.kalsaria@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
b0e9a30dd6
commit
1690be63a2
@@ -2119,13 +2119,17 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
{
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct ndmsg *ndm;
|
||||
struct nlattr *llattr;
|
||||
struct nlattr *tb[NDA_MAX+1];
|
||||
struct net_device *dev;
|
||||
int err = -EINVAL;
|
||||
__u8 *addr;
|
||||
|
||||
if (nlmsg_len(nlh) < sizeof(*ndm))
|
||||
return -EINVAL;
|
||||
if (!capable(CAP_NET_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
ndm = nlmsg_data(nlh);
|
||||
if (ndm->ndm_ifindex == 0) {
|
||||
@@ -2139,13 +2143,17 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
llattr = nlmsg_find_attr(nlh, sizeof(*ndm), NDA_LLADDR);
|
||||
if (llattr == NULL || nla_len(llattr) != ETH_ALEN) {
|
||||
pr_info("PF_BRIGDE: RTM_DELNEIGH with invalid address\n");
|
||||
if (!tb[NDA_LLADDR] || nla_len(tb[NDA_LLADDR]) != ETH_ALEN) {
|
||||
pr_info("PF_BRIDGE: RTM_DELNEIGH with invalid address\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
addr = nla_data(tb[NDA_LLADDR]);
|
||||
if (!is_valid_ether_addr(addr)) {
|
||||
pr_info("PF_BRIDGE: RTM_DELNEIGH with invalid ether address\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
addr = nla_data(llattr);
|
||||
err = -EOPNOTSUPP;
|
||||
|
||||
/* Support fdb on master device the net/bridge default case */
|
||||
@@ -2155,7 +2163,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
const struct net_device_ops *ops = br_dev->netdev_ops;
|
||||
|
||||
if (ops->ndo_fdb_del)
|
||||
err = ops->ndo_fdb_del(ndm, dev, addr);
|
||||
err = ops->ndo_fdb_del(ndm, tb, dev, addr);
|
||||
|
||||
if (err)
|
||||
goto out;
|
||||
@@ -2165,7 +2173,7 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
|
||||
|
||||
/* Embedded bridge, macvlan, and any other device support */
|
||||
if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_del) {
|
||||
err = dev->netdev_ops->ndo_fdb_del(ndm, dev, addr);
|
||||
err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr);
|
||||
|
||||
if (!err) {
|
||||
rtnl_fdb_notify(dev, addr, RTM_DELNEIGH);
|
||||
|
Reference in New Issue
Block a user