br_netlink.c (30b0594a3e6c2bcbe5bd59753d0319d6f9925e40) br_netlink.c (9163a0fc1f0c0980f117cc25f4fa6ba9b0750a36)
1/*
2 * Bridge netlink control interface
3 *
4 * Authors:
5 * Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 1020 unchanged lines hidden (view full) ---

1029 [IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 },
1030 [IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 },
1031 [IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 },
1032 [IFLA_BR_VLAN_DEFAULT_PVID] = { .type = NLA_U16 },
1033 [IFLA_BR_VLAN_STATS_ENABLED] = { .type = NLA_U8 },
1034 [IFLA_BR_MCAST_STATS_ENABLED] = { .type = NLA_U8 },
1035 [IFLA_BR_MCAST_IGMP_VERSION] = { .type = NLA_U8 },
1036 [IFLA_BR_MCAST_MLD_VERSION] = { .type = NLA_U8 },
1/*
2 * Bridge netlink control interface
3 *
4 * Authors:
5 * Stephen Hemminger <shemminger@osdl.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License

--- 1020 unchanged lines hidden (view full) ---

1029 [IFLA_BR_NF_CALL_IPTABLES] = { .type = NLA_U8 },
1030 [IFLA_BR_NF_CALL_IP6TABLES] = { .type = NLA_U8 },
1031 [IFLA_BR_NF_CALL_ARPTABLES] = { .type = NLA_U8 },
1032 [IFLA_BR_VLAN_DEFAULT_PVID] = { .type = NLA_U16 },
1033 [IFLA_BR_VLAN_STATS_ENABLED] = { .type = NLA_U8 },
1034 [IFLA_BR_MCAST_STATS_ENABLED] = { .type = NLA_U8 },
1035 [IFLA_BR_MCAST_IGMP_VERSION] = { .type = NLA_U8 },
1036 [IFLA_BR_MCAST_MLD_VERSION] = { .type = NLA_U8 },
1037 [IFLA_BR_VLAN_STATS_PER_PORT] = { .type = NLA_U8 },
1037};
1038
1039static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
1040 struct nlattr *data[],
1041 struct netlink_ext_ack *extack)
1042{
1043 struct net_bridge *br = netdev_priv(brdev);
1044 int err;

--- 64 unchanged lines hidden (view full) ---

1109
1110 if (data[IFLA_BR_VLAN_STATS_ENABLED]) {
1111 __u8 vlan_stats = nla_get_u8(data[IFLA_BR_VLAN_STATS_ENABLED]);
1112
1113 err = br_vlan_set_stats(br, vlan_stats);
1114 if (err)
1115 return err;
1116 }
1038};
1039
1040static int br_changelink(struct net_device *brdev, struct nlattr *tb[],
1041 struct nlattr *data[],
1042 struct netlink_ext_ack *extack)
1043{
1044 struct net_bridge *br = netdev_priv(brdev);
1045 int err;

--- 64 unchanged lines hidden (view full) ---

1110
1111 if (data[IFLA_BR_VLAN_STATS_ENABLED]) {
1112 __u8 vlan_stats = nla_get_u8(data[IFLA_BR_VLAN_STATS_ENABLED]);
1113
1114 err = br_vlan_set_stats(br, vlan_stats);
1115 if (err)
1116 return err;
1117 }
1118
1119 if (data[IFLA_BR_VLAN_STATS_PER_PORT]) {
1120 __u8 per_port = nla_get_u8(data[IFLA_BR_VLAN_STATS_PER_PORT]);
1121
1122 err = br_vlan_set_stats_per_port(br, per_port);
1123 if (err)
1124 return err;
1125 }
1117#endif
1118
1119 if (data[IFLA_BR_GROUP_FWD_MASK]) {
1120 u16 fwd_mask = nla_get_u16(data[IFLA_BR_GROUP_FWD_MASK]);
1121
1122 if (fwd_mask & BR_GROUPFWD_RESTRICTED)
1123 return -EINVAL;
1124 br->group_fwd_mask = fwd_mask;

--- 197 unchanged lines hidden (view full) ---

1322 nla_total_size(sizeof(u32)) + /* IFLA_BR_AGEING_TIME */
1323 nla_total_size(sizeof(u32)) + /* IFLA_BR_STP_STATE */
1324 nla_total_size(sizeof(u16)) + /* IFLA_BR_PRIORITY */
1325 nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_FILTERING */
1326#ifdef CONFIG_BRIDGE_VLAN_FILTERING
1327 nla_total_size(sizeof(__be16)) + /* IFLA_BR_VLAN_PROTOCOL */
1328 nla_total_size(sizeof(u16)) + /* IFLA_BR_VLAN_DEFAULT_PVID */
1329 nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_STATS_ENABLED */
1126#endif
1127
1128 if (data[IFLA_BR_GROUP_FWD_MASK]) {
1129 u16 fwd_mask = nla_get_u16(data[IFLA_BR_GROUP_FWD_MASK]);
1130
1131 if (fwd_mask & BR_GROUPFWD_RESTRICTED)
1132 return -EINVAL;
1133 br->group_fwd_mask = fwd_mask;

--- 197 unchanged lines hidden (view full) ---

1331 nla_total_size(sizeof(u32)) + /* IFLA_BR_AGEING_TIME */
1332 nla_total_size(sizeof(u32)) + /* IFLA_BR_STP_STATE */
1333 nla_total_size(sizeof(u16)) + /* IFLA_BR_PRIORITY */
1334 nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_FILTERING */
1335#ifdef CONFIG_BRIDGE_VLAN_FILTERING
1336 nla_total_size(sizeof(__be16)) + /* IFLA_BR_VLAN_PROTOCOL */
1337 nla_total_size(sizeof(u16)) + /* IFLA_BR_VLAN_DEFAULT_PVID */
1338 nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_STATS_ENABLED */
1339 nla_total_size(sizeof(u8)) + /* IFLA_BR_VLAN_STATS_PER_PORT */
1330#endif
1331 nla_total_size(sizeof(u16)) + /* IFLA_BR_GROUP_FWD_MASK */
1332 nla_total_size(sizeof(struct ifla_bridge_id)) + /* IFLA_BR_ROOT_ID */
1333 nla_total_size(sizeof(struct ifla_bridge_id)) + /* IFLA_BR_BRIDGE_ID */
1334 nla_total_size(sizeof(u16)) + /* IFLA_BR_ROOT_PORT */
1335 nla_total_size(sizeof(u32)) + /* IFLA_BR_ROOT_PATH_COST */
1336 nla_total_size(sizeof(u8)) + /* IFLA_BR_TOPOLOGY_CHANGE */
1337 nla_total_size(sizeof(u8)) + /* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */

--- 74 unchanged lines hidden (view full) ---

1412 br->topology_change_detected) ||
1413 nla_put(skb, IFLA_BR_GROUP_ADDR, ETH_ALEN, br->group_addr))
1414 return -EMSGSIZE;
1415
1416#ifdef CONFIG_BRIDGE_VLAN_FILTERING
1417 if (nla_put_be16(skb, IFLA_BR_VLAN_PROTOCOL, br->vlan_proto) ||
1418 nla_put_u16(skb, IFLA_BR_VLAN_DEFAULT_PVID, br->default_pvid) ||
1419 nla_put_u8(skb, IFLA_BR_VLAN_STATS_ENABLED,
1340#endif
1341 nla_total_size(sizeof(u16)) + /* IFLA_BR_GROUP_FWD_MASK */
1342 nla_total_size(sizeof(struct ifla_bridge_id)) + /* IFLA_BR_ROOT_ID */
1343 nla_total_size(sizeof(struct ifla_bridge_id)) + /* IFLA_BR_BRIDGE_ID */
1344 nla_total_size(sizeof(u16)) + /* IFLA_BR_ROOT_PORT */
1345 nla_total_size(sizeof(u32)) + /* IFLA_BR_ROOT_PATH_COST */
1346 nla_total_size(sizeof(u8)) + /* IFLA_BR_TOPOLOGY_CHANGE */
1347 nla_total_size(sizeof(u8)) + /* IFLA_BR_TOPOLOGY_CHANGE_DETECTED */

--- 74 unchanged lines hidden (view full) ---

1422 br->topology_change_detected) ||
1423 nla_put(skb, IFLA_BR_GROUP_ADDR, ETH_ALEN, br->group_addr))
1424 return -EMSGSIZE;
1425
1426#ifdef CONFIG_BRIDGE_VLAN_FILTERING
1427 if (nla_put_be16(skb, IFLA_BR_VLAN_PROTOCOL, br->vlan_proto) ||
1428 nla_put_u16(skb, IFLA_BR_VLAN_DEFAULT_PVID, br->default_pvid) ||
1429 nla_put_u8(skb, IFLA_BR_VLAN_STATS_ENABLED,
1420 br_opt_get(br, BROPT_VLAN_STATS_ENABLED)))
1430 br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) ||
1431 nla_put_u8(skb, IFLA_BR_VLAN_STATS_PER_PORT,
1432 br_opt_get(br, IFLA_BR_VLAN_STATS_PER_PORT)))
1421 return -EMSGSIZE;
1422#endif
1423#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
1424 if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
1425 nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING,
1426 br_opt_get(br, BROPT_MULTICAST_ENABLED)) ||
1427 nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
1428 br_opt_get(br, BROPT_MULTICAST_QUERY_USE_IFADDR)) ||

--- 224 unchanged lines hidden ---
1433 return -EMSGSIZE;
1434#endif
1435#ifdef CONFIG_BRIDGE_IGMP_SNOOPING
1436 if (nla_put_u8(skb, IFLA_BR_MCAST_ROUTER, br->multicast_router) ||
1437 nla_put_u8(skb, IFLA_BR_MCAST_SNOOPING,
1438 br_opt_get(br, BROPT_MULTICAST_ENABLED)) ||
1439 nla_put_u8(skb, IFLA_BR_MCAST_QUERY_USE_IFADDR,
1440 br_opt_get(br, BROPT_MULTICAST_QUERY_USE_IFADDR)) ||

--- 224 unchanged lines hidden ---