Skip to content

Commit 591bb27

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_hook_ops structs can be const
We no longer place these on a list so they can be const. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 5da773a commit 591bb27

File tree

18 files changed

+18
-18
lines changed

18 files changed

+18
-18
lines changed

drivers/net/ipvlan/ipvlan_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct ipvlan_netns {
1515
unsigned int ipvl_nf_hook_refcnt;
1616
};
1717

18-
static struct nf_hook_ops ipvl_nfops[] __read_mostly = {
18+
static const struct nf_hook_ops ipvl_nfops[] = {
1919
{
2020
.hook = ipvlan_nf_input,
2121
.pf = NFPROTO_IPV4,

net/bridge/br_netfilter_hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ EXPORT_SYMBOL_GPL(br_netfilter_enable);
887887

888888
/* For br_nf_post_routing, we need (prio = NF_BR_PRI_LAST), because
889889
* br_dev_queue_push_xmit is called afterwards */
890-
static struct nf_hook_ops br_nf_ops[] __read_mostly = {
890+
static const struct nf_hook_ops br_nf_ops[] = {
891891
{
892892
.hook = br_nf_pre_routing,
893893
.pf = NFPROTO_BRIDGE,

net/bridge/netfilter/ebtable_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ebt_out_hook(void *priv, struct sk_buff *skb,
7070
return ebt_do_table(skb, state, state->net->xt.frame_filter);
7171
}
7272

73-
static struct nf_hook_ops ebt_ops_filter[] __read_mostly = {
73+
static const struct nf_hook_ops ebt_ops_filter[] = {
7474
{
7575
.hook = ebt_in_hook,
7676
.pf = NFPROTO_BRIDGE,

net/bridge/netfilter/ebtable_nat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ebt_nat_out(void *priv, struct sk_buff *skb,
7070
return ebt_do_table(skb, state, state->net->xt.frame_nat);
7171
}
7272

73-
static struct nf_hook_ops ebt_ops_nat[] __read_mostly = {
73+
static const struct nf_hook_ops ebt_ops_nat[] = {
7474
{
7575
.hook = ebt_nat_out,
7676
.pf = NFPROTO_BRIDGE,

net/decnet/netfilter/dn_rtmsg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
115115
RCV_SKB_FAIL(-EINVAL);
116116
}
117117

118-
static struct nf_hook_ops dnrmg_ops __read_mostly = {
118+
static const struct nf_hook_ops dnrmg_ops = {
119119
.hook = dnrmg_hook,
120120
.pf = NFPROTO_DECNET,
121121
.hooknum = NF_DN_ROUTE,

net/ipv4/netfilter/ipt_CLUSTERIP.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ arp_mangle(void *priv,
624624
return NF_ACCEPT;
625625
}
626626

627-
static struct nf_hook_ops cip_arp_ops __read_mostly = {
627+
static const struct nf_hook_ops cip_arp_ops = {
628628
.hook = arp_mangle,
629629
.pf = NFPROTO_ARP,
630630
.hooknum = NF_ARP_OUT,

net/ipv4/netfilter/ipt_SYNPROXY.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ static unsigned int ipv4_synproxy_hook(void *priv,
416416
return NF_ACCEPT;
417417
}
418418

419-
static struct nf_hook_ops ipv4_synproxy_ops[] __read_mostly = {
419+
static const struct nf_hook_ops ipv4_synproxy_ops[] = {
420420
{
421421
.hook = ipv4_synproxy_hook,
422422
.pf = NFPROTO_IPV4,

net/ipv4/netfilter/iptable_nat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static unsigned int iptable_nat_ipv4_local_fn(void *priv,
6767
return nf_nat_ipv4_local_fn(priv, skb, state, iptable_nat_do_chain);
6868
}
6969

70-
static struct nf_hook_ops nf_nat_ipv4_ops[] __read_mostly = {
70+
static const struct nf_hook_ops nf_nat_ipv4_ops[] = {
7171
/* Before packet filtering, change destination */
7272
{
7373
.hook = iptable_nat_ipv4_in,

net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ static unsigned int ipv4_conntrack_local(void *priv,
174174

175175
/* Connection tracking may drop packets, but never alters them, so
176176
make it the first hook. */
177-
static struct nf_hook_ops ipv4_conntrack_ops[] __read_mostly = {
177+
static const struct nf_hook_ops ipv4_conntrack_ops[] = {
178178
{
179179
.hook = ipv4_conntrack_in,
180180
.pf = NFPROTO_IPV4,

net/ipv4/netfilter/nf_defrag_ipv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static unsigned int ipv4_conntrack_defrag(void *priv,
9090
return NF_ACCEPT;
9191
}
9292

93-
static struct nf_hook_ops ipv4_defrag_ops[] = {
93+
static const struct nf_hook_ops ipv4_defrag_ops[] = {
9494
{
9595
.hook = ipv4_conntrack_defrag,
9696
.pf = NFPROTO_IPV4,

net/ipv6/ila/ila_xlat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ ila_nf_input(void *priv,
208208
return NF_ACCEPT;
209209
}
210210

211-
static struct nf_hook_ops ila_nf_hook_ops[] __read_mostly = {
211+
static const struct nf_hook_ops ila_nf_hook_ops[] = {
212212
{
213213
.hook = ila_nf_input,
214214
.pf = NFPROTO_IPV6,

net/ipv6/netfilter/ip6t_SYNPROXY.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ static unsigned int ipv6_synproxy_hook(void *priv,
438438
return NF_ACCEPT;
439439
}
440440

441-
static struct nf_hook_ops ipv6_synproxy_ops[] __read_mostly = {
441+
static const struct nf_hook_ops ipv6_synproxy_ops[] = {
442442
{
443443
.hook = ipv6_synproxy_hook,
444444
.pf = NFPROTO_IPV6,

net/ipv6/netfilter/ip6table_nat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static unsigned int ip6table_nat_local_fn(void *priv,
6969
return nf_nat_ipv6_local_fn(priv, skb, state, ip6table_nat_do_chain);
7070
}
7171

72-
static struct nf_hook_ops nf_nat_ipv6_ops[] __read_mostly = {
72+
static const struct nf_hook_ops nf_nat_ipv6_ops[] = {
7373
/* Before packet filtering, change destination */
7474
{
7575
.hook = ip6table_nat_in,

net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static unsigned int ipv6_conntrack_local(void *priv,
191191
return nf_conntrack_in(state->net, PF_INET6, state->hook, skb);
192192
}
193193

194-
static struct nf_hook_ops ipv6_conntrack_ops[] __read_mostly = {
194+
static const struct nf_hook_ops ipv6_conntrack_ops[] = {
195195
{
196196
.hook = ipv6_conntrack_in,
197197
.pf = NFPROTO_IPV6,

net/ipv6/netfilter/nf_defrag_ipv6_hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static unsigned int ipv6_defrag(void *priv,
7474
return err == 0 ? NF_ACCEPT : NF_DROP;
7575
}
7676

77-
static struct nf_hook_ops ipv6_defrag_ops[] = {
77+
static const struct nf_hook_ops ipv6_defrag_ops[] = {
7878
{
7979
.hook = ipv6_defrag,
8080
.pf = NFPROTO_IPV6,

net/netfilter/ipvs/ip_vs_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2101,7 +2101,7 @@ ip_vs_forward_icmp_v6(void *priv, struct sk_buff *skb,
21012101
#endif
21022102

21032103

2104-
static struct nf_hook_ops ip_vs_ops[] __read_mostly = {
2104+
static const struct nf_hook_ops ip_vs_ops[] = {
21052105
/* After packet filtering, change source only for VS/NAT */
21062106
{
21072107
.hook = ip_vs_reply4,

security/selinux/hooks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6530,7 +6530,7 @@ security_initcall(selinux_init);
65306530

65316531
#if defined(CONFIG_NETFILTER)
65326532

6533-
static struct nf_hook_ops selinux_nf_ops[] = {
6533+
static const struct nf_hook_ops selinux_nf_ops[] = {
65346534
{
65356535
.hook = selinux_ipv4_postroute,
65366536
.pf = NFPROTO_IPV4,

security/smack/smack_netfilter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static unsigned int smack_ipv4_output(void *priv,
5858
return NF_ACCEPT;
5959
}
6060

61-
static struct nf_hook_ops smack_nf_ops[] = {
61+
static const struct nf_hook_ops smack_nf_ops[] = {
6262
{
6363
.hook = smack_ipv4_output,
6464
.pf = NFPROTO_IPV4,

0 commit comments

Comments
 (0)