github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/socket_netlink_generic_team.txt (about)

     1  # Copyright 2018 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # AF_NETLINK/NETLINK_GENERIC/team support.
     5  
     6  include <linux/net.h>
     7  include <net/netlink.h>
     8  include <uapi/linux/netlink.h>
     9  include <uapi/linux/genetlink.h>
    10  include <uapi/linux/if_team.h>
    11  
    12  resource genl_team_family_id[int16]
    13  resource ifindex_team[ifindex]
    14  type msghdr_nl_team[CMD] msghdr_netlink[netlink_msg_t[genl_team_family_id, genlmsghdr_t[CMD], team_nl_policy]]
    15  
    16  syz_genetlink_get_family_id$team(name ptr[in, string["team"]], fd sock_nl_generic) genl_team_family_id
    17  ioctl$ifreq_SIOCGIFINDEX_team(fd sock, cmd const[SIOCGIFINDEX], arg ptr[out, ifreq_dev_t["team0", ifindex_team]])
    18  
    19  sendmsg$TEAM_CMD_NOOP(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_NOOP]], f flags[send_flags])
    20  sendmsg$TEAM_CMD_OPTIONS_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_OPTIONS_SET]], f flags[send_flags])
    21  sendmsg$TEAM_CMD_OPTIONS_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_OPTIONS_GET]], f flags[send_flags])
    22  sendmsg$TEAM_CMD_PORT_LIST_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_PORT_LIST_GET]], f flags[send_flags])
    23  
    24  team_nl_policy {
    25  	TEAM_ATTR_TEAM_IFINDEX	nlattr[TEAM_ATTR_TEAM_IFINDEX, ifindex_team]
    26  	TEAM_ATTR_LIST_OPTION	nlnest[TEAM_ATTR_LIST_OPTION, array[nlattr[TEAM_ATTR_ITEM_OPTION, team_attr_option]]]
    27  } [packed, align[4]]
    28  
    29  type team_nl_option_policy[NAME, TYPE, DATA] {
    30  	TEAM_ATTR_OPTION_NAME	nlattr[TEAM_ATTR_OPTION_NAME, string[NAME, TEAM_STRING_MAX_LEN]]
    31  	TEAM_ATTR_OPTION_TYPE	nlattr[TEAM_ATTR_OPTION_TYPE, const[TYPE, int8]]
    32  	TEAM_ATTR_OPTION_DATA	nlattr[TEAM_ATTR_OPTION_DATA, DATA]
    33  } [packed, align[4]]
    34  
    35  type team_nl_option_policy$per_port[NAME, TYPE, DATA] {
    36  	opt				team_nl_option_policy[NAME, TYPE, DATA]
    37  	TEAM_ATTR_OPTION_PORT_IFINDEX	nlattr[TEAM_ATTR_OPTION_PORT_IFINDEX, ifindex]
    38  } [packed, align[4]]
    39  
    40  type team_nl_option_policy$array[NAME, TYPE, DATA, SIZE] {
    41  	opt				team_nl_option_policy[NAME, TYPE, DATA]
    42  	TEAM_ATTR_OPTION_ARRAY_INDEX	nlattr[TEAM_ATTR_OPTION_ARRAY_INDEX, int32[0:SIZE]]
    43  } [packed, align[4]]
    44  
    45  team_attr_option [
    46  	name				team_nl_option_policy["mode", NLA_STRING, string[team_attr_option_mode]]
    47  	notify_peers_count		team_nl_option_policy["notify_peers_count", NLA_U32, int32]
    48  	notify_peers_interval		team_nl_option_policy["notify_peers_interval", NLA_U32, int32]
    49  	mcast_rejoin_count		team_nl_option_policy["mcast_rejoin_count", NLA_U32, int32]
    50  	mcast_rejoin_interval		team_nl_option_policy["mcast_rejoin_interval", NLA_U32, int32]
    51  # TODO: NLA_FLAG value is determined by presence of TEAM_ATTR_OPTION_DATA attr, but we always pass it.
    52  	enabled				team_nl_option_policy$per_port["enabled", NLA_FLAG, void]
    53  	user_linkup			team_nl_option_policy$per_port["user_linkup", NLA_FLAG, void]
    54  	user_linkup_enabled		team_nl_option_policy$per_port["user_linkup_enabled", NLA_FLAG, void]
    55  	priority			team_nl_option_policy$per_port["priority", NLA_S32, int32]
    56  	queue_id			team_nl_option_policy$per_port["queue_id", NLA_U32, int32]
    57  	activeport			team_nl_option_policy["activeport", NLA_U32, ifindex]
    58  	bpf_hash_func			team_nl_option_policy["bpf_hash_func", NLA_BINARY, array[sock_filter]]
    59  	lb_tx_method			team_nl_option_policy["lb_tx_method", NLA_STRING, string[team_attr_option_lb_tx_method]]
    60  	lb_tx_hash_to_port_mapping	team_nl_option_policy$array["lb_tx_hash_to_port_mapping", NLA_U32, ifindex, 256]
    61  	lb_hash_stats			team_nl_option_policy$array["lb_hash_stats", NLA_BINARY, int32, 256]
    62  	lb_port_stats			team_nl_option_policy$per_port["lb_port_stats", NLA_BINARY, int32]
    63  	lb_stats_refresh_interval	team_nl_option_policy["lb_stats_refresh_interval", NLA_U32, int32]
    64  ] [varlen]
    65  
    66  team_attr_option_mode = "activebackup", "broadcast", "loadbalance", "random", "roundrobin"
    67  team_attr_option_lb_tx_method = "hash", "hash_to_port_mapping"