Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37b10383 authored by Florian Westphal's avatar Florian Westphal Committed by Steffen Klassert
Browse files

xfrm: policy: make policy backend const

parent bdba9fe0
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -269,7 +269,7 @@ static struct dst_ops xfrm4_dst_ops_template = {
	.gc_thresh =		INT_MAX,
	.gc_thresh =		INT_MAX,
};
};


static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
	.dst_ops =		&xfrm4_dst_ops_template,
	.dst_ops =		&xfrm4_dst_ops_template,
	.dst_lookup =		xfrm4_dst_lookup,
	.dst_lookup =		xfrm4_dst_lookup,
	.get_saddr =		xfrm4_get_saddr,
	.get_saddr =		xfrm4_get_saddr,
+1 −1
Original line number Original line Diff line number Diff line
@@ -289,7 +289,7 @@ static struct dst_ops xfrm6_dst_ops_template = {
	.gc_thresh =		INT_MAX,
	.gc_thresh =		INT_MAX,
};
};


static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
	.dst_ops =		&xfrm6_dst_ops_template,
	.dst_ops =		&xfrm6_dst_ops_template,
	.dst_lookup =		xfrm6_dst_lookup,
	.dst_lookup =		xfrm6_dst_lookup,
	.get_saddr =		xfrm6_get_saddr,
	.get_saddr =		xfrm6_get_saddr,
+9 −9
Original line number Original line Diff line number Diff line
@@ -45,7 +45,7 @@ struct xfrm_flo {
};
};


static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock);
static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock);
static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[AF_INET6 + 1]
static struct xfrm_policy_afinfo const __rcu *xfrm_policy_afinfo[AF_INET6 + 1]
						__read_mostly;
						__read_mostly;


static struct kmem_cache *xfrm_dst_cache __read_mostly;
static struct kmem_cache *xfrm_dst_cache __read_mostly;
@@ -122,7 +122,7 @@ static inline struct dst_entry *__xfrm_dst_lookup(struct net *net,
						  const xfrm_address_t *daddr,
						  const xfrm_address_t *daddr,
						  int family)
						  int family)
{
{
	struct xfrm_policy_afinfo *afinfo;
	const struct xfrm_policy_afinfo *afinfo;
	struct dst_entry *dst;
	struct dst_entry *dst;


	afinfo = xfrm_policy_get_afinfo(family);
	afinfo = xfrm_policy_get_afinfo(family);
@@ -1426,7 +1426,7 @@ xfrm_get_saddr(struct net *net, int oif, xfrm_address_t *local,
	       xfrm_address_t *remote, unsigned short family)
	       xfrm_address_t *remote, unsigned short family)
{
{
	int err;
	int err;
	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);


	if (unlikely(afinfo == NULL))
	if (unlikely(afinfo == NULL))
		return -EINVAL;
		return -EINVAL;
@@ -1535,7 +1535,7 @@ xfrm_tmpl_resolve(struct xfrm_policy **pols, int npols, const struct flowi *fl,


static int xfrm_get_tos(const struct flowi *fl, int family)
static int xfrm_get_tos(const struct flowi *fl, int family)
{
{
	struct xfrm_policy_afinfo *afinfo;
	const struct xfrm_policy_afinfo *afinfo;
	int tos = 0;
	int tos = 0;


	afinfo = xfrm_policy_get_afinfo(family);
	afinfo = xfrm_policy_get_afinfo(family);
@@ -1598,7 +1598,7 @@ static const struct flow_cache_ops xfrm_bundle_fc_ops = {


static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
{
{
	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	struct dst_ops *dst_ops;
	struct dst_ops *dst_ops;
	struct xfrm_dst *xdst;
	struct xfrm_dst *xdst;


@@ -1635,7 +1635,7 @@ static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
				 int nfheader_len)
				 int nfheader_len)
{
{
	struct xfrm_policy_afinfo *afinfo =
	const struct xfrm_policy_afinfo *afinfo =
		xfrm_policy_get_afinfo(dst->ops->family);
		xfrm_policy_get_afinfo(dst->ops->family);
	int err;
	int err;


@@ -1652,7 +1652,7 @@ static inline int xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
static inline int xfrm_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
				const struct flowi *fl)
				const struct flowi *fl)
{
{
	struct xfrm_policy_afinfo *afinfo =
	const struct xfrm_policy_afinfo *afinfo =
		xfrm_policy_get_afinfo(xdst->u.dst.ops->family);
		xfrm_policy_get_afinfo(xdst->u.dst.ops->family);
	int err;
	int err;


@@ -2201,7 +2201,7 @@ xfrm_bundle_lookup(struct net *net, const struct flowi *fl, u16 family, u8 dir,
static struct dst_entry *make_blackhole(struct net *net, u16 family,
static struct dst_entry *make_blackhole(struct net *net, u16 family,
					struct dst_entry *dst_orig)
					struct dst_entry *dst_orig)
{
{
	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	struct dst_entry *ret;
	struct dst_entry *ret;


	if (!afinfo) {
	if (!afinfo) {
@@ -2452,7 +2452,7 @@ xfrm_policy_ok(const struct xfrm_tmpl *tmpl, const struct sec_path *sp, int star
int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
			  unsigned int family, int reverse)
			  unsigned int family, int reverse)
{
{
	struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
	int err;
	int err;


	if (unlikely(afinfo == NULL))
	if (unlikely(afinfo == NULL))