Commit 72b72949db9aabaafd791a9077f02188a866824d

Authored by Jan Engelhardt
Committed by Patrick McHardy
1 parent 58c0fb0ddd

[NETFILTER]: annotate rest of nf_nat_* with const

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>

Showing 3 changed files with 16 additions and 17 deletions Side-by-side Diff

net/ipv4/netfilter/nf_nat_core.c
... ... @@ -150,9 +150,9 @@
150 150 const struct nf_nat_range *range)
151 151 {
152 152 unsigned int h = hash_by_src(tuple);
153   - struct nf_conn_nat *nat;
154   - struct nf_conn *ct;
155   - struct hlist_node *n;
  153 + const struct nf_conn_nat *nat;
  154 + const struct nf_conn *ct;
  155 + const struct hlist_node *n;
156 156  
157 157 rcu_read_lock();
158 158 hlist_for_each_entry_rcu(nat, n, &bysource[h], bysource) {
... ... @@ -426,7 +426,7 @@
426 426 struct icmphdr icmp;
427 427 struct iphdr ip;
428 428 } *inside;
429   - struct nf_conntrack_l4proto *l4proto;
  429 + const struct nf_conntrack_l4proto *l4proto;
430 430 struct nf_conntrack_tuple inner, target;
431 431 int hdrlen = ip_hdrlen(skb);
432 432 enum ip_conntrack_dir dir = CTINFO2DIR(ctinfo);
net/ipv4/netfilter/nf_nat_snmp_basic.c
... ... @@ -220,7 +220,7 @@
220 220 if (ch < 0x80)
221 221 *len = ch;
222 222 else {
223   - cnt = (unsigned char) (ch & 0x7F);
  223 + cnt = ch & 0x7F;
224 224 *len = 0;
225 225  
226 226 while (cnt > 0) {
... ... @@ -618,8 +618,7 @@
618 618 int syntax;
619 619 };
620 620  
621   -static struct snmp_cnv snmp_conv [] =
622   -{
  621 +static const struct snmp_cnv snmp_conv[] = {
623 622 {ASN1_UNI, ASN1_NUL, SNMP_NULL},
624 623 {ASN1_UNI, ASN1_INT, SNMP_INTEGER},
625 624 {ASN1_UNI, ASN1_OTS, SNMP_OCTETSTR},
... ... @@ -644,7 +643,7 @@
644 643 unsigned int cls,
645 644 unsigned short *syntax)
646 645 {
647   - struct snmp_cnv *cnv;
  646 + const struct snmp_cnv *cnv;
648 647  
649 648 cnv = snmp_conv;
650 649  
... ... @@ -904,7 +903,7 @@
904 903 u_int32_t old;
905 904  
906 905 if (debug)
907   - memcpy(&old, (unsigned char *)addr, sizeof(old));
  906 + memcpy(&old, addr, sizeof(old));
908 907  
909 908 *addr = map->to;
910 909  
... ... @@ -999,7 +998,7 @@
999 998 *
1000 999 *****************************************************************************/
1001 1000  
1002   -static void hex_dump(unsigned char *buf, size_t len)
  1001 +static void hex_dump(const unsigned char *buf, size_t len)
1003 1002 {
1004 1003 size_t i;
1005 1004  
... ... @@ -1080,7 +1079,7 @@
1080 1079 if (cls != ASN1_CTX || con != ASN1_CON)
1081 1080 return 0;
1082 1081 if (debug > 1) {
1083   - unsigned char *pdus[] = {
  1082 + static const unsigned char *const pdus[] = {
1084 1083 [SNMP_PDU_GET] = "get",
1085 1084 [SNMP_PDU_NEXT] = "get-next",
1086 1085 [SNMP_PDU_RESPONSE] = "response",
... ... @@ -1232,8 +1231,8 @@
1232 1231 {
1233 1232 int dir = CTINFO2DIR(ctinfo);
1234 1233 unsigned int ret;
1235   - struct iphdr *iph = ip_hdr(skb);
1236   - struct udphdr *udph = (struct udphdr *)((u_int32_t *)iph + iph->ihl);
  1234 + const struct iphdr *iph = ip_hdr(skb);
  1235 + const struct udphdr *udph = (struct udphdr *)((__be32 *)iph + iph->ihl);
1237 1236  
1238 1237 /* SNMP replies and originating SNMP traps get mangled */
1239 1238 if (udph->source == htons(SNMP_PORT) && dir != IP_CT_DIR_REPLY)
net/ipv4/netfilter/nf_nat_standalone.c
... ... @@ -30,8 +30,8 @@
30 30 #ifdef CONFIG_XFRM
31 31 static void nat_decode_session(struct sk_buff *skb, struct flowi *fl)
32 32 {
33   - struct nf_conn *ct;
34   - struct nf_conntrack_tuple *t;
  33 + const struct nf_conn *ct;
  34 + const struct nf_conntrack_tuple *t;
35 35 enum ip_conntrack_info ctinfo;
36 36 enum ip_conntrack_dir dir;
37 37 unsigned long statusbit;
... ... @@ -189,7 +189,7 @@
189 189 int (*okfn)(struct sk_buff *))
190 190 {
191 191 #ifdef CONFIG_XFRM
192   - struct nf_conn *ct;
  192 + const struct nf_conn *ct;
193 193 enum ip_conntrack_info ctinfo;
194 194 #endif
195 195 unsigned int ret;
... ... @@ -223,7 +223,7 @@
223 223 const struct net_device *out,
224 224 int (*okfn)(struct sk_buff *))
225 225 {
226   - struct nf_conn *ct;
  226 + const struct nf_conn *ct;
227 227 enum ip_conntrack_info ctinfo;
228 228 unsigned int ret;
229 229