br_netlink.c (50501936288d6a29d7ef78f25d00e33240fad45f) | br_netlink.c (29cfb2aaa4425a608651a05b9b875bc445394443) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Bridge netlink control interface 4 * 5 * Authors: 6 * Stephen Hemminger <shemminger@osdl.org> 7 */ 8 --- 197 unchanged lines hidden (view full) --- 206 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_N_GROUPS */ 207 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_MAX_GROUPS */ 208#endif 209 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_GROUP_FWD_MASK */ 210 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_RING_OPEN */ 211 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_IN_OPEN */ 212 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT */ 213 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_EHT_HOSTS_CNT */ | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Bridge netlink control interface 4 * 5 * Authors: 6 * Stephen Hemminger <shemminger@osdl.org> 7 */ 8 --- 197 unchanged lines hidden (view full) --- 206 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_N_GROUPS */ 207 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_MAX_GROUPS */ 208#endif 209 + nla_total_size(sizeof(u16)) /* IFLA_BRPORT_GROUP_FWD_MASK */ 210 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_RING_OPEN */ 211 + nla_total_size(sizeof(u8)) /* IFLA_BRPORT_MRP_IN_OPEN */ 212 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT */ 213 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_MCAST_EHT_HOSTS_CNT */ |
214 + nla_total_size(sizeof(u32)) /* IFLA_BRPORT_BACKUP_NHID */ |
|
214 + 0; 215} 216 217static inline size_t br_nlmsg_size(struct net_device *dev, u32 filter_mask) 218{ 219 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 220 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 221 + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ --- 92 unchanged lines hidden (view full) --- 314 /* we might be called only with br->lock */ 315 rcu_read_lock(); 316 backup_p = rcu_dereference(p->backup_port); 317 if (backup_p) 318 nla_put_u32(skb, IFLA_BRPORT_BACKUP_PORT, 319 backup_p->dev->ifindex); 320 rcu_read_unlock(); 321 | 215 + 0; 216} 217 218static inline size_t br_nlmsg_size(struct net_device *dev, u32 filter_mask) 219{ 220 return NLMSG_ALIGN(sizeof(struct ifinfomsg)) 221 + nla_total_size(IFNAMSIZ) /* IFLA_IFNAME */ 222 + nla_total_size(MAX_ADDR_LEN) /* IFLA_ADDRESS */ --- 92 unchanged lines hidden (view full) --- 315 /* we might be called only with br->lock */ 316 rcu_read_lock(); 317 backup_p = rcu_dereference(p->backup_port); 318 if (backup_p) 319 nla_put_u32(skb, IFLA_BRPORT_BACKUP_PORT, 320 backup_p->dev->ifindex); 321 rcu_read_unlock(); 322 |
323 if (p->backup_nhid && 324 nla_put_u32(skb, IFLA_BRPORT_BACKUP_NHID, p->backup_nhid)) 325 return -EMSGSIZE; 326 |
|
322 return 0; 323} 324 325static int br_fill_ifvlaninfo_range(struct sk_buff *skb, u16 vid_start, 326 u16 vid_end, u16 flags) 327{ 328 struct bridge_vlan_info vinfo; 329 --- 560 unchanged lines hidden (view full) --- 890 [IFLA_BRPORT_ISOLATED] = { .type = NLA_U8 }, 891 [IFLA_BRPORT_LOCKED] = { .type = NLA_U8 }, 892 [IFLA_BRPORT_MAB] = { .type = NLA_U8 }, 893 [IFLA_BRPORT_BACKUP_PORT] = { .type = NLA_U32 }, 894 [IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT] = { .type = NLA_U32 }, 895 [IFLA_BRPORT_MCAST_N_GROUPS] = { .type = NLA_REJECT }, 896 [IFLA_BRPORT_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, 897 [IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), | 327 return 0; 328} 329 330static int br_fill_ifvlaninfo_range(struct sk_buff *skb, u16 vid_start, 331 u16 vid_end, u16 flags) 332{ 333 struct bridge_vlan_info vinfo; 334 --- 560 unchanged lines hidden (view full) --- 895 [IFLA_BRPORT_ISOLATED] = { .type = NLA_U8 }, 896 [IFLA_BRPORT_LOCKED] = { .type = NLA_U8 }, 897 [IFLA_BRPORT_MAB] = { .type = NLA_U8 }, 898 [IFLA_BRPORT_BACKUP_PORT] = { .type = NLA_U32 }, 899 [IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT] = { .type = NLA_U32 }, 900 [IFLA_BRPORT_MCAST_N_GROUPS] = { .type = NLA_REJECT }, 901 [IFLA_BRPORT_MCAST_MAX_GROUPS] = { .type = NLA_U32 }, 902 [IFLA_BRPORT_NEIGH_VLAN_SUPPRESS] = NLA_POLICY_MAX(NLA_U8, 1), |
903 [IFLA_BRPORT_BACKUP_NHID] = { .type = NLA_U32 }, |
|
898}; 899 900/* Change the state of the port and notify spanning tree */ 901static int br_set_port_state(struct net_bridge_port *p, u8 state) 902{ 903 if (state > BR_STATE_BLOCKING) 904 return -EINVAL; 905 --- 154 unchanged lines hidden (view full) --- 1060 return -ENOENT; 1061 } 1062 1063 err = nbp_backup_change(p, backup_dev); 1064 if (err) 1065 return err; 1066 } 1067 | 904}; 905 906/* Change the state of the port and notify spanning tree */ 907static int br_set_port_state(struct net_bridge_port *p, u8 state) 908{ 909 if (state > BR_STATE_BLOCKING) 910 return -EINVAL; 911 --- 154 unchanged lines hidden (view full) --- 1066 return -ENOENT; 1067 } 1068 1069 err = nbp_backup_change(p, backup_dev); 1070 if (err) 1071 return err; 1072 } 1073 |
1074 if (tb[IFLA_BRPORT_BACKUP_NHID]) { 1075 u32 backup_nhid = nla_get_u32(tb[IFLA_BRPORT_BACKUP_NHID]); 1076 1077 WRITE_ONCE(p->backup_nhid, backup_nhid); 1078 } 1079 |
|
1068 return 0; 1069} 1070 1071/* Change state and parameters on port. */ 1072int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags, 1073 struct netlink_ext_ack *extack) 1074{ 1075 struct net_bridge *br = (struct net_bridge *)netdev_priv(dev); --- 839 unchanged lines hidden --- | 1080 return 0; 1081} 1082 1083/* Change state and parameters on port. */ 1084int br_setlink(struct net_device *dev, struct nlmsghdr *nlh, u16 flags, 1085 struct netlink_ext_ack *extack) 1086{ 1087 struct net_bridge *br = (struct net_bridge *)netdev_priv(dev); --- 839 unchanged lines hidden --- |