[NETLINK]: Mark netlink policies const
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
14a49e1fd2
commit
ef7c79ed64
19 changed files with 28 additions and 28 deletions
|
@ -64,7 +64,7 @@ struct fib_rules_ops
|
||||||
void (*flush_cache)(void);
|
void (*flush_cache)(void);
|
||||||
|
|
||||||
int nlgroup;
|
int nlgroup;
|
||||||
struct nla_policy *policy;
|
const struct nla_policy *policy;
|
||||||
struct list_head *rules_list;
|
struct list_head *rules_list;
|
||||||
struct module *owner;
|
struct module *owner;
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct genl_ops
|
||||||
{
|
{
|
||||||
u8 cmd;
|
u8 cmd;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
struct nla_policy *policy;
|
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 (*dumpit)(struct sk_buff *skb,
|
int (*dumpit)(struct sk_buff *skb,
|
||||||
|
|
|
@ -213,7 +213,7 @@ extern void fib_select_default(const struct flowi *flp, struct fib_result *res);
|
||||||
#endif /* CONFIG_IP_MULTIPLE_TABLES */
|
#endif /* CONFIG_IP_MULTIPLE_TABLES */
|
||||||
|
|
||||||
/* Exported by fib_frontend.c */
|
/* Exported by fib_frontend.c */
|
||||||
extern struct nla_policy rtm_ipv4_policy[];
|
extern const struct nla_policy rtm_ipv4_policy[];
|
||||||
extern void ip_fib_init(void);
|
extern void ip_fib_init(void);
|
||||||
extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
|
||||||
struct net_device *dev, __be32 *spec_dst, u32 *itag);
|
struct net_device *dev, __be32 *spec_dst, u32 *itag);
|
||||||
|
|
|
@ -222,10 +222,10 @@ extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb,
|
||||||
gfp_t flags);
|
gfp_t flags);
|
||||||
|
|
||||||
extern int nla_validate(struct nlattr *head, int len, int maxtype,
|
extern int nla_validate(struct nlattr *head, int len, int maxtype,
|
||||||
struct nla_policy *policy);
|
const struct nla_policy *policy);
|
||||||
extern int nla_parse(struct nlattr *tb[], int maxtype,
|
extern int nla_parse(struct nlattr *tb[], int maxtype,
|
||||||
struct nlattr *head, int len,
|
struct nlattr *head, int len,
|
||||||
struct nla_policy *policy);
|
const struct nla_policy *policy);
|
||||||
extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
|
extern struct nlattr * nla_find(struct nlattr *head, int len, int attrtype);
|
||||||
extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
|
extern size_t nla_strlcpy(char *dst, const struct nlattr *nla,
|
||||||
size_t dstsize);
|
size_t dstsize);
|
||||||
|
@ -360,7 +360,7 @@ static inline struct nlmsghdr *nlmsg_next(struct nlmsghdr *nlh, int *remaining)
|
||||||
*/
|
*/
|
||||||
static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen,
|
static inline int nlmsg_parse(struct nlmsghdr *nlh, int hdrlen,
|
||||||
struct nlattr *tb[], int maxtype,
|
struct nlattr *tb[], int maxtype,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
|
if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -392,7 +392,7 @@ static inline struct nlattr *nlmsg_find_attr(struct nlmsghdr *nlh,
|
||||||
* @policy: validation policy
|
* @policy: validation policy
|
||||||
*/
|
*/
|
||||||
static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
|
static inline int nlmsg_validate(struct nlmsghdr *nlh, int hdrlen, int maxtype,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
|
if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -729,7 +729,7 @@ static inline struct nlattr *nla_find_nested(struct nlattr *nla, int attrtype)
|
||||||
*/
|
*/
|
||||||
static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
|
static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
|
||||||
struct nlattr *nla,
|
struct nlattr *nla,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
|
return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy);
|
||||||
}
|
}
|
||||||
|
@ -990,7 +990,7 @@ static inline int nla_nest_cancel(struct sk_buff *skb, struct nlattr *start)
|
||||||
* Returns 0 on success or a negative error code.
|
* Returns 0 on success or a negative error code.
|
||||||
*/
|
*/
|
||||||
static inline int nla_validate_nested(struct nlattr *start, int maxtype,
|
static inline int nla_validate_nested(struct nlattr *start, int maxtype,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
|
return nla_validate(nla_data(start), nla_len(start), maxtype, policy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1761,7 +1761,7 @@ static inline struct neigh_parms *lookup_neigh_params(struct neigh_table *tbl,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = {
|
static const struct nla_policy nl_neightbl_policy[NDTA_MAX+1] = {
|
||||||
[NDTA_NAME] = { .type = NLA_STRING },
|
[NDTA_NAME] = { .type = NLA_STRING },
|
||||||
[NDTA_THRESH1] = { .type = NLA_U32 },
|
[NDTA_THRESH1] = { .type = NLA_U32 },
|
||||||
[NDTA_THRESH2] = { .type = NLA_U32 },
|
[NDTA_THRESH2] = { .type = NLA_U32 },
|
||||||
|
@ -1770,7 +1770,7 @@ static struct nla_policy nl_neightbl_policy[NDTA_MAX+1] __read_mostly = {
|
||||||
[NDTA_PARMS] = { .type = NLA_NESTED },
|
[NDTA_PARMS] = { .type = NLA_NESTED },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] __read_mostly = {
|
static const struct nla_policy nl_ntbl_parm_policy[NDTPA_MAX+1] = {
|
||||||
[NDTPA_IFINDEX] = { .type = NLA_U32 },
|
[NDTPA_IFINDEX] = { .type = NLA_U32 },
|
||||||
[NDTPA_QUEUE_LEN] = { .type = NLA_U32 },
|
[NDTPA_QUEUE_LEN] = { .type = NLA_U32 },
|
||||||
[NDTPA_PROXY_QLEN] = { .type = NLA_U32 },
|
[NDTPA_PROXY_QLEN] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -551,7 +551,7 @@ cont:
|
||||||
return skb->len;
|
return skb->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy ifla_policy[IFLA_MAX+1] __read_mostly = {
|
static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
|
||||||
[IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
|
[IFLA_IFNAME] = { .type = NLA_STRING, .len = IFNAMSIZ-1 },
|
||||||
[IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) },
|
[IFLA_MAP] = { .len = sizeof(struct rtnl_link_ifmap) },
|
||||||
[IFLA_MTU] = { .type = NLA_U32 },
|
[IFLA_MTU] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -638,7 +638,7 @@ static struct dn_dev *dn_dev_by_index(int ifindex)
|
||||||
return dn_dev;
|
return dn_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy dn_ifa_policy[IFA_MAX+1] __read_mostly = {
|
static const struct nla_policy dn_ifa_policy[IFA_MAX+1] = {
|
||||||
[IFA_ADDRESS] = { .type = NLA_U16 },
|
[IFA_ADDRESS] = { .type = NLA_U16 },
|
||||||
[IFA_LOCAL] = { .type = NLA_U16 },
|
[IFA_LOCAL] = { .type = NLA_U16 },
|
||||||
[IFA_LABEL] = { .type = NLA_STRING,
|
[IFA_LABEL] = { .type = NLA_STRING,
|
||||||
|
|
|
@ -108,7 +108,7 @@ errout:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy dn_fib_rule_policy[FRA_MAX+1] __read_mostly = {
|
static const struct nla_policy dn_fib_rule_policy[FRA_MAX+1] = {
|
||||||
FRA_GENERIC_POLICY,
|
FRA_GENERIC_POLICY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ static struct ipv4_devconf ipv4_devconf_dflt = {
|
||||||
|
|
||||||
#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
|
#define IPV4_DEVCONF_DFLT(attr) IPV4_DEVCONF(ipv4_devconf_dflt, attr)
|
||||||
|
|
||||||
static struct nla_policy ifa_ipv4_policy[IFA_MAX+1] __read_mostly = {
|
static const struct nla_policy ifa_ipv4_policy[IFA_MAX+1] = {
|
||||||
[IFA_LOCAL] = { .type = NLA_U32 },
|
[IFA_LOCAL] = { .type = NLA_U32 },
|
||||||
[IFA_ADDRESS] = { .type = NLA_U32 },
|
[IFA_ADDRESS] = { .type = NLA_U32 },
|
||||||
[IFA_BROADCAST] = { .type = NLA_U32 },
|
[IFA_BROADCAST] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -441,7 +441,7 @@ int ip_rt_ioctl(unsigned int cmd, void __user *arg)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct nla_policy rtm_ipv4_policy[RTA_MAX+1] __read_mostly = {
|
const struct nla_policy rtm_ipv4_policy[RTA_MAX+1] = {
|
||||||
[RTA_DST] = { .type = NLA_U32 },
|
[RTA_DST] = { .type = NLA_U32 },
|
||||||
[RTA_SRC] = { .type = NLA_U32 },
|
[RTA_SRC] = { .type = NLA_U32 },
|
||||||
[RTA_IIF] = { .type = NLA_U32 },
|
[RTA_IIF] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -169,7 +169,7 @@ static struct fib_table *fib_empty_table(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy fib4_rule_policy[FRA_MAX+1] __read_mostly = {
|
static const struct nla_policy fib4_rule_policy[FRA_MAX+1] = {
|
||||||
FRA_GENERIC_POLICY,
|
FRA_GENERIC_POLICY,
|
||||||
[FRA_FLOW] = { .type = NLA_U32 },
|
[FRA_FLOW] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
|
@ -2990,7 +2990,7 @@ static struct in6_addr *extract_addr(struct nlattr *addr, struct nlattr *local)
|
||||||
return pfx;
|
return pfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy ifa_ipv6_policy[IFA_MAX+1] __read_mostly = {
|
static const struct nla_policy ifa_ipv6_policy[IFA_MAX+1] = {
|
||||||
[IFA_ADDRESS] = { .len = sizeof(struct in6_addr) },
|
[IFA_ADDRESS] = { .len = sizeof(struct in6_addr) },
|
||||||
[IFA_LOCAL] = { .len = sizeof(struct in6_addr) },
|
[IFA_LOCAL] = { .len = sizeof(struct in6_addr) },
|
||||||
[IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) },
|
[IFA_CACHEINFO] = { .len = sizeof(struct ifa_cacheinfo) },
|
||||||
|
|
|
@ -157,7 +157,7 @@ static int fib6_rule_match(struct fib_rule *rule, struct flowi *fl, int flags)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy fib6_rule_policy[FRA_MAX+1] __read_mostly = {
|
static const struct nla_policy fib6_rule_policy[FRA_MAX+1] = {
|
||||||
FRA_GENERIC_POLICY,
|
FRA_GENERIC_POLICY,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1999,7 +1999,7 @@ void rt6_mtu_change(struct net_device *dev, unsigned mtu)
|
||||||
fib6_clean_all(rt6_mtu_change_route, 0, &arg);
|
fib6_clean_all(rt6_mtu_change_route, 0, &arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy rtm_ipv6_policy[RTA_MAX+1] __read_mostly = {
|
static const struct nla_policy rtm_ipv6_policy[RTA_MAX+1] = {
|
||||||
[RTA_GATEWAY] = { .len = sizeof(struct in6_addr) },
|
[RTA_GATEWAY] = { .len = sizeof(struct in6_addr) },
|
||||||
[RTA_OIF] = { .type = NLA_U32 },
|
[RTA_OIF] = { .type = NLA_U32 },
|
||||||
[RTA_IIF] = { .type = NLA_U32 },
|
[RTA_IIF] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -59,7 +59,7 @@ static struct genl_family netlbl_cipsov4_gnl_family = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NetLabel Netlink attribute policy */
|
/* NetLabel Netlink attribute policy */
|
||||||
static struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
|
static const struct nla_policy netlbl_cipsov4_genl_policy[NLBL_CIPSOV4_A_MAX + 1] = {
|
||||||
[NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 },
|
[NLBL_CIPSOV4_A_DOI] = { .type = NLA_U32 },
|
||||||
[NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 },
|
[NLBL_CIPSOV4_A_MTYPE] = { .type = NLA_U32 },
|
||||||
[NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
|
[NLBL_CIPSOV4_A_TAG] = { .type = NLA_U8 },
|
||||||
|
|
|
@ -59,7 +59,7 @@ static struct genl_family netlbl_mgmt_gnl_family = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NetLabel Netlink attribute policy */
|
/* NetLabel Netlink attribute policy */
|
||||||
static struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
|
static const struct nla_policy netlbl_mgmt_genl_policy[NLBL_MGMT_A_MAX + 1] = {
|
||||||
[NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING },
|
[NLBL_MGMT_A_DOMAIN] = { .type = NLA_NUL_STRING },
|
||||||
[NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 },
|
[NLBL_MGMT_A_PROTOCOL] = { .type = NLA_U32 },
|
||||||
[NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
|
[NLBL_MGMT_A_VERSION] = { .type = NLA_U32 },
|
||||||
|
|
|
@ -61,7 +61,7 @@ static struct genl_family netlbl_unlabel_gnl_family = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* NetLabel Netlink attribute policy */
|
/* NetLabel Netlink attribute policy */
|
||||||
static struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
|
static const struct nla_policy netlbl_unlabel_genl_policy[NLBL_UNLABEL_A_MAX + 1] = {
|
||||||
[NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 },
|
[NLBL_UNLABEL_A_ACPTFLG] = { .type = NLA_U8 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ static u16 nla_attr_minlen[NLA_TYPE_MAX+1] __read_mostly = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static int validate_nla(struct nlattr *nla, int maxtype,
|
static int validate_nla(struct nlattr *nla, int maxtype,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
struct nla_policy *pt;
|
const struct nla_policy *pt;
|
||||||
int minlen = 0, attrlen = nla_len(nla);
|
int minlen = 0, attrlen = nla_len(nla);
|
||||||
|
|
||||||
if (nla->nla_type <= 0 || nla->nla_type > maxtype)
|
if (nla->nla_type <= 0 || nla->nla_type > maxtype)
|
||||||
|
@ -99,7 +99,7 @@ static int validate_nla(struct nlattr *nla, int maxtype,
|
||||||
* Returns 0 on success or a negative error code.
|
* Returns 0 on success or a negative error code.
|
||||||
*/
|
*/
|
||||||
int nla_validate(struct nlattr *head, int len, int maxtype,
|
int nla_validate(struct nlattr *head, int len, int maxtype,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
struct nlattr *nla;
|
struct nlattr *nla;
|
||||||
int rem, err;
|
int rem, err;
|
||||||
|
@ -130,7 +130,7 @@ errout:
|
||||||
* Returns 0 on success or a negative error code.
|
* Returns 0 on success or a negative error code.
|
||||||
*/
|
*/
|
||||||
int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
|
int nla_parse(struct nlattr *tb[], int maxtype, struct nlattr *head, int len,
|
||||||
struct nla_policy *policy)
|
const struct nla_policy *policy)
|
||||||
{
|
{
|
||||||
struct nlattr *nla;
|
struct nlattr *nla;
|
||||||
int rem, err;
|
int rem, err;
|
||||||
|
|
|
@ -472,7 +472,7 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
|
||||||
return skb;
|
return skb;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] __read_mostly = {
|
static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = {
|
||||||
[CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
|
[CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
|
||||||
[CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
|
[CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
|
||||||
.len = GENL_NAMSIZ - 1 },
|
.len = GENL_NAMSIZ - 1 },
|
||||||
|
|
Loading…
Reference in a new issue