Commit 2aa4abed authored by Casper Andersson's avatar Casper Andersson Committed by David S. Miller

net: bridge: allow add/remove permanent mdb entries on disabled ports

Adding mdb entries on disabled ports allows you to do setup before
accepting any traffic, avoiding any time where the port is not in the
multicast group.
Signed-off-by: default avatarCasper Andersson <casper.casan@gmail.com>
Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fe63ec97
...@@ -1025,8 +1025,8 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1025,8 +1025,8 @@ static int br_mdb_add(struct sk_buff *skb, struct nlmsghdr *nlh,
NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device"); NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device");
return -EINVAL; return -EINVAL;
} }
if (p->state == BR_STATE_DISABLED) { if (p->state == BR_STATE_DISABLED && entry->state != MDB_PERMANENT) {
NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state"); NL_SET_ERR_MSG_MOD(extack, "Port is in disabled state and entry is not permanent");
return -EINVAL; return -EINVAL;
} }
vg = nbp_vlan_group(p); vg = nbp_vlan_group(p);
...@@ -1086,9 +1086,6 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry, ...@@ -1086,9 +1086,6 @@ static int __br_mdb_del(struct net_bridge *br, struct br_mdb_entry *entry,
if (!p->key.port || p->key.port->dev->ifindex != entry->ifindex) if (!p->key.port || p->key.port->dev->ifindex != entry->ifindex)
continue; continue;
if (p->key.port->state == BR_STATE_DISABLED)
goto unlock;
br_multicast_del_pg(mp, p, pp); br_multicast_del_pg(mp, p, pp);
err = 0; err = 0;
break; break;
...@@ -1124,8 +1121,14 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -1124,8 +1121,14 @@ static int br_mdb_del(struct sk_buff *skb, struct nlmsghdr *nlh,
return -ENODEV; return -ENODEV;
p = br_port_get_rtnl(pdev); p = br_port_get_rtnl(pdev);
if (!p || p->br != br || p->state == BR_STATE_DISABLED) if (!p) {
NL_SET_ERR_MSG_MOD(extack, "Net device is not a bridge port");
return -EINVAL;
}
if (p->br != br) {
NL_SET_ERR_MSG_MOD(extack, "Port belongs to a different bridge device");
return -EINVAL; return -EINVAL;
}
vg = nbp_vlan_group(p); vg = nbp_vlan_group(p);
} else { } else {
vg = br_vlan_group(br); vg = br_vlan_group(br);
......
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