aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2008-04-14 05:15:42 -0400
committerPatrick McHardy <kaber@trash.net>2008-04-14 05:15:42 -0400
commit72b72949db9aabaafd791a9077f02188a866824d (patch)
tree5621ea59664345cf4be6db5d9f328995f3c4b229 /net/ipv4
parent58c0fb0ddd92e5105d61fc85b6e7af7b1f669067 (diff)
[NETFILTER]: annotate rest of nf_nat_* with const
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/netfilter/nf_nat_core.c8
-rw-r--r--net/ipv4/netfilter/nf_nat_snmp_basic.c17
-rw-r--r--net/ipv4/netfilter/nf_nat_standalone.c8
3 files changed, 16 insertions, 17 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index 0d5fa3a54d04..9c8aa8df2d5e 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -150,9 +150,9 @@ find_appropriate_src(const struct nf_conntrack_tuple *tuple,
150 const struct nf_nat_range *range) 150 const struct nf_nat_range *range)
151{ 151{
152 unsigned int h = hash_by_src(tuple); 152 unsigned int h = hash_by_src(tuple);
153 struct nf_conn_nat *nat; 153 const struct nf_conn_nat *nat;
154 struct nf_conn *ct; 154 const struct nf_conn *ct;
155 struct hlist_node *n; 155 const struct hlist_node *n;
156 156
157 rcu_read_lock(); 157 rcu_read_lock();
158 hlist_for_each_entry_rcu(nat, n, &bysource[h], bysource) { 158 hlist_for_each_entry_rcu(nat, n, &bysource[h], bysource) {
@@ -426,7 +426,7 @@ int nf_nat_icmp_reply_translation(struct nf_conn *ct,
426 struct icmphdr icmp; 426 struct icmphdr icmp;
427 struct iphdr ip; 427 struct iphdr ip;
428 } *inside; 428 } *inside;
429 struct nf_conntrack_l4proto *l4proto; 429 const struct nf_conntrack_l4proto *l4proto;
430 struct nf_conntrack_tuple inner, target; 430 struct nf_conntrack_tuple inner, target;
431 int hdrlen = ip_hdrlen(skb); 431 int hdrlen = ip_hdrlen(skb);
432 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo); 432 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
diff --git a/net/ipv4/netfilter/nf_nat_snmp_basic.c b/net/ipv4/netfilter/nf_nat_snmp_basic.c
index 000e080bac5c..5daefad3d193 100644
--- a/net/ipv4/netfilter/nf_nat_snmp_basic.c
+++ b/net/ipv4/netfilter/nf_nat_snmp_basic.c
@@ -220,7 +220,7 @@ static unsigned char asn1_length_decode(struct asn1_ctx *ctx,
220 if (ch < 0x80) 220 if (ch < 0x80)
221 *len = ch; 221 *len = ch;
222 else { 222 else {
223 cnt = (unsigned char) (ch & 0x7F); 223 cnt = ch & 0x7F;
224 *len = 0; 224 *len = 0;
225 225
226 while (cnt > 0) { 226 while (cnt > 0) {
@@ -618,8 +618,7 @@ struct snmp_cnv
618 int syntax; 618 int syntax;
619}; 619};
620 620
621static struct snmp_cnv snmp_conv [] = 621static const struct snmp_cnv snmp_conv[] = {
622{
623 {ASN1_UNI, ASN1_NUL, SNMP_NULL}, 622 {ASN1_UNI, ASN1_NUL, SNMP_NULL},
624 {ASN1_UNI, ASN1_INT, SNMP_INTEGER}, 623 {ASN1_UNI, ASN1_INT, SNMP_INTEGER},
625 {ASN1_UNI, ASN1_OTS, SNMP_OCTETSTR}, 624 {ASN1_UNI, ASN1_OTS, SNMP_OCTETSTR},
@@ -644,7 +643,7 @@ static unsigned char snmp_tag_cls2syntax(unsigned int tag,
644 unsigned int cls, 643 unsigned int cls,
645 unsigned short *syntax) 644 unsigned short *syntax)
646{ 645{
647 struct snmp_cnv *cnv; 646 const struct snmp_cnv *cnv;
648 647
649 cnv = snmp_conv; 648 cnv = snmp_conv;
650 649
@@ -904,7 +903,7 @@ static inline void mangle_address(unsigned char *begin,
904 u_int32_t old; 903 u_int32_t old;
905 904
906 if (debug) 905 if (debug)
907 memcpy(&old, (unsigned char *)addr, sizeof(old)); 906 memcpy(&old, addr, sizeof(old));
908 907
909 *addr = map->to; 908 *addr = map->to;
910 909
@@ -999,7 +998,7 @@ err_id_free:
999 * 998 *
1000 *****************************************************************************/ 999 *****************************************************************************/
1001 1000
1002static void hex_dump(unsigned char *buf, size_t len) 1001static void hex_dump(const unsigned char *buf, size_t len)
1003{ 1002{
1004 size_t i; 1003 size_t i;
1005 1004
@@ -1080,7 +1079,7 @@ static int snmp_parse_mangle(unsigned char *msg,
1080 if (cls != ASN1_CTX || con != ASN1_CON) 1079 if (cls != ASN1_CTX || con != ASN1_CON)
1081 return 0; 1080 return 0;
1082 if (debug > 1) { 1081 if (debug > 1) {
1083 unsigned char *pdus[] = { 1082 static const unsigned char *const pdus[] = {
1084 [SNMP_PDU_GET] = "get", 1083 [SNMP_PDU_GET] = "get",
1085 [SNMP_PDU_NEXT] = "get-next", 1084 [SNMP_PDU_NEXT] = "get-next",
1086 [SNMP_PDU_RESPONSE] = "response", 1085 [SNMP_PDU_RESPONSE] = "response",
@@ -1232,8 +1231,8 @@ static int help(struct sk_buff *skb, unsigned int protoff,
1232{ 1231{
1233 int dir = CTINFO2DIR(ctinfo); 1232 int dir = CTINFO2DIR(ctinfo);
1234 unsigned int ret; 1233 unsigned int ret;
1235 struct iphdr *iph = ip_hdr(skb); 1234 const struct iphdr *iph = ip_hdr(skb);
1236 struct udphdr *udph = (struct udphdr *)((u_int32_t *)iph + iph->ihl); 1235 const struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl);
1237 1236
1238 /* SNMP replies and originating SNMP traps get mangled */ 1237 /* SNMP replies and originating SNMP traps get mangled */
1239 if (udph->source == htons(SNMP_PORT) && dir != IP_CT_DIR_REPLY) 1238 if (udph->source == htons(SNMP_PORT) && dir != IP_CT_DIR_REPLY)
diff --git a/net/ipv4/netfilter/nf_nat_standalone.c b/net/ipv4/netfilter/nf_nat_standalone.c
index 99b2c788d5a8..9fba42d9cdea 100644
--- a/net/ipv4/netfilter/nf_nat_standalone.c
+++ b/net/ipv4/netfilter/nf_nat_standalone.c
@@ -30,8 +30,8 @@
30#ifdef CONFIG_XFRM 30#ifdef CONFIG_XFRM
31static void nat_decode_session(struct sk_buff *skb, struct flowi *fl) 31static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
32{ 32{
33 struct nf_conn *ct; 33 const struct nf_conn *ct;
34 struct nf_conntrack_tuple *t; 34 const struct nf_conntrack_tuple *t;
35 enum ip_conntrack_info ctinfo; 35 enum ip_conntrack_info ctinfo;
36 enum ip_conntrack_dir dir; 36 enum ip_conntrack_dir dir;
37 unsigned long statusbit; 37 unsigned long statusbit;
@@ -189,7 +189,7 @@ nf_nat_out(unsigned int hooknum,
189 int (*okfn)(struct sk_buff *)) 189 int (*okfn)(struct sk_buff *))
190{ 190{
191#ifdef CONFIG_XFRM 191#ifdef CONFIG_XFRM
192 struct nf_conn *ct; 192 const struct nf_conn *ct;
193 enum ip_conntrack_info ctinfo; 193 enum ip_conntrack_info ctinfo;
194#endif 194#endif
195 unsigned int ret; 195 unsigned int ret;
@@ -223,7 +223,7 @@ nf_nat_local_fn(unsigned int hooknum,
223 const struct net_device *out, 223 const struct net_device *out,
224 int (*okfn)(struct sk_buff *)) 224 int (*okfn)(struct sk_buff *))
225{ 225{
226 struct nf_conn *ct; 226 const struct nf_conn *ct;
227 enum ip_conntrack_info ctinfo; 227 enum ip_conntrack_info ctinfo;
228 unsigned int ret; 228 unsigned int ret;
229 229