Commit 1e796fda authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: constify nf_afinfo

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 90a9ba8d
...@@ -226,8 +226,8 @@ struct nf_afinfo { ...@@ -226,8 +226,8 @@ struct nf_afinfo {
int route_key_size; int route_key_size;
}; };
extern struct nf_afinfo *nf_afinfo[]; extern const struct nf_afinfo *nf_afinfo[NPROTO];
static inline struct nf_afinfo *nf_get_afinfo(unsigned short family) static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family)
{ {
return rcu_dereference(nf_afinfo[family]); return rcu_dereference(nf_afinfo[family]);
} }
...@@ -236,7 +236,7 @@ static inline __sum16 ...@@ -236,7 +236,7 @@ static inline __sum16
nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
u_int8_t protocol, unsigned short family) u_int8_t protocol, unsigned short family)
{ {
struct nf_afinfo *afinfo; const struct nf_afinfo *afinfo;
__sum16 csum = 0; __sum16 csum = 0;
rcu_read_lock(); rcu_read_lock();
...@@ -247,8 +247,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, ...@@ -247,8 +247,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
return csum; return csum;
} }
extern int nf_register_afinfo(struct nf_afinfo *afinfo); extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
extern void nf_unregister_afinfo(struct nf_afinfo *afinfo); extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
#include <net/flow.h> #include <net/flow.h>
extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *);
......
...@@ -190,7 +190,7 @@ static int nf_ip_route(struct dst_entry **dst, struct flowi *fl) ...@@ -190,7 +190,7 @@ static int nf_ip_route(struct dst_entry **dst, struct flowi *fl)
return ip_route_output_key((struct rtable **)dst, fl); return ip_route_output_key((struct rtable **)dst, fl);
} }
static struct nf_afinfo nf_ip_afinfo = { static const struct nf_afinfo nf_ip_afinfo = {
.family = AF_INET, .family = AF_INET,
.checksum = nf_ip_checksum, .checksum = nf_ip_checksum,
.route = nf_ip_route, .route = nf_ip_route,
......
...@@ -124,7 +124,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, ...@@ -124,7 +124,7 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook,
EXPORT_SYMBOL(nf_ip6_checksum); EXPORT_SYMBOL(nf_ip6_checksum);
static struct nf_afinfo nf_ip6_afinfo = { static const struct nf_afinfo nf_ip6_afinfo = {
.family = AF_INET6, .family = AF_INET6,
.checksum = nf_ip6_checksum, .checksum = nf_ip6_checksum,
.route = nf_ip6_route, .route = nf_ip6_route,
......
...@@ -26,10 +26,10 @@ ...@@ -26,10 +26,10 @@
static DEFINE_MUTEX(afinfo_mutex); static DEFINE_MUTEX(afinfo_mutex);
struct nf_afinfo *nf_afinfo[NPROTO] __read_mostly; const struct nf_afinfo *nf_afinfo[NPROTO] __read_mostly;
EXPORT_SYMBOL(nf_afinfo); EXPORT_SYMBOL(nf_afinfo);
int nf_register_afinfo(struct nf_afinfo *afinfo) int nf_register_afinfo(const struct nf_afinfo *afinfo)
{ {
int err; int err;
...@@ -42,7 +42,7 @@ int nf_register_afinfo(struct nf_afinfo *afinfo) ...@@ -42,7 +42,7 @@ int nf_register_afinfo(struct nf_afinfo *afinfo)
} }
EXPORT_SYMBOL_GPL(nf_register_afinfo); EXPORT_SYMBOL_GPL(nf_register_afinfo);
void nf_unregister_afinfo(struct nf_afinfo *afinfo) void nf_unregister_afinfo(const struct nf_afinfo *afinfo)
{ {
mutex_lock(&afinfo_mutex); mutex_lock(&afinfo_mutex);
rcu_assign_pointer(nf_afinfo[afinfo->family], NULL); rcu_assign_pointer(nf_afinfo[afinfo->family], NULL);
......
...@@ -708,7 +708,7 @@ static int callforward_do_filter(union nf_conntrack_address *src, ...@@ -708,7 +708,7 @@ static int callforward_do_filter(union nf_conntrack_address *src,
union nf_conntrack_address *dst, union nf_conntrack_address *dst,
int family) int family)
{ {
struct nf_afinfo *afinfo; const struct nf_afinfo *afinfo;
struct flowi fl1, fl2; struct flowi fl1, fl2;
int ret = 0; int ret = 0;
......
...@@ -119,7 +119,7 @@ static int __nf_queue(struct sk_buff *skb, ...@@ -119,7 +119,7 @@ static int __nf_queue(struct sk_buff *skb,
struct net_device *physindev; struct net_device *physindev;
struct net_device *physoutdev; struct net_device *physoutdev;
#endif #endif
struct nf_afinfo *afinfo; const struct nf_afinfo *afinfo;
const struct nf_queue_handler *qh; const struct nf_queue_handler *qh;
/* QUEUE == DROP if noone is waiting, to be safe. */ /* QUEUE == DROP if noone is waiting, to be safe. */
...@@ -233,7 +233,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) ...@@ -233,7 +233,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
{ {
struct sk_buff *skb = entry->skb; struct sk_buff *skb = entry->skb;
struct list_head *elem = &entry->elem->list; struct list_head *elem = &entry->elem->list;
struct nf_afinfo *afinfo; const struct nf_afinfo *afinfo;
rcu_read_lock(); rcu_read_lock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment