No functional changes, these structures should be const.
Unified · Split
| @@ -381,13 +381,13 @@ struct nf_nat_hook { · 380 unmodified lines | ||
| 381 | 381 | enum ip_conntrack_dir dir); |
| 382 | 382 | }; |
| 383 | 383 | |
| 384 | −extern struct nf_nat_hook __rcu *nf_nat_hook; | |
| 384 | +extern const struct nf_nat_hook __rcu *nf_nat_hook; | |
| 385 | 385 | |
| 386 | 386 | static inline void |
| 387 | 387 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family) |
| 388 | 388 | { |
| 389 | 389 | #if IS_ENABLED(CONFIG_NF_NAT) |
| 390 | − struct nf_nat_hook *nat_hook; | |
| 390 | + const struct nf_nat_hook *nat_hook; | |
| 391 | 391 | |
| 392 | 392 | rcu_read_lock(); |
| 393 | 393 | nat_hook = rcu_dereference(nf_nat_hook); |
| @@ -464,7 +464,7 @@ struct nf_ct_hook { · 70 unmodified lines | ||
| 464 | 464 | const struct sk_buff *); |
| 465 | 465 | void (*attach)(struct sk_buff *nskb, const struct sk_buff *skb); |
| 466 | 466 | }; |
| 467 | −extern struct nf_ct_hook __rcu *nf_ct_hook; | |
| 467 | +extern const struct nf_ct_hook __rcu *nf_ct_hook; | |
| 468 | 468 | |
| 469 | 469 | struct nlattr; |
| 470 | 470 | |
| @@ -479,7 +479,7 @@ struct nfnl_ct_hook { · 8 unmodified lines | ||
| 479 | 479 | void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, |
| 480 | 480 | enum ip_conntrack_info ctinfo, s32 off); |
| 481 | 481 | }; |
| 482 | −extern struct nfnl_ct_hook __rcu *nfnl_ct_hook; | |
| 482 | +extern const struct nfnl_ct_hook __rcu *nfnl_ct_hook; | |
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | 485 | * nf_skb_duplicated - TEE target has sent a packet |
| @@ -666,14 +666,14 @@ EXPORT_SYMBOL(nf_hook_slow_list); · 665 unmodified lines | ||
| 666 | 666 | /* This needs to be compiled in any case to avoid dependencies between the |
| 667 | 667 | * nfnetlink_queue code and nf_conntrack. |
| 668 | 668 | */ |
| 669 | −struct nfnl_ct_hook __rcu *nfnl_ct_hook __read_mostly; | |
| 669 | +const struct nfnl_ct_hook __rcu *nfnl_ct_hook __read_mostly; | |
| 670 | 670 | EXPORT_SYMBOL_GPL(nfnl_ct_hook); |
| 671 | 671 | |
| 672 | −struct nf_ct_hook __rcu *nf_ct_hook __read_mostly; | |
| 672 | +const struct nf_ct_hook __rcu *nf_ct_hook __read_mostly; | |
| 673 | 673 | EXPORT_SYMBOL_GPL(nf_ct_hook); |
| 674 | 674 | |
| 675 | 675 | #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; | |
| 677 | 677 | EXPORT_SYMBOL_GPL(nf_nat_hook); |
| 678 | 678 | |
| 679 | 679 | /* 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 | ||
| 696 | 696 | |
| 697 | 697 | void nf_conntrack_destroy(struct nf_conntrack *nfct) |
| 698 | 698 | { |
| 699 | − struct nf_ct_hook *ct_hook; | |
| 699 | + const struct nf_ct_hook *ct_hook; | |
| 700 | 700 | |
| 701 | 701 | rcu_read_lock(); |
| 702 | 702 | ct_hook = rcu_dereference(nf_ct_hook); |
| @@ -709,7 +709,7 @@ EXPORT_SYMBOL(nf_conntrack_destroy); · 6 unmodified lines | ||
| 709 | 709 | bool nf_ct_get_tuple_skb(struct nf_conntrack_tuple *dst_tuple, |
| 710 | 710 | const struct sk_buff *skb) |
| 711 | 711 | { |
| 712 | − struct nf_ct_hook *ct_hook; | |
| 712 | + const struct nf_ct_hook *ct_hook; | |
| 713 | 713 | bool ret = false; |
| 714 | 714 | |
| 715 | 715 | rcu_read_lock(); |
| @@ -2085,9 +2085,9 @@ static int __nf_conntrack_update(struct net *net, struct sk_buff *skb, · 2084 unmodified lines | ||
| 2085 | 2085 | struct nf_conn *ct, |
| 2086 | 2086 | enum ip_conntrack_info ctinfo) |
| 2087 | 2087 | { |
| 2088 | + const struct nf_nat_hook *nat_hook; | |
| 2088 | 2089 | struct nf_conntrack_tuple_hash *h; |
| 2089 | 2090 | struct nf_conntrack_tuple tuple; |
| 2090 | − struct nf_nat_hook *nat_hook; | |
| 2091 | 2091 | unsigned int status; |
| 2092 | 2092 | int dataoff; |
| 2093 | 2093 | u16 l3num; |
| @@ -2769,7 +2769,7 @@ err_cachep: · 675 unmodified lines | ||
| 2769 | 2769 | return ret; |
| 2770 | 2770 | } |
| 2771 | 2771 | |
| 2772 | −static struct nf_ct_hook nf_conntrack_hook = { | |
| 2772 | +static const struct nf_ct_hook nf_conntrack_hook = { | |
| 2773 | 2773 | .update = nf_conntrack_update, |
| 2774 | 2774 | .destroy = destroy_conntrack, |
| 2775 | 2775 | .get_tuple_skb = nf_conntrack_get_tuple_skb, |
| @@ -1819,7 +1819,7 @@ ctnetlink_parse_nat_setup(struct nf_conn *ct, · 1818 unmodified lines | ||
| 1819 | 1819 | const struct nlattr *attr) |
| 1820 | 1820 | __must_hold(RCU) |
| 1821 | 1821 | { |
| 1822 | − struct nf_nat_hook *nat_hook; | |
| 1822 | + const struct nf_nat_hook *nat_hook; | |
| 1823 | 1823 | int err; |
| 1824 | 1824 | |
| 1825 | 1825 | 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 | ||
| 2921 | 2921 | nf_ct_tcp_seqadj_set(skb, ct, ctinfo, diff); |
| 2922 | 2922 | } |
| 2923 | 2923 | |
| 2924 | −static struct nfnl_ct_hook ctnetlink_glue_hook = { | |
| 2924 | +static const struct nfnl_ct_hook ctnetlink_glue_hook = { | |
| 2925 | 2925 | .build_size = ctnetlink_glue_build_size, |
| 2926 | 2926 | .build = ctnetlink_glue_build, |
| 2927 | 2927 | .parse = ctnetlink_glue_parse, |
| @@ -1167,7 +1167,7 @@ static struct pernet_operations nat_net_ops = { · 1166 unmodified lines | ||
| 1167 | 1167 | .size = sizeof(struct nat_net), |
| 1168 | 1168 | }; |
| 1169 | 1169 | |
| 1170 | −static struct nf_nat_hook nat_hook = { | |
| 1170 | +static const struct nf_nat_hook nat_hook = { | |
| 1171 | 1171 | .parse_nat_setup = nfnetlink_parse_nat_setup, |
| 1172 | 1172 | #ifdef CONFIG_XFRM |
| 1173 | 1173 | .decode_session = __nf_nat_decode_session, |
| @@ -225,7 +225,7 @@ find_dequeue_entry(struct nfqnl_instance *queue, unsigned int id) · 224 unmodified lines | ||
| 225 | 225 | |
| 226 | 226 | static void nfqnl_reinject(struct nf_queue_entry *entry, unsigned int verdict) |
| 227 | 227 | { |
| 228 | − struct nf_ct_hook *ct_hook; | |
| 228 | + const struct nf_ct_hook *ct_hook; | |
| 229 | 229 | int err; |
| 230 | 230 | |
| 231 | 231 | if (verdict == NF_ACCEPT || |
| @@ -388,7 +388,7 @@ nfqnl_build_packet_message(struct net *net, struct nfqnl_instance *queue, · 156 unmodified lines | ||
| 388 | 388 | struct net_device *outdev; |
| 389 | 389 | struct nf_conn *ct = NULL; |
| 390 | 390 | enum ip_conntrack_info ctinfo = 0; |
| 391 | − struct nfnl_ct_hook *nfnl_ct; | |
| 391 | + const struct nfnl_ct_hook *nfnl_ct; | |
| 392 | 392 | bool csum_verify; |
| 393 | 393 | char *secdata = NULL; |
| 394 | 394 | u32 seclen = 0; |
| @@ -1103,7 +1103,7 @@ static int nfqnl_recv_verdict_batch(struct sk_buff *skb, · 708 unmodified lines | ||
| 1103 | 1103 | return 0; |
| 1104 | 1104 | } |
| 1105 | 1105 | |
| 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, | |
| 1107 | 1107 | const struct nlmsghdr *nlh, |
| 1108 | 1108 | const struct nlattr * const nfqa[], |
| 1109 | 1109 | 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 | ||
| 1170 | 1170 | { |
| 1171 | 1171 | struct nfnl_queue_net *q = nfnl_queue_pernet(info->net); |
| 1172 | 1172 | u_int16_t queue_num = ntohs(info->nfmsg->res_id); |
| 1173 | + const struct nfnl_ct_hook *nfnl_ct; | |
| 1173 | 1174 | struct nfqnl_msg_verdict_hdr *vhdr; |
| 1174 | 1175 | enum ip_conntrack_info ctinfo; |
| 1175 | 1176 | struct nfqnl_instance *queue; |
| 1176 | 1177 | struct nf_queue_entry *entry; |
| 1177 | − struct nfnl_ct_hook *nfnl_ct; | |
| 1178 | 1178 | struct nf_conn *ct = NULL; |
| 1179 | 1179 | unsigned int verdict; |
| 1180 | 1180 | int err; |