Skip to content

Commit 37b1038

Browse files
Florian Westphalklassert
authored andcommitted
xfrm: policy: make policy backend const
Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
1 parent bdba9fe commit 37b1038

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

net/ipv4/xfrm4_policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static struct dst_ops xfrm4_dst_ops_template = {
269269
.gc_thresh = INT_MAX,
270270
};
271271

272-
static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
272+
static const struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
273273
.dst_ops = &xfrm4_dst_ops_template,
274274
.dst_lookup = xfrm4_dst_lookup,
275275
.get_saddr = xfrm4_get_saddr,

net/ipv6/xfrm6_policy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ static struct dst_ops xfrm6_dst_ops_template = {
289289
.gc_thresh = INT_MAX,
290290
};
291291

292-
static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
292+
static const struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
293293
.dst_ops = &xfrm6_dst_ops_template,
294294
.dst_lookup = xfrm6_dst_lookup,
295295
.get_saddr = xfrm6_get_saddr,

net/xfrm/xfrm_policy.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct xfrm_flo {
4545
};
4646

4747
static DEFINE_SPINLOCK(xfrm_policy_afinfo_lock);
48-
static struct xfrm_policy_afinfo __rcu *xfrm_policy_afinfo[AF_INET6 + 1]
48+
static struct xfrm_policy_afinfo const __rcu *xfrm_policy_afinfo[AF_INET6 + 1]
4949
__read_mostly;
5050

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

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

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

15361536
static int xfrm_get_tos(const struct flowi *fl, int family)
15371537
{
1538-
struct xfrm_policy_afinfo *afinfo;
1538+
const struct xfrm_policy_afinfo *afinfo;
15391539
int tos = 0;
15401540

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

15991599
static inline struct xfrm_dst *xfrm_alloc_dst(struct net *net, int family)
16001600
{
1601-
struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
1601+
const struct xfrm_policy_afinfo *afinfo = xfrm_policy_get_afinfo(family);
16021602
struct dst_ops *dst_ops;
16031603
struct xfrm_dst *xdst;
16041604

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

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

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

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

24582458
if (unlikely(afinfo == NULL))

0 commit comments

Comments
 (0)