[NETFILTER]: nf_conntrack: annotate l3protos with const

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jan Engelhardt 2008-01-31 04:53:24 -08:00 committed by David S. Miller
parent 7cc3864d39
commit 32948588ac
5 changed files with 23 additions and 20 deletions

View File

@ -68,8 +68,8 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
int int
print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
struct nf_conntrack_l3proto *l3proto, const struct nf_conntrack_l3proto *l3proto,
struct nf_conntrack_l4proto *proto); const struct nf_conntrack_l4proto *proto);
extern struct hlist_head *nf_conntrack_hash; extern struct hlist_head *nf_conntrack_hash;
extern spinlock_t nf_conntrack_lock ; extern spinlock_t nf_conntrack_lock ;

View File

@ -27,7 +27,8 @@
static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
struct nf_conntrack_tuple *tuple) struct nf_conntrack_tuple *tuple)
{ {
__be32 _addrs[2], *ap; const __be32 *ap;
__be32 _addrs[2];
ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr), ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr),
sizeof(u_int32_t) * 2, _addrs); sizeof(u_int32_t) * 2, _addrs);
if (ap == NULL) if (ap == NULL)
@ -76,7 +77,8 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
unsigned int *dataoff, u_int8_t *protonum) unsigned int *dataoff, u_int8_t *protonum)
{ {
struct iphdr _iph, *iph; const struct iphdr *iph;
struct iphdr _iph;
iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph); iph = skb_header_pointer(skb, nhoff, sizeof(_iph), &_iph);
if (iph == NULL) if (iph == NULL)
@ -111,8 +113,8 @@ static unsigned int ipv4_conntrack_help(unsigned int hooknum,
{ {
struct nf_conn *ct; struct nf_conn *ct;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
struct nf_conn_help *help; const struct nf_conn_help *help;
struct nf_conntrack_helper *helper; const struct nf_conntrack_helper *helper;
/* This is where we call the helper: as the packet goes out. */ /* This is where we call the helper: as the packet goes out. */
ct = nf_ct_get(skb, &ctinfo); ct = nf_ct_get(skb, &ctinfo);
@ -299,8 +301,8 @@ static ctl_table ip_ct_sysctl_table[] = {
static int static int
getorigdst(struct sock *sk, int optval, void __user *user, int *len) getorigdst(struct sock *sk, int optval, void __user *user, int *len)
{ {
struct inet_sock *inet = inet_sk(sk); const struct inet_sock *inet = inet_sk(sk);
struct nf_conntrack_tuple_hash *h; const struct nf_conntrack_tuple_hash *h;
struct nf_conntrack_tuple tuple; struct nf_conntrack_tuple tuple;
NF_CT_TUPLE_U_BLANK(&tuple); NF_CT_TUPLE_U_BLANK(&tuple);

View File

@ -98,8 +98,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
{ {
const struct nf_conntrack_tuple_hash *hash = v; const struct nf_conntrack_tuple_hash *hash = v;
const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash); const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
struct nf_conntrack_l3proto *l3proto; const struct nf_conntrack_l3proto *l3proto;
struct nf_conntrack_l4proto *l4proto; const struct nf_conntrack_l4proto *l4proto;
NF_CT_ASSERT(ct); NF_CT_ASSERT(ct);
@ -251,7 +251,7 @@ static void exp_seq_stop(struct seq_file *seq, void *v)
static int exp_seq_show(struct seq_file *s, void *v) static int exp_seq_show(struct seq_file *s, void *v)
{ {
struct nf_conntrack_expect *exp; struct nf_conntrack_expect *exp;
struct hlist_node *n = v; const struct hlist_node *n = v;
exp = hlist_entry(n, struct nf_conntrack_expect, hnode); exp = hlist_entry(n, struct nf_conntrack_expect, hnode);
@ -332,7 +332,7 @@ static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
static int ct_cpu_seq_show(struct seq_file *seq, void *v) static int ct_cpu_seq_show(struct seq_file *seq, void *v)
{ {
unsigned int nr_conntracks = atomic_read(&nf_conntrack_count); unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
struct ip_conntrack_stat *st = v; const struct ip_conntrack_stat *st = v;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n"); seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n");

View File

@ -30,7 +30,8 @@
static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff,
struct nf_conntrack_tuple *tuple) struct nf_conntrack_tuple *tuple)
{ {
u_int32_t _addrs[8], *ap; const u_int32_t *ap;
u_int32_t _addrs[8];
ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr),
sizeof(_addrs), _addrs); sizeof(_addrs), _addrs);
@ -146,8 +147,8 @@ static unsigned int ipv6_confirm(unsigned int hooknum,
int (*okfn)(struct sk_buff *)) int (*okfn)(struct sk_buff *))
{ {
struct nf_conn *ct; struct nf_conn *ct;
struct nf_conn_help *help; const struct nf_conn_help *help;
struct nf_conntrack_helper *helper; const struct nf_conntrack_helper *helper;
enum ip_conntrack_info ctinfo; enum ip_conntrack_info ctinfo;
unsigned int ret, protoff; unsigned int ret, protoff;
unsigned int extoff = (u8 *)(ipv6_hdr(skb) + 1) - skb->data; unsigned int extoff = (u8 *)(ipv6_hdr(skb) + 1) - skb->data;

View File

@ -31,8 +31,8 @@ MODULE_LICENSE("GPL");
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
int int
print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
struct nf_conntrack_l3proto *l3proto, const struct nf_conntrack_l3proto *l3proto,
struct nf_conntrack_l4proto *l4proto) const struct nf_conntrack_l4proto *l4proto)
{ {
return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple); return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple);
} }
@ -118,8 +118,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
{ {
const struct nf_conntrack_tuple_hash *hash = v; const struct nf_conntrack_tuple_hash *hash = v;
const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash); const struct nf_conn *ct = nf_ct_tuplehash_to_ctrack(hash);
struct nf_conntrack_l3proto *l3proto; const struct nf_conntrack_l3proto *l3proto;
struct nf_conntrack_l4proto *l4proto; const struct nf_conntrack_l4proto *l4proto;
NF_CT_ASSERT(ct); NF_CT_ASSERT(ct);
@ -246,7 +246,7 @@ static void ct_cpu_seq_stop(struct seq_file *seq, void *v)
static int ct_cpu_seq_show(struct seq_file *seq, void *v) static int ct_cpu_seq_show(struct seq_file *seq, void *v)
{ {
unsigned int nr_conntracks = atomic_read(&nf_conntrack_count); unsigned int nr_conntracks = atomic_read(&nf_conntrack_count);
struct ip_conntrack_stat *st = v; const struct ip_conntrack_stat *st = v;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n"); seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete\n");