Commit 41135cc836a1abeb12ca1416bdb29e87ad021153
Committed by
David S. Miller
1 parent
32613090a9
Exists in
master
and in
20 other branches
net: constify struct inet6_protocol
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 17 changed files with 29 additions and 33 deletions Side-by-side Diff
- include/net/protocol.h
- net/dccp/ipv6.c
- net/ipv6/af_inet6.c
- net/ipv6/ah6.c
- net/ipv6/esp6.c
- net/ipv6/exthdrs.c
- net/ipv6/icmp.c
- net/ipv6/ip6_input.c
- net/ipv6/ip6mr.c
- net/ipv6/ipcomp6.c
- net/ipv6/protocol.c
- net/ipv6/reassembly.c
- net/ipv6/tcp_ipv6.c
- net/ipv6/tunnel6.c
- net/ipv6/udp.c
- net/ipv6/udplite.c
- net/sctp/ipv6.c
include/net/protocol.h
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | extern const struct net_protocol *inet_protos[MAX_INET_PROTOS]; |
98 | 98 | |
99 | 99 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
100 | -extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | |
100 | +extern const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | |
101 | 101 | #endif |
102 | 102 | |
103 | 103 | extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); |
... | ... | @@ -106,8 +106,8 @@ |
106 | 106 | extern void inet_unregister_protosw(struct inet_protosw *p); |
107 | 107 | |
108 | 108 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
109 | -extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); | |
110 | -extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); | |
109 | +extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num); | |
110 | +extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num); | |
111 | 111 | extern int inet6_register_protosw(struct inet_protosw *p); |
112 | 112 | extern void inet6_unregister_protosw(struct inet_protosw *p); |
113 | 113 | #endif |
net/dccp/ipv6.c
... | ... | @@ -1152,7 +1152,7 @@ |
1152 | 1152 | #endif |
1153 | 1153 | }; |
1154 | 1154 | |
1155 | -static struct inet6_protocol dccp_v6_protocol = { | |
1155 | +static const struct inet6_protocol dccp_v6_protocol = { | |
1156 | 1156 | .handler = dccp_v6_rcv, |
1157 | 1157 | .err_handler = dccp_v6_err, |
1158 | 1158 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, |
net/ipv6/af_inet6.c
... | ... | @@ -710,7 +710,7 @@ |
710 | 710 | |
711 | 711 | static int ipv6_gso_pull_exthdrs(struct sk_buff *skb, int proto) |
712 | 712 | { |
713 | - struct inet6_protocol *ops = NULL; | |
713 | + const struct inet6_protocol *ops = NULL; | |
714 | 714 | |
715 | 715 | for (;;) { |
716 | 716 | struct ipv6_opt_hdr *opth; |
... | ... | @@ -745,7 +745,7 @@ |
745 | 745 | static int ipv6_gso_send_check(struct sk_buff *skb) |
746 | 746 | { |
747 | 747 | struct ipv6hdr *ipv6h; |
748 | - struct inet6_protocol *ops; | |
748 | + const struct inet6_protocol *ops; | |
749 | 749 | int err = -EINVAL; |
750 | 750 | |
751 | 751 | if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h)))) |
... | ... | @@ -773,7 +773,7 @@ |
773 | 773 | { |
774 | 774 | struct sk_buff *segs = ERR_PTR(-EINVAL); |
775 | 775 | struct ipv6hdr *ipv6h; |
776 | - struct inet6_protocol *ops; | |
776 | + const struct inet6_protocol *ops; | |
777 | 777 | int proto; |
778 | 778 | struct frag_hdr *fptr; |
779 | 779 | unsigned int unfrag_ip6hlen; |
... | ... | @@ -840,7 +840,7 @@ |
840 | 840 | static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, |
841 | 841 | struct sk_buff *skb) |
842 | 842 | { |
843 | - struct inet6_protocol *ops; | |
843 | + const struct inet6_protocol *ops; | |
844 | 844 | struct sk_buff **pp = NULL; |
845 | 845 | struct sk_buff *p; |
846 | 846 | struct ipv6hdr *iph; |
... | ... | @@ -926,7 +926,7 @@ |
926 | 926 | |
927 | 927 | static int ipv6_gro_complete(struct sk_buff *skb) |
928 | 928 | { |
929 | - struct inet6_protocol *ops; | |
929 | + const struct inet6_protocol *ops; | |
930 | 930 | struct ipv6hdr *iph = ipv6_hdr(skb); |
931 | 931 | int err = -ENOSYS; |
932 | 932 |
net/ipv6/ah6.c
... | ... | @@ -527,7 +527,7 @@ |
527 | 527 | .hdr_offset = xfrm6_find_1stfragopt, |
528 | 528 | }; |
529 | 529 | |
530 | -static struct inet6_protocol ah6_protocol = { | |
530 | +static const struct inet6_protocol ah6_protocol = { | |
531 | 531 | .handler = xfrm6_rcv, |
532 | 532 | .err_handler = ah6_err, |
533 | 533 | .flags = INET6_PROTO_NOPOLICY, |
net/ipv6/esp6.c
... | ... | @@ -558,7 +558,7 @@ |
558 | 558 | .hdr_offset = xfrm6_find_1stfragopt, |
559 | 559 | }; |
560 | 560 | |
561 | -static struct inet6_protocol esp6_protocol = { | |
561 | +static const struct inet6_protocol esp6_protocol = { | |
562 | 562 | .handler = xfrm6_rcv, |
563 | 563 | .err_handler = esp6_err, |
564 | 564 | .flags = INET6_PROTO_NOPOLICY, |
net/ipv6/exthdrs.c
... | ... | @@ -500,17 +500,17 @@ |
500 | 500 | return -1; |
501 | 501 | } |
502 | 502 | |
503 | -static struct inet6_protocol rthdr_protocol = { | |
503 | +static const struct inet6_protocol rthdr_protocol = { | |
504 | 504 | .handler = ipv6_rthdr_rcv, |
505 | 505 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, |
506 | 506 | }; |
507 | 507 | |
508 | -static struct inet6_protocol destopt_protocol = { | |
508 | +static const struct inet6_protocol destopt_protocol = { | |
509 | 509 | .handler = ipv6_destopt_rcv, |
510 | 510 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_GSO_EXTHDR, |
511 | 511 | }; |
512 | 512 | |
513 | -static struct inet6_protocol nodata_protocol = { | |
513 | +static const struct inet6_protocol nodata_protocol = { | |
514 | 514 | .handler = dst_discard, |
515 | 515 | .flags = INET6_PROTO_NOPOLICY, |
516 | 516 | }; |
net/ipv6/icmp.c
... | ... | @@ -86,7 +86,7 @@ |
86 | 86 | |
87 | 87 | static int icmpv6_rcv(struct sk_buff *skb); |
88 | 88 | |
89 | -static struct inet6_protocol icmpv6_protocol = { | |
89 | +static const struct inet6_protocol icmpv6_protocol = { | |
90 | 90 | .handler = icmpv6_rcv, |
91 | 91 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
92 | 92 | }; |
... | ... | @@ -583,7 +583,7 @@ |
583 | 583 | |
584 | 584 | static void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info) |
585 | 585 | { |
586 | - struct inet6_protocol *ipprot; | |
586 | + const struct inet6_protocol *ipprot; | |
587 | 587 | int inner_offset; |
588 | 588 | int hash; |
589 | 589 | u8 nexthdr; |
net/ipv6/ip6_input.c
net/ipv6/ip6mr.c
... | ... | @@ -83,10 +83,6 @@ |
83 | 83 | static int ip6mr_fill_mroute(struct sk_buff *skb, struct mfc6_cache *c, struct rtmsg *rtm); |
84 | 84 | static void mroute_clean_tables(struct net *net); |
85 | 85 | |
86 | -#ifdef CONFIG_IPV6_PIMSM_V2 | |
87 | -static struct inet6_protocol pim6_protocol; | |
88 | -#endif | |
89 | - | |
90 | 86 | static struct timer_list ipmr_expire_timer; |
91 | 87 | |
92 | 88 | |
... | ... | @@ -410,7 +406,7 @@ |
410 | 406 | return 0; |
411 | 407 | } |
412 | 408 | |
413 | -static struct inet6_protocol pim6_protocol = { | |
409 | +static const struct inet6_protocol pim6_protocol = { | |
414 | 410 | .handler = pim6_rcv, |
415 | 411 | }; |
416 | 412 |
net/ipv6/ipcomp6.c
net/ipv6/protocol.c
... | ... | @@ -25,11 +25,11 @@ |
25 | 25 | #include <linux/spinlock.h> |
26 | 26 | #include <net/protocol.h> |
27 | 27 | |
28 | -struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | |
28 | +const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | |
29 | 29 | static DEFINE_SPINLOCK(inet6_proto_lock); |
30 | 30 | |
31 | 31 | |
32 | -int inet6_add_protocol(struct inet6_protocol *prot, unsigned char protocol) | |
32 | +int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char protocol) | |
33 | 33 | { |
34 | 34 | int ret, hash = protocol & (MAX_INET_PROTOS - 1); |
35 | 35 | |
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 | * Remove a protocol from the hash tables. |
54 | 54 | */ |
55 | 55 | |
56 | -int inet6_del_protocol(struct inet6_protocol *prot, unsigned char protocol) | |
56 | +int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char protocol) | |
57 | 57 | { |
58 | 58 | int ret, hash = protocol & (MAX_INET_PROTOS - 1); |
59 | 59 |
net/ipv6/reassembly.c
net/ipv6/tcp_ipv6.c
... | ... | @@ -2093,7 +2093,7 @@ |
2093 | 2093 | #endif |
2094 | 2094 | }; |
2095 | 2095 | |
2096 | -static struct inet6_protocol tcpv6_protocol = { | |
2096 | +static const struct inet6_protocol tcpv6_protocol = { | |
2097 | 2097 | .handler = tcp_v6_rcv, |
2098 | 2098 | .err_handler = tcp_v6_err, |
2099 | 2099 | .gso_send_check = tcp_v6_gso_send_check, |
net/ipv6/tunnel6.c
... | ... | @@ -133,13 +133,13 @@ |
133 | 133 | break; |
134 | 134 | } |
135 | 135 | |
136 | -static struct inet6_protocol tunnel6_protocol = { | |
136 | +static const struct inet6_protocol tunnel6_protocol = { | |
137 | 137 | .handler = tunnel6_rcv, |
138 | 138 | .err_handler = tunnel6_err, |
139 | 139 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
140 | 140 | }; |
141 | 141 | |
142 | -static struct inet6_protocol tunnel46_protocol = { | |
142 | +static const struct inet6_protocol tunnel46_protocol = { | |
143 | 143 | .handler = tunnel46_rcv, |
144 | 144 | .err_handler = tunnel6_err, |
145 | 145 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
net/ipv6/udp.c
... | ... | @@ -1172,7 +1172,7 @@ |
1172 | 1172 | return segs; |
1173 | 1173 | } |
1174 | 1174 | |
1175 | -static struct inet6_protocol udpv6_protocol = { | |
1175 | +static const struct inet6_protocol udpv6_protocol = { | |
1176 | 1176 | .handler = udpv6_rcv, |
1177 | 1177 | .err_handler = udpv6_err, |
1178 | 1178 | .gso_send_check = udp6_ufo_send_check, |
net/ipv6/udplite.c
... | ... | @@ -25,7 +25,7 @@ |
25 | 25 | __udp6_lib_err(skb, opt, type, code, offset, info, &udplite_table); |
26 | 26 | } |
27 | 27 | |
28 | -static struct inet6_protocol udplitev6_protocol = { | |
28 | +static const struct inet6_protocol udplitev6_protocol = { | |
29 | 29 | .handler = udplitev6_rcv, |
30 | 30 | .err_handler = udplitev6_err, |
31 | 31 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
net/sctp/ipv6.c
... | ... | @@ -949,7 +949,7 @@ |
949 | 949 | return sctp_rcv(skb) ? -1 : 0; |
950 | 950 | } |
951 | 951 | |
952 | -static struct inet6_protocol sctpv6_protocol = { | |
952 | +static const struct inet6_protocol sctpv6_protocol = { | |
953 | 953 | .handler = sctp6_rcv, |
954 | 954 | .err_handler = sctp_v6_err, |
955 | 955 | .flags = INET6_PROTO_NOPOLICY | INET6_PROTO_FINAL, |