Skip to content

Commit ffefc0e

Browse files
committed
route: make nh_encap_ops const
1 parent 06f3c59 commit ffefc0e

File tree

7 files changed

+11
-11
lines changed

7 files changed

+11
-11
lines changed

lib/route/nexthop-encap.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ void *nh_encap_check_and_get_priv(struct rtnl_nh_encap *nh_encap,
3333
/*
3434
* MPLS encap
3535
*/
36-
extern struct nh_encap_ops mpls_encap_ops;
36+
extern const struct nh_encap_ops mpls_encap_ops;
3737

3838
/*
3939
* IPv6 encap
4040
*/
41-
extern struct nh_encap_ops ip6_encap_ops;
41+
extern const struct nh_encap_ops ip6_encap_ops;
4242

4343
/*
4444
* IPv4 encap
4545
*/
46-
extern struct nh_encap_ops ip_encap_ops;
46+
extern const struct nh_encap_ops ip_encap_ops;
4747

4848
/*
4949
* ILA encap
5050
*/
51-
extern struct nh_encap_ops ila_encap_ops;
51+
extern const struct nh_encap_ops ila_encap_ops;
5252
#endif

lib/route/nexthop_encap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include "nl-route.h"
88
#include "nexthop-encap.h"
99

10-
static struct lwtunnel_encap_type {
10+
static const struct lwtunnel_encap_type {
1111
const char *name;
12-
struct nh_encap_ops *ops;
12+
const struct nh_encap_ops *ops;
1313
} lwtunnel_encap_types[__LWTUNNEL_ENCAP_MAX] = {
1414
[LWTUNNEL_ENCAP_NONE] = { .name = "none" },
1515
[LWTUNNEL_ENCAP_MPLS] = { .name = "mpls", .ops = &mpls_encap_ops },

lib/route/nh_encap_ila.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int ila_encap_parse_msg(struct nlattr *nla,
153153
return 0;
154154
}
155155

156-
struct nh_encap_ops ila_encap_ops = {
156+
const struct nh_encap_ops ila_encap_ops = {
157157
.encap_type = LWTUNNEL_ENCAP_ILA,
158158
.build_msg = ila_encap_build_msg,
159159
.parse_msg = ila_encap_parse_msg,

lib/route/nh_encap_ip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static int ip_encap_compare(void *_a, void *_b)
211211
return diff;
212212
}
213213

214-
struct nh_encap_ops ip_encap_ops = {
214+
const struct nh_encap_ops ip_encap_ops = {
215215
.encap_type = LWTUNNEL_ENCAP_IP,
216216
.build_msg = ip_encap_build_msg,
217217
.parse_msg = ip_encap_parse_msg,

lib/route/nh_encap_ip6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int ip6_encap_compare(void *_a, void *_b)
214214
return diff;
215215
}
216216

217-
struct nh_encap_ops ip6_encap_ops = {
217+
const struct nh_encap_ops ip6_encap_ops = {
218218
.encap_type = LWTUNNEL_ENCAP_IP6,
219219
.build_msg = ip6_encap_build_msg,
220220
.parse_msg = ip6_encap_parse_msg,

lib/route/nh_encap_mpls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ static int mpls_encap_compare(void *_a, void *_b)
120120
return diff;
121121
}
122122

123-
struct nh_encap_ops mpls_encap_ops = {
123+
const struct nh_encap_ops mpls_encap_ops = {
124124
.encap_type = LWTUNNEL_ENCAP_MPLS,
125125
.build_msg = mpls_encap_build_msg,
126126
.parse_msg = mpls_encap_parse_msg,

lib/route/nl-route.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct rtnl_link {
7777
};
7878

7979
struct rtnl_nh_encap {
80-
struct nh_encap_ops *ops;
80+
const struct nh_encap_ops *ops;
8181
void *priv; /* private data for encap type */
8282
};
8383

0 commit comments

Comments
 (0)