genetlink: make policy common to family

Since maxattr is common, the policy can't really differ sanely,
so make it common as well.

The only user that did in fact manage to make a non-common policy
is taskstats, which has to be really careful about it (since it's
still using a common maxattr!). This is no longer supported, but
we can fake it using pre_doit.

This reduces the size of e.g. nl80211.o (which has lots of commands):

   text	   data	    bss	    dec	    hex	filename
 398745	  14323	   2240	 415308	  6564c	net/wireless/nl80211.o (before)
 397913	  14331	   2240	 414484	  65314	net/wireless/nl80211.o (after)
--------------------------------
   -832      +8       0    -824

Which is obviously just 8 bytes for each command, and an added 8
bytes for the new policy pointer. I'm not sure why the ops list is
counted as .text though.

Most of the code transformations were done using the following spatch:
    @ops@
    identifier OPS;
    expression POLICY;
    @@
    struct genl_ops OPS[] = {
    ...,
     {
    -	.policy = POLICY,
     },
    ...
    };

    @@
    identifier ops.OPS;
    expression ops.POLICY;
    identifier fam;
    expression M;
    @@
    struct genl_family fam = {
            .ops = OPS,
            .maxattr = M,
    +       .policy = POLICY,
            ...
    };

This also gets rid of devlink_nl_cmd_region_read_dumpit() accessing
the cb->data as ops, which we want to change in a later genl patch.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Johannes Berg 2019-03-21 22:51:02 +01:00 committed by David S. Miller
parent 601ed4d6dc
commit 3b0f31f2b8
36 changed files with 68 additions and 374 deletions

View File

@ -1999,22 +1999,18 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, struct genl_info *info)
static const struct genl_ops nbd_connect_genl_ops[] = { static const struct genl_ops nbd_connect_genl_ops[] = {
{ {
.cmd = NBD_CMD_CONNECT, .cmd = NBD_CMD_CONNECT,
.policy = nbd_attr_policy,
.doit = nbd_genl_connect, .doit = nbd_genl_connect,
}, },
{ {
.cmd = NBD_CMD_DISCONNECT, .cmd = NBD_CMD_DISCONNECT,
.policy = nbd_attr_policy,
.doit = nbd_genl_disconnect, .doit = nbd_genl_disconnect,
}, },
{ {
.cmd = NBD_CMD_RECONFIGURE, .cmd = NBD_CMD_RECONFIGURE,
.policy = nbd_attr_policy,
.doit = nbd_genl_reconfigure, .doit = nbd_genl_reconfigure,
}, },
{ {
.cmd = NBD_CMD_STATUS, .cmd = NBD_CMD_STATUS,
.policy = nbd_attr_policy,
.doit = nbd_genl_status, .doit = nbd_genl_status,
}, },
}; };
@ -2031,6 +2027,7 @@ static struct genl_family nbd_genl_family __ro_after_init = {
.ops = nbd_connect_genl_ops, .ops = nbd_connect_genl_ops,
.n_ops = ARRAY_SIZE(nbd_connect_genl_ops), .n_ops = ARRAY_SIZE(nbd_connect_genl_ops),
.maxattr = NBD_ATTR_MAX, .maxattr = NBD_ATTR_MAX,
.policy = nbd_attr_policy,
.mcgrps = nbd_mcast_grps, .mcgrps = nbd_mcast_grps,
.n_mcgrps = ARRAY_SIZE(nbd_mcast_grps), .n_mcgrps = ARRAY_SIZE(nbd_mcast_grps),
}; };

View File

@ -1271,20 +1271,17 @@ static const struct genl_ops gtp_genl_ops[] = {
{ {
.cmd = GTP_CMD_NEWPDP, .cmd = GTP_CMD_NEWPDP,
.doit = gtp_genl_new_pdp, .doit = gtp_genl_new_pdp,
.policy = gtp_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = GTP_CMD_DELPDP, .cmd = GTP_CMD_DELPDP,
.doit = gtp_genl_del_pdp, .doit = gtp_genl_del_pdp,
.policy = gtp_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = GTP_CMD_GETPDP, .cmd = GTP_CMD_GETPDP,
.doit = gtp_genl_get_pdp, .doit = gtp_genl_get_pdp,
.dumpit = gtp_genl_dump_pdp, .dumpit = gtp_genl_dump_pdp,
.policy = gtp_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -1294,6 +1291,7 @@ static struct genl_family gtp_genl_family __ro_after_init = {
.version = 0, .version = 0,
.hdrsize = 0, .hdrsize = 0,
.maxattr = GTPA_MAX, .maxattr = GTPA_MAX,
.policy = gtp_genl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = gtp_genl_ops, .ops = gtp_genl_ops,

View File

@ -598,37 +598,31 @@ static const struct nla_policy hwsim_genl_policy[MAC802154_HWSIM_ATTR_MAX + 1] =
static const struct genl_ops hwsim_nl_ops[] = { static const struct genl_ops hwsim_nl_ops[] = {
{ {
.cmd = MAC802154_HWSIM_CMD_NEW_RADIO, .cmd = MAC802154_HWSIM_CMD_NEW_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_new_radio_nl, .doit = hwsim_new_radio_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = MAC802154_HWSIM_CMD_DEL_RADIO, .cmd = MAC802154_HWSIM_CMD_DEL_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_del_radio_nl, .doit = hwsim_del_radio_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = MAC802154_HWSIM_CMD_GET_RADIO, .cmd = MAC802154_HWSIM_CMD_GET_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_get_radio_nl, .doit = hwsim_get_radio_nl,
.dumpit = hwsim_dump_radio_nl, .dumpit = hwsim_dump_radio_nl,
}, },
{ {
.cmd = MAC802154_HWSIM_CMD_NEW_EDGE, .cmd = MAC802154_HWSIM_CMD_NEW_EDGE,
.policy = hwsim_genl_policy,
.doit = hwsim_new_edge_nl, .doit = hwsim_new_edge_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = MAC802154_HWSIM_CMD_DEL_EDGE, .cmd = MAC802154_HWSIM_CMD_DEL_EDGE,
.policy = hwsim_genl_policy,
.doit = hwsim_del_edge_nl, .doit = hwsim_del_edge_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = MAC802154_HWSIM_CMD_SET_EDGE, .cmd = MAC802154_HWSIM_CMD_SET_EDGE,
.policy = hwsim_genl_policy,
.doit = hwsim_set_edge_lqi, .doit = hwsim_set_edge_lqi,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
@ -638,6 +632,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
.name = "MAC802154_HWSIM", .name = "MAC802154_HWSIM",
.version = 1, .version = 1,
.maxattr = MAC802154_HWSIM_ATTR_MAX, .maxattr = MAC802154_HWSIM_ATTR_MAX,
.policy = hwsim_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = hwsim_nl_ops, .ops = hwsim_nl_ops,
.n_ops = ARRAY_SIZE(hwsim_nl_ops), .n_ops = ARRAY_SIZE(hwsim_nl_ops),

View File

@ -2637,60 +2637,50 @@ static const struct genl_ops macsec_genl_ops[] = {
{ {
.cmd = MACSEC_CMD_GET_TXSC, .cmd = MACSEC_CMD_GET_TXSC,
.dumpit = macsec_dump_txsc, .dumpit = macsec_dump_txsc,
.policy = macsec_genl_policy,
}, },
{ {
.cmd = MACSEC_CMD_ADD_RXSC, .cmd = MACSEC_CMD_ADD_RXSC,
.doit = macsec_add_rxsc, .doit = macsec_add_rxsc,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_DEL_RXSC, .cmd = MACSEC_CMD_DEL_RXSC,
.doit = macsec_del_rxsc, .doit = macsec_del_rxsc,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_UPD_RXSC, .cmd = MACSEC_CMD_UPD_RXSC,
.doit = macsec_upd_rxsc, .doit = macsec_upd_rxsc,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_ADD_TXSA, .cmd = MACSEC_CMD_ADD_TXSA,
.doit = macsec_add_txsa, .doit = macsec_add_txsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_DEL_TXSA, .cmd = MACSEC_CMD_DEL_TXSA,
.doit = macsec_del_txsa, .doit = macsec_del_txsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_UPD_TXSA, .cmd = MACSEC_CMD_UPD_TXSA,
.doit = macsec_upd_txsa, .doit = macsec_upd_txsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_ADD_RXSA, .cmd = MACSEC_CMD_ADD_RXSA,
.doit = macsec_add_rxsa, .doit = macsec_add_rxsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_DEL_RXSA, .cmd = MACSEC_CMD_DEL_RXSA,
.doit = macsec_del_rxsa, .doit = macsec_del_rxsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = MACSEC_CMD_UPD_RXSA, .cmd = MACSEC_CMD_UPD_RXSA,
.doit = macsec_upd_rxsa, .doit = macsec_upd_rxsa,
.policy = macsec_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -2700,6 +2690,7 @@ static struct genl_family macsec_fam __ro_after_init = {
.hdrsize = 0, .hdrsize = 0,
.version = MACSEC_GENL_VERSION, .version = MACSEC_GENL_VERSION,
.maxattr = MACSEC_ATTR_MAX, .maxattr = MACSEC_ATTR_MAX,
.policy = macsec_genl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = macsec_genl_ops, .ops = macsec_genl_ops,

View File

@ -2725,24 +2725,20 @@ static const struct genl_ops team_nl_ops[] = {
{ {
.cmd = TEAM_CMD_NOOP, .cmd = TEAM_CMD_NOOP,
.doit = team_nl_cmd_noop, .doit = team_nl_cmd_noop,
.policy = team_nl_policy,
}, },
{ {
.cmd = TEAM_CMD_OPTIONS_SET, .cmd = TEAM_CMD_OPTIONS_SET,
.doit = team_nl_cmd_options_set, .doit = team_nl_cmd_options_set,
.policy = team_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = TEAM_CMD_OPTIONS_GET, .cmd = TEAM_CMD_OPTIONS_GET,
.doit = team_nl_cmd_options_get, .doit = team_nl_cmd_options_get,
.policy = team_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = TEAM_CMD_PORT_LIST_GET, .cmd = TEAM_CMD_PORT_LIST_GET,
.doit = team_nl_cmd_port_list_get, .doit = team_nl_cmd_port_list_get,
.policy = team_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -2755,6 +2751,7 @@ static struct genl_family team_nl_family __ro_after_init = {
.name = TEAM_GENL_NAME, .name = TEAM_GENL_NAME,
.version = TEAM_GENL_VERSION, .version = TEAM_GENL_VERSION,
.maxattr = TEAM_ATTR_MAX, .maxattr = TEAM_ATTR_MAX,
.policy = team_nl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = team_nl_ops, .ops = team_nl_ops,

View File

@ -3620,35 +3620,29 @@ static int hwsim_dump_radio_nl(struct sk_buff *skb,
static const struct genl_ops hwsim_ops[] = { static const struct genl_ops hwsim_ops[] = {
{ {
.cmd = HWSIM_CMD_REGISTER, .cmd = HWSIM_CMD_REGISTER,
.policy = hwsim_genl_policy,
.doit = hwsim_register_received_nl, .doit = hwsim_register_received_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = HWSIM_CMD_FRAME, .cmd = HWSIM_CMD_FRAME,
.policy = hwsim_genl_policy,
.doit = hwsim_cloned_frame_received_nl, .doit = hwsim_cloned_frame_received_nl,
}, },
{ {
.cmd = HWSIM_CMD_TX_INFO_FRAME, .cmd = HWSIM_CMD_TX_INFO_FRAME,
.policy = hwsim_genl_policy,
.doit = hwsim_tx_info_frame_received_nl, .doit = hwsim_tx_info_frame_received_nl,
}, },
{ {
.cmd = HWSIM_CMD_NEW_RADIO, .cmd = HWSIM_CMD_NEW_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_new_radio_nl, .doit = hwsim_new_radio_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = HWSIM_CMD_DEL_RADIO, .cmd = HWSIM_CMD_DEL_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_del_radio_nl, .doit = hwsim_del_radio_nl,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
}, },
{ {
.cmd = HWSIM_CMD_GET_RADIO, .cmd = HWSIM_CMD_GET_RADIO,
.policy = hwsim_genl_policy,
.doit = hwsim_get_radio_nl, .doit = hwsim_get_radio_nl,
.dumpit = hwsim_dump_radio_nl, .dumpit = hwsim_dump_radio_nl,
}, },
@ -3658,6 +3652,7 @@ static struct genl_family hwsim_genl_family __ro_after_init = {
.name = "MAC80211_HWSIM", .name = "MAC80211_HWSIM",
.version = 1, .version = 1,
.maxattr = HWSIM_ATTR_MAX, .maxattr = HWSIM_ATTR_MAX,
.policy = hwsim_genl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = hwsim_ops, .ops = hwsim_ops,

View File

@ -442,25 +442,21 @@ static const struct genl_ops tcmu_genl_ops[] = {
{ {
.cmd = TCMU_CMD_SET_FEATURES, .cmd = TCMU_CMD_SET_FEATURES,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = tcmu_attr_policy,
.doit = tcmu_genl_set_features, .doit = tcmu_genl_set_features,
}, },
{ {
.cmd = TCMU_CMD_ADDED_DEVICE_DONE, .cmd = TCMU_CMD_ADDED_DEVICE_DONE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = tcmu_attr_policy,
.doit = tcmu_genl_add_dev_done, .doit = tcmu_genl_add_dev_done,
}, },
{ {
.cmd = TCMU_CMD_REMOVED_DEVICE_DONE, .cmd = TCMU_CMD_REMOVED_DEVICE_DONE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = tcmu_attr_policy,
.doit = tcmu_genl_rm_dev_done, .doit = tcmu_genl_rm_dev_done,
}, },
{ {
.cmd = TCMU_CMD_RECONFIG_DEVICE_DONE, .cmd = TCMU_CMD_RECONFIG_DEVICE_DONE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = tcmu_attr_policy,
.doit = tcmu_genl_reconfig_dev_done, .doit = tcmu_genl_reconfig_dev_done,
}, },
}; };
@ -472,6 +468,7 @@ static struct genl_family tcmu_genl_family __ro_after_init = {
.name = "TCM-USER", .name = "TCM-USER",
.version = 2, .version = 2,
.maxattr = TCMU_ATTR_MAX, .maxattr = TCMU_ATTR_MAX,
.policy = tcmu_attr_policy,
.mcgrps = tcmu_mcgrps, .mcgrps = tcmu_mcgrps,
.n_mcgrps = ARRAY_SIZE(tcmu_mcgrps), .n_mcgrps = ARRAY_SIZE(tcmu_mcgrps),
.netnsok = true, .netnsok = true,

View File

@ -233,7 +233,6 @@ const char *CONCAT_(GENL_MAGIC_FAMILY, _genl_cmd_to_str)(__u8 cmd)
{ \ { \
handler \ handler \
.cmd = op_name, \ .cmd = op_name, \
.policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy), \
}, },
#define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops) #define ZZZ_genl_ops CONCAT_(GENL_MAGIC_FAMILY, _genl_ops)
@ -290,7 +289,8 @@ static struct genl_family ZZZ_genl_family __ro_after_init = {
#ifdef GENL_MAGIC_FAMILY_HDRSZ #ifdef GENL_MAGIC_FAMILY_HDRSZ
.hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ), .hdrsize = NLA_ALIGN(GENL_MAGIC_FAMILY_HDRSZ),
#endif #endif
.maxattr = ARRAY_SIZE(drbd_tla_nl_policy)-1, .maxattr = ARRAY_SIZE(CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy))-1,
.policy = CONCAT_(GENL_MAGIC_FAMILY, _tla_nl_policy),
.ops = ZZZ_genl_ops, .ops = ZZZ_genl_ops,
.n_ops = ARRAY_SIZE(ZZZ_genl_ops), .n_ops = ARRAY_SIZE(ZZZ_genl_ops),
.mcgrps = ZZZ_genl_mcgrps, .mcgrps = ZZZ_genl_mcgrps,

View File

@ -26,6 +26,7 @@ struct genl_info;
* @name: name of family * @name: name of family
* @version: protocol version * @version: protocol version
* @maxattr: maximum number of attributes supported * @maxattr: maximum number of attributes supported
* @policy: netlink policy
* @netnsok: set to true if the family can handle network * @netnsok: set to true if the family can handle network
* namespaces and should be presented in all of them * namespaces and should be presented in all of them
* @parallel_ops: operations can be called in parallel and aren't * @parallel_ops: operations can be called in parallel and aren't
@ -56,6 +57,7 @@ struct genl_family {
unsigned int maxattr; unsigned int maxattr;
bool netnsok; bool netnsok;
bool parallel_ops; bool parallel_ops;
const struct nla_policy *policy;
int (*pre_doit)(const struct genl_ops *ops, int (*pre_doit)(const struct genl_ops *ops,
struct sk_buff *skb, struct sk_buff *skb,
struct genl_info *info); struct genl_info *info);
@ -124,14 +126,12 @@ static inline int genl_err_attr(struct genl_info *info, int err,
* @cmd: command identifier * @cmd: command identifier
* @internal_flags: flags used by the family * @internal_flags: flags used by the family
* @flags: flags * @flags: flags
* @policy: attribute validation policy
* @doit: standard command callback * @doit: standard command callback
* @start: start callback for dumps * @start: start callback for dumps
* @dumpit: callback for dumpers * @dumpit: callback for dumpers
* @done: completion callback for dumps * @done: completion callback for dumps
*/ */
struct genl_ops { struct genl_ops {
const struct nla_policy *policy;
int (*doit)(struct sk_buff *skb, int (*doit)(struct sk_buff *skb,
struct genl_info *info); struct genl_info *info);
int (*start)(struct netlink_callback *cb); int (*start)(struct netlink_callback *cb);

View File

@ -650,16 +650,37 @@ static const struct genl_ops taskstats_ops[] = {
{ {
.cmd = TASKSTATS_CMD_GET, .cmd = TASKSTATS_CMD_GET,
.doit = taskstats_user_cmd, .doit = taskstats_user_cmd,
.policy = taskstats_cmd_get_policy, /* policy enforced later */
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_HASPOL,
}, },
{ {
.cmd = CGROUPSTATS_CMD_GET, .cmd = CGROUPSTATS_CMD_GET,
.doit = cgroupstats_user_cmd, .doit = cgroupstats_user_cmd,
.policy = cgroupstats_cmd_get_policy, /* policy enforced later */
.flags = GENL_CMD_CAP_HASPOL,
}, },
}; };
static int taskstats_pre_doit(const struct genl_ops *ops, struct sk_buff *skb,
struct genl_info *info)
{
const struct nla_policy *policy = NULL;
switch (ops->cmd) {
case TASKSTATS_CMD_GET:
policy = taskstats_cmd_get_policy;
break;
case CGROUPSTATS_CMD_GET:
policy = cgroupstats_cmd_get_policy;
break;
default:
return -EINVAL;
}
return nlmsg_validate(info->nlhdr, GENL_HDRLEN, TASKSTATS_CMD_ATTR_MAX,
policy, info->extack);
}
static struct genl_family family __ro_after_init = { static struct genl_family family __ro_after_init = {
.name = TASKSTATS_GENL_NAME, .name = TASKSTATS_GENL_NAME,
.version = TASKSTATS_GENL_VERSION, .version = TASKSTATS_GENL_VERSION,
@ -667,6 +688,7 @@ static struct genl_family family __ro_after_init = {
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = taskstats_ops, .ops = taskstats_ops,
.n_ops = ARRAY_SIZE(taskstats_ops), .n_ops = ARRAY_SIZE(taskstats_ops),
.pre_doit = taskstats_pre_doit,
}; };
/* Needed early in initialization */ /* Needed early in initialization */

View File

@ -1345,34 +1345,29 @@ static const struct genl_ops batadv_netlink_ops[] = {
{ {
.cmd = BATADV_CMD_GET_MESH, .cmd = BATADV_CMD_GET_MESH,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.policy = batadv_netlink_policy,
.doit = batadv_netlink_get_mesh, .doit = batadv_netlink_get_mesh,
.internal_flags = BATADV_FLAG_NEED_MESH, .internal_flags = BATADV_FLAG_NEED_MESH,
}, },
{ {
.cmd = BATADV_CMD_TP_METER, .cmd = BATADV_CMD_TP_METER,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.doit = batadv_netlink_tp_meter_start, .doit = batadv_netlink_tp_meter_start,
.internal_flags = BATADV_FLAG_NEED_MESH, .internal_flags = BATADV_FLAG_NEED_MESH,
}, },
{ {
.cmd = BATADV_CMD_TP_METER_CANCEL, .cmd = BATADV_CMD_TP_METER_CANCEL,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.doit = batadv_netlink_tp_meter_cancel, .doit = batadv_netlink_tp_meter_cancel,
.internal_flags = BATADV_FLAG_NEED_MESH, .internal_flags = BATADV_FLAG_NEED_MESH,
}, },
{ {
.cmd = BATADV_CMD_GET_ROUTING_ALGOS, .cmd = BATADV_CMD_GET_ROUTING_ALGOS,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_algo_dump, .dumpit = batadv_algo_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_HARDIF, .cmd = BATADV_CMD_GET_HARDIF,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.policy = batadv_netlink_policy,
.dumpit = batadv_netlink_dump_hardif, .dumpit = batadv_netlink_dump_hardif,
.doit = batadv_netlink_get_hardif, .doit = batadv_netlink_get_hardif,
.internal_flags = BATADV_FLAG_NEED_MESH | .internal_flags = BATADV_FLAG_NEED_MESH |
@ -1381,68 +1376,57 @@ static const struct genl_ops batadv_netlink_ops[] = {
{ {
.cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_tt_local_dump, .dumpit = batadv_tt_local_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_tt_global_dump, .dumpit = batadv_tt_global_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_ORIGINATORS, .cmd = BATADV_CMD_GET_ORIGINATORS,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_orig_dump, .dumpit = batadv_orig_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_NEIGHBORS, .cmd = BATADV_CMD_GET_NEIGHBORS,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_hardif_neigh_dump, .dumpit = batadv_hardif_neigh_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_GATEWAYS, .cmd = BATADV_CMD_GET_GATEWAYS,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_gw_dump, .dumpit = batadv_gw_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_BLA_CLAIM, .cmd = BATADV_CMD_GET_BLA_CLAIM,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_bla_claim_dump, .dumpit = batadv_bla_claim_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_BLA_BACKBONE, .cmd = BATADV_CMD_GET_BLA_BACKBONE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_bla_backbone_dump, .dumpit = batadv_bla_backbone_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_DAT_CACHE, .cmd = BATADV_CMD_GET_DAT_CACHE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_dat_cache_dump, .dumpit = batadv_dat_cache_dump,
}, },
{ {
.cmd = BATADV_CMD_GET_MCAST_FLAGS, .cmd = BATADV_CMD_GET_MCAST_FLAGS,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.dumpit = batadv_mcast_flags_dump, .dumpit = batadv_mcast_flags_dump,
}, },
{ {
.cmd = BATADV_CMD_SET_MESH, .cmd = BATADV_CMD_SET_MESH,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.doit = batadv_netlink_set_mesh, .doit = batadv_netlink_set_mesh,
.internal_flags = BATADV_FLAG_NEED_MESH, .internal_flags = BATADV_FLAG_NEED_MESH,
}, },
{ {
.cmd = BATADV_CMD_SET_HARDIF, .cmd = BATADV_CMD_SET_HARDIF,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.doit = batadv_netlink_set_hardif, .doit = batadv_netlink_set_hardif,
.internal_flags = BATADV_FLAG_NEED_MESH | .internal_flags = BATADV_FLAG_NEED_MESH |
BATADV_FLAG_NEED_HARDIF, BATADV_FLAG_NEED_HARDIF,
@ -1450,7 +1434,6 @@ static const struct genl_ops batadv_netlink_ops[] = {
{ {
.cmd = BATADV_CMD_GET_VLAN, .cmd = BATADV_CMD_GET_VLAN,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.policy = batadv_netlink_policy,
.doit = batadv_netlink_get_vlan, .doit = batadv_netlink_get_vlan,
.internal_flags = BATADV_FLAG_NEED_MESH | .internal_flags = BATADV_FLAG_NEED_MESH |
BATADV_FLAG_NEED_VLAN, BATADV_FLAG_NEED_VLAN,
@ -1458,7 +1441,6 @@ static const struct genl_ops batadv_netlink_ops[] = {
{ {
.cmd = BATADV_CMD_SET_VLAN, .cmd = BATADV_CMD_SET_VLAN,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = batadv_netlink_policy,
.doit = batadv_netlink_set_vlan, .doit = batadv_netlink_set_vlan,
.internal_flags = BATADV_FLAG_NEED_MESH | .internal_flags = BATADV_FLAG_NEED_MESH |
BATADV_FLAG_NEED_VLAN, BATADV_FLAG_NEED_VLAN,
@ -1470,6 +1452,7 @@ struct genl_family batadv_netlink_family __ro_after_init = {
.name = BATADV_NL_NAME, .name = BATADV_NL_NAME,
.version = 1, .version = 1,
.maxattr = BATADV_ATTR_MAX, .maxattr = BATADV_ATTR_MAX,
.policy = batadv_netlink_policy,
.netnsok = true, .netnsok = true,
.pre_doit = batadv_pre_doit, .pre_doit = batadv_pre_doit,
.post_doit = batadv_post_doit, .post_doit = batadv_post_doit,

View File

@ -3640,7 +3640,6 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
{ {
u64 ret_offset, start_offset, end_offset = 0; u64 ret_offset, start_offset, end_offset = 0;
const struct genl_ops *ops = cb->data;
struct devlink_region *region; struct devlink_region *region;
struct nlattr *chunks_attr; struct nlattr *chunks_attr;
const char *region_name; const char *region_name;
@ -3657,7 +3656,8 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
return -ENOMEM; return -ENOMEM;
err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize, err = nlmsg_parse(cb->nlh, GENL_HDRLEN + devlink_nl_family.hdrsize,
attrs, DEVLINK_ATTR_MAX, ops->policy, cb->extack); attrs, DEVLINK_ATTR_MAX, devlink_nl_family.policy,
cb->extack);
if (err) if (err)
goto out_free; goto out_free;
@ -4923,7 +4923,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_GET, .cmd = DEVLINK_CMD_GET,
.doit = devlink_nl_cmd_get_doit, .doit = devlink_nl_cmd_get_doit,
.dumpit = devlink_nl_cmd_get_dumpit, .dumpit = devlink_nl_cmd_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
@ -4931,21 +4930,18 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_PORT_GET, .cmd = DEVLINK_CMD_PORT_GET,
.doit = devlink_nl_cmd_port_get_doit, .doit = devlink_nl_cmd_port_get_doit,
.dumpit = devlink_nl_cmd_port_get_dumpit, .dumpit = devlink_nl_cmd_port_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_PORT_SET, .cmd = DEVLINK_CMD_PORT_SET,
.doit = devlink_nl_cmd_port_set_doit, .doit = devlink_nl_cmd_port_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
}, },
{ {
.cmd = DEVLINK_CMD_PORT_SPLIT, .cmd = DEVLINK_CMD_PORT_SPLIT,
.doit = devlink_nl_cmd_port_split_doit, .doit = devlink_nl_cmd_port_split_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -4953,7 +4949,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_PORT_UNSPLIT, .cmd = DEVLINK_CMD_PORT_UNSPLIT,
.doit = devlink_nl_cmd_port_unsplit_doit, .doit = devlink_nl_cmd_port_unsplit_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -4962,7 +4957,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_SB_GET, .cmd = DEVLINK_CMD_SB_GET,
.doit = devlink_nl_cmd_sb_get_doit, .doit = devlink_nl_cmd_sb_get_doit,
.dumpit = devlink_nl_cmd_sb_get_dumpit, .dumpit = devlink_nl_cmd_sb_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
@ -4971,7 +4965,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_SB_POOL_GET, .cmd = DEVLINK_CMD_SB_POOL_GET,
.doit = devlink_nl_cmd_sb_pool_get_doit, .doit = devlink_nl_cmd_sb_pool_get_doit,
.dumpit = devlink_nl_cmd_sb_pool_get_dumpit, .dumpit = devlink_nl_cmd_sb_pool_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
@ -4979,7 +4972,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_SB_POOL_SET, .cmd = DEVLINK_CMD_SB_POOL_SET,
.doit = devlink_nl_cmd_sb_pool_set_doit, .doit = devlink_nl_cmd_sb_pool_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
@ -4988,7 +4980,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_SB_PORT_POOL_GET, .cmd = DEVLINK_CMD_SB_PORT_POOL_GET,
.doit = devlink_nl_cmd_sb_port_pool_get_doit, .doit = devlink_nl_cmd_sb_port_pool_get_doit,
.dumpit = devlink_nl_cmd_sb_port_pool_get_dumpit, .dumpit = devlink_nl_cmd_sb_port_pool_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT | .internal_flags = DEVLINK_NL_FLAG_NEED_PORT |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
@ -4996,7 +4987,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_SB_PORT_POOL_SET, .cmd = DEVLINK_CMD_SB_PORT_POOL_SET,
.doit = devlink_nl_cmd_sb_port_pool_set_doit, .doit = devlink_nl_cmd_sb_port_pool_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT | .internal_flags = DEVLINK_NL_FLAG_NEED_PORT |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
@ -5005,7 +4995,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_SB_TC_POOL_BIND_GET, .cmd = DEVLINK_CMD_SB_TC_POOL_BIND_GET,
.doit = devlink_nl_cmd_sb_tc_pool_bind_get_doit, .doit = devlink_nl_cmd_sb_tc_pool_bind_get_doit,
.dumpit = devlink_nl_cmd_sb_tc_pool_bind_get_dumpit, .dumpit = devlink_nl_cmd_sb_tc_pool_bind_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT | .internal_flags = DEVLINK_NL_FLAG_NEED_PORT |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
@ -5013,7 +5002,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_SB_TC_POOL_BIND_SET, .cmd = DEVLINK_CMD_SB_TC_POOL_BIND_SET,
.doit = devlink_nl_cmd_sb_tc_pool_bind_set_doit, .doit = devlink_nl_cmd_sb_tc_pool_bind_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT | .internal_flags = DEVLINK_NL_FLAG_NEED_PORT |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
@ -5021,7 +5009,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_SB_OCC_SNAPSHOT, .cmd = DEVLINK_CMD_SB_OCC_SNAPSHOT,
.doit = devlink_nl_cmd_sb_occ_snapshot_doit, .doit = devlink_nl_cmd_sb_occ_snapshot_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
@ -5029,7 +5016,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_SB_OCC_MAX_CLEAR, .cmd = DEVLINK_CMD_SB_OCC_MAX_CLEAR,
.doit = devlink_nl_cmd_sb_occ_max_clear_doit, .doit = devlink_nl_cmd_sb_occ_max_clear_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NEED_SB, DEVLINK_NL_FLAG_NEED_SB,
@ -5037,14 +5023,12 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_ESWITCH_GET, .cmd = DEVLINK_CMD_ESWITCH_GET,
.doit = devlink_nl_cmd_eswitch_get_doit, .doit = devlink_nl_cmd_eswitch_get_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_ESWITCH_SET, .cmd = DEVLINK_CMD_ESWITCH_SET,
.doit = devlink_nl_cmd_eswitch_set_doit, .doit = devlink_nl_cmd_eswitch_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -5052,49 +5036,42 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_DPIPE_TABLE_GET, .cmd = DEVLINK_CMD_DPIPE_TABLE_GET,
.doit = devlink_nl_cmd_dpipe_table_get, .doit = devlink_nl_cmd_dpipe_table_get,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_DPIPE_ENTRIES_GET, .cmd = DEVLINK_CMD_DPIPE_ENTRIES_GET,
.doit = devlink_nl_cmd_dpipe_entries_get, .doit = devlink_nl_cmd_dpipe_entries_get,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_DPIPE_HEADERS_GET, .cmd = DEVLINK_CMD_DPIPE_HEADERS_GET,
.doit = devlink_nl_cmd_dpipe_headers_get, .doit = devlink_nl_cmd_dpipe_headers_get,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET, .cmd = DEVLINK_CMD_DPIPE_TABLE_COUNTERS_SET,
.doit = devlink_nl_cmd_dpipe_table_counters_set, .doit = devlink_nl_cmd_dpipe_table_counters_set,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_RESOURCE_SET, .cmd = DEVLINK_CMD_RESOURCE_SET,
.doit = devlink_nl_cmd_resource_set, .doit = devlink_nl_cmd_resource_set,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_RESOURCE_DUMP, .cmd = DEVLINK_CMD_RESOURCE_DUMP,
.doit = devlink_nl_cmd_resource_dump, .doit = devlink_nl_cmd_resource_dump,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_RELOAD, .cmd = DEVLINK_CMD_RELOAD,
.doit = devlink_nl_cmd_reload, .doit = devlink_nl_cmd_reload,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -5103,14 +5080,12 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_PARAM_GET, .cmd = DEVLINK_CMD_PARAM_GET,
.doit = devlink_nl_cmd_param_get_doit, .doit = devlink_nl_cmd_param_get_doit,
.dumpit = devlink_nl_cmd_param_get_dumpit, .dumpit = devlink_nl_cmd_param_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_PARAM_SET, .cmd = DEVLINK_CMD_PARAM_SET,
.doit = devlink_nl_cmd_param_set_doit, .doit = devlink_nl_cmd_param_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
@ -5118,14 +5093,12 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_PORT_PARAM_GET, .cmd = DEVLINK_CMD_PORT_PARAM_GET,
.doit = devlink_nl_cmd_port_param_get_doit, .doit = devlink_nl_cmd_port_param_get_doit,
.dumpit = devlink_nl_cmd_port_param_get_dumpit, .dumpit = devlink_nl_cmd_port_param_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_PORT_PARAM_SET, .cmd = DEVLINK_CMD_PORT_PARAM_SET,
.doit = devlink_nl_cmd_port_param_set_doit, .doit = devlink_nl_cmd_port_param_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_PORT, .internal_flags = DEVLINK_NL_FLAG_NEED_PORT,
}, },
@ -5133,21 +5106,18 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_REGION_GET, .cmd = DEVLINK_CMD_REGION_GET,
.doit = devlink_nl_cmd_region_get_doit, .doit = devlink_nl_cmd_region_get_doit,
.dumpit = devlink_nl_cmd_region_get_dumpit, .dumpit = devlink_nl_cmd_region_get_dumpit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_REGION_DEL, .cmd = DEVLINK_CMD_REGION_DEL,
.doit = devlink_nl_cmd_region_del, .doit = devlink_nl_cmd_region_del,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_REGION_READ, .cmd = DEVLINK_CMD_REGION_READ,
.dumpit = devlink_nl_cmd_region_read_dumpit, .dumpit = devlink_nl_cmd_region_read_dumpit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
@ -5155,7 +5125,6 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_INFO_GET, .cmd = DEVLINK_CMD_INFO_GET,
.doit = devlink_nl_cmd_info_get_doit, .doit = devlink_nl_cmd_info_get_doit,
.dumpit = devlink_nl_cmd_info_get_dumpit, .dumpit = devlink_nl_cmd_info_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
@ -5163,35 +5132,30 @@ static const struct genl_ops devlink_nl_ops[] = {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_GET, .cmd = DEVLINK_CMD_HEALTH_REPORTER_GET,
.doit = devlink_nl_cmd_health_reporter_get_doit, .doit = devlink_nl_cmd_health_reporter_get_doit,
.dumpit = devlink_nl_cmd_health_reporter_get_dumpit, .dumpit = devlink_nl_cmd_health_reporter_get_dumpit,
.policy = devlink_nl_policy,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_SET, .cmd = DEVLINK_CMD_HEALTH_REPORTER_SET,
.doit = devlink_nl_cmd_health_reporter_set_doit, .doit = devlink_nl_cmd_health_reporter_set_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_RECOVER, .cmd = DEVLINK_CMD_HEALTH_REPORTER_RECOVER,
.doit = devlink_nl_cmd_health_reporter_recover_doit, .doit = devlink_nl_cmd_health_reporter_recover_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE, .cmd = DEVLINK_CMD_HEALTH_REPORTER_DIAGNOSE,
.doit = devlink_nl_cmd_health_reporter_diagnose_doit, .doit = devlink_nl_cmd_health_reporter_diagnose_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET, .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_GET,
.doit = devlink_nl_cmd_health_reporter_dump_get_doit, .doit = devlink_nl_cmd_health_reporter_dump_get_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -5199,7 +5163,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR, .cmd = DEVLINK_CMD_HEALTH_REPORTER_DUMP_CLEAR,
.doit = devlink_nl_cmd_health_reporter_dump_clear_doit, .doit = devlink_nl_cmd_health_reporter_dump_clear_doit,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK | .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK |
DEVLINK_NL_FLAG_NO_LOCK, DEVLINK_NL_FLAG_NO_LOCK,
@ -5207,7 +5170,6 @@ static const struct genl_ops devlink_nl_ops[] = {
{ {
.cmd = DEVLINK_CMD_FLASH_UPDATE, .cmd = DEVLINK_CMD_FLASH_UPDATE,
.doit = devlink_nl_cmd_flash_update, .doit = devlink_nl_cmd_flash_update,
.policy = devlink_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK, .internal_flags = DEVLINK_NL_FLAG_NEED_DEVLINK,
}, },
@ -5217,6 +5179,7 @@ static struct genl_family devlink_nl_family __ro_after_init = {
.name = DEVLINK_GENL_NAME, .name = DEVLINK_GENL_NAME,
.version = DEVLINK_GENL_VERSION, .version = DEVLINK_GENL_VERSION,
.maxattr = DEVLINK_ATTR_MAX, .maxattr = DEVLINK_ATTR_MAX,
.policy = devlink_nl_policy,
.netnsok = true, .netnsok = true,
.pre_doit = devlink_nl_pre_doit, .pre_doit = devlink_nl_pre_doit,
.post_doit = devlink_nl_post_doit, .post_doit = devlink_nl_post_doit,

View File

@ -449,14 +449,12 @@ static const struct genl_ops hsr_ops[] = {
{ {
.cmd = HSR_C_GET_NODE_STATUS, .cmd = HSR_C_GET_NODE_STATUS,
.flags = 0, .flags = 0,
.policy = hsr_genl_policy,
.doit = hsr_get_node_status, .doit = hsr_get_node_status,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = HSR_C_GET_NODE_LIST, .cmd = HSR_C_GET_NODE_LIST,
.flags = 0, .flags = 0,
.policy = hsr_genl_policy,
.doit = hsr_get_node_list, .doit = hsr_get_node_list,
.dumpit = NULL, .dumpit = NULL,
}, },
@ -467,6 +465,7 @@ static struct genl_family hsr_genl_family __ro_after_init = {
.name = "HSR", .name = "HSR",
.version = 1, .version = 1,
.maxattr = HSR_A_MAX, .maxattr = HSR_A_MAX,
.policy = hsr_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = hsr_ops, .ops = hsr_ops,
.n_ops = ARRAY_SIZE(hsr_ops), .n_ops = ARRAY_SIZE(hsr_ops),

View File

@ -20,7 +20,6 @@ void ieee802154_nl_exit(void);
#define IEEE802154_OP(_cmd, _func) \ #define IEEE802154_OP(_cmd, _func) \
{ \ { \
.cmd = _cmd, \ .cmd = _cmd, \
.policy = ieee802154_policy, \
.doit = _func, \ .doit = _func, \
.dumpit = NULL, \ .dumpit = NULL, \
.flags = GENL_ADMIN_PERM, \ .flags = GENL_ADMIN_PERM, \
@ -29,7 +28,6 @@ void ieee802154_nl_exit(void);
#define IEEE802154_DUMP(_cmd, _func, _dump) \ #define IEEE802154_DUMP(_cmd, _func, _dump) \
{ \ { \
.cmd = _cmd, \ .cmd = _cmd, \
.policy = ieee802154_policy, \
.doit = _func, \ .doit = _func, \
.dumpit = _dump, \ .dumpit = _dump, \
} }

View File

@ -136,6 +136,7 @@ struct genl_family nl802154_family __ro_after_init = {
.name = IEEE802154_NL_NAME, .name = IEEE802154_NL_NAME,
.version = 1, .version = 1,
.maxattr = IEEE802154_ATTR_MAX, .maxattr = IEEE802154_ATTR_MAX,
.policy = ieee802154_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = ieee802154_ops, .ops = ieee802154_ops,
.n_ops = ARRAY_SIZE(ieee802154_ops), .n_ops = ARRAY_SIZE(ieee802154_ops),

View File

@ -2220,7 +2220,6 @@ static const struct genl_ops nl802154_ops[] = {
.doit = nl802154_get_wpan_phy, .doit = nl802154_get_wpan_phy,
.dumpit = nl802154_dump_wpan_phy, .dumpit = nl802154_dump_wpan_phy,
.done = nl802154_dump_wpan_phy_done, .done = nl802154_dump_wpan_phy_done,
.policy = nl802154_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2229,7 +2228,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_GET_INTERFACE, .cmd = NL802154_CMD_GET_INTERFACE,
.doit = nl802154_get_interface, .doit = nl802154_get_interface,
.dumpit = nl802154_dump_interface, .dumpit = nl802154_dump_interface,
.policy = nl802154_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL802154_FLAG_NEED_WPAN_DEV | .internal_flags = NL802154_FLAG_NEED_WPAN_DEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2237,7 +2235,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_NEW_INTERFACE, .cmd = NL802154_CMD_NEW_INTERFACE,
.doit = nl802154_new_interface, .doit = nl802154_new_interface,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2245,7 +2242,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_DEL_INTERFACE, .cmd = NL802154_CMD_DEL_INTERFACE,
.doit = nl802154_del_interface, .doit = nl802154_del_interface,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_DEV | .internal_flags = NL802154_FLAG_NEED_WPAN_DEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2253,7 +2249,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_CHANNEL, .cmd = NL802154_CMD_SET_CHANNEL,
.doit = nl802154_set_channel, .doit = nl802154_set_channel,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2261,7 +2256,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_CCA_MODE, .cmd = NL802154_CMD_SET_CCA_MODE,
.doit = nl802154_set_cca_mode, .doit = nl802154_set_cca_mode,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2269,7 +2263,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_CCA_ED_LEVEL, .cmd = NL802154_CMD_SET_CCA_ED_LEVEL,
.doit = nl802154_set_cca_ed_level, .doit = nl802154_set_cca_ed_level,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2277,7 +2270,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_TX_POWER, .cmd = NL802154_CMD_SET_TX_POWER,
.doit = nl802154_set_tx_power, .doit = nl802154_set_tx_power,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2285,7 +2277,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_WPAN_PHY_NETNS, .cmd = NL802154_CMD_SET_WPAN_PHY_NETNS,
.doit = nl802154_wpan_phy_netns, .doit = nl802154_wpan_phy_netns,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_WPAN_PHY | .internal_flags = NL802154_FLAG_NEED_WPAN_PHY |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2293,7 +2284,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_PAN_ID, .cmd = NL802154_CMD_SET_PAN_ID,
.doit = nl802154_set_pan_id, .doit = nl802154_set_pan_id,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2301,7 +2291,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_SHORT_ADDR, .cmd = NL802154_CMD_SET_SHORT_ADDR,
.doit = nl802154_set_short_addr, .doit = nl802154_set_short_addr,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2309,7 +2298,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_BACKOFF_EXPONENT, .cmd = NL802154_CMD_SET_BACKOFF_EXPONENT,
.doit = nl802154_set_backoff_exponent, .doit = nl802154_set_backoff_exponent,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2317,7 +2305,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_MAX_CSMA_BACKOFFS, .cmd = NL802154_CMD_SET_MAX_CSMA_BACKOFFS,
.doit = nl802154_set_max_csma_backoffs, .doit = nl802154_set_max_csma_backoffs,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2325,7 +2312,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_MAX_FRAME_RETRIES, .cmd = NL802154_CMD_SET_MAX_FRAME_RETRIES,
.doit = nl802154_set_max_frame_retries, .doit = nl802154_set_max_frame_retries,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2333,7 +2319,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_LBT_MODE, .cmd = NL802154_CMD_SET_LBT_MODE,
.doit = nl802154_set_lbt_mode, .doit = nl802154_set_lbt_mode,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2341,7 +2326,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_ACKREQ_DEFAULT, .cmd = NL802154_CMD_SET_ACKREQ_DEFAULT,
.doit = nl802154_set_ackreq_default, .doit = nl802154_set_ackreq_default,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2350,7 +2334,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_SET_SEC_PARAMS, .cmd = NL802154_CMD_SET_SEC_PARAMS,
.doit = nl802154_set_llsec_params, .doit = nl802154_set_llsec_params,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2359,7 +2342,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_GET_SEC_KEY, .cmd = NL802154_CMD_GET_SEC_KEY,
/* TODO .doit by matching key id? */ /* TODO .doit by matching key id? */
.dumpit = nl802154_dump_llsec_key, .dumpit = nl802154_dump_llsec_key,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2367,7 +2349,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_NEW_SEC_KEY, .cmd = NL802154_CMD_NEW_SEC_KEY,
.doit = nl802154_add_llsec_key, .doit = nl802154_add_llsec_key,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2375,7 +2356,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_DEL_SEC_KEY, .cmd = NL802154_CMD_DEL_SEC_KEY,
.doit = nl802154_del_llsec_key, .doit = nl802154_del_llsec_key,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2385,7 +2365,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_GET_SEC_DEV, .cmd = NL802154_CMD_GET_SEC_DEV,
/* TODO .doit by matching extended_addr? */ /* TODO .doit by matching extended_addr? */
.dumpit = nl802154_dump_llsec_dev, .dumpit = nl802154_dump_llsec_dev,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2393,7 +2372,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_NEW_SEC_DEV, .cmd = NL802154_CMD_NEW_SEC_DEV,
.doit = nl802154_add_llsec_dev, .doit = nl802154_add_llsec_dev,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2401,7 +2379,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_DEL_SEC_DEV, .cmd = NL802154_CMD_DEL_SEC_DEV,
.doit = nl802154_del_llsec_dev, .doit = nl802154_del_llsec_dev,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2411,7 +2388,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_GET_SEC_DEVKEY, .cmd = NL802154_CMD_GET_SEC_DEVKEY,
/* TODO doit by matching ??? */ /* TODO doit by matching ??? */
.dumpit = nl802154_dump_llsec_devkey, .dumpit = nl802154_dump_llsec_devkey,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2419,7 +2395,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_NEW_SEC_DEVKEY, .cmd = NL802154_CMD_NEW_SEC_DEVKEY,
.doit = nl802154_add_llsec_devkey, .doit = nl802154_add_llsec_devkey,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2427,7 +2402,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_DEL_SEC_DEVKEY, .cmd = NL802154_CMD_DEL_SEC_DEVKEY,
.doit = nl802154_del_llsec_devkey, .doit = nl802154_del_llsec_devkey,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2436,7 +2410,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_GET_SEC_LEVEL, .cmd = NL802154_CMD_GET_SEC_LEVEL,
/* TODO .doit by matching frame_type? */ /* TODO .doit by matching frame_type? */
.dumpit = nl802154_dump_llsec_seclevel, .dumpit = nl802154_dump_llsec_seclevel,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2444,7 +2417,6 @@ static const struct genl_ops nl802154_ops[] = {
{ {
.cmd = NL802154_CMD_NEW_SEC_LEVEL, .cmd = NL802154_CMD_NEW_SEC_LEVEL,
.doit = nl802154_add_llsec_seclevel, .doit = nl802154_add_llsec_seclevel,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2453,7 +2425,6 @@ static const struct genl_ops nl802154_ops[] = {
.cmd = NL802154_CMD_DEL_SEC_LEVEL, .cmd = NL802154_CMD_DEL_SEC_LEVEL,
/* TODO match frame_type only? */ /* TODO match frame_type only? */
.doit = nl802154_del_llsec_seclevel, .doit = nl802154_del_llsec_seclevel,
.policy = nl802154_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL802154_FLAG_NEED_NETDEV | .internal_flags = NL802154_FLAG_NEED_NETDEV |
NL802154_FLAG_NEED_RTNL, NL802154_FLAG_NEED_RTNL,
@ -2466,6 +2437,7 @@ static struct genl_family nl802154_fam __ro_after_init = {
.hdrsize = 0, /* no private header */ .hdrsize = 0, /* no private header */
.version = 1, /* no particular meaning now */ .version = 1, /* no particular meaning now */
.maxattr = NL802154_ATTR_MAX, .maxattr = NL802154_ATTR_MAX,
.policy = nl802154_policy,
.netnsok = true, .netnsok = true,
.pre_doit = nl802154_pre_doit, .pre_doit = nl802154_pre_doit,
.post_doit = nl802154_post_doit, .post_doit = nl802154_post_doit,

View File

@ -808,20 +808,17 @@ static const struct genl_ops fou_nl_ops[] = {
{ {
.cmd = FOU_CMD_ADD, .cmd = FOU_CMD_ADD,
.doit = fou_nl_cmd_add_port, .doit = fou_nl_cmd_add_port,
.policy = fou_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = FOU_CMD_DEL, .cmd = FOU_CMD_DEL,
.doit = fou_nl_cmd_rm_port, .doit = fou_nl_cmd_rm_port,
.policy = fou_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = FOU_CMD_GET, .cmd = FOU_CMD_GET,
.doit = fou_nl_cmd_get_port, .doit = fou_nl_cmd_get_port,
.dumpit = fou_nl_dump, .dumpit = fou_nl_dump,
.policy = fou_nl_policy,
}, },
}; };
@ -830,6 +827,7 @@ static struct genl_family fou_nl_family __ro_after_init = {
.name = FOU_GENL_NAME, .name = FOU_GENL_NAME,
.version = FOU_GENL_VERSION, .version = FOU_GENL_VERSION,
.maxattr = FOU_ATTR_MAX, .maxattr = FOU_ATTR_MAX,
.policy = fou_nl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = fou_nl_ops, .ops = fou_nl_ops,

View File

@ -953,12 +953,10 @@ static const struct genl_ops tcp_metrics_nl_ops[] = {
.cmd = TCP_METRICS_CMD_GET, .cmd = TCP_METRICS_CMD_GET,
.doit = tcp_metrics_nl_cmd_get, .doit = tcp_metrics_nl_cmd_get,
.dumpit = tcp_metrics_nl_dump, .dumpit = tcp_metrics_nl_dump,
.policy = tcp_metrics_nl_policy,
}, },
{ {
.cmd = TCP_METRICS_CMD_DEL, .cmd = TCP_METRICS_CMD_DEL,
.doit = tcp_metrics_nl_cmd_del, .doit = tcp_metrics_nl_cmd_del,
.policy = tcp_metrics_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -968,6 +966,7 @@ static struct genl_family tcp_metrics_nl_family __ro_after_init = {
.name = TCP_METRICS_GENL_NAME, .name = TCP_METRICS_GENL_NAME,
.version = TCP_METRICS_GENL_VERSION, .version = TCP_METRICS_GENL_VERSION,
.maxattr = TCP_METRICS_ATTR_MAX, .maxattr = TCP_METRICS_ATTR_MAX,
.policy = tcp_metrics_nl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = tcp_metrics_nl_ops, .ops = tcp_metrics_nl_ops,

View File

@ -17,19 +17,16 @@ static const struct genl_ops ila_nl_ops[] = {
{ {
.cmd = ILA_CMD_ADD, .cmd = ILA_CMD_ADD,
.doit = ila_xlat_nl_cmd_add_mapping, .doit = ila_xlat_nl_cmd_add_mapping,
.policy = ila_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = ILA_CMD_DEL, .cmd = ILA_CMD_DEL,
.doit = ila_xlat_nl_cmd_del_mapping, .doit = ila_xlat_nl_cmd_del_mapping,
.policy = ila_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = ILA_CMD_FLUSH, .cmd = ILA_CMD_FLUSH,
.doit = ila_xlat_nl_cmd_flush, .doit = ila_xlat_nl_cmd_flush,
.policy = ila_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
@ -38,7 +35,6 @@ static const struct genl_ops ila_nl_ops[] = {
.start = ila_xlat_nl_dump_start, .start = ila_xlat_nl_dump_start,
.dumpit = ila_xlat_nl_dump, .dumpit = ila_xlat_nl_dump,
.done = ila_xlat_nl_dump_done, .done = ila_xlat_nl_dump_done,
.policy = ila_nl_policy,
}, },
}; };
@ -49,6 +45,7 @@ struct genl_family ila_nl_family __ro_after_init = {
.name = ILA_GENL_NAME, .name = ILA_GENL_NAME,
.version = ILA_GENL_VERSION, .version = ILA_GENL_VERSION,
.maxattr = ILA_ATTR_MAX, .maxattr = ILA_ATTR_MAX,
.policy = ila_nl_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.module = THIS_MODULE, .module = THIS_MODULE,

View File

@ -399,7 +399,6 @@ static const struct genl_ops seg6_genl_ops[] = {
{ {
.cmd = SEG6_CMD_SETHMAC, .cmd = SEG6_CMD_SETHMAC,
.doit = seg6_genl_sethmac, .doit = seg6_genl_sethmac,
.policy = seg6_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
@ -407,19 +406,16 @@ static const struct genl_ops seg6_genl_ops[] = {
.start = seg6_genl_dumphmac_start, .start = seg6_genl_dumphmac_start,
.dumpit = seg6_genl_dumphmac, .dumpit = seg6_genl_dumphmac,
.done = seg6_genl_dumphmac_done, .done = seg6_genl_dumphmac_done,
.policy = seg6_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = SEG6_CMD_SET_TUNSRC, .cmd = SEG6_CMD_SET_TUNSRC,
.doit = seg6_genl_set_tunsrc, .doit = seg6_genl_set_tunsrc,
.policy = seg6_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = SEG6_CMD_GET_TUNSRC, .cmd = SEG6_CMD_GET_TUNSRC,
.doit = seg6_genl_get_tunsrc, .doit = seg6_genl_get_tunsrc,
.policy = seg6_genl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -429,6 +425,7 @@ static struct genl_family seg6_genl_family __ro_after_init = {
.name = SEG6_GENL_NAME, .name = SEG6_GENL_NAME,
.version = SEG6_GENL_VERSION, .version = SEG6_GENL_VERSION,
.maxattr = SEG6_ATTR_MAX, .maxattr = SEG6_ATTR_MAX,
.policy = seg6_genl_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = seg6_genl_ops, .ops = seg6_genl_ops,

View File

@ -916,57 +916,48 @@ static const struct genl_ops l2tp_nl_ops[] = {
{ {
.cmd = L2TP_CMD_NOOP, .cmd = L2TP_CMD_NOOP,
.doit = l2tp_nl_cmd_noop, .doit = l2tp_nl_cmd_noop,
.policy = l2tp_nl_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
{ {
.cmd = L2TP_CMD_TUNNEL_CREATE, .cmd = L2TP_CMD_TUNNEL_CREATE,
.doit = l2tp_nl_cmd_tunnel_create, .doit = l2tp_nl_cmd_tunnel_create,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_TUNNEL_DELETE, .cmd = L2TP_CMD_TUNNEL_DELETE,
.doit = l2tp_nl_cmd_tunnel_delete, .doit = l2tp_nl_cmd_tunnel_delete,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_TUNNEL_MODIFY, .cmd = L2TP_CMD_TUNNEL_MODIFY,
.doit = l2tp_nl_cmd_tunnel_modify, .doit = l2tp_nl_cmd_tunnel_modify,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_TUNNEL_GET, .cmd = L2TP_CMD_TUNNEL_GET,
.doit = l2tp_nl_cmd_tunnel_get, .doit = l2tp_nl_cmd_tunnel_get,
.dumpit = l2tp_nl_cmd_tunnel_dump, .dumpit = l2tp_nl_cmd_tunnel_dump,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_SESSION_CREATE, .cmd = L2TP_CMD_SESSION_CREATE,
.doit = l2tp_nl_cmd_session_create, .doit = l2tp_nl_cmd_session_create,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_SESSION_DELETE, .cmd = L2TP_CMD_SESSION_DELETE,
.doit = l2tp_nl_cmd_session_delete, .doit = l2tp_nl_cmd_session_delete,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_SESSION_MODIFY, .cmd = L2TP_CMD_SESSION_MODIFY,
.doit = l2tp_nl_cmd_session_modify, .doit = l2tp_nl_cmd_session_modify,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = L2TP_CMD_SESSION_GET, .cmd = L2TP_CMD_SESSION_GET,
.doit = l2tp_nl_cmd_session_get, .doit = l2tp_nl_cmd_session_get,
.dumpit = l2tp_nl_cmd_session_dump, .dumpit = l2tp_nl_cmd_session_dump,
.policy = l2tp_nl_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
}; };
@ -976,6 +967,7 @@ static struct genl_family l2tp_nl_family __ro_after_init = {
.version = L2TP_GENL_VERSION, .version = L2TP_GENL_VERSION,
.hdrsize = 0, .hdrsize = 0,
.maxattr = L2TP_ATTR_MAX, .maxattr = L2TP_ATTR_MAX,
.policy = l2tp_nl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = l2tp_nl_ops, .ops = l2tp_nl_ops,

View File

@ -723,38 +723,32 @@ static int ncsi_set_channel_mask_nl(struct sk_buff *msg,
static const struct genl_ops ncsi_ops[] = { static const struct genl_ops ncsi_ops[] = {
{ {
.cmd = NCSI_CMD_PKG_INFO, .cmd = NCSI_CMD_PKG_INFO,
.policy = ncsi_genl_policy,
.doit = ncsi_pkg_info_nl, .doit = ncsi_pkg_info_nl,
.dumpit = ncsi_pkg_info_all_nl, .dumpit = ncsi_pkg_info_all_nl,
.flags = 0, .flags = 0,
}, },
{ {
.cmd = NCSI_CMD_SET_INTERFACE, .cmd = NCSI_CMD_SET_INTERFACE,
.policy = ncsi_genl_policy,
.doit = ncsi_set_interface_nl, .doit = ncsi_set_interface_nl,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NCSI_CMD_CLEAR_INTERFACE, .cmd = NCSI_CMD_CLEAR_INTERFACE,
.policy = ncsi_genl_policy,
.doit = ncsi_clear_interface_nl, .doit = ncsi_clear_interface_nl,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NCSI_CMD_SEND_CMD, .cmd = NCSI_CMD_SEND_CMD,
.policy = ncsi_genl_policy,
.doit = ncsi_send_cmd_nl, .doit = ncsi_send_cmd_nl,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NCSI_CMD_SET_PACKAGE_MASK, .cmd = NCSI_CMD_SET_PACKAGE_MASK,
.policy = ncsi_genl_policy,
.doit = ncsi_set_package_mask_nl, .doit = ncsi_set_package_mask_nl,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NCSI_CMD_SET_CHANNEL_MASK, .cmd = NCSI_CMD_SET_CHANNEL_MASK,
.policy = ncsi_genl_policy,
.doit = ncsi_set_channel_mask_nl, .doit = ncsi_set_channel_mask_nl,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
@ -764,6 +758,7 @@ static struct genl_family ncsi_genl_family __ro_after_init = {
.name = "NCSI", .name = "NCSI",
.version = 0, .version = 0,
.maxattr = NCSI_ATTR_MAX, .maxattr = NCSI_ATTR_MAX,
.policy = ncsi_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = ncsi_ops, .ops = ncsi_ops,
.n_ops = ARRAY_SIZE(ncsi_ops), .n_ops = ARRAY_SIZE(ncsi_ops),

View File

@ -3775,19 +3775,16 @@ static const struct genl_ops ip_vs_genl_ops[] = {
{ {
.cmd = IPVS_CMD_NEW_SERVICE, .cmd = IPVS_CMD_NEW_SERVICE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
.cmd = IPVS_CMD_SET_SERVICE, .cmd = IPVS_CMD_SET_SERVICE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
.cmd = IPVS_CMD_DEL_SERVICE, .cmd = IPVS_CMD_DEL_SERVICE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
@ -3795,42 +3792,35 @@ static const struct genl_ops ip_vs_genl_ops[] = {
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.doit = ip_vs_genl_get_cmd, .doit = ip_vs_genl_get_cmd,
.dumpit = ip_vs_genl_dump_services, .dumpit = ip_vs_genl_dump_services,
.policy = ip_vs_cmd_policy,
}, },
{ {
.cmd = IPVS_CMD_NEW_DEST, .cmd = IPVS_CMD_NEW_DEST,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
.cmd = IPVS_CMD_SET_DEST, .cmd = IPVS_CMD_SET_DEST,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
.cmd = IPVS_CMD_DEL_DEST, .cmd = IPVS_CMD_DEL_DEST,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
.cmd = IPVS_CMD_GET_DEST, .cmd = IPVS_CMD_GET_DEST,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.dumpit = ip_vs_genl_dump_dests, .dumpit = ip_vs_genl_dump_dests,
}, },
{ {
.cmd = IPVS_CMD_NEW_DAEMON, .cmd = IPVS_CMD_NEW_DAEMON,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_daemon, .doit = ip_vs_genl_set_daemon,
}, },
{ {
.cmd = IPVS_CMD_DEL_DAEMON, .cmd = IPVS_CMD_DEL_DAEMON,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_daemon, .doit = ip_vs_genl_set_daemon,
}, },
{ {
@ -3841,7 +3831,6 @@ static const struct genl_ops ip_vs_genl_ops[] = {
{ {
.cmd = IPVS_CMD_SET_CONFIG, .cmd = IPVS_CMD_SET_CONFIG,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
@ -3857,7 +3846,6 @@ static const struct genl_ops ip_vs_genl_ops[] = {
{ {
.cmd = IPVS_CMD_ZERO, .cmd = IPVS_CMD_ZERO,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = ip_vs_cmd_policy,
.doit = ip_vs_genl_set_cmd, .doit = ip_vs_genl_set_cmd,
}, },
{ {
@ -3872,6 +3860,7 @@ static struct genl_family ip_vs_genl_family __ro_after_init = {
.name = IPVS_GENL_NAME, .name = IPVS_GENL_NAME,
.version = IPVS_GENL_VERSION, .version = IPVS_GENL_VERSION,
.maxattr = IPVS_CMD_ATTR_MAX, .maxattr = IPVS_CMD_ATTR_MAX,
.policy = ip_vs_cmd_policy,
.netnsok = true, /* Make ipvsadm to work on netns */ .netnsok = true, /* Make ipvsadm to work on netns */
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = ip_vs_genl_ops, .ops = ip_vs_genl_ops,

View File

@ -322,28 +322,24 @@ static const struct genl_ops netlbl_calipso_ops[] = {
{ {
.cmd = NLBL_CALIPSO_C_ADD, .cmd = NLBL_CALIPSO_C_ADD,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = calipso_genl_policy,
.doit = netlbl_calipso_add, .doit = netlbl_calipso_add,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CALIPSO_C_REMOVE, .cmd = NLBL_CALIPSO_C_REMOVE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = calipso_genl_policy,
.doit = netlbl_calipso_remove, .doit = netlbl_calipso_remove,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CALIPSO_C_LIST, .cmd = NLBL_CALIPSO_C_LIST,
.flags = 0, .flags = 0,
.policy = calipso_genl_policy,
.doit = netlbl_calipso_list, .doit = netlbl_calipso_list,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CALIPSO_C_LISTALL, .cmd = NLBL_CALIPSO_C_LISTALL,
.flags = 0, .flags = 0,
.policy = calipso_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_calipso_listall, .dumpit = netlbl_calipso_listall,
}, },
@ -354,6 +350,7 @@ static struct genl_family netlbl_calipso_gnl_family __ro_after_init = {
.name = NETLBL_NLTYPE_CALIPSO_NAME, .name = NETLBL_NLTYPE_CALIPSO_NAME,
.version = NETLBL_PROTO_VERSION, .version = NETLBL_PROTO_VERSION,
.maxattr = NLBL_CALIPSO_A_MAX, .maxattr = NLBL_CALIPSO_A_MAX,
.policy = calipso_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = netlbl_calipso_ops, .ops = netlbl_calipso_ops,
.n_ops = ARRAY_SIZE(netlbl_calipso_ops), .n_ops = ARRAY_SIZE(netlbl_calipso_ops),

View File

@ -734,28 +734,24 @@ static const struct genl_ops netlbl_cipsov4_ops[] = {
{ {
.cmd = NLBL_CIPSOV4_C_ADD, .cmd = NLBL_CIPSOV4_C_ADD,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_add, .doit = netlbl_cipsov4_add,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CIPSOV4_C_REMOVE, .cmd = NLBL_CIPSOV4_C_REMOVE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_remove, .doit = netlbl_cipsov4_remove,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CIPSOV4_C_LIST, .cmd = NLBL_CIPSOV4_C_LIST,
.flags = 0, .flags = 0,
.policy = netlbl_cipsov4_genl_policy,
.doit = netlbl_cipsov4_list, .doit = netlbl_cipsov4_list,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_CIPSOV4_C_LISTALL, .cmd = NLBL_CIPSOV4_C_LISTALL,
.flags = 0, .flags = 0,
.policy = netlbl_cipsov4_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_cipsov4_listall, .dumpit = netlbl_cipsov4_listall,
}, },
@ -766,6 +762,7 @@ static struct genl_family netlbl_cipsov4_gnl_family __ro_after_init = {
.name = NETLBL_NLTYPE_CIPSOV4_NAME, .name = NETLBL_NLTYPE_CIPSOV4_NAME,
.version = NETLBL_PROTO_VERSION, .version = NETLBL_PROTO_VERSION,
.maxattr = NLBL_CIPSOV4_A_MAX, .maxattr = NLBL_CIPSOV4_A_MAX,
.policy = netlbl_cipsov4_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = netlbl_cipsov4_ops, .ops = netlbl_cipsov4_ops,
.n_ops = ARRAY_SIZE(netlbl_cipsov4_ops), .n_ops = ARRAY_SIZE(netlbl_cipsov4_ops),

View File

@ -773,56 +773,48 @@ static const struct genl_ops netlbl_mgmt_genl_ops[] = {
{ {
.cmd = NLBL_MGMT_C_ADD, .cmd = NLBL_MGMT_C_ADD,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_add, .doit = netlbl_mgmt_add,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_MGMT_C_REMOVE, .cmd = NLBL_MGMT_C_REMOVE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_remove, .doit = netlbl_mgmt_remove,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_MGMT_C_LISTALL, .cmd = NLBL_MGMT_C_LISTALL,
.flags = 0, .flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_mgmt_listall, .dumpit = netlbl_mgmt_listall,
}, },
{ {
.cmd = NLBL_MGMT_C_ADDDEF, .cmd = NLBL_MGMT_C_ADDDEF,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_adddef, .doit = netlbl_mgmt_adddef,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_MGMT_C_REMOVEDEF, .cmd = NLBL_MGMT_C_REMOVEDEF,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_removedef, .doit = netlbl_mgmt_removedef,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_MGMT_C_LISTDEF, .cmd = NLBL_MGMT_C_LISTDEF,
.flags = 0, .flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_listdef, .doit = netlbl_mgmt_listdef,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_MGMT_C_PROTOCOLS, .cmd = NLBL_MGMT_C_PROTOCOLS,
.flags = 0, .flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_mgmt_protocols, .dumpit = netlbl_mgmt_protocols,
}, },
{ {
.cmd = NLBL_MGMT_C_VERSION, .cmd = NLBL_MGMT_C_VERSION,
.flags = 0, .flags = 0,
.policy = netlbl_mgmt_genl_policy,
.doit = netlbl_mgmt_version, .doit = netlbl_mgmt_version,
.dumpit = NULL, .dumpit = NULL,
}, },
@ -833,6 +825,7 @@ static struct genl_family netlbl_mgmt_gnl_family __ro_after_init = {
.name = NETLBL_NLTYPE_MGMT_NAME, .name = NETLBL_NLTYPE_MGMT_NAME,
.version = NETLBL_PROTO_VERSION, .version = NETLBL_PROTO_VERSION,
.maxattr = NLBL_MGMT_A_MAX, .maxattr = NLBL_MGMT_A_MAX,
.policy = netlbl_mgmt_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = netlbl_mgmt_genl_ops, .ops = netlbl_mgmt_genl_ops,
.n_ops = ARRAY_SIZE(netlbl_mgmt_genl_ops), .n_ops = ARRAY_SIZE(netlbl_mgmt_genl_ops),

View File

@ -1318,56 +1318,48 @@ static const struct genl_ops netlbl_unlabel_genl_ops[] = {
{ {
.cmd = NLBL_UNLABEL_C_STATICADD, .cmd = NLBL_UNLABEL_C_STATICADD,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_staticadd, .doit = netlbl_unlabel_staticadd,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_UNLABEL_C_STATICREMOVE, .cmd = NLBL_UNLABEL_C_STATICREMOVE,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_staticremove, .doit = netlbl_unlabel_staticremove,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_UNLABEL_C_STATICLIST, .cmd = NLBL_UNLABEL_C_STATICLIST,
.flags = 0, .flags = 0,
.policy = netlbl_unlabel_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_unlabel_staticlist, .dumpit = netlbl_unlabel_staticlist,
}, },
{ {
.cmd = NLBL_UNLABEL_C_STATICADDDEF, .cmd = NLBL_UNLABEL_C_STATICADDDEF,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_staticadddef, .doit = netlbl_unlabel_staticadddef,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_UNLABEL_C_STATICREMOVEDEF, .cmd = NLBL_UNLABEL_C_STATICREMOVEDEF,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_staticremovedef, .doit = netlbl_unlabel_staticremovedef,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_UNLABEL_C_STATICLISTDEF, .cmd = NLBL_UNLABEL_C_STATICLISTDEF,
.flags = 0, .flags = 0,
.policy = netlbl_unlabel_genl_policy,
.doit = NULL, .doit = NULL,
.dumpit = netlbl_unlabel_staticlistdef, .dumpit = netlbl_unlabel_staticlistdef,
}, },
{ {
.cmd = NLBL_UNLABEL_C_ACCEPT, .cmd = NLBL_UNLABEL_C_ACCEPT,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_accept, .doit = netlbl_unlabel_accept,
.dumpit = NULL, .dumpit = NULL,
}, },
{ {
.cmd = NLBL_UNLABEL_C_LIST, .cmd = NLBL_UNLABEL_C_LIST,
.flags = 0, .flags = 0,
.policy = netlbl_unlabel_genl_policy,
.doit = netlbl_unlabel_list, .doit = netlbl_unlabel_list,
.dumpit = NULL, .dumpit = NULL,
}, },
@ -1378,6 +1370,7 @@ static struct genl_family netlbl_unlabel_gnl_family __ro_after_init = {
.name = NETLBL_NLTYPE_UNLABELED_NAME, .name = NETLBL_NLTYPE_UNLABELED_NAME,
.version = NETLBL_PROTO_VERSION, .version = NETLBL_PROTO_VERSION,
.maxattr = NLBL_UNLABEL_A_MAX, .maxattr = NLBL_UNLABEL_A_MAX,
.policy = netlbl_unlabel_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = netlbl_unlabel_genl_ops, .ops = netlbl_unlabel_genl_ops,
.n_ops = ARRAY_SIZE(netlbl_unlabel_genl_ops), .n_ops = ARRAY_SIZE(netlbl_unlabel_genl_ops),

View File

@ -577,7 +577,7 @@ static int genl_family_rcv_msg(const struct genl_family *family,
if (attrbuf) { if (attrbuf) {
err = nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr, err = nlmsg_parse(nlh, hdrlen, attrbuf, family->maxattr,
ops->policy, extack); family->policy, extack);
if (err < 0) if (err < 0)
goto out; goto out;
} }
@ -677,7 +677,7 @@ static int ctrl_fill_info(const struct genl_family *family, u32 portid, u32 seq,
op_flags |= GENL_CMD_CAP_DUMP; op_flags |= GENL_CMD_CAP_DUMP;
if (ops->doit) if (ops->doit)
op_flags |= GENL_CMD_CAP_DO; op_flags |= GENL_CMD_CAP_DO;
if (ops->policy) if (family->policy)
op_flags |= GENL_CMD_CAP_HASPOL; op_flags |= GENL_CMD_CAP_HASPOL;
nest = nla_nest_start(skb, i + 1); nest = nla_nest_start(skb, i + 1);
@ -939,7 +939,6 @@ static const struct genl_ops genl_ctrl_ops[] = {
.cmd = CTRL_CMD_GETFAMILY, .cmd = CTRL_CMD_GETFAMILY,
.doit = ctrl_getfamily, .doit = ctrl_getfamily,
.dumpit = ctrl_dumpfamily, .dumpit = ctrl_dumpfamily,
.policy = ctrl_policy,
}, },
}; };
@ -957,6 +956,7 @@ static struct genl_family genl_ctrl __ro_after_init = {
.name = "nlctrl", .name = "nlctrl",
.version = 0x2, .version = 0x2,
.maxattr = CTRL_ATTR_MAX, .maxattr = CTRL_ATTR_MAX,
.policy = ctrl_policy,
.netnsok = true, .netnsok = true,
}; };

View File

@ -1670,99 +1670,80 @@ static const struct genl_ops nfc_genl_ops[] = {
.doit = nfc_genl_get_device, .doit = nfc_genl_get_device,
.dumpit = nfc_genl_dump_devices, .dumpit = nfc_genl_dump_devices,
.done = nfc_genl_dump_devices_done, .done = nfc_genl_dump_devices_done,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DEV_UP, .cmd = NFC_CMD_DEV_UP,
.doit = nfc_genl_dev_up, .doit = nfc_genl_dev_up,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DEV_DOWN, .cmd = NFC_CMD_DEV_DOWN,
.doit = nfc_genl_dev_down, .doit = nfc_genl_dev_down,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_START_POLL, .cmd = NFC_CMD_START_POLL,
.doit = nfc_genl_start_poll, .doit = nfc_genl_start_poll,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_STOP_POLL, .cmd = NFC_CMD_STOP_POLL,
.doit = nfc_genl_stop_poll, .doit = nfc_genl_stop_poll,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DEP_LINK_UP, .cmd = NFC_CMD_DEP_LINK_UP,
.doit = nfc_genl_dep_link_up, .doit = nfc_genl_dep_link_up,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DEP_LINK_DOWN, .cmd = NFC_CMD_DEP_LINK_DOWN,
.doit = nfc_genl_dep_link_down, .doit = nfc_genl_dep_link_down,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_GET_TARGET, .cmd = NFC_CMD_GET_TARGET,
.dumpit = nfc_genl_dump_targets, .dumpit = nfc_genl_dump_targets,
.done = nfc_genl_dump_targets_done, .done = nfc_genl_dump_targets_done,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_LLC_GET_PARAMS, .cmd = NFC_CMD_LLC_GET_PARAMS,
.doit = nfc_genl_llc_get_params, .doit = nfc_genl_llc_get_params,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_LLC_SET_PARAMS, .cmd = NFC_CMD_LLC_SET_PARAMS,
.doit = nfc_genl_llc_set_params, .doit = nfc_genl_llc_set_params,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_LLC_SDREQ, .cmd = NFC_CMD_LLC_SDREQ,
.doit = nfc_genl_llc_sdreq, .doit = nfc_genl_llc_sdreq,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_FW_DOWNLOAD, .cmd = NFC_CMD_FW_DOWNLOAD,
.doit = nfc_genl_fw_download, .doit = nfc_genl_fw_download,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_ENABLE_SE, .cmd = NFC_CMD_ENABLE_SE,
.doit = nfc_genl_enable_se, .doit = nfc_genl_enable_se,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DISABLE_SE, .cmd = NFC_CMD_DISABLE_SE,
.doit = nfc_genl_disable_se, .doit = nfc_genl_disable_se,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_GET_SE, .cmd = NFC_CMD_GET_SE,
.dumpit = nfc_genl_dump_ses, .dumpit = nfc_genl_dump_ses,
.done = nfc_genl_dump_ses_done, .done = nfc_genl_dump_ses_done,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_SE_IO, .cmd = NFC_CMD_SE_IO,
.doit = nfc_genl_se_io, .doit = nfc_genl_se_io,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_ACTIVATE_TARGET, .cmd = NFC_CMD_ACTIVATE_TARGET,
.doit = nfc_genl_activate_target, .doit = nfc_genl_activate_target,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_VENDOR, .cmd = NFC_CMD_VENDOR,
.doit = nfc_genl_vendor_cmd, .doit = nfc_genl_vendor_cmd,
.policy = nfc_genl_policy,
}, },
{ {
.cmd = NFC_CMD_DEACTIVATE_TARGET, .cmd = NFC_CMD_DEACTIVATE_TARGET,
.doit = nfc_genl_deactivate_target, .doit = nfc_genl_deactivate_target,
.policy = nfc_genl_policy,
}, },
}; };
@ -1771,6 +1752,7 @@ static struct genl_family nfc_genl_family __ro_after_init = {
.name = NFC_GENL_NAME, .name = NFC_GENL_NAME,
.version = NFC_GENL_VERSION, .version = NFC_GENL_VERSION,
.maxattr = NFC_ATTR_MAX, .maxattr = NFC_ATTR_MAX,
.policy = nfc_genl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = nfc_genl_ops, .ops = nfc_genl_ops,
.n_ops = ARRAY_SIZE(nfc_genl_ops), .n_ops = ARRAY_SIZE(nfc_genl_ops),

View File

@ -2154,18 +2154,15 @@ static struct genl_ops ct_limit_genl_ops[] = {
{ .cmd = OVS_CT_LIMIT_CMD_SET, { .cmd = OVS_CT_LIMIT_CMD_SET,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
* privilege. */ * privilege. */
.policy = ct_limit_policy,
.doit = ovs_ct_limit_cmd_set, .doit = ovs_ct_limit_cmd_set,
}, },
{ .cmd = OVS_CT_LIMIT_CMD_DEL, { .cmd = OVS_CT_LIMIT_CMD_DEL,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
* privilege. */ * privilege. */
.policy = ct_limit_policy,
.doit = ovs_ct_limit_cmd_del, .doit = ovs_ct_limit_cmd_del,
}, },
{ .cmd = OVS_CT_LIMIT_CMD_GET, { .cmd = OVS_CT_LIMIT_CMD_GET,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = ct_limit_policy,
.doit = ovs_ct_limit_cmd_get, .doit = ovs_ct_limit_cmd_get,
}, },
}; };
@ -2179,6 +2176,7 @@ struct genl_family dp_ct_limit_genl_family __ro_after_init = {
.name = OVS_CT_LIMIT_FAMILY, .name = OVS_CT_LIMIT_FAMILY,
.version = OVS_CT_LIMIT_VERSION, .version = OVS_CT_LIMIT_VERSION,
.maxattr = OVS_CT_LIMIT_ATTR_MAX, .maxattr = OVS_CT_LIMIT_ATTR_MAX,
.policy = ct_limit_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = ct_limit_genl_ops, .ops = ct_limit_genl_ops,

View File

@ -639,7 +639,6 @@ static const struct nla_policy packet_policy[OVS_PACKET_ATTR_MAX + 1] = {
static const struct genl_ops dp_packet_genl_ops[] = { static const struct genl_ops dp_packet_genl_ops[] = {
{ .cmd = OVS_PACKET_CMD_EXECUTE, { .cmd = OVS_PACKET_CMD_EXECUTE,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = packet_policy,
.doit = ovs_packet_cmd_execute .doit = ovs_packet_cmd_execute
} }
}; };
@ -649,6 +648,7 @@ static struct genl_family dp_packet_genl_family __ro_after_init = {
.name = OVS_PACKET_FAMILY, .name = OVS_PACKET_FAMILY,
.version = OVS_PACKET_VERSION, .version = OVS_PACKET_VERSION,
.maxattr = OVS_PACKET_ATTR_MAX, .maxattr = OVS_PACKET_ATTR_MAX,
.policy = packet_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = dp_packet_genl_ops, .ops = dp_packet_genl_ops,
@ -1424,23 +1424,19 @@ static const struct nla_policy flow_policy[OVS_FLOW_ATTR_MAX + 1] = {
static const struct genl_ops dp_flow_genl_ops[] = { static const struct genl_ops dp_flow_genl_ops[] = {
{ .cmd = OVS_FLOW_CMD_NEW, { .cmd = OVS_FLOW_CMD_NEW,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
.doit = ovs_flow_cmd_new .doit = ovs_flow_cmd_new
}, },
{ .cmd = OVS_FLOW_CMD_DEL, { .cmd = OVS_FLOW_CMD_DEL,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
.doit = ovs_flow_cmd_del .doit = ovs_flow_cmd_del
}, },
{ .cmd = OVS_FLOW_CMD_GET, { .cmd = OVS_FLOW_CMD_GET,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = flow_policy,
.doit = ovs_flow_cmd_get, .doit = ovs_flow_cmd_get,
.dumpit = ovs_flow_cmd_dump .dumpit = ovs_flow_cmd_dump
}, },
{ .cmd = OVS_FLOW_CMD_SET, { .cmd = OVS_FLOW_CMD_SET,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = flow_policy,
.doit = ovs_flow_cmd_set, .doit = ovs_flow_cmd_set,
}, },
}; };
@ -1450,6 +1446,7 @@ static struct genl_family dp_flow_genl_family __ro_after_init = {
.name = OVS_FLOW_FAMILY, .name = OVS_FLOW_FAMILY,
.version = OVS_FLOW_VERSION, .version = OVS_FLOW_VERSION,
.maxattr = OVS_FLOW_ATTR_MAX, .maxattr = OVS_FLOW_ATTR_MAX,
.policy = flow_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = dp_flow_genl_ops, .ops = dp_flow_genl_ops,
@ -1817,23 +1814,19 @@ static const struct nla_policy datapath_policy[OVS_DP_ATTR_MAX + 1] = {
static const struct genl_ops dp_datapath_genl_ops[] = { static const struct genl_ops dp_datapath_genl_ops[] = {
{ .cmd = OVS_DP_CMD_NEW, { .cmd = OVS_DP_CMD_NEW,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
.doit = ovs_dp_cmd_new .doit = ovs_dp_cmd_new
}, },
{ .cmd = OVS_DP_CMD_DEL, { .cmd = OVS_DP_CMD_DEL,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
.doit = ovs_dp_cmd_del .doit = ovs_dp_cmd_del
}, },
{ .cmd = OVS_DP_CMD_GET, { .cmd = OVS_DP_CMD_GET,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = datapath_policy,
.doit = ovs_dp_cmd_get, .doit = ovs_dp_cmd_get,
.dumpit = ovs_dp_cmd_dump .dumpit = ovs_dp_cmd_dump
}, },
{ .cmd = OVS_DP_CMD_SET, { .cmd = OVS_DP_CMD_SET,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = datapath_policy,
.doit = ovs_dp_cmd_set, .doit = ovs_dp_cmd_set,
}, },
}; };
@ -1843,6 +1836,7 @@ static struct genl_family dp_datapath_genl_family __ro_after_init = {
.name = OVS_DATAPATH_FAMILY, .name = OVS_DATAPATH_FAMILY,
.version = OVS_DATAPATH_VERSION, .version = OVS_DATAPATH_VERSION,
.maxattr = OVS_DP_ATTR_MAX, .maxattr = OVS_DP_ATTR_MAX,
.policy = datapath_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = dp_datapath_genl_ops, .ops = dp_datapath_genl_ops,
@ -2260,23 +2254,19 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = {
static const struct genl_ops dp_vport_genl_ops[] = { static const struct genl_ops dp_vport_genl_ops[] = {
{ .cmd = OVS_VPORT_CMD_NEW, { .cmd = OVS_VPORT_CMD_NEW,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
.doit = ovs_vport_cmd_new .doit = ovs_vport_cmd_new
}, },
{ .cmd = OVS_VPORT_CMD_DEL, { .cmd = OVS_VPORT_CMD_DEL,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
.doit = ovs_vport_cmd_del .doit = ovs_vport_cmd_del
}, },
{ .cmd = OVS_VPORT_CMD_GET, { .cmd = OVS_VPORT_CMD_GET,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = vport_policy,
.doit = ovs_vport_cmd_get, .doit = ovs_vport_cmd_get,
.dumpit = ovs_vport_cmd_dump .dumpit = ovs_vport_cmd_dump
}, },
{ .cmd = OVS_VPORT_CMD_SET, { .cmd = OVS_VPORT_CMD_SET,
.flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */ .flags = GENL_UNS_ADMIN_PERM, /* Requires CAP_NET_ADMIN privilege. */
.policy = vport_policy,
.doit = ovs_vport_cmd_set, .doit = ovs_vport_cmd_set,
}, },
}; };
@ -2286,6 +2276,7 @@ struct genl_family dp_vport_genl_family __ro_after_init = {
.name = OVS_VPORT_FAMILY, .name = OVS_VPORT_FAMILY,
.version = OVS_VPORT_VERSION, .version = OVS_VPORT_VERSION,
.maxattr = OVS_VPORT_ATTR_MAX, .maxattr = OVS_VPORT_ATTR_MAX,
.policy = vport_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = dp_vport_genl_ops, .ops = dp_vport_genl_ops,

View File

@ -527,26 +527,22 @@ bool ovs_meter_execute(struct datapath *dp, struct sk_buff *skb,
static struct genl_ops dp_meter_genl_ops[] = { static struct genl_ops dp_meter_genl_ops[] = {
{ .cmd = OVS_METER_CMD_FEATURES, { .cmd = OVS_METER_CMD_FEATURES,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = meter_policy,
.doit = ovs_meter_cmd_features .doit = ovs_meter_cmd_features
}, },
{ .cmd = OVS_METER_CMD_SET, { .cmd = OVS_METER_CMD_SET,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
* privilege. * privilege.
*/ */
.policy = meter_policy,
.doit = ovs_meter_cmd_set, .doit = ovs_meter_cmd_set,
}, },
{ .cmd = OVS_METER_CMD_GET, { .cmd = OVS_METER_CMD_GET,
.flags = 0, /* OK for unprivileged users. */ .flags = 0, /* OK for unprivileged users. */
.policy = meter_policy,
.doit = ovs_meter_cmd_get, .doit = ovs_meter_cmd_get,
}, },
{ .cmd = OVS_METER_CMD_DEL, { .cmd = OVS_METER_CMD_DEL,
.flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN .flags = GENL_ADMIN_PERM, /* Requires CAP_NET_ADMIN
* privilege. * privilege.
*/ */
.policy = meter_policy,
.doit = ovs_meter_cmd_del .doit = ovs_meter_cmd_del
}, },
}; };
@ -560,6 +556,7 @@ struct genl_family dp_meter_genl_family __ro_after_init = {
.name = OVS_METER_FAMILY, .name = OVS_METER_FAMILY,
.version = OVS_METER_VERSION, .version = OVS_METER_VERSION,
.maxattr = OVS_METER_ATTR_MAX, .maxattr = OVS_METER_ATTR_MAX,
.policy = meter_policy,
.netnsok = true, .netnsok = true,
.parallel_ops = true, .parallel_ops = true,
.ops = dp_meter_genl_ops, .ops = dp_meter_genl_ops,

View File

@ -611,7 +611,6 @@ static const struct genl_ops smc_pnet_ops[] = {
{ {
.cmd = SMC_PNETID_GET, .cmd = SMC_PNETID_GET,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = smc_pnet_policy,
.doit = smc_pnet_get, .doit = smc_pnet_get,
.dumpit = smc_pnet_dump, .dumpit = smc_pnet_dump,
.start = smc_pnet_dump_start .start = smc_pnet_dump_start
@ -619,19 +618,16 @@ static const struct genl_ops smc_pnet_ops[] = {
{ {
.cmd = SMC_PNETID_ADD, .cmd = SMC_PNETID_ADD,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = smc_pnet_policy,
.doit = smc_pnet_add .doit = smc_pnet_add
}, },
{ {
.cmd = SMC_PNETID_DEL, .cmd = SMC_PNETID_DEL,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = smc_pnet_policy,
.doit = smc_pnet_del .doit = smc_pnet_del
}, },
{ {
.cmd = SMC_PNETID_FLUSH, .cmd = SMC_PNETID_FLUSH,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = smc_pnet_policy,
.doit = smc_pnet_flush .doit = smc_pnet_flush
} }
}; };
@ -642,6 +638,7 @@ static struct genl_family smc_pnet_nl_family __ro_after_init = {
.name = SMCR_GENL_FAMILY_NAME, .name = SMCR_GENL_FAMILY_NAME,
.version = SMCR_GENL_FAMILY_VERSION, .version = SMCR_GENL_FAMILY_VERSION,
.maxattr = SMC_PNETID_MAX, .maxattr = SMC_PNETID_MAX,
.policy = smc_pnet_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = smc_pnet_ops, .ops = smc_pnet_ops,

View File

@ -144,114 +144,93 @@ static const struct genl_ops tipc_genl_v2_ops[] = {
{ {
.cmd = TIPC_NL_BEARER_DISABLE, .cmd = TIPC_NL_BEARER_DISABLE,
.doit = tipc_nl_bearer_disable, .doit = tipc_nl_bearer_disable,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_BEARER_ENABLE, .cmd = TIPC_NL_BEARER_ENABLE,
.doit = tipc_nl_bearer_enable, .doit = tipc_nl_bearer_enable,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_BEARER_GET, .cmd = TIPC_NL_BEARER_GET,
.doit = tipc_nl_bearer_get, .doit = tipc_nl_bearer_get,
.dumpit = tipc_nl_bearer_dump, .dumpit = tipc_nl_bearer_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_BEARER_ADD, .cmd = TIPC_NL_BEARER_ADD,
.doit = tipc_nl_bearer_add, .doit = tipc_nl_bearer_add,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_BEARER_SET, .cmd = TIPC_NL_BEARER_SET,
.doit = tipc_nl_bearer_set, .doit = tipc_nl_bearer_set,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_SOCK_GET, .cmd = TIPC_NL_SOCK_GET,
.start = tipc_dump_start, .start = tipc_dump_start,
.dumpit = tipc_nl_sk_dump, .dumpit = tipc_nl_sk_dump,
.done = tipc_dump_done, .done = tipc_dump_done,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_PUBL_GET, .cmd = TIPC_NL_PUBL_GET,
.dumpit = tipc_nl_publ_dump, .dumpit = tipc_nl_publ_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_LINK_GET, .cmd = TIPC_NL_LINK_GET,
.doit = tipc_nl_node_get_link, .doit = tipc_nl_node_get_link,
.dumpit = tipc_nl_node_dump_link, .dumpit = tipc_nl_node_dump_link,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_LINK_SET, .cmd = TIPC_NL_LINK_SET,
.doit = tipc_nl_node_set_link, .doit = tipc_nl_node_set_link,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_LINK_RESET_STATS, .cmd = TIPC_NL_LINK_RESET_STATS,
.doit = tipc_nl_node_reset_link_stats, .doit = tipc_nl_node_reset_link_stats,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_MEDIA_GET, .cmd = TIPC_NL_MEDIA_GET,
.doit = tipc_nl_media_get, .doit = tipc_nl_media_get,
.dumpit = tipc_nl_media_dump, .dumpit = tipc_nl_media_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_MEDIA_SET, .cmd = TIPC_NL_MEDIA_SET,
.doit = tipc_nl_media_set, .doit = tipc_nl_media_set,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_NODE_GET, .cmd = TIPC_NL_NODE_GET,
.dumpit = tipc_nl_node_dump, .dumpit = tipc_nl_node_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_NET_GET, .cmd = TIPC_NL_NET_GET,
.dumpit = tipc_nl_net_dump, .dumpit = tipc_nl_net_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_NET_SET, .cmd = TIPC_NL_NET_SET,
.doit = tipc_nl_net_set, .doit = tipc_nl_net_set,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_NAME_TABLE_GET, .cmd = TIPC_NL_NAME_TABLE_GET,
.dumpit = tipc_nl_name_table_dump, .dumpit = tipc_nl_name_table_dump,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_MON_SET, .cmd = TIPC_NL_MON_SET,
.doit = tipc_nl_node_set_monitor, .doit = tipc_nl_node_set_monitor,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_MON_GET, .cmd = TIPC_NL_MON_GET,
.doit = tipc_nl_node_get_monitor, .doit = tipc_nl_node_get_monitor,
.dumpit = tipc_nl_node_dump_monitor, .dumpit = tipc_nl_node_dump_monitor,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_MON_PEER_GET, .cmd = TIPC_NL_MON_PEER_GET,
.dumpit = tipc_nl_node_dump_monitor_peer, .dumpit = tipc_nl_node_dump_monitor_peer,
.policy = tipc_nl_policy,
}, },
{ {
.cmd = TIPC_NL_PEER_REMOVE, .cmd = TIPC_NL_PEER_REMOVE,
.doit = tipc_nl_peer_rm, .doit = tipc_nl_peer_rm,
.policy = tipc_nl_policy,
}, },
#ifdef CONFIG_TIPC_MEDIA_UDP #ifdef CONFIG_TIPC_MEDIA_UDP
{ {
.cmd = TIPC_NL_UDP_GET_REMOTEIP, .cmd = TIPC_NL_UDP_GET_REMOTEIP,
.dumpit = tipc_udp_nl_dump_remoteip, .dumpit = tipc_udp_nl_dump_remoteip,
.policy = tipc_nl_policy,
}, },
#endif #endif
}; };
@ -261,6 +240,7 @@ struct genl_family tipc_genl_family __ro_after_init = {
.version = TIPC_GENL_V2_VERSION, .version = TIPC_GENL_V2_VERSION,
.hdrsize = 0, .hdrsize = 0,
.maxattr = TIPC_NLA_MAX, .maxattr = TIPC_NLA_MAX,
.policy = tipc_nl_policy,
.netnsok = true, .netnsok = true,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = tipc_genl_v2_ops, .ops = tipc_genl_v2_ops,

View File

@ -420,25 +420,21 @@ static const struct genl_ops wimax_gnl_ops[] = {
{ {
.cmd = WIMAX_GNL_OP_MSG_FROM_USER, .cmd = WIMAX_GNL_OP_MSG_FROM_USER,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_policy,
.doit = wimax_gnl_doit_msg_from_user, .doit = wimax_gnl_doit_msg_from_user,
}, },
{ {
.cmd = WIMAX_GNL_OP_RESET, .cmd = WIMAX_GNL_OP_RESET,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_policy,
.doit = wimax_gnl_doit_reset, .doit = wimax_gnl_doit_reset,
}, },
{ {
.cmd = WIMAX_GNL_OP_RFKILL, .cmd = WIMAX_GNL_OP_RFKILL,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_policy,
.doit = wimax_gnl_doit_rfkill, .doit = wimax_gnl_doit_rfkill,
}, },
{ {
.cmd = WIMAX_GNL_OP_STATE_GET, .cmd = WIMAX_GNL_OP_STATE_GET,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.policy = wimax_gnl_policy,
.doit = wimax_gnl_doit_state_get, .doit = wimax_gnl_doit_state_get,
}, },
}; };
@ -582,6 +578,7 @@ struct genl_family wimax_gnl_family __ro_after_init = {
.version = WIMAX_GNL_VERSION, .version = WIMAX_GNL_VERSION,
.hdrsize = 0, .hdrsize = 0,
.maxattr = WIMAX_GNL_ATTR_MAX, .maxattr = WIMAX_GNL_ATTR_MAX,
.policy = wimax_gnl_policy,
.module = THIS_MODULE, .module = THIS_MODULE,
.ops = wimax_gnl_ops, .ops = wimax_gnl_ops,
.n_ops = ARRAY_SIZE(wimax_gnl_ops), .n_ops = ARRAY_SIZE(wimax_gnl_ops),

View File

@ -13368,7 +13368,6 @@ static const struct genl_ops nl80211_ops[] = {
.doit = nl80211_get_wiphy, .doit = nl80211_get_wiphy,
.dumpit = nl80211_dump_wiphy, .dumpit = nl80211_dump_wiphy,
.done = nl80211_dump_wiphy_done, .done = nl80211_dump_wiphy_done,
.policy = nl80211_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13376,7 +13375,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_WIPHY, .cmd = NL80211_CMD_SET_WIPHY,
.doit = nl80211_set_wiphy, .doit = nl80211_set_wiphy,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_RTNL, .internal_flags = NL80211_FLAG_NEED_RTNL,
}, },
@ -13384,7 +13382,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_GET_INTERFACE, .cmd = NL80211_CMD_GET_INTERFACE,
.doit = nl80211_get_interface, .doit = nl80211_get_interface,
.dumpit = nl80211_dump_interface, .dumpit = nl80211_dump_interface,
.policy = nl80211_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL80211_FLAG_NEED_WDEV | .internal_flags = NL80211_FLAG_NEED_WDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13392,7 +13389,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_INTERFACE, .cmd = NL80211_CMD_SET_INTERFACE,
.doit = nl80211_set_interface, .doit = nl80211_set_interface,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13400,7 +13396,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_NEW_INTERFACE, .cmd = NL80211_CMD_NEW_INTERFACE,
.doit = nl80211_new_interface, .doit = nl80211_new_interface,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13408,7 +13403,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_INTERFACE, .cmd = NL80211_CMD_DEL_INTERFACE,
.doit = nl80211_del_interface, .doit = nl80211_del_interface,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV | .internal_flags = NL80211_FLAG_NEED_WDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13416,7 +13410,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_KEY, .cmd = NL80211_CMD_GET_KEY,
.doit = nl80211_get_key, .doit = nl80211_get_key,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13424,7 +13417,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_KEY, .cmd = NL80211_CMD_SET_KEY,
.doit = nl80211_set_key, .doit = nl80211_set_key,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL | NL80211_FLAG_NEED_RTNL |
@ -13433,7 +13425,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_NEW_KEY, .cmd = NL80211_CMD_NEW_KEY,
.doit = nl80211_new_key, .doit = nl80211_new_key,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL | NL80211_FLAG_NEED_RTNL |
@ -13442,14 +13433,12 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_KEY, .cmd = NL80211_CMD_DEL_KEY,
.doit = nl80211_del_key, .doit = nl80211_del_key,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_SET_BEACON, .cmd = NL80211_CMD_SET_BEACON,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.doit = nl80211_set_beacon, .doit = nl80211_set_beacon,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
@ -13457,7 +13446,6 @@ static const struct genl_ops nl80211_ops[] = {
}, },
{ {
.cmd = NL80211_CMD_START_AP, .cmd = NL80211_CMD_START_AP,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.doit = nl80211_start_ap, .doit = nl80211_start_ap,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
@ -13465,7 +13453,6 @@ static const struct genl_ops nl80211_ops[] = {
}, },
{ {
.cmd = NL80211_CMD_STOP_AP, .cmd = NL80211_CMD_STOP_AP,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.doit = nl80211_stop_ap, .doit = nl80211_stop_ap,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
@ -13475,14 +13462,12 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_GET_STATION, .cmd = NL80211_CMD_GET_STATION,
.doit = nl80211_get_station, .doit = nl80211_get_station,
.dumpit = nl80211_dump_station, .dumpit = nl80211_dump_station,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_SET_STATION, .cmd = NL80211_CMD_SET_STATION,
.doit = nl80211_set_station, .doit = nl80211_set_station,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13490,7 +13475,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_NEW_STATION, .cmd = NL80211_CMD_NEW_STATION,
.doit = nl80211_new_station, .doit = nl80211_new_station,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13498,7 +13482,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_STATION, .cmd = NL80211_CMD_DEL_STATION,
.doit = nl80211_del_station, .doit = nl80211_del_station,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13507,7 +13490,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_GET_MPATH, .cmd = NL80211_CMD_GET_MPATH,
.doit = nl80211_get_mpath, .doit = nl80211_get_mpath,
.dumpit = nl80211_dump_mpath, .dumpit = nl80211_dump_mpath,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13516,7 +13498,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_GET_MPP, .cmd = NL80211_CMD_GET_MPP,
.doit = nl80211_get_mpp, .doit = nl80211_get_mpp,
.dumpit = nl80211_dump_mpp, .dumpit = nl80211_dump_mpp,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13524,7 +13505,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_MPATH, .cmd = NL80211_CMD_SET_MPATH,
.doit = nl80211_set_mpath, .doit = nl80211_set_mpath,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13532,7 +13512,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_NEW_MPATH, .cmd = NL80211_CMD_NEW_MPATH,
.doit = nl80211_new_mpath, .doit = nl80211_new_mpath,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13540,7 +13519,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_MPATH, .cmd = NL80211_CMD_DEL_MPATH,
.doit = nl80211_del_mpath, .doit = nl80211_del_mpath,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13548,7 +13526,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_BSS, .cmd = NL80211_CMD_SET_BSS,
.doit = nl80211_set_bss, .doit = nl80211_set_bss,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13557,7 +13534,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_GET_REG, .cmd = NL80211_CMD_GET_REG,
.doit = nl80211_get_reg_do, .doit = nl80211_get_reg_do,
.dumpit = nl80211_get_reg_dump, .dumpit = nl80211_get_reg_dump,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_RTNL, .internal_flags = NL80211_FLAG_NEED_RTNL,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
}, },
@ -13565,7 +13541,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_REG, .cmd = NL80211_CMD_SET_REG,
.doit = nl80211_set_reg, .doit = nl80211_set_reg,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_RTNL, .internal_flags = NL80211_FLAG_NEED_RTNL,
}, },
@ -13573,19 +13548,16 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_REQ_SET_REG, .cmd = NL80211_CMD_REQ_SET_REG,
.doit = nl80211_req_set_reg, .doit = nl80211_req_set_reg,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NL80211_CMD_RELOAD_REGDB, .cmd = NL80211_CMD_RELOAD_REGDB,
.doit = nl80211_reload_regdb, .doit = nl80211_reload_regdb,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
}, },
{ {
.cmd = NL80211_CMD_GET_MESH_CONFIG, .cmd = NL80211_CMD_GET_MESH_CONFIG,
.doit = nl80211_get_mesh_config, .doit = nl80211_get_mesh_config,
.policy = nl80211_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13593,7 +13565,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_MESH_CONFIG, .cmd = NL80211_CMD_SET_MESH_CONFIG,
.doit = nl80211_update_mesh_config, .doit = nl80211_update_mesh_config,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13601,7 +13572,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_TRIGGER_SCAN, .cmd = NL80211_CMD_TRIGGER_SCAN,
.doit = nl80211_trigger_scan, .doit = nl80211_trigger_scan,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13609,20 +13579,17 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_ABORT_SCAN, .cmd = NL80211_CMD_ABORT_SCAN,
.doit = nl80211_abort_scan, .doit = nl80211_abort_scan,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_GET_SCAN, .cmd = NL80211_CMD_GET_SCAN,
.policy = nl80211_policy,
.dumpit = nl80211_dump_scan, .dumpit = nl80211_dump_scan,
}, },
{ {
.cmd = NL80211_CMD_START_SCHED_SCAN, .cmd = NL80211_CMD_START_SCHED_SCAN,
.doit = nl80211_start_sched_scan, .doit = nl80211_start_sched_scan,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13630,7 +13597,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_STOP_SCHED_SCAN, .cmd = NL80211_CMD_STOP_SCHED_SCAN,
.doit = nl80211_stop_sched_scan, .doit = nl80211_stop_sched_scan,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13638,7 +13604,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_AUTHENTICATE, .cmd = NL80211_CMD_AUTHENTICATE,
.doit = nl80211_authenticate, .doit = nl80211_authenticate,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL | NL80211_FLAG_NEED_RTNL |
@ -13647,7 +13612,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_ASSOCIATE, .cmd = NL80211_CMD_ASSOCIATE,
.doit = nl80211_associate, .doit = nl80211_associate,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13655,7 +13619,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEAUTHENTICATE, .cmd = NL80211_CMD_DEAUTHENTICATE,
.doit = nl80211_deauthenticate, .doit = nl80211_deauthenticate,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13663,7 +13626,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DISASSOCIATE, .cmd = NL80211_CMD_DISASSOCIATE,
.doit = nl80211_disassociate, .doit = nl80211_disassociate,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13671,7 +13633,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_JOIN_IBSS, .cmd = NL80211_CMD_JOIN_IBSS,
.doit = nl80211_join_ibss, .doit = nl80211_join_ibss,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13679,7 +13640,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_LEAVE_IBSS, .cmd = NL80211_CMD_LEAVE_IBSS,
.doit = nl80211_leave_ibss, .doit = nl80211_leave_ibss,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13689,7 +13649,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_TESTMODE, .cmd = NL80211_CMD_TESTMODE,
.doit = nl80211_testmode_do, .doit = nl80211_testmode_do,
.dumpit = nl80211_testmode_dump, .dumpit = nl80211_testmode_dump,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13698,7 +13657,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CONNECT, .cmd = NL80211_CMD_CONNECT,
.doit = nl80211_connect, .doit = nl80211_connect,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13706,7 +13664,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_UPDATE_CONNECT_PARAMS, .cmd = NL80211_CMD_UPDATE_CONNECT_PARAMS,
.doit = nl80211_update_connect_params, .doit = nl80211_update_connect_params,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13714,7 +13671,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DISCONNECT, .cmd = NL80211_CMD_DISCONNECT,
.doit = nl80211_disconnect, .doit = nl80211_disconnect,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13722,20 +13678,17 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_WIPHY_NETNS, .cmd = NL80211_CMD_SET_WIPHY_NETNS,
.doit = nl80211_wiphy_netns, .doit = nl80211_wiphy_netns,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_GET_SURVEY, .cmd = NL80211_CMD_GET_SURVEY,
.policy = nl80211_policy,
.dumpit = nl80211_dump_survey, .dumpit = nl80211_dump_survey,
}, },
{ {
.cmd = NL80211_CMD_SET_PMKSA, .cmd = NL80211_CMD_SET_PMKSA,
.doit = nl80211_setdel_pmksa, .doit = nl80211_setdel_pmksa,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13743,7 +13696,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_PMKSA, .cmd = NL80211_CMD_DEL_PMKSA,
.doit = nl80211_setdel_pmksa, .doit = nl80211_setdel_pmksa,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13751,7 +13703,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_FLUSH_PMKSA, .cmd = NL80211_CMD_FLUSH_PMKSA,
.doit = nl80211_flush_pmksa, .doit = nl80211_flush_pmksa,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13759,7 +13710,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_REMAIN_ON_CHANNEL, .cmd = NL80211_CMD_REMAIN_ON_CHANNEL,
.doit = nl80211_remain_on_channel, .doit = nl80211_remain_on_channel,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13767,7 +13717,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, .cmd = NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
.doit = nl80211_cancel_remain_on_channel, .doit = nl80211_cancel_remain_on_channel,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13775,7 +13724,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_TX_BITRATE_MASK, .cmd = NL80211_CMD_SET_TX_BITRATE_MASK,
.doit = nl80211_set_tx_bitrate_mask, .doit = nl80211_set_tx_bitrate_mask,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13783,7 +13731,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_REGISTER_FRAME, .cmd = NL80211_CMD_REGISTER_FRAME,
.doit = nl80211_register_mgmt, .doit = nl80211_register_mgmt,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV | .internal_flags = NL80211_FLAG_NEED_WDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13791,7 +13738,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_FRAME, .cmd = NL80211_CMD_FRAME,
.doit = nl80211_tx_mgmt, .doit = nl80211_tx_mgmt,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13799,7 +13745,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_FRAME_WAIT_CANCEL, .cmd = NL80211_CMD_FRAME_WAIT_CANCEL,
.doit = nl80211_tx_mgmt_cancel_wait, .doit = nl80211_tx_mgmt_cancel_wait,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13807,7 +13752,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_POWER_SAVE, .cmd = NL80211_CMD_SET_POWER_SAVE,
.doit = nl80211_set_power_save, .doit = nl80211_set_power_save,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13815,7 +13759,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_POWER_SAVE, .cmd = NL80211_CMD_GET_POWER_SAVE,
.doit = nl80211_get_power_save, .doit = nl80211_get_power_save,
.policy = nl80211_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13823,7 +13766,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_CQM, .cmd = NL80211_CMD_SET_CQM,
.doit = nl80211_set_cqm, .doit = nl80211_set_cqm,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13831,7 +13773,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_CHANNEL, .cmd = NL80211_CMD_SET_CHANNEL,
.doit = nl80211_set_channel, .doit = nl80211_set_channel,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13839,7 +13780,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_WDS_PEER, .cmd = NL80211_CMD_SET_WDS_PEER,
.doit = nl80211_set_wds_peer, .doit = nl80211_set_wds_peer,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13847,7 +13787,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_JOIN_MESH, .cmd = NL80211_CMD_JOIN_MESH,
.doit = nl80211_join_mesh, .doit = nl80211_join_mesh,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13855,7 +13794,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_LEAVE_MESH, .cmd = NL80211_CMD_LEAVE_MESH,
.doit = nl80211_leave_mesh, .doit = nl80211_leave_mesh,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13863,7 +13801,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_JOIN_OCB, .cmd = NL80211_CMD_JOIN_OCB,
.doit = nl80211_join_ocb, .doit = nl80211_join_ocb,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13871,7 +13808,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_LEAVE_OCB, .cmd = NL80211_CMD_LEAVE_OCB,
.doit = nl80211_leave_ocb, .doit = nl80211_leave_ocb,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13880,7 +13816,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_WOWLAN, .cmd = NL80211_CMD_GET_WOWLAN,
.doit = nl80211_get_wowlan, .doit = nl80211_get_wowlan,
.policy = nl80211_policy,
/* can be retrieved by unprivileged users */ /* can be retrieved by unprivileged users */
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13888,7 +13823,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_WOWLAN, .cmd = NL80211_CMD_SET_WOWLAN,
.doit = nl80211_set_wowlan, .doit = nl80211_set_wowlan,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13897,7 +13831,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_REKEY_OFFLOAD, .cmd = NL80211_CMD_SET_REKEY_OFFLOAD,
.doit = nl80211_set_rekey_data, .doit = nl80211_set_rekey_data,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL | NL80211_FLAG_NEED_RTNL |
@ -13906,7 +13839,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_TDLS_MGMT, .cmd = NL80211_CMD_TDLS_MGMT,
.doit = nl80211_tdls_mgmt, .doit = nl80211_tdls_mgmt,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13914,7 +13846,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_TDLS_OPER, .cmd = NL80211_CMD_TDLS_OPER,
.doit = nl80211_tdls_oper, .doit = nl80211_tdls_oper,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13922,7 +13853,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_UNEXPECTED_FRAME, .cmd = NL80211_CMD_UNEXPECTED_FRAME,
.doit = nl80211_register_unexpected_frame, .doit = nl80211_register_unexpected_frame,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13930,7 +13860,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_PROBE_CLIENT, .cmd = NL80211_CMD_PROBE_CLIENT,
.doit = nl80211_probe_client, .doit = nl80211_probe_client,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13938,7 +13867,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_REGISTER_BEACONS, .cmd = NL80211_CMD_REGISTER_BEACONS,
.doit = nl80211_register_beacons, .doit = nl80211_register_beacons,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13946,7 +13874,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_NOACK_MAP, .cmd = NL80211_CMD_SET_NOACK_MAP,
.doit = nl80211_set_noack_map, .doit = nl80211_set_noack_map,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13954,7 +13881,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_START_P2P_DEVICE, .cmd = NL80211_CMD_START_P2P_DEVICE,
.doit = nl80211_start_p2p_device, .doit = nl80211_start_p2p_device,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV | .internal_flags = NL80211_FLAG_NEED_WDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13962,7 +13888,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_STOP_P2P_DEVICE, .cmd = NL80211_CMD_STOP_P2P_DEVICE,
.doit = nl80211_stop_p2p_device, .doit = nl80211_stop_p2p_device,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13970,7 +13895,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_START_NAN, .cmd = NL80211_CMD_START_NAN,
.doit = nl80211_start_nan, .doit = nl80211_start_nan,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV | .internal_flags = NL80211_FLAG_NEED_WDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13978,7 +13902,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_STOP_NAN, .cmd = NL80211_CMD_STOP_NAN,
.doit = nl80211_stop_nan, .doit = nl80211_stop_nan,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13986,7 +13909,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_ADD_NAN_FUNCTION, .cmd = NL80211_CMD_ADD_NAN_FUNCTION,
.doit = nl80211_nan_add_func, .doit = nl80211_nan_add_func,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -13994,7 +13916,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_NAN_FUNCTION, .cmd = NL80211_CMD_DEL_NAN_FUNCTION,
.doit = nl80211_nan_del_func, .doit = nl80211_nan_del_func,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14002,7 +13923,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CHANGE_NAN_CONFIG, .cmd = NL80211_CMD_CHANGE_NAN_CONFIG,
.doit = nl80211_nan_change_config, .doit = nl80211_nan_change_config,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14010,7 +13930,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_MCAST_RATE, .cmd = NL80211_CMD_SET_MCAST_RATE,
.doit = nl80211_set_mcast_rate, .doit = nl80211_set_mcast_rate,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14018,7 +13937,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_MAC_ACL, .cmd = NL80211_CMD_SET_MAC_ACL,
.doit = nl80211_set_mac_acl, .doit = nl80211_set_mac_acl,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14026,7 +13944,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_RADAR_DETECT, .cmd = NL80211_CMD_RADAR_DETECT,
.doit = nl80211_start_radar_detection, .doit = nl80211_start_radar_detection,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14034,12 +13951,10 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_PROTOCOL_FEATURES, .cmd = NL80211_CMD_GET_PROTOCOL_FEATURES,
.doit = nl80211_get_protocol_features, .doit = nl80211_get_protocol_features,
.policy = nl80211_policy,
}, },
{ {
.cmd = NL80211_CMD_UPDATE_FT_IES, .cmd = NL80211_CMD_UPDATE_FT_IES,
.doit = nl80211_update_ft_ies, .doit = nl80211_update_ft_ies,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14047,7 +13962,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CRIT_PROTOCOL_START, .cmd = NL80211_CMD_CRIT_PROTOCOL_START,
.doit = nl80211_crit_protocol_start, .doit = nl80211_crit_protocol_start,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14055,7 +13969,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CRIT_PROTOCOL_STOP, .cmd = NL80211_CMD_CRIT_PROTOCOL_STOP,
.doit = nl80211_crit_protocol_stop, .doit = nl80211_crit_protocol_stop,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14063,14 +13976,12 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_COALESCE, .cmd = NL80211_CMD_GET_COALESCE,
.doit = nl80211_get_coalesce, .doit = nl80211_get_coalesce,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_SET_COALESCE, .cmd = NL80211_CMD_SET_COALESCE,
.doit = nl80211_set_coalesce, .doit = nl80211_set_coalesce,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14078,7 +13989,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CHANNEL_SWITCH, .cmd = NL80211_CMD_CHANNEL_SWITCH,
.doit = nl80211_channel_switch, .doit = nl80211_channel_switch,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14087,7 +13997,6 @@ static const struct genl_ops nl80211_ops[] = {
.cmd = NL80211_CMD_VENDOR, .cmd = NL80211_CMD_VENDOR,
.doit = nl80211_vendor_cmd, .doit = nl80211_vendor_cmd,
.dumpit = nl80211_vendor_cmd_dump, .dumpit = nl80211_vendor_cmd_dump,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WIPHY | .internal_flags = NL80211_FLAG_NEED_WIPHY |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14095,7 +14004,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_QOS_MAP, .cmd = NL80211_CMD_SET_QOS_MAP,
.doit = nl80211_set_qos_map, .doit = nl80211_set_qos_map,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14103,7 +14011,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_ADD_TX_TS, .cmd = NL80211_CMD_ADD_TX_TS,
.doit = nl80211_add_tx_ts, .doit = nl80211_add_tx_ts,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14111,7 +14018,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_DEL_TX_TS, .cmd = NL80211_CMD_DEL_TX_TS,
.doit = nl80211_del_tx_ts, .doit = nl80211_del_tx_ts,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14119,7 +14025,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_TDLS_CHANNEL_SWITCH, .cmd = NL80211_CMD_TDLS_CHANNEL_SWITCH,
.doit = nl80211_tdls_channel_switch, .doit = nl80211_tdls_channel_switch,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14127,7 +14032,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH, .cmd = NL80211_CMD_TDLS_CANCEL_CHANNEL_SWITCH,
.doit = nl80211_tdls_cancel_channel_switch, .doit = nl80211_tdls_cancel_channel_switch,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14135,7 +14039,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_MULTICAST_TO_UNICAST, .cmd = NL80211_CMD_SET_MULTICAST_TO_UNICAST,
.doit = nl80211_set_multicast_to_unicast, .doit = nl80211_set_multicast_to_unicast,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14143,21 +14046,18 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_SET_PMK, .cmd = NL80211_CMD_SET_PMK,
.doit = nl80211_set_pmk, .doit = nl80211_set_pmk,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_DEL_PMK, .cmd = NL80211_CMD_DEL_PMK,
.doit = nl80211_del_pmk, .doit = nl80211_del_pmk,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_EXTERNAL_AUTH, .cmd = NL80211_CMD_EXTERNAL_AUTH,
.doit = nl80211_external_auth, .doit = nl80211_external_auth,
.policy = nl80211_policy,
.flags = GENL_ADMIN_PERM, .flags = GENL_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14165,7 +14065,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_CONTROL_PORT_FRAME, .cmd = NL80211_CMD_CONTROL_PORT_FRAME,
.doit = nl80211_tx_control_port, .doit = nl80211_tx_control_port,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14173,14 +14072,12 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_GET_FTM_RESPONDER_STATS, .cmd = NL80211_CMD_GET_FTM_RESPONDER_STATS,
.doit = nl80211_get_ftm_responder_stats, .doit = nl80211_get_ftm_responder_stats,
.policy = nl80211_policy,
.internal_flags = NL80211_FLAG_NEED_NETDEV | .internal_flags = NL80211_FLAG_NEED_NETDEV |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
}, },
{ {
.cmd = NL80211_CMD_PEER_MEASUREMENT_START, .cmd = NL80211_CMD_PEER_MEASUREMENT_START,
.doit = nl80211_pmsr_start, .doit = nl80211_pmsr_start,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_WDEV_UP | .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14188,7 +14085,6 @@ static const struct genl_ops nl80211_ops[] = {
{ {
.cmd = NL80211_CMD_NOTIFY_RADAR, .cmd = NL80211_CMD_NOTIFY_RADAR,
.doit = nl80211_notify_radar_detection, .doit = nl80211_notify_radar_detection,
.policy = nl80211_policy,
.flags = GENL_UNS_ADMIN_PERM, .flags = GENL_UNS_ADMIN_PERM,
.internal_flags = NL80211_FLAG_NEED_NETDEV_UP | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP |
NL80211_FLAG_NEED_RTNL, NL80211_FLAG_NEED_RTNL,
@ -14200,6 +14096,7 @@ static struct genl_family nl80211_fam __ro_after_init = {
.hdrsize = 0, /* no private header */ .hdrsize = 0, /* no private header */
.version = 1, /* no particular meaning now */ .version = 1, /* no particular meaning now */
.maxattr = NL80211_ATTR_MAX, .maxattr = NL80211_ATTR_MAX,
.policy = nl80211_policy,
.netnsok = true, .netnsok = true,
.pre_doit = nl80211_pre_doit, .pre_doit = nl80211_pre_doit,
.post_doit = nl80211_post_doit, .post_doit = nl80211_post_doit,