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

     1  # Copyright 2021 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  # TODO: these descriptions allow some basic testing, but does not seem to cover ingress path and lots of other things.
     5  # Some things that can be improved:
     6  # - supporting net namespaces in 802.15.4 subsystem for proper isolation, reproducubility
     7  #   (https://bugzilla.kernel.org/show_bug.cgi?id=211675)
     8  #   currently, parallel test processes use the same wpan0/wpan1 global devices in init namespace,
     9  #   thus no isolation, reproducubility, coverage guidance does not work
    10  # - supporting phy flags (WPAN_PHY_FLAG_TXPOWER, etc) in mac802154_hwsim
    11  #   this will increase coverage that can be achieved with mac802154_hwsim
    12  # - supporting remote coverage in 802.15.4 subsystem, lots of code seems to execute asynchronously
    13  # - figuring out how to achieve coverage of ingress path and describing 802.15.4 packet format
    14  # - there is something called 6lowpan that is related to 802.15.4, need to figure out what it is and how to reach it
    15  # - executor sets wpan0/1 UP in setup_802154, but lots of commands require the device to be DOWN
    16  #   since these are in init net namespace, our descriptions in socket_netlink_route.txt can change these devices
    17  #   thus commands that require devices to be DOWN don't actually work
    18  
    19  include <linux/net.h>
    20  include <linux/socket.h>
    21  include <uapi/linux/netlink.h>
    22  include <uapi/linux/genetlink.h>
    23  include <net/af_ieee802154.h>
    24  include <net/netlink.h>
    25  include <net/nl802154.h>
    26  include <linux/ieee802154.h>
    27  include <linux/nl802154.h>
    28  
    29  resource sock_802154_raw[sock]
    30  resource sock_802154_dgram[sock]
    31  
    32  syz_init_net_socket$802154_raw(domain const[AF_IEEE802154], type const[SOCK_RAW], proto const[0]) sock_802154_raw
    33  bind$802154_raw(fd sock_802154_raw, addr ptr[in, sockaddr_ieee802154], len bytesize[addr])
    34  sendmsg$802154_raw(fd sock_802154_raw, msg ptr[in, msghdr_802154], f flags[send_flags])
    35  
    36  syz_init_net_socket$802154_dgram(domain const[AF_IEEE802154], type const[SOCK_DGRAM], proto const[0]) sock_802154_dgram
    37  connect$802154_dgram(fd sock_802154_dgram, addr ptr[in, sockaddr_ieee802154], len bytesize[addr])
    38  bind$802154_dgram(fd sock_802154_dgram, addr ptr[in, sockaddr_ieee802154], len bytesize[addr])
    39  sendmsg$802154_dgram(fd sock_802154_dgram, msg ptr[in, msghdr_802154], f flags[send_flags])
    40  
    41  setsockopt$WPAN_WANTACK(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_WANTACK], val ptr[in, bool32], len bytesize[val])
    42  setsockopt$WPAN_WANTLQI(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_WANTLQI], val ptr[in, bool32], len bytesize[val])
    43  setsockopt$WPAN_SECURITY(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_SECURITY], val ptr[in, flags[ieee802154_security, int32]], len bytesize[val])
    44  setsockopt$WPAN_SECURITY_LEVEL(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_SECURITY_LEVEL], val ptr[in, int32[WPAN_SECURITY_LEVEL_DEFAULT:IEEE802154_SCF_SECLEVEL_ENC_MIC128]], len bytesize[val])
    45  getsockopt$WPAN_WANTACK(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_WANTACK], val ptr[out, int32], len ptr[inout, bytesize[val, int32]])
    46  getsockopt$WPAN_WANTLQI(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_WANTLQI], val ptr[out, int32], len ptr[inout, bytesize[val, int32]])
    47  getsockopt$WPAN_SECURITY(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_SECURITY], val ptr[out, int32], len ptr[inout, bytesize[val, int32]])
    48  getsockopt$WPAN_SECURITY_LEVEL(fd sock_802154_dgram, level const[SOL_IEEE802154], opt const[WPAN_SECURITY_LEVEL], val ptr[out, int32], len ptr[inout, bytesize[val, int32]])
    49  
    50  resource genl_nl802154_family_id[int16]
    51  resource ieee802154_ifindex[int32]
    52  type msghdr_nl802154[CMD, POLICY] msghdr_netlink[netlink_msg_t[genl_nl802154_family_id, genlmsghdr_t[CMD], POLICY]]
    53  
    54  syz_genetlink_get_family_id$nl802154(name ptr[in, string["nl802154"]], fd sock_nl_generic_init) genl_nl802154_family_id
    55  ioctl$sock_SIOCGIFINDEX_802154(fd sock_nl_generic_init, cmd const[SIOCGIFINDEX], arg ptr[out, ifreq_dev_t[ieee802154_dev_names, ieee802154_ifindex]])
    56  
    57  sendmsg$NL802154_CMD_GET_WPAN_PHY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_WPAN_PHY, nl802154_policy$GET_WPAN_PHY]], f flags[send_flags])
    58  sendmsg$NL802154_CMD_GET_INTERFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_INTERFACE, nl802154_policy$GET_INTERFACE]], f flags[send_flags])
    59  sendmsg$NL802154_CMD_NEW_INTERFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_NEW_INTERFACE, nl802154_policy$NEW_INTERFACE]], f flags[send_flags])
    60  # This is disabled as we only have 2 global hwsim devices, if we delete them we are out of devices.
    61  # sendmsg$NL802154_CMD_DEL_INTERFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_DEL_INTERFACE, nl802154_policy$DEL_INTERFACE]], f flags[send_flags])
    62  sendmsg$NL802154_CMD_SET_CHANNEL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_CHANNEL, nl802154_policy$SET_CHANNEL]], f flags[send_flags])
    63  sendmsg$NL802154_CMD_SET_CCA_MODE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_CCA_MODE, nl802154_policy$SET_CCA_MODE]], f flags[send_flags])
    64  sendmsg$NL802154_CMD_SET_CCA_ED_LEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_CCA_ED_LEVEL, nl802154_policy$SET_CCA_ED_LEVEL]], f flags[send_flags])
    65  sendmsg$NL802154_CMD_SET_TX_POWER(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_TX_POWER, nl802154_policy$SET_TX_POWER]], f flags[send_flags])
    66  # This may be more harmful than useful. Once we move the device from init ns, we won't be able to test it anymore...
    67  sendmsg$NL802154_CMD_SET_WPAN_PHY_NETNS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_WPAN_PHY_NETNS, nl802154_policy$SET_WPAN_PHY_NETNS]], f flags[send_flags])
    68  sendmsg$NL802154_CMD_SET_PAN_ID(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_PAN_ID, nl802154_policy$SET_PAN_ID]], f flags[send_flags])
    69  sendmsg$NL802154_CMD_SET_SHORT_ADDR(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_SHORT_ADDR, nl802154_policy$SET_SHORT_ADDR]], f flags[send_flags])
    70  sendmsg$NL802154_CMD_SET_BACKOFF_EXPONENT(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_BACKOFF_EXPONENT, nl802154_policy$SET_BACKOFF_EXPONENT]], f flags[send_flags])
    71  sendmsg$NL802154_CMD_SET_MAX_CSMA_BACKOFFS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_MAX_CSMA_BACKOFFS, nl802154_policy$SET_MAX_CSMA_BACKOFFS]], f flags[send_flags])
    72  sendmsg$NL802154_CMD_SET_MAX_FRAME_RETRIES(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_MAX_FRAME_RETRIES, nl802154_policy$SET_MAX_FRAME_RETRIES]], f flags[send_flags])
    73  sendmsg$NL802154_CMD_SET_LBT_MODE(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_LBT_MODE, nl802154_policy$SET_LBT_MODE]], f flags[send_flags])
    74  sendmsg$NL802154_CMD_SET_ACKREQ_DEFAULT(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_ACKREQ_DEFAULT, nl802154_policy$SET_ACKREQ_DEFAULT]], f flags[send_flags])
    75  sendmsg$NL802154_CMD_SET_SEC_PARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_SET_SEC_PARAMS, nl802154_policy$SET_SEC_PARAMS]], f flags[send_flags])
    76  sendmsg$NL802154_CMD_GET_SEC_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_SEC_KEY, nl802154_policy$GET_SEC_KEY]], f flags[send_flags])
    77  sendmsg$NL802154_CMD_NEW_SEC_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_NEW_SEC_KEY, nl802154_policy$NEW_SEC_KEY]], f flags[send_flags])
    78  sendmsg$NL802154_CMD_DEL_SEC_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_DEL_SEC_KEY, nl802154_policy$DEL_SEC_KEY]], f flags[send_flags])
    79  sendmsg$NL802154_CMD_GET_SEC_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_SEC_DEV, nl802154_policy$GET_SEC_DEV]], f flags[send_flags])
    80  sendmsg$NL802154_CMD_NEW_SEC_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_NEW_SEC_DEV, nl802154_policy$NEW_SEC_DEV]], f flags[send_flags])
    81  sendmsg$NL802154_CMD_DEL_SEC_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_DEL_SEC_DEV, nl802154_policy$DEL_SEC_DEV]], f flags[send_flags])
    82  sendmsg$NL802154_CMD_GET_SEC_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_SEC_DEVKEY, nl802154_policy$GET_SEC_DEVKEY]], f flags[send_flags])
    83  sendmsg$NL802154_CMD_NEW_SEC_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_NEW_SEC_DEVKEY, nl802154_policy$NEW_SEC_DEVKEY]], f flags[send_flags])
    84  sendmsg$NL802154_CMD_DEL_SEC_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_DEL_SEC_DEVKEY, nl802154_policy$DEL_SEC_DEVKEY]], f flags[send_flags])
    85  sendmsg$NL802154_CMD_GET_SEC_LEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_GET_SEC_LEVEL, nl802154_policy$GET_SEC_LEVEL]], f flags[send_flags])
    86  sendmsg$NL802154_CMD_NEW_SEC_LEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_NEW_SEC_LEVEL, nl802154_policy$NEW_DEL_SEC_LEVEL]], f flags[send_flags])
    87  sendmsg$NL802154_CMD_DEL_SEC_LEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_nl802154[NL802154_CMD_DEL_SEC_LEVEL, nl802154_policy$NEW_DEL_SEC_LEVEL]], f flags[send_flags])
    88  
    89  nl802154_policy$GET_WPAN_PHY [
    90  	NL802154_ATTR_WPAN_PHY	nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
    91  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
    92  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
    93  ] [varlen]
    94  
    95  nl802154_policy$GET_INTERFACE [
    96  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
    97  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
    98  ] [varlen]
    99  
   100  nl802154_policy$NEW_INTERFACE [
   101  	NL802154_ATTR_WPAN_PHY		nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   102  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   103  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   104  	NL802154_ATTR_IFNAME		nlattr[NL802154_ATTR_IFNAME, string[ieee802154_dev_names]]
   105  	NL802154_ATTR_IFTYPE		nlattr[NL802154_ATTR_IFTYPE, flags[nl802154_iftype, int32]]
   106  	NL802154_ATTR_EXTENDED_ADDR	nlattr[NL802154_ATTR_EXTENDED_ADDR, ieee802154_hwaddr]
   107  ] [varlen]
   108  
   109  nl802154_iftype = NL802154_IFTYPE_UNSPEC, NL802154_IFTYPE_NODE, NL802154_IFTYPE_MONITOR, NL802154_IFTYPE_COORD
   110  
   111  #nl802154_policy$DEL_INTERFACE [
   112  #	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   113  #	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   114  #] [varlen]
   115  
   116  nl802154_policy$SET_CHANNEL [
   117  	NL802154_ATTR_WPAN_PHY	nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   118  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   119  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   120  	NL802154_ATTR_PAGE	nlattr[NL802154_ATTR_PAGE, int8[0:IEEE802154_MAX_PAGE]]
   121  	NL802154_ATTR_CHANNEL	nlattr[NL802154_ATTR_CHANNEL, int8[0:IEEE802154_MAX_CHANNEL]]
   122  ] [varlen]
   123  
   124  nl802154_policy$SET_CCA_MODE [
   125  	NL802154_ATTR_WPAN_PHY	nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   126  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   127  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   128  	NL802154_ATTR_CCA_MODE	nlattr[NL802154_ATTR_CCA_MODE, flags[nl802154_cca_modes, int32]]
   129  	NL802154_ATTR_CCA_OPT	nlattr[NL802154_ATTR_CCA_OPT, flags[nl802154_cca_opts, int32]]
   130  ] [varlen]
   131  
   132  nl802154_cca_modes = NL802154_CCA_ENERGY, NL802154_CCA_CARRIER, NL802154_CCA_ENERGY_CARRIER, NL802154_CCA_ALOHA, NL802154_CCA_UWB_SHR, NL802154_CCA_UWB_MULTIPLEXED
   133  nl802154_cca_opts = NL802154_CCA_OPT_ENERGY_CARRIER_AND, NL802154_CCA_OPT_ENERGY_CARRIER_OR
   134  
   135  nl802154_policy$SET_CCA_ED_LEVEL [
   136  	NL802154_ATTR_WPAN_PHY		nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   137  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   138  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   139  	NL802154_ATTR_CCA_ED_LEVEL	nlattr[NL802154_ATTR_CCA_ED_LEVEL, int32[0:16]]
   140  ] [varlen]
   141  
   142  nl802154_policy$SET_TX_POWER [
   143  	NL802154_ATTR_WPAN_PHY	nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   144  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   145  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   146  	NL802154_ATTR_TX_POWER	nlattr[NL802154_ATTR_TX_POWER, int32]
   147  ] [varlen]
   148  
   149  nl802154_policy$SET_WPAN_PHY_NETNS [
   150  	NL802154_ATTR_WPAN_PHY	nlattr[NL802154_ATTR_WPAN_PHY, flags[ieee802154_phy_index, int32]]
   151  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   152  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   153  	NL802154_ATTR_PID	nlattr[NL802154_ATTR_PID, pid]
   154  	NL802154_ATTR_NETNS_FD	nlattr[NL802154_ATTR_NETNS_FD, fd_namespace]
   155  ] [varlen]
   156  
   157  nl802154_policy$SET_PAN_ID [
   158  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   159  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   160  	NL802154_ATTR_PAN_ID	nlattr[NL802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   161  ] [varlen]
   162  
   163  nl802154_policy$SET_SHORT_ADDR [
   164  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   165  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   166  	NL802154_ATTR_SHORT_ADDR	nlattr[NL802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   167  ] [varlen]
   168  
   169  nl802154_policy$SET_BACKOFF_EXPONENT [
   170  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   171  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   172  	NL802154_ATTR_MIN_BE	nlattr[NL802154_ATTR_MIN_BE, int8]
   173  	NL802154_ATTR_MAX_BE	nlattr[NL802154_ATTR_MAX_BE, int8]
   174  ] [varlen]
   175  
   176  nl802154_policy$SET_MAX_CSMA_BACKOFFS [
   177  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   178  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   179  	NL802154_ATTR_MAX_CSMA_BACKOFFS	nlattr[NL802154_ATTR_MAX_CSMA_BACKOFFS, int8]
   180  ] [varlen]
   181  
   182  nl802154_policy$SET_MAX_FRAME_RETRIES [
   183  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   184  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   185  	NL802154_ATTR_MAX_FRAME_RETRIES	nlattr[NL802154_ATTR_MAX_FRAME_RETRIES, int8]
   186  ] [varlen]
   187  
   188  nl802154_policy$SET_LBT_MODE [
   189  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   190  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   191  	NL802154_ATTR_LBT_MODE	nlattr[NL802154_ATTR_LBT_MODE, bool8]
   192  ] [varlen]
   193  
   194  nl802154_policy$SET_ACKREQ_DEFAULT [
   195  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   196  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   197  	NL802154_ATTR_ACKREQ_DEFAULT	nlattr[NL802154_ATTR_ACKREQ_DEFAULT, bool8]
   198  ] [varlen]
   199  
   200  nl802154_policy$SET_SEC_PARAMS [
   201  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   202  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   203  	NL802154_ATTR_SEC_ENABLED	nlattr[NL802154_ATTR_SEC_ENABLED, bool8]
   204  	NL802154_ATTR_SEC_OUT_KEY_ID	nlnest[NL802154_ATTR_SEC_OUT_KEY_ID, array[nl802154_key_id_policy]]
   205  	NL802154_ATTR_SEC_OUT_LEVEL	nlattr[NL802154_ATTR_SEC_OUT_LEVEL, int32[0:NL802154_SECLEVEL_MAX]]
   206  	NL802154_ATTR_SEC_FRAME_COUNTER	nlattr[NL802154_ATTR_SEC_FRAME_COUNTER, int32]
   207  ] [varlen]
   208  
   209  nl802154_policy$GET_SEC_KEY [
   210  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   211  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   212  ] [varlen]
   213  
   214  nl802154_policy$NEW_SEC_KEY [
   215  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   216  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   217  	NL802154_ATTR_SEC_KEY	nlnest[NL802154_ATTR_SEC_KEY, array[nl802154_key_policy]]
   218  ] [varlen]
   219  
   220  nl802154_key_policy [
   221  	NL802154_KEY_ATTR_ID		nlnest[NL802154_KEY_ATTR_ID, array[nl802154_key_id_policy]]
   222  	NL802154_KEY_ATTR_USAGE_FRAMES	nlattr[NL802154_KEY_ATTR_USAGE_FRAMES, int8]
   223  	NL802154_KEY_ATTR_USAGE_CMDS	nlattr[NL802154_KEY_ATTR_USAGE_CMDS, array[int8, 32]]
   224  	NL802154_KEY_ATTR_BYTES		nlattr[NL802154_KEY_ATTR_BYTES, array[int8, NL802154_KEY_SIZE]]
   225  ] [varlen]
   226  
   227  nl802154_key_id_policy [
   228  	NL802154_KEY_ID_ATTR_MODE		nlattr[NL802154_KEY_ID_ATTR_MODE, int32[0:NL802154_KEY_ID_MODE_MAX]]
   229  	NL802154_KEY_ID_ATTR_INDEX		nlattr[NL802154_KEY_ID_ATTR_INDEX, flags[ieee802154_scf_key, int8]]
   230  	NL802154_KEY_ID_ATTR_IMPLICIT		nlnest[NL802154_KEY_ID_ATTR_IMPLICIT, array[nl802154_dev_addr_policy]]
   231  	NL802154_KEY_ID_ATTR_SOURCE_SHORT	nlattr[NL802154_KEY_ID_ATTR_SOURCE_SHORT, int32]
   232  	NL802154_KEY_ID_ATTR_SOURCE_EXTENDED	nlattr[NL802154_KEY_ID_ATTR_SOURCE_EXTENDED, int64]
   233  ] [varlen]
   234  
   235  nl802154_dev_addr_policy [
   236  	NL802154_DEV_ADDR_ATTR_PAN_ID	nlattr[NL802154_DEV_ADDR_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   237  	NL802154_DEV_ADDR_ATTR_MODE	nlattr[NL802154_DEV_ADDR_ATTR_MODE, int32[0:NL802154_DEV_ADDR_MAX]]
   238  	NL802154_DEV_ADDR_ATTR_SHORT	nlattr[NL802154_DEV_ADDR_ATTR_SHORT, flags[ieee802154_short_addr, int16]]
   239  	NL802154_DEV_ADDR_ATTR_EXTENDED	nlattr[NL802154_DEV_ADDR_ATTR_EXTENDED, ieee802154_hwaddr]
   240  ] [varlen]
   241  
   242  nl802154_policy$DEL_SEC_KEY [
   243  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   244  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   245  	NL802154_ATTR_SEC_KEY	nlnest[NL802154_ATTR_SEC_KEY, array[nl802154_key_policy]]
   246  ] [varlen]
   247  
   248  nl802154_policy$GET_SEC_DEV [
   249  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   250  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   251  ] [varlen]
   252  
   253  nl802154_policy$NEW_SEC_DEV [
   254  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   255  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   256  	NL802154_ATTR_SEC_DEVICE	nlnest[NL802154_ATTR_SEC_DEVICE, array[nl802154_dev_policy]]
   257  ] [varlen]
   258  
   259  nl802154_dev_policy [
   260  	NL802154_DEV_ATTR_FRAME_COUNTER		nlattr[NL802154_DEV_ATTR_FRAME_COUNTER, int16]
   261  	NL802154_DEV_ATTR_PAN_ID		nlattr[NL802154_DEV_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   262  	NL802154_DEV_ATTR_SHORT_ADDR		nlattr[NL802154_DEV_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   263  	NL802154_DEV_ATTR_EXTENDED_ADDR		nlattr[NL802154_DEV_ATTR_EXTENDED_ADDR, ieee802154_hwaddr]
   264  	NL802154_DEV_ATTR_SECLEVEL_EXEMPT	nlattr[NL802154_DEV_ATTR_SECLEVEL_EXEMPT, bool8]
   265  	NL802154_DEV_ATTR_KEY_MODE		nlattr[NL802154_DEV_ATTR_KEY_MODE, int32[0:NL802154_DEVKEY_MAX]]
   266  ] [varlen]
   267  
   268  nl802154_policy$DEL_SEC_DEV [
   269  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   270  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   271  	NL802154_ATTR_SEC_DEVICE	nlnest[NL802154_ATTR_SEC_DEVICE, nlattr[NL802154_DEV_ATTR_EXTENDED_ADDR, ieee802154_hwaddr]]
   272  ] [varlen]
   273  
   274  nl802154_policy$GET_SEC_DEVKEY [
   275  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   276  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   277  ] [varlen]
   278  
   279  nl802154_policy$NEW_SEC_DEVKEY [
   280  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   281  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   282  	NL802154_ATTR_SEC_DEVKEY	nlnest[NL802154_ATTR_SEC_DEVKEY, array[nl802154_devkey_policy]]
   283  ] [varlen]
   284  
   285  nl802154_devkey_policy [
   286  	NL802154_DEVKEY_ATTR_FRAME_COUNTER	nlattr[NL802154_DEVKEY_ATTR_FRAME_COUNTER, int32]
   287  	NL802154_DEVKEY_ATTR_EXTENDED_ADDR	nlattr[NL802154_DEVKEY_ATTR_EXTENDED_ADDR, ieee802154_hwaddr]
   288  	NL802154_DEVKEY_ATTR_ID			nlnest[NL802154_DEVKEY_ATTR_ID, array[nl802154_key_id_policy]]
   289  ] [varlen]
   290  
   291  nl802154_policy$DEL_SEC_DEVKEY [
   292  	NL802154_ATTR_IFINDEX		nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   293  	NL802154_ATTR_WPAN_DEV		nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   294  	NL802154_ATTR_SEC_DEVKEY	nlnest[NL802154_ATTR_SEC_DEVKEY, array[nl802154_devkey_policy]]
   295  ] [varlen]
   296  
   297  nl802154_policy$GET_SEC_LEVEL [
   298  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   299  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   300  ] [varlen]
   301  
   302  nl802154_policy$NEW_DEL_SEC_LEVEL [
   303  	NL802154_ATTR_IFINDEX	nlattr[NL802154_ATTR_IFINDEX, ieee802154_ifindex]
   304  	NL802154_ATTR_WPAN_DEV	nlattr[NL802154_ATTR_WPAN_DEV, flags[ieee802154_dev_index, int64]]
   305  	NL802154_ATTR_SEC_LEVEL	nlnest[NL802154_ATTR_SEC_LEVEL, array[nl802154_seclevel_policy]]
   306  ] [varlen]
   307  
   308  nl802154_seclevel_policy [
   309  	NL802154_SECLEVEL_ATTR_LEVELS		nlattr[NL802154_SECLEVEL_ATTR_LEVELS, int8]
   310  	NL802154_SECLEVEL_ATTR_FRAME		nlattr[NL802154_SECLEVEL_ATTR_FRAME, int32[0:NL802154_FRAME_MAX]]
   311  	NL802154_SECLEVEL_ATTR_CMD_FRAME	nlattr[NL802154_SECLEVEL_ATTR_CMD_FRAME, int32[0:NL802154_CMD_FRAME_MAX]]
   312  	NL802154_SECLEVEL_ATTR_DEV_OVERRIDE	nlattr[NL802154_SECLEVEL_ATTR_DEV_OVERRIDE, bool8]
   313  ] [varlen]
   314  
   315  resource genl_ieee802154_family_id[int16]
   316  type msghdr_ieee802154[CMD, POLICY] msghdr_netlink[netlink_msg_t[genl_ieee802154_family_id, genlmsghdr_t[CMD], POLICY]]
   317  
   318  syz_genetlink_get_family_id$ieee802154(name ptr[in, string["802.15.4 MAC"]], fd sock_nl_generic_init) genl_ieee802154_family_id
   319  
   320  sendmsg$IEEE802154_LIST_PHY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LIST_PHY, void]], f flags[send_flags])
   321  sendmsg$IEEE802154_ADD_IFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_ADD_IFACE, ieee802154_policy$ADD_IFACE]], f flags[send_flags])
   322  # This is disabled as we only have 2 global hwsim devices, if we delete them we are out of devices.
   323  # sendmsg$IEEE802154_DEL_IFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_DEL_IFACE, ieee802154_policy$DEL_IFACE]], f flags[send_flags])
   324  sendmsg$IEEE802154_ASSOCIATE_REQ(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_ASSOCIATE_REQ, ieee802154_policy$ASSOCIATE_REQ]], f flags[send_flags])
   325  sendmsg$IEEE802154_ASSOCIATE_RESP(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_ASSOCIATE_RESP, ieee802154_policy$ASSOCIATE_RESP]], f flags[send_flags])
   326  sendmsg$IEEE802154_DISASSOCIATE_REQ(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_DISASSOCIATE_REQ, ieee802154_policy$DISASSOCIATE_REQ]], f flags[send_flags])
   327  sendmsg$IEEE802154_SCAN_REQ(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_SCAN_REQ, ieee802154_policy$SCAN_REQ]], f flags[send_flags])
   328  sendmsg$IEEE802154_START_REQ(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_START_REQ, ieee802154_policy$START_REQ]], f flags[send_flags])
   329  sendmsg$IEEE802154_LIST_IFACE(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LIST_IFACE, ieee802154_policy$LIST_IFACE]], f flags[send_flags])
   330  sendmsg$IEEE802154_SET_MACPARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_SET_MACPARAMS, ieee802154_policy$SET_MACPARAMS]], f flags[send_flags])
   331  sendmsg$IEEE802154_LLSEC_GETPARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_GETPARAMS, ieee802154_policy$LLSEC_GETPARAMS]], f flags[send_flags])
   332  sendmsg$IEEE802154_LLSEC_SETPARAMS(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_SETPARAMS, ieee802154_policy$LLSEC_SETPARAMS]], f flags[send_flags])
   333  sendmsg$IEEE802154_LLSEC_LIST_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_LIST_KEY, void]], f flags[send_flags])
   334  sendmsg$IEEE802154_LLSEC_ADD_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_ADD_KEY, ieee802154_policy$LLSEC_ADD_KEY]], f flags[send_flags])
   335  sendmsg$IEEE802154_LLSEC_DEL_KEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_DEL_KEY, ieee802154_policy$LLSEC_DEL_KEY]], f flags[send_flags])
   336  sendmsg$IEEE802154_LLSEC_LIST_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_LIST_DEV, void]], f flags[send_flags])
   337  sendmsg$IEEE802154_LLSEC_ADD_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_ADD_DEV, ieee802154_policy$LLSEC_ADD_DEV]], f flags[send_flags])
   338  sendmsg$IEEE802154_LLSEC_DEL_DEV(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_DEL_DEV, ieee802154_policy$LLSEC_DEL_DEV]], f flags[send_flags])
   339  sendmsg$IEEE802154_LLSEC_LIST_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_LIST_DEVKEY, void]], f flags[send_flags])
   340  sendmsg$IEEE802154_LLSEC_ADD_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_ADD_DEVKEY, ieee802154_policy$LLSEC_ADD_DEVKEY]], f flags[send_flags])
   341  sendmsg$IEEE802154_LLSEC_DEL_DEVKEY(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_DEL_DEVKEY, ieee802154_policy$LLSEC_DEL_DEVKEY]], f flags[send_flags])
   342  sendmsg$IEEE802154_LLSEC_LIST_SECLEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_LIST_SECLEVEL, void]], f flags[send_flags])
   343  sendmsg$IEEE802154_LLSEC_ADD_SECLEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_ADD_SECLEVEL, ieee802154_policy$LLSEC_ADD_DEL_SECLEVEL]], f flags[send_flags])
   344  sendmsg$IEEE802154_LLSEC_DEL_SECLEVEL(fd sock_nl_generic_init, msg ptr[in, msghdr_ieee802154[IEEE802154_LLSEC_DEL_SECLEVEL, ieee802154_policy$LLSEC_ADD_DEL_SECLEVEL]], f flags[send_flags])
   345  
   346  ieee802154_policy$ADD_IFACE [
   347  	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   348  	IEEE802154_ATTR_PHY_NAME	nlattr[IEEE802154_ATTR_PHY_NAME, string[ieee802154_phy_names]]
   349  	IEEE802154_ATTR_HW_ADDR		nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   350  	IEEE802154_ATTR_DEV_TYPE	nlattr[IEEE802154_ATTR_DEV_TYPE, int8[IEEE802154_DEV_WPAN:IEEE802154_DEV_MONITOR]]
   351  ] [varlen]
   352  
   353  #ieee802154_policy$DEL_IFACE [
   354  #	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   355  #	IEEE802154_ATTR_PHY_NAME	nlattr[IEEE802154_ATTR_PHY_NAME, string[ieee802154_phy_names]]
   356  #] [varlen]
   357  
   358  ieee802154_policy$ASSOCIATE_REQ [
   359  	IEEE802154_ATTR_CHANNEL			nlattr[IEEE802154_ATTR_CHANNEL, int8[0:IEEE802154_MAX_CHANNEL]]
   360  	IEEE802154_ATTR_COORD_PAN_ID		nlattr[IEEE802154_ATTR_COORD_PAN_ID, flags[ieee802154_pan_id, int16]]
   361  	IEEE802154_ATTR_COORD_HW_ADDR		nlattr[IEEE802154_ATTR_COORD_HW_ADDR, ieee802154_hwaddr]
   362  	IEEE802154_ATTR_COORD_SHORT_ADDR	nlattr[IEEE802154_ATTR_COORD_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   363  	IEEE802154_ATTR_CAPABILITY		nlattr[IEEE802154_ATTR_CAPABILITY, int8]
   364  	IEEE802154_ATTR_PAGE			nlattr[IEEE802154_ATTR_PAGE, int8[0:IEEE802154_MAX_PAGE]]
   365  ] [varlen]
   366  
   367  ieee802154_policy$ASSOCIATE_RESP [
   368  	IEEE802154_ATTR_STATUS			nlattr[IEEE802154_ATTR_STATUS, int8]
   369  	IEEE802154_ATTR_COORD_HW_ADDR		nlattr[IEEE802154_ATTR_COORD_HW_ADDR, ieee802154_hwaddr]
   370  	IEEE802154_ATTR_COORD_SHORT_ADDR	nlattr[IEEE802154_ATTR_COORD_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   371  ] [varlen]
   372  
   373  ieee802154_policy$DISASSOCIATE_REQ [
   374  	IEEE802154_ATTR_REASON			nlattr[IEEE802154_ATTR_REASON, int8]
   375  	IEEE802154_ATTR_COORD_HW_ADDR		nlattr[IEEE802154_ATTR_COORD_HW_ADDR, ieee802154_hwaddr]
   376  	IEEE802154_ATTR_COORD_SHORT_ADDR	nlattr[IEEE802154_ATTR_COORD_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   377  ] [varlen]
   378  
   379  ieee802154_policy$SCAN_REQ [
   380  	IEEE802154_ATTR_SCAN_TYPE	nlattr[IEEE802154_ATTR_SCAN_TYPE, int8]
   381  	IEEE802154_ATTR_CHANNELS	nlattr[IEEE802154_ATTR_CHANNELS, int32[0:IEEE802154_MAX_CHANNEL]]
   382  	IEEE802154_ATTR_DURATION	nlattr[IEEE802154_ATTR_DURATION, int8]
   383  	IEEE802154_ATTR_PAGE		nlattr[IEEE802154_ATTR_PAGE, int8[0:IEEE802154_MAX_PAGE]]
   384  ] [varlen]
   385  
   386  ieee802154_policy$START_REQ [
   387  	IEEE802154_ATTR_COORD_PAN_ID		nlattr[IEEE802154_ATTR_COORD_PAN_ID, flags[ieee802154_pan_id, int16]]
   388  	IEEE802154_ATTR_COORD_SHORT_ADDR	nlattr[IEEE802154_ATTR_COORD_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   389  	IEEE802154_ATTR_CHANNEL			nlattr[IEEE802154_ATTR_CHANNEL, int8[0:IEEE802154_MAX_CHANNEL]]
   390  	IEEE802154_ATTR_BCN_ORD			nlattr[IEEE802154_ATTR_BCN_ORD, int8]
   391  	IEEE802154_ATTR_SF_ORD			nlattr[IEEE802154_ATTR_SF_ORD, int8]
   392  	IEEE802154_ATTR_PAN_COORD		nlattr[IEEE802154_ATTR_PAN_COORD, int8]
   393  	IEEE802154_ATTR_BAT_EXT			nlattr[IEEE802154_ATTR_BAT_EXT, int8]
   394  	IEEE802154_ATTR_COORD_REALIGN		nlattr[IEEE802154_ATTR_COORD_REALIGN, int8]
   395  	IEEE802154_ATTR_PAGE			nlattr[IEEE802154_ATTR_PAGE, int8[0:IEEE802154_MAX_PAGE]]
   396  ] [varlen]
   397  
   398  ieee802154_policy$LIST_IFACE [
   399  	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   400  	IEEE802154_ATTR_DEV_INDEX	nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   401  ] [varlen]
   402  
   403  ieee802154_policy$SET_MACPARAMS [
   404  	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   405  	IEEE802154_ATTR_DEV_INDEX	nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   406  	IEEE802154_ATTR_LBT_ENABLED	nlattr[IEEE802154_ATTR_LBT_ENABLED, bool8]
   407  	IEEE802154_ATTR_CCA_MODE	nlattr[IEEE802154_ATTR_CCA_MODE, int8]
   408  	IEEE802154_ATTR_CCA_ED_LEVEL	nlattr[IEEE802154_ATTR_CCA_ED_LEVEL, int32]
   409  	IEEE802154_ATTR_CSMA_RETRIES	nlattr[IEEE802154_ATTR_CSMA_RETRIES, int8]
   410  	IEEE802154_ATTR_CSMA_MIN_BE	nlattr[IEEE802154_ATTR_CSMA_MIN_BE, int8]
   411  	IEEE802154_ATTR_CSMA_MAX_BE	nlattr[IEEE802154_ATTR_CSMA_MAX_BE, int8]
   412  	IEEE802154_ATTR_FRAME_RETRIES	nlattr[IEEE802154_ATTR_FRAME_RETRIES, int8]
   413  	IEEE802154_ATTR_TXPOWER		nlattr[IEEE802154_ATTR_TXPOWER, int8]
   414  ] [varlen]
   415  
   416  ieee802154_policy$LLSEC_GETPARAMS [
   417  	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   418  	IEEE802154_ATTR_DEV_INDEX	nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   419  ] [varlen]
   420  
   421  ieee802154_policy$LLSEC_SETPARAMS [
   422  	IEEE802154_ATTR_DEV_NAME			nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   423  	IEEE802154_ATTR_DEV_INDEX			nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   424  	IEEE802154_ATTR_LLSEC_SECLEVEL			nlattr[IEEE802154_ATTR_LLSEC_SECLEVEL, int8[0:7]]
   425  	IEEE802154_ATTR_LLSEC_ENABLED			nlattr[IEEE802154_ATTR_LLSEC_ENABLED, bool8]
   426  	IEEE802154_ATTR_LLSEC_KEY_MODE			nlattr[IEEE802154_ATTR_LLSEC_KEY_MODE, flags[ieee802154_scf_key, int8]]
   427  	IEEE802154_ATTR_PAN_ID				nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   428  	IEEE802154_ATTR_HW_ADDR				nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   429  	IEEE802154_ATTR_SHORT_ADDR			nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   430  	IEEE802154_ATTR_LLSEC_KEY_ID			nlattr[IEEE802154_ATTR_LLSEC_KEY_ID, int8]
   431  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT		nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT, int32]
   432  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED	nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED, ieee802154_hwaddr]
   433  	IEEE802154_ATTR_LLSEC_FRAME_COUNTER		nlattr[IEEE802154_ATTR_LLSEC_FRAME_COUNTER, int32]
   434  ] [varlen]
   435  
   436  ieee802154_scf_key = IEEE802154_SCF_KEY_IMPLICIT, IEEE802154_SCF_KEY_INDEX, IEEE802154_SCF_KEY_SHORT_INDEX, IEEE802154_SCF_KEY_HW_INDEX
   437  
   438  ieee802154_policy$LLSEC_ADD_KEY [
   439  	IEEE802154_ATTR_DEV_NAME			nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   440  	IEEE802154_ATTR_DEV_INDEX			nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   441  	IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES	nlattr[IEEE802154_ATTR_LLSEC_KEY_USAGE_FRAME_TYPES, int8]
   442  	IEEE802154_ATTR_LLSEC_KEY_BYTES			nlattr[IEEE802154_ATTR_LLSEC_KEY_BYTES, array[int8, 16]]
   443  	IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS	nlattr[IEEE802154_ATTR_LLSEC_KEY_USAGE_COMMANDS, array[int8, 32]]
   444  	IEEE802154_ATTR_LLSEC_KEY_MODE			nlattr[IEEE802154_ATTR_LLSEC_KEY_MODE, flags[ieee802154_scf_key, int8]]
   445  	IEEE802154_ATTR_PAN_ID				nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   446  	IEEE802154_ATTR_HW_ADDR				nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   447  	IEEE802154_ATTR_SHORT_ADDR			nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   448  	IEEE802154_ATTR_LLSEC_KEY_ID			nlattr[IEEE802154_ATTR_LLSEC_KEY_ID, int8]
   449  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT		nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT, int32]
   450  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED	nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED, ieee802154_hwaddr]
   451  ] [varlen]
   452  
   453  ieee802154_policy$LLSEC_DEL_KEY [
   454  	IEEE802154_ATTR_DEV_NAME			nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   455  	IEEE802154_ATTR_DEV_INDEX			nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   456  	IEEE802154_ATTR_LLSEC_KEY_MODE			nlattr[IEEE802154_ATTR_LLSEC_KEY_MODE, flags[ieee802154_scf_key, int8]]
   457  	IEEE802154_ATTR_PAN_ID				nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   458  	IEEE802154_ATTR_HW_ADDR				nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   459  	IEEE802154_ATTR_SHORT_ADDR			nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   460  	IEEE802154_ATTR_LLSEC_KEY_ID			nlattr[IEEE802154_ATTR_LLSEC_KEY_ID, int8]
   461  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT		nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT, int32]
   462  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED	nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED, ieee802154_hwaddr]
   463  ] [varlen]
   464  
   465  ieee802154_policy$LLSEC_ADD_DEV [
   466  	IEEE802154_ATTR_DEV_NAME		nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   467  	IEEE802154_ATTR_DEV_INDEX		nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   468  	IEEE802154_ATTR_LLSEC_FRAME_COUNTER	nlattr[IEEE802154_ATTR_LLSEC_FRAME_COUNTER, int32]
   469  	IEEE802154_ATTR_HW_ADDR			nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   470  	IEEE802154_ATTR_SHORT_ADDR		nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   471  	IEEE802154_ATTR_PAN_ID			nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   472  	IEEE802154_ATTR_LLSEC_DEV_OVERRIDE	nlattr[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE, bool8]
   473  	IEEE802154_ATTR_LLSEC_DEV_KEY_MODE	nlattr[IEEE802154_ATTR_LLSEC_DEV_KEY_MODE, flags[ieee802154_devkey_mode, int8]]
   474  ] [varlen]
   475  
   476  ieee802154_devkey_mode = NL802154_DEVKEY_IGNORE, NL802154_DEVKEY_RESTRICT, NL802154_DEVKEY_RECORD
   477  
   478  ieee802154_policy$LLSEC_DEL_DEV [
   479  	IEEE802154_ATTR_DEV_NAME	nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   480  	IEEE802154_ATTR_DEV_INDEX	nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   481  	IEEE802154_ATTR_HW_ADDR		nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   482  ] [varlen]
   483  
   484  ieee802154_policy$LLSEC_ADD_DEVKEY [
   485  	IEEE802154_ATTR_DEV_NAME			nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   486  	IEEE802154_ATTR_DEV_INDEX			nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   487  	IEEE802154_ATTR_LLSEC_FRAME_COUNTER		nlattr[IEEE802154_ATTR_LLSEC_FRAME_COUNTER, int32]
   488  	IEEE802154_ATTR_HW_ADDR				nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   489  	IEEE802154_ATTR_LLSEC_KEY_MODE			nlattr[IEEE802154_ATTR_LLSEC_KEY_MODE, flags[ieee802154_scf_key, int8]]
   490  	IEEE802154_ATTR_PAN_ID				nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   491  	IEEE802154_ATTR_SHORT_ADDR			nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   492  	IEEE802154_ATTR_LLSEC_KEY_ID			nlattr[IEEE802154_ATTR_LLSEC_KEY_ID, int8]
   493  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT		nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT, int32]
   494  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED	nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED, ieee802154_hwaddr]
   495  ] [varlen]
   496  
   497  ieee802154_policy$LLSEC_DEL_DEVKEY [
   498  	IEEE802154_ATTR_DEV_NAME			nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   499  	IEEE802154_ATTR_DEV_INDEX			nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   500  	IEEE802154_ATTR_HW_ADDR				nlattr[IEEE802154_ATTR_HW_ADDR, ieee802154_hwaddr]
   501  	IEEE802154_ATTR_LLSEC_KEY_MODE			nlattr[IEEE802154_ATTR_LLSEC_KEY_MODE, flags[ieee802154_scf_key, int8]]
   502  	IEEE802154_ATTR_PAN_ID				nlattr[IEEE802154_ATTR_PAN_ID, flags[ieee802154_pan_id, int16]]
   503  	IEEE802154_ATTR_SHORT_ADDR			nlattr[IEEE802154_ATTR_SHORT_ADDR, flags[ieee802154_short_addr, int16]]
   504  	IEEE802154_ATTR_LLSEC_KEY_ID			nlattr[IEEE802154_ATTR_LLSEC_KEY_ID, int8]
   505  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT		nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT, int32]
   506  	IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED	nlattr[IEEE802154_ATTR_LLSEC_KEY_SOURCE_EXTENDED, ieee802154_hwaddr]
   507  ] [varlen]
   508  
   509  ieee802154_policy$LLSEC_ADD_DEL_SECLEVEL [
   510  	IEEE802154_ATTR_DEV_NAME		nlattr[IEEE802154_ATTR_DEV_NAME, string[ieee802154_dev_names]]
   511  	IEEE802154_ATTR_DEV_INDEX		nlattr[IEEE802154_ATTR_DEV_INDEX, ieee802154_ifindex]
   512  	IEEE802154_ATTR_LLSEC_FRAME_TYPE	nlattr[IEEE802154_ATTR_LLSEC_FRAME_TYPE, int8]
   513  	IEEE802154_ATTR_LLSEC_SECLEVELS		nlattr[IEEE802154_ATTR_LLSEC_SECLEVELS, int8]
   514  	IEEE802154_ATTR_LLSEC_DEV_OVERRIDE	nlattr[IEEE802154_ATTR_LLSEC_DEV_OVERRIDE, bool8]
   515  	IEEE802154_ATTR_LLSEC_CMD_FRAME_ID	nlattr[IEEE802154_ATTR_LLSEC_CMD_FRAME_ID, int8]
   516  ] [varlen]
   517  
   518  sockaddr_ieee802154 {
   519  	family	const[AF_IEEE802154, int16]
   520  	addr	ieee802154_addr_sa
   521  }
   522  
   523  ieee802154_addr_sa [
   524  	none	ieee802154_addr_sa_t[IEEE802154_ADDR_NONE, void]
   525  	short	ieee802154_addr_sa_t[IEEE802154_ADDR_SHORT, flags[ieee802154_short_addr, int16]]
   526  	long	ieee802154_addr_sa_t[IEEE802154_ADDR_LONG, ieee802154_hwaddr]
   527  ]
   528  
   529  type ieee802154_addr_sa_t[TYP, ADDR] {
   530  	addr_type	const[TYP, int32]
   531  	pan_id		flags[ieee802154_pan_id, int16]
   532  	addr		ADDR
   533  }
   534  
   535  ieee802154_hwaddr {
   536  	val	flags[ieee802154_hwaddrs, int64]
   537  } [align[1]]
   538  
   539  msghdr_802154 {
   540  	addr	ptr[in, sockaddr_ieee802154, opt]
   541  	addrlen	len[addr, int32]
   542  	vec	ptr[in, iovec[in, array[int8]]]
   543  	vlen	const[1, intptr]
   544  	ctrl	const[0, intptr]
   545  	ctrllen	const[0, intptr]
   546  	f	flags[send_flags, int32]
   547  }
   548  
   549  # executor/common_linux.h:setup_802154 knowns about these constants.
   550  ieee802154_short_addr = IEEE802154_ADDR_UNDEF, IEEE802154_ADDR_BROADCAST, 0, 0xaaa0, 0xaaa1, 0xaaa2, 0xaaa3
   551  # Note: the last byte (02) is some flags that need to have a particular value.
   552  ieee802154_hwaddrs = 0, 0xaaaaaaaaaaaa0002, 0xaaaaaaaaaaaa0102, 0xaaaaaaaaaaaa0202, 0xaaaaaaaaaaaa0302
   553  ieee802154_dev_names = "wpan0", "wpan1", "wpan3", "wpan4"
   554  ieee802154_phy_names = "phy0", "phy1", "phy2", "phy3"
   555  ieee802154_phy_index = 0, 1, 2, 3
   556  ieee802154_dev_index = 0x0, 0x100000001, 0x200000002, 0x300000003, 0x2, 0x3
   557  ieee802154_pan_id = IEEE802154_PANID_BROADCAST, 0, 1, 2, 3
   558  ieee802154_security = WPAN_SECURITY_DEFAULT, WPAN_SECURITY_OFF, WPAN_SECURITY_ON