| @@ -184,6 +184,7 @@ static int __mdb_fill_info(struct sk_buff *skb, · 183 unmodified lines |
| 184 | MDBA_MDB_EATTR_TIMER, | 184 | MDBA_MDB_EATTR_TIMER, |
| 185 | br_timer_value(mtimer))) | 185 | br_timer_value(mtimer))) |
| 186 | goto nest_err; | 186 | goto nest_err; |
| | 187 | |
| 187 | switch (mp->addr.proto) { | 188 | switch (mp->addr.proto) { |
| 188 | case htons(ETH_P_IP): | 189 | case htons(ETH_P_IP): |
| 189 | dump_srcs_mode = !!(mp->br->multicast_igmp_version == 3); | 190 | dump_srcs_mode = !!(mp->br->multicast_igmp_version == 3); |
| @@ -206,10 +207,15 @@ static int __mdb_fill_info(struct sk_buff *skb, · 16 unmodified lines |
| 206 | break; | 207 | break; |
| 207 | #endif | 208 | #endif |
| 208 | } | 209 | } |
| 209 | if (p && dump_srcs_mode && | 210 | if (p) { |
| 210 | (__mdb_fill_srcs(skb, p) || | 211 | if (nla_put_u8(skb, MDBA_MDB_EATTR_RTPROT, p->rt_protocol)) |
| 211 | nla_put_u8(skb, MDBA_MDB_EATTR_GROUP_MODE, p->filter_mode))) | 212 | goto nest_err; |
| 212 | goto nest_err; | 213 | if (dump_srcs_mode && |
| | 214 | (__mdb_fill_srcs(skb, p) || |
| | 215 | nla_put_u8(skb, MDBA_MDB_EATTR_GROUP_MODE, |
| | 216 | p->filter_mode))) |
| | 217 | goto nest_err; |
| | 218 | } |
| 213 | nla_nest_end(skb, nest_ent); | 219 | nla_nest_end(skb, nest_ent); |
| 214 | | 220 | |
| 215 | return 0; | 221 | return 0; |
| @@ -414,6 +420,9 @@ static size_t rtnl_mdb_nlmsg_size(struct net_bridge_port_group *pg) · 198 unmodified lines |
| 414 | if (!pg) | 420 | if (!pg) |
| 415 | goto out; | 421 | goto out; |
| 416 | | 422 | |
| | 423 | /* MDBA_MDB_EATTR_RTPROT */ |
| | 424 | nlmsg_size += nla_total_size(sizeof(u8)); |
| | 425 | |
| 417 | switch (pg->addr.proto) { | 426 | switch (pg->addr.proto) { |
| 418 | case htons(ETH_P_IP): | 427 | case htons(ETH_P_IP): |
| 419 | /* MDBA_MDB_EATTR_SOURCE */ | 428 | /* MDBA_MDB_EATTR_SOURCE */ |
| @@ -809,16 +818,20 @@ static int br_mdb_parse(struct sk_buff *skb, struct nlmsghdr *nlh, · 389 unmodified lines |
| 809 | } | 818 | } |
| 810 | | 819 | |
| 811 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, | 820 | static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, |
| 812 | struct br_ip *group, struct br_mdb_entry *entry, | 821 | struct br_mdb_entry *entry, |
| | 822 | struct nlattr **mdb_attrs, |
| 813 | struct netlink_ext_ack *extack) | 823 | struct netlink_ext_ack *extack) |
| 814 | { | 824 | { |
| 815 | struct net_bridge_mdb_entry *mp; | 825 | struct net_bridge_mdb_entry *mp; |
| 816 | struct net_bridge_port_group *p; | 826 | struct net_bridge_port_group *p; |
| 817 | struct net_bridge_port_group __rcu **pp; | 827 | struct net_bridge_port_group __rcu **pp; |
| 818 | unsigned long now = jiffies; | 828 | unsigned long now = jiffies; |
| | 829 | struct br_ip group; |
| 819 | u8 filter_mode; | 830 | u8 filter_mode; |
| 820 | int err; | 831 | int err; |
| 821 | | 832 | |
| | 833 | __mdb_entry_to_br_ip(entry, &group, mdb_attrs); |
| | 834 | |
| 822 | /* host join errors which can happen before creating the group */ | 835 | /* host join errors which can happen before creating the group */ |
| 823 | if (!port) { | 836 | if (!port) { |
| 824 | /* don't allow any flags for host-joined groups */ | 837 | /* don't allow any flags for host-joined groups */ |
| @@ -826,15 +839,15 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, · 1 unmodified line |
| 826 | NL_SET_ERR_MSG_MOD(extack, "Flags are not allowed for host groups"); | 839 | NL_SET_ERR_MSG_MOD(extack, "Flags are not allowed for host groups"); |
| 827 | return -EINVAL; | 840 | return -EINVAL; |
| 828 | } | 841 | } |
| 829 | if (!br_multicast_is_star_g(group)) { | 842 | if (!br_multicast_is_star_g(&group)) { |
| 830 | NL_SET_ERR_MSG_MOD(extack, "Groups with sources cannot be manually host joined"); | 843 | NL_SET_ERR_MSG_MOD(extack, "Groups with sources cannot be manually host joined"); |
| 831 | return -EINVAL; | 844 | return -EINVAL; |
| 832 | } | 845 | } |
| 833 | } | 846 | } |
| 834 | | 847 | |
| 835 | mp = br_mdb_ip_get(br, group); | 848 | mp = br_mdb_ip_get(br, &group); |
| 836 | if (!mp) { | 849 | if (!mp) { |
| 837 | mp = br_multicast_new_group(br, group); | 850 | mp = br_multicast_new_group(br, &group); |
| 838 | err = PTR_ERR_OR_ZERO(mp); | 851 | err = PTR_ERR_OR_ZERO(mp); |
| 839 | if (err) | 852 | if (err) |
| 840 | return err; | 853 | return err; |
| @@ -864,11 +877,11 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port, · 23 unmodified lines |
| 864 | break; | 877 | break; |
| 865 | } | 878 | } |
| 866 | | 879 | |
| 867 | filter_mode = br_multicast_is_star_g(group) ? MCAST_EXCLUDE : | 880 | filter_mode = br_multicast_is_star_g(&group) ? MCAST_EXCLUDE : |
| 868 | MCAST_INCLUDE; | 881 | MCAST_INCLUDE; |
| 869 | | 882 | |
| 870 | p = br_multicast_new_port_group(port, group, *pp, entry->state, NULL, | 883 | p = br_multicast_new_port_group(port, &group, *pp, entry->state, NULL, |
| 871 | filter_mode); | 884 | filter_mode, RTPROT_STATIC); |
| 872 | if (unlikely(!p)) { | 885 | if (unlikely(!p)) { |
| 873 | NL_SET_ERR_MSG_MOD(extack, "Couldn't allocate new port group"); | 886 | NL_SET_ERR_MSG_MOD(extack, "Couldn't allocate new port group"); |
| 874 | return -ENOMEM; | 887 | return -ENOMEM; |
| @@ -887,13 +900,10 @@ static int __br_mdb_add(struct net *net, struct net_bridge *br, · 12 unmodified lines |
| 887 | struct nlattr **mdb_attrs, | 900 | struct nlattr **mdb_attrs, |
| 888 | struct netlink_ext_ack *extack) | 901 | struct netlink_ext_ack *extack) |
| 889 | { | 902 | { |
| 890 | struct br_ip ip; | | |
| 891 | int ret; | 903 | int ret; |
| 892 | | 904 | |
| 893 | __mdb_entry_to_br_ip(entry, &ip, mdb_attrs); | | |
| 894 | | | |
| 895 | spin_lock_bh(&br->multicast_lock); | 905 | spin_lock_bh(&br->multicast_lock); |
| 896 | ret = br_mdb_add_group(br, p, &ip, entry, extack); | 906 | ret = br_mdb_add_group(br, p, entry, mdb_attrs, extack); |
| 897 | spin_unlock_bh(&br->multicast_lock); | 907 | spin_unlock_bh(&br->multicast_lock); |
| 898 | | 908 | |
| 899 | return ret; | 909 | return ret; |