Skip to content

Commit 89d69d2

Browse files
Stephen Hemmingerdavem330
authored andcommitted
net: make neigh_ops constant
These tables are never modified at runtime. Move to read-only section. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent dcbfef8 commit 89d69d2

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

include/net/arp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
2626
const unsigned char *target_hw);
2727
extern void arp_xmit(struct sk_buff *skb);
2828

29-
extern struct neigh_ops arp_broken_ops;
29+
extern const struct neigh_ops arp_broken_ops;
3030

3131
#endif /* _ARP_H */

include/net/neighbour.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ struct neighbour
118118
int (*output)(struct sk_buff *skb);
119119
struct sk_buff_head arp_queue;
120120
struct timer_list timer;
121-
struct neigh_ops *ops;
121+
const struct neigh_ops *ops;
122122
u8 primary_key[0];
123123
};
124124

net/atm/clip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static void clip_neigh_error(struct neighbour *neigh, struct sk_buff *skb)
267267
kfree_skb(skb);
268268
}
269269

270-
static struct neigh_ops clip_neigh_ops = {
270+
static const struct neigh_ops clip_neigh_ops = {
271271
.family = AF_INET,
272272
.solicit = clip_neigh_solicit,
273273
.error_report = clip_neigh_error,

net/decnet/dn_neigh.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static int dn_phase3_output(struct sk_buff *);
5959
/*
6060
* For talking to broadcast devices: Ethernet & PPP
6161
*/
62-
static struct neigh_ops dn_long_ops = {
62+
static const struct neigh_ops dn_long_ops = {
6363
.family = AF_DECnet,
6464
.error_report = dn_long_error_report,
6565
.output = dn_long_output,
@@ -71,7 +71,7 @@ static struct neigh_ops dn_long_ops = {
7171
/*
7272
* For talking to pointopoint and multidrop devices: DDCMP and X.25
7373
*/
74-
static struct neigh_ops dn_short_ops = {
74+
static const struct neigh_ops dn_short_ops = {
7575
.family = AF_DECnet,
7676
.error_report = dn_short_error_report,
7777
.output = dn_short_output,
@@ -83,7 +83,7 @@ static struct neigh_ops dn_short_ops = {
8383
/*
8484
* For talking to DECnet phase III nodes
8585
*/
86-
static struct neigh_ops dn_phase3_ops = {
86+
static const struct neigh_ops dn_phase3_ops = {
8787
.family = AF_DECnet,
8888
.error_report = dn_short_error_report, /* Can use short version here */
8989
.output = dn_phase3_output,

net/ipv4/arp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb);
130130
static void arp_error_report(struct neighbour *neigh, struct sk_buff *skb);
131131
static void parp_redo(struct sk_buff *skb);
132132

133-
static struct neigh_ops arp_generic_ops = {
133+
static const struct neigh_ops arp_generic_ops = {
134134
.family = AF_INET,
135135
.solicit = arp_solicit,
136136
.error_report = arp_error_report,
@@ -140,7 +140,7 @@ static struct neigh_ops arp_generic_ops = {
140140
.queue_xmit = dev_queue_xmit,
141141
};
142142

143-
static struct neigh_ops arp_hh_ops = {
143+
static const struct neigh_ops arp_hh_ops = {
144144
.family = AF_INET,
145145
.solicit = arp_solicit,
146146
.error_report = arp_error_report,
@@ -150,15 +150,15 @@ static struct neigh_ops arp_hh_ops = {
150150
.queue_xmit = dev_queue_xmit,
151151
};
152152

153-
static struct neigh_ops arp_direct_ops = {
153+
static const struct neigh_ops arp_direct_ops = {
154154
.family = AF_INET,
155155
.output = dev_queue_xmit,
156156
.connected_output = dev_queue_xmit,
157157
.hh_output = dev_queue_xmit,
158158
.queue_xmit = dev_queue_xmit,
159159
};
160160

161-
struct neigh_ops arp_broken_ops = {
161+
const struct neigh_ops arp_broken_ops = {
162162
.family = AF_INET,
163163
.solicit = arp_solicit,
164164
.error_report = arp_error_report,

net/ipv6/ndisc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int pndisc_constructor(struct pneigh_entry *n);
9898
static void pndisc_destructor(struct pneigh_entry *n);
9999
static void pndisc_redo(struct sk_buff *skb);
100100

101-
static struct neigh_ops ndisc_generic_ops = {
101+
static const struct neigh_ops ndisc_generic_ops = {
102102
.family = AF_INET6,
103103
.solicit = ndisc_solicit,
104104
.error_report = ndisc_error_report,
@@ -108,7 +108,7 @@ static struct neigh_ops ndisc_generic_ops = {
108108
.queue_xmit = dev_queue_xmit,
109109
};
110110

111-
static struct neigh_ops ndisc_hh_ops = {
111+
static const struct neigh_ops ndisc_hh_ops = {
112112
.family = AF_INET6,
113113
.solicit = ndisc_solicit,
114114
.error_report = ndisc_error_report,
@@ -119,7 +119,7 @@ static struct neigh_ops ndisc_hh_ops = {
119119
};
120120

121121

122-
static struct neigh_ops ndisc_direct_ops = {
122+
static const struct neigh_ops ndisc_direct_ops = {
123123
.family = AF_INET6,
124124
.output = dev_queue_xmit,
125125
.connected_output = dev_queue_xmit,

0 commit comments

Comments
 (0)