mirror of
https://github.com/a52xq-dev/kernel.git
synced 2026-10-18 21:58:11 +07:00
genetlink: no longer support using static family IDs
Static family IDs have never really been used, the only use case was the workaround I introduced for those users that assumed their family ID was also their multicast group ID. Additionally, because static family IDs would never be reserved by the generic netlink code, using a relatively low ID would only work for built-in families that can be registered immediately after generic netlink is started, which is basically only the control family (apart from the workaround code, which I also had to add code for so it would reserve those IDs) Thus, anything other than GENL_ID_GENERATE is flawed and luckily not used except in the cases I mentioned. Move those workarounds into a few lines of code, and then get rid of GENL_ID_GENERATE entirely, making it more robust. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c90c39dab3
commit
a07ea4d994
37 changed files with 24 additions and 69 deletions
|
|
@ -83,7 +83,6 @@ static const struct genl_multicast_group acpi_event_mcgrps[] = {
|
|||
};
|
||||
|
||||
static struct genl_family acpi_event_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = ACPI_GENL_FAMILY_NAME,
|
||||
.version = ACPI_GENL_VERSION,
|
||||
.maxattr = ACPI_GENL_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -1095,7 +1095,6 @@ static int gtp_genl_del_pdp(struct sk_buff *skb, struct genl_info *info)
|
|||
}
|
||||
|
||||
static struct genl_family gtp_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = "gtp",
|
||||
.version = 0,
|
||||
.hdrsize = 0,
|
||||
|
|
|
|||
|
|
@ -1422,7 +1422,6 @@ static void clear_tx_sa(struct macsec_tx_sa *tx_sa)
|
|||
}
|
||||
|
||||
static struct genl_family macsec_fam = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = MACSEC_GENL_NAME,
|
||||
.hdrsize = 0,
|
||||
.version = MACSEC_GENL_VERSION,
|
||||
|
|
|
|||
|
|
@ -2151,7 +2151,6 @@ static struct rtnl_link_ops team_link_ops __read_mostly = {
|
|||
***********************************/
|
||||
|
||||
static struct genl_family team_nl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = TEAM_GENL_NAME,
|
||||
.version = TEAM_GENL_VERSION,
|
||||
.maxattr = TEAM_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -589,7 +589,6 @@ struct hwsim_radiotap_ack_hdr {
|
|||
|
||||
/* MAC80211_HWSIM netlinf family */
|
||||
static struct genl_family hwsim_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = "MAC80211_HWSIM",
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -1369,12 +1369,6 @@ static struct genl_multicast_group pmcraid_mcgrps[] = {
|
|||
};
|
||||
|
||||
static struct genl_family pmcraid_event_family = {
|
||||
/*
|
||||
* Due to prior multicast group abuse (the code having assumed that
|
||||
* the family ID can be used as a multicast group ID) we need to
|
||||
* statically allocate a family (and thus group) ID.
|
||||
*/
|
||||
.id = GENL_ID_PMCRAID,
|
||||
.name = "pmcraid",
|
||||
.version = 1,
|
||||
.maxattr = PMCRAID_AEN_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -148,7 +148,6 @@ static const struct genl_multicast_group tcmu_mcgrps[] = {
|
|||
|
||||
/* Our generic netlink family */
|
||||
static struct genl_family tcmu_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = "TCM-USER",
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -2164,7 +2164,6 @@ static const struct genl_multicast_group thermal_event_mcgrps[] = {
|
|||
};
|
||||
|
||||
static struct genl_family thermal_event_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = THERMAL_GENL_FAMILY_NAME,
|
||||
.version = THERMAL_GENL_VERSION,
|
||||
.maxattr = THERMAL_GENL_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ static uint32_t dlm_nl_seqnum;
|
|||
static uint32_t listener_nlportid;
|
||||
|
||||
static struct genl_family family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = DLM_GENL_NAME,
|
||||
.version = DLM_GENL_VERSION,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,13 +13,6 @@ static const struct genl_multicast_group quota_mcgrps[] = {
|
|||
|
||||
/* Netlink family structure for quota */
|
||||
static struct genl_family quota_genl_family = {
|
||||
/*
|
||||
* Needed due to multicast group ID abuse - old code assumed
|
||||
* the family ID was also a valid multicast group ID (which
|
||||
* isn't true) and userspace might thus rely on it. Assign a
|
||||
* static ID for this group to make dealing with that easier.
|
||||
*/
|
||||
.id = GENL_ID_VFS_DQUOT,
|
||||
.hdrsize = 0,
|
||||
.name = "VFS_DQUOT",
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -260,7 +260,6 @@ static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
|
|||
*/
|
||||
#define ZZZ_genl_family CONCAT_(GENL_MAGIC_FAMILY, _genl_family)
|
||||
static struct genl_family ZZZ_genl_family __read_mostly = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = __stringify(GENL_MAGIC_FAMILY),
|
||||
.version = GENL_MAGIC_VERSION,
|
||||
#ifdef GENL_MAGIC_FAMILY_HDRSZ
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct genl_info;
|
|||
|
||||
/**
|
||||
* struct genl_family - generic netlink family
|
||||
* @id: protocol family idenfitier
|
||||
* @id: protocol family identifier (private)
|
||||
* @hdrsize: length of user specific header in bytes
|
||||
* @name: name of family
|
||||
* @version: protocol version
|
||||
|
|
@ -48,7 +48,7 @@ struct genl_info;
|
|||
* @n_ops: number of operations supported by this family (private)
|
||||
*/
|
||||
struct genl_family {
|
||||
unsigned int id;
|
||||
unsigned int id; /* private */
|
||||
unsigned int hdrsize;
|
||||
char name[GENL_NAMSIZ];
|
||||
unsigned int version;
|
||||
|
|
@ -149,9 +149,6 @@ static inline int genl_register_family(struct genl_family *family)
|
|||
* Registers the specified family and operations from the specified table.
|
||||
* Only one family may be registered with the same family name or identifier.
|
||||
*
|
||||
* The family id may equal GENL_ID_GENERATE causing an unique id to
|
||||
* be automatically generated and assigned.
|
||||
*
|
||||
* Either a doit or dumpit callback must be specified for every registered
|
||||
* operation or the function will fail. Only one operation structure per
|
||||
* command identifier may be registered.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ struct genlmsghdr {
|
|||
/*
|
||||
* List of reserved static generic netlink identifiers:
|
||||
*/
|
||||
#define GENL_ID_GENERATE 0
|
||||
#define GENL_ID_CTRL NLMSG_MIN_TYPE
|
||||
#define GENL_ID_VFS_DQUOT (NLMSG_MIN_TYPE + 1)
|
||||
#define GENL_ID_PMCRAID (NLMSG_MIN_TYPE + 2)
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ static int family_registered;
|
|||
struct kmem_cache *taskstats_cache;
|
||||
|
||||
static struct genl_family family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = TASKSTATS_GENL_NAME,
|
||||
.version = TASKSTATS_GENL_VERSION,
|
||||
.maxattr = TASKSTATS_CMD_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
#include "translation-table.h"
|
||||
|
||||
struct genl_family batadv_netlink_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = BATADV_NL_NAME,
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -342,7 +342,6 @@ static void devlink_nl_post_doit(const struct genl_ops *ops,
|
|||
}
|
||||
|
||||
static struct genl_family devlink_nl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.name = DEVLINK_GENL_NAME,
|
||||
.version = DEVLINK_GENL_VERSION,
|
||||
.maxattr = DEVLINK_ATTR_MAX,
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ struct dm_hw_stat_delta {
|
|||
};
|
||||
|
||||
static struct genl_family net_drop_monitor_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = "NET_DM",
|
||||
.version = 2,
|
||||
|
|
|
|||
|
|
@ -132,7 +132,6 @@ static const struct nla_policy hsr_genl_policy[HSR_A_MAX + 1] = {
|
|||
};
|
||||
|
||||
static struct genl_family hsr_genl_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = "HSR",
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ static unsigned int ieee802154_seq_num;
|
|||
static DEFINE_SPINLOCK(ieee802154_seq_lock);
|
||||
|
||||
struct genl_family nl802154_family = {
|
||||
.id = GENL_ID_GENERATE,
|
||||
.hdrsize = 0,
|
||||
.name = IEEE802154_NL_NAME,
|
||||
.version = 1,
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ static void nl802154_post_doit(const struct genl_ops *ops, struct sk_buff *skb,
|
|||
|
||||
/* the netlink family */
|
||||
static struct genl_family nl802154_fam = {
|
||||
.id = GENL_ID_GENERATE, /* don't bother with a hardcoded ID */
|
||||
.name = NL802154_GENL_NAME, /* have users key off the name instead */
|
||||
.hdrsize = 0, /* no private header */
|
||||
.version = 1, /* no particular meaning now */
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue