Skip to content

Commit 3261309

Browse files
Alexey Dobriyandavem330
authored andcommitted
net: constify struct net_protocol
Remove long removed "inet_protocol_base" declaration. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e4c57d0 commit 3261309

14 files changed

Lines changed: 27 additions & 32 deletions

File tree

‎include/net/protocol.h‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ struct inet_protosw {
9494
#define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */
9595
#define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */
9696

97-
extern struct net_protocol *inet_protocol_base;
98-
extern struct net_protocol *inet_protos[MAX_INET_PROTOS];
97+
extern const struct net_protocol *inet_protos[MAX_INET_PROTOS];
9998

10099
#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
101100
extern struct inet6_protocol *inet6_protos[MAX_INET_PROTOS];
102101
#endif
103102

104-
extern int inet_add_protocol(struct net_protocol *prot, unsigned char num);
105-
extern int inet_del_protocol(struct net_protocol *prot, unsigned char num);
103+
extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
104+
extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
106105
extern void inet_register_protosw(struct inet_protosw *p);
107106
extern void inet_unregister_protosw(struct inet_protosw *p);
108107

‎net/dccp/ipv4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ static struct proto dccp_v4_prot = {
948948
#endif
949949
};
950950

951-
static struct net_protocol dccp_v4_protocol = {
951+
static const struct net_protocol dccp_v4_protocol = {
952952
.handler = dccp_v4_rcv,
953953
.err_handler = dccp_v4_err,
954954
.no_policy = 1,

‎net/ipv4/af_inet.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(build_ehash_secret);
244244
static inline int inet_netns_ok(struct net *net, int protocol)
245245
{
246246
int hash;
247-
struct net_protocol *ipprot;
247+
const struct net_protocol *ipprot;
248248

249249
if (net_eq(net, &init_net))
250250
return 1;
@@ -1162,7 +1162,7 @@ EXPORT_SYMBOL(inet_sk_rebuild_header);
11621162
static int inet_gso_send_check(struct sk_buff *skb)
11631163
{
11641164
struct iphdr *iph;
1165-
struct net_protocol *ops;
1165+
const struct net_protocol *ops;
11661166
int proto;
11671167
int ihl;
11681168
int err = -EINVAL;
@@ -1198,7 +1198,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
11981198
{
11991199
struct sk_buff *segs = ERR_PTR(-EINVAL);
12001200
struct iphdr *iph;
1201-
struct net_protocol *ops;
1201+
const struct net_protocol *ops;
12021202
int proto;
12031203
int ihl;
12041204
int id;
@@ -1265,7 +1265,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb, int features)
12651265
static struct sk_buff **inet_gro_receive(struct sk_buff **head,
12661266
struct sk_buff *skb)
12671267
{
1268-
struct net_protocol *ops;
1268+
const struct net_protocol *ops;
12691269
struct sk_buff **pp = NULL;
12701270
struct sk_buff *p;
12711271
struct iphdr *iph;
@@ -1342,7 +1342,7 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
13421342

13431343
static int inet_gro_complete(struct sk_buff *skb)
13441344
{
1345-
struct net_protocol *ops;
1345+
const struct net_protocol *ops;
13461346
struct iphdr *iph = ip_hdr(skb);
13471347
int proto = iph->protocol & (MAX_INET_PROTOS - 1);
13481348
int err = -ENOSYS;
@@ -1427,13 +1427,13 @@ void snmp_mib_free(void *ptr[2])
14271427
EXPORT_SYMBOL_GPL(snmp_mib_free);
14281428

14291429
#ifdef CONFIG_IP_MULTICAST
1430-
static struct net_protocol igmp_protocol = {
1430+
static const struct net_protocol igmp_protocol = {
14311431
.handler = igmp_rcv,
14321432
.netns_ok = 1,
14331433
};
14341434
#endif
14351435

1436-
static struct net_protocol tcp_protocol = {
1436+
static const struct net_protocol tcp_protocol = {
14371437
.handler = tcp_v4_rcv,
14381438
.err_handler = tcp_v4_err,
14391439
.gso_send_check = tcp_v4_gso_send_check,
@@ -1444,7 +1444,7 @@ static struct net_protocol tcp_protocol = {
14441444
.netns_ok = 1,
14451445
};
14461446

1447-
static struct net_protocol udp_protocol = {
1447+
static const struct net_protocol udp_protocol = {
14481448
.handler = udp_rcv,
14491449
.err_handler = udp_err,
14501450
.gso_send_check = udp4_ufo_send_check,
@@ -1453,7 +1453,7 @@ static struct net_protocol udp_protocol = {
14531453
.netns_ok = 1,
14541454
};
14551455

1456-
static struct net_protocol icmp_protocol = {
1456+
static const struct net_protocol icmp_protocol = {
14571457
.handler = icmp_rcv,
14581458
.no_policy = 1,
14591459
.netns_ok = 1,

‎net/ipv4/ah4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static const struct xfrm_type ah_type =
311311
.output = ah_output
312312
};
313313

314-
static struct net_protocol ah4_protocol = {
314+
static const struct net_protocol ah4_protocol = {
315315
.handler = xfrm4_rcv,
316316
.err_handler = ah4_err,
317317
.no_policy = 1,

‎net/ipv4/esp4.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ static const struct xfrm_type esp_type =
615615
.output = esp_output
616616
};
617617

618-
static struct net_protocol esp4_protocol = {
618+
static const struct net_protocol esp4_protocol = {
619619
.handler = xfrm4_rcv,
620620
.err_handler = esp4_err,
621621
.no_policy = 1,

‎net/ipv4/icmp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static void icmp_unreach(struct sk_buff *skb)
655655
struct iphdr *iph;
656656
struct icmphdr *icmph;
657657
int hash, protocol;
658-
struct net_protocol *ipprot;
658+
const struct net_protocol *ipprot;
659659
u32 info = 0;
660660
struct net *net;
661661

‎net/ipv4/ip_gre.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ static void ipgre_fb_tunnel_init(struct net_device *dev)
12881288
}
12891289

12901290

1291-
static struct net_protocol ipgre_protocol = {
1291+
static const struct net_protocol ipgre_protocol = {
12921292
.handler = ipgre_rcv,
12931293
.err_handler = ipgre_err,
12941294
.netns_ok = 1,

‎net/ipv4/ip_input.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
202202
{
203203
int protocol = ip_hdr(skb)->protocol;
204204
int hash, raw;
205-
struct net_protocol *ipprot;
205+
const struct net_protocol *ipprot;
206206

207207
resubmit:
208208
raw = raw_local_deliver(skb, protocol);

‎net/ipv4/ipcomp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static const struct xfrm_type ipcomp_type = {
146146
.output = ipcomp_output
147147
};
148148

149-
static struct net_protocol ipcomp4_protocol = {
149+
static const struct net_protocol ipcomp4_protocol = {
150150
.handler = xfrm4_rcv,
151151
.err_handler = ipcomp4_err,
152152
.no_policy = 1,

‎net/ipv4/ipmr.c‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ static int ipmr_cache_report(struct net *net,
9999
struct sk_buff *pkt, vifi_t vifi, int assert);
100100
static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);
101101

102-
#ifdef CONFIG_IP_PIMSM_V2
103-
static struct net_protocol pim_protocol;
104-
#endif
105-
106102
static struct timer_list ipmr_expire_timer;
107103

108104
/* Service routines creating virtual interfaces: DVMRP tunnels and PIMREG */
@@ -1945,7 +1941,7 @@ static const struct file_operations ipmr_mfc_fops = {
19451941
#endif
19461942

19471943
#ifdef CONFIG_IP_PIMSM_V2
1948-
static struct net_protocol pim_protocol = {
1944+
static const struct net_protocol pim_protocol = {
19491945
.handler = pim_rcv,
19501946
.netns_ok = 1,
19511947
};

0 commit comments

Comments
 (0)