History

netfilter: make function op structures const

No functional changes, these structures should be const.

Florian Westphal committed 4 years ago

Commit 285c8a71 parent 3fce1646 files · +18 −18Browse files

Unified · Split

6 files
  1. include/linux/netfilter.h +4 −4
  2. net/netfilter/core.c +5 −5
  3. net/netfilter/nf_conntrack_core.c +2 −2
  4. net/netfilter/nf_conntrack_netlink.c +2 −2
  5. net/netfilter/nf_nat_core.c +1 −1
  6. net/netfilter/nfnetlink_queue.c +4 −4
include/linux/netfilter.h+4−4
@@ -381,13 +381,13 @@ struct nf_nat_hook { · 380 unmodified lines
381381 enum ip_conntrack_dir dir);
382382 };
383383
384−extern struct nf_nat_hook __rcu *nf_nat_hook;
384+extern const struct nf_nat_hook __rcu *nf_nat_hook;
385385
386386 static inline void
387387 nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
388388 {
389389 #if IS_ENABLED(CONFIG_NF_NAT)
390− struct nf_nat_hook *nat_hook;
390+ const struct nf_nat_hook *nat_hook;
391391
392392 rcu_read_lock();
393393 nat_hook = rcu_dereference(nf_nat_hook);
@@ -464,7 +464,7 @@ struct nf_ct_hook { · 70 unmodified lines
464464 const struct sk_buff *);
465465 void (*attach)(struct sk_buff *nskb, const struct sk_buff *skb);
466466 };
467−extern struct nf_ct_hook __rcu *nf_ct_hook;
467+extern const struct nf_ct_hook __rcu *nf_ct_hook;
468468
469469 struct nlattr;
470470
@@ -479,7 +479,7 @@ struct nfnl_ct_hook { · 8 unmodified lines
479479 void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct,
480480 enum ip_conntrack_info ctinfo, s32 off);
481481 };
482−extern struct nfnl_ct_hook __rcu *nfnl_ct_hook;
482+extern const struct nfnl_ct_hook __rcu *nfnl_ct_hook;
483483
484484 /**
485485 * nf_skb_duplicated - TEE target has sent a packet
net/netfilter/core.c+5−5
@@ -666,14 +666,14 @@ EXPORT_SYMBOL(nf_hook_slow_list); · 665 unmodified lines
666666 /* This needs to be compiled in any case to avoid dependencies between the
667667 * nfnetlink_queue code and nf_conntrack.
668668 */
669−struct nfnl_ct_hook __rcu *nfnl_ct_hook __read_mostly;
669+const struct nfnl_ct_hook __rcu *nfnl_ct_hook __read_mostly;
670670 EXPORT_SYMBOL_GPL(nfnl_ct_hook);
671671
672−struct nf_ct_hook __rcu *nf_ct_hook __read_mostly;
672+const struct nf_ct_hook __rcu *nf_ct_hook __read_mostly;
673673 EXPORT_SYMBOL_GPL(nf_ct_hook);
674674
675675 #if IS_ENABLED(CONFIG_NF_CONNTRACK)
676−struct nf_nat_hook __rcu *nf_nat_hook __read_mostly;
676+const struct nf_nat_hook __rcu *nf_nat_hook __read_mostly;
677677 EXPORT_SYMBOL_GPL(nf_nat_hook);
678678
679679 /* This does not belong here, but locally generated errors need it if connection
@@ -696,7 +696,7 @@ EXPORT_SYMBOL(nf_ct_attach); · 16 unmodified lines
696696
697697 void nf_conntrack_destroy(struct nf_conntrack *nfct)
698698 {
699− struct nf_ct_hook *ct_hook;
699+ const struct nf_ct_hook *ct_hook;
700700
701701 rcu_read_lock();
702702 ct_hook = rcu_dereference(nf_ct_hook);
@@ -709,7 +709,7 @@ EXPORT_SYMBOL(nf_conntrack_destroy); · 6 unmodified lines
709709 bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple,
710710 const struct sk_buff *skb)
711711 {
712− struct nf_ct_hook *ct_hook;
712+ const struct nf_ct_hook *ct_hook;
713713 bool ret = false;
714714
715715 rcu_read_lock();
net/netfilter/nf_conntrack_core.c+2−2
@@ -2085,9 +2085,9 @@ static int __nf_conntrack_update(struct net *net, struct sk_buff *skb, · 2084 unmodified lines
20852085 struct nf_conn *ct,
20862086 enum ip_conntrack_info ctinfo)
20872087 {
2088+ const struct nf_nat_hook *nat_hook;
20882089 struct nf_conntrack_tuple_hash *h;
20892090 struct nf_conntrack_tuple tuple;
2090− struct nf_nat_hook *nat_hook;
20912091 unsigned int status;
20922092 int dataoff;
20932093 u16 l3num;
@@ -2769,7 +2769,7 @@ err_cachep: · 675 unmodified lines
27692769 return ret;
27702770 }
27712771
2772−static struct nf_ct_hook nf_conntrack_hook = {
2772+static const struct nf_ct_hook nf_conntrack_hook = {
27732773 .update = nf_conntrack_update,
27742774 .destroy = destroy_conntrack,
27752775 .get_tuple_skb = nf_conntrack_get_tuple_skb,
net/netfilter/nf_conntrack_netlink.c+2−2
@@ -1819,7 +1819,7 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct, · 1818 unmodified lines
18191819 const struct nlattr *attr)
18201820 __must_hold(RCU)
18211821 {
1822− struct nf_nat_hook *nat_hook;
1822+ const struct nf_nat_hook *nat_hook;
18231823 int err;
18241824
18251825 nat_hook = rcu_dereference(nf_nat_hook);
@@ -2921,7 +2921,7 @@ static void ctnetlink_glue_seqadj(struct sk_buff *skb, struct nf_conn *ct, · 1095 unmodified lines
29212921 nf_ct_tcp_seqadj_set(skb, ct, ctinfo, diff);
29222922 }
29232923
2924−static struct nfnl_ct_hook ctnetlink_glue_hook = {
2924+static const struct nfnl_ct_hook ctnetlink_glue_hook = {
29252925 .build_size = ctnetlink_glue_build_size,
29262926 .build = ctnetlink_glue_build,
29272927 .parse = ctnetlink_glue_parse,
net/netfilter/nf_nat_core.c+1−1
@@ -1167,7 +1167,7 @@ static struct pernet_operations nat_net_ops = { · 1166 unmodified lines
11671167 .size = sizeof(struct nat_net),
11681168 };
11691169
1170−static struct nf_nat_hook nat_hook = {
1170+static const struct nf_nat_hook nat_hook = {
11711171 .parse_nat_setup = nfnetlink_parse_nat_setup,
11721172 #ifdef CONFIG_XFRM
11731173 .decode_session = __nf_nat_decode_session,
net/netfilter/nfnetlink_queue.c+4−4
@@ -225,7 +225,7 @@ find_dequeue_entry(struct nfqnl_instance *queue, unsigned int id) · 224 unmodified lines
225225
226226 static void nfqnl_reinject(struct nf_queue_entry *entry, unsigned int verdict)
227227 {
228− struct nf_ct_hook *ct_hook;
228+ const struct nf_ct_hook *ct_hook;
229229 int err;
230230
231231 if (verdict == NF_ACCEPT ||
@@ -388,7 +388,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, · 156 unmodified lines
388388 struct net_device *outdev;
389389 struct nf_conn *ct = NULL;
390390 enum ip_conntrack_info ctinfo = 0;
391− struct nfnl_ct_hook *nfnl_ct;
391+ const struct nfnl_ct_hook *nfnl_ct;
392392 bool csum_verify;
393393 char *secdata = NULL;
394394 u32 seclen = 0;
@@ -1103,7 +1103,7 @@ static int nfqnl_recv_verdict_batch(struct sk_buff *skb, · 708 unmodified lines
11031103 return 0;
11041104 }
11051105
1106−static struct nf_conn *nfqnl_ct_parse(struct nfnl_ct_hook *nfnl_ct,
1106+static struct nf_conn *nfqnl_ct_parse(const struct nfnl_ct_hook *nfnl_ct,
11071107 const struct nlmsghdr *nlh,
11081108 const struct nlattr * const nfqa[],
11091109 struct nf_queue_entry *entry,
@@ -1170,11 +1170,11 @@ static int nfqnl_recv_verdict(struct sk_buff *skb, const struct nfnl_info *info, · 60 unmodified lines
11701170 {
11711171 struct nfnl_queue_net *q = nfnl_queue_pernet(info->net);
11721172 u_int16_t queue_num = ntohs(info->nfmsg->res_id);
1173+ const struct nfnl_ct_hook *nfnl_ct;
11731174 struct nfqnl_msg_verdict_hdr *vhdr;
11741175 enum ip_conntrack_info ctinfo;
11751176 struct nfqnl_instance *queue;
11761177 struct nf_queue_entry *entry;
1177− struct nfnl_ct_hook *nfnl_ct;
11781178 struct nf_conn *ct = NULL;
11791179 unsigned int verdict;
11801180 int err;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t