diff options
author | David S. Miller <davem@davemloft.net> | 2008-04-14 06:50:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-14 06:50:43 -0400 |
commit | 334f8b2afd9652e20f67ddee4fec483ed860425b (patch) | |
tree | 35d4fb46a9dc145e831fe5da026f2bfd9ee6657c /net/ipv6 | |
parent | 7477fd2e6b676fcd15861c2a96a7172f71afe0a5 (diff) | |
parent | ef1a5a50bbd509b8697dcd4d13017e9e0053867b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-2.6.26
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/netfilter.c | 42 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6_tables.c | 33 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_LOG.c | 6 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_REJECT.c | 3 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_ipv6header.c | 3 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6t_rt.c | 3 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6table_filter.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6table_mangle.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/ip6table_raw.c | 2 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | 14 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | 29 | ||||
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_reasm.c | 8 |
12 files changed, 91 insertions, 56 deletions
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c index aed51bcc66b4..8c6c5e71f210 100644 --- a/net/ipv6/netfilter.c +++ b/net/ipv6/netfilter.c | |||
@@ -121,16 +121,44 @@ __sum16 nf_ip6_checksum(struct sk_buff *skb, unsigned int hook, | |||
121 | } | 121 | } |
122 | return csum; | 122 | return csum; |
123 | } | 123 | } |
124 | |||
125 | EXPORT_SYMBOL(nf_ip6_checksum); | 124 | EXPORT_SYMBOL(nf_ip6_checksum); |
126 | 125 | ||
126 | static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook, | ||
127 | unsigned int dataoff, unsigned int len, | ||
128 | u_int8_t protocol) | ||
129 | { | ||
130 | struct ipv6hdr *ip6h = ipv6_hdr(skb); | ||
131 | __wsum hsum; | ||
132 | __sum16 csum = 0; | ||
133 | |||
134 | switch (skb->ip_summed) { | ||
135 | case CHECKSUM_COMPLETE: | ||
136 | if (len == skb->len - dataoff) | ||
137 | return nf_ip6_checksum(skb, hook, dataoff, protocol); | ||
138 | /* fall through */ | ||
139 | case CHECKSUM_NONE: | ||
140 | hsum = skb_checksum(skb, 0, dataoff, 0); | ||
141 | skb->csum = ~csum_unfold(csum_ipv6_magic(&ip6h->saddr, | ||
142 | &ip6h->daddr, | ||
143 | skb->len - dataoff, | ||
144 | protocol, | ||
145 | csum_sub(0, hsum))); | ||
146 | skb->ip_summed = CHECKSUM_NONE; | ||
147 | csum = __skb_checksum_complete_head(skb, dataoff + len); | ||
148 | if (!csum) | ||
149 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
150 | } | ||
151 | return csum; | ||
152 | }; | ||
153 | |||
127 | static const struct nf_afinfo nf_ip6_afinfo = { | 154 | static const struct nf_afinfo nf_ip6_afinfo = { |
128 | .family = AF_INET6, | 155 | .family = AF_INET6, |
129 | .checksum = nf_ip6_checksum, | 156 | .checksum = nf_ip6_checksum, |
130 | .route = nf_ip6_route, | 157 | .checksum_partial = nf_ip6_checksum_partial, |
131 | .saveroute = nf_ip6_saveroute, | 158 | .route = nf_ip6_route, |
132 | .reroute = nf_ip6_reroute, | 159 | .saveroute = nf_ip6_saveroute, |
133 | .route_key_size = sizeof(struct ip6_rt_info), | 160 | .reroute = nf_ip6_reroute, |
161 | .route_key_size = sizeof(struct ip6_rt_info), | ||
134 | }; | 162 | }; |
135 | 163 | ||
136 | int __init ipv6_netfilter_init(void) | 164 | int __init ipv6_netfilter_init(void) |
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c index 70ef0d276cc0..0b4557e03431 100644 --- a/net/ipv6/netfilter/ip6_tables.c +++ b/net/ipv6/netfilter/ip6_tables.c | |||
@@ -325,7 +325,7 @@ static void trace_packet(struct sk_buff *skb, | |||
325 | struct ip6t_entry *e) | 325 | struct ip6t_entry *e) |
326 | { | 326 | { |
327 | void *table_base; | 327 | void *table_base; |
328 | struct ip6t_entry *root; | 328 | const struct ip6t_entry *root; |
329 | char *hookname, *chainname, *comment; | 329 | char *hookname, *chainname, *comment; |
330 | unsigned int rulenum = 0; | 330 | unsigned int rulenum = 0; |
331 | 331 | ||
@@ -952,7 +952,7 @@ static struct xt_counters *alloc_counters(struct xt_table *table) | |||
952 | { | 952 | { |
953 | unsigned int countersize; | 953 | unsigned int countersize; |
954 | struct xt_counters *counters; | 954 | struct xt_counters *counters; |
955 | struct xt_table_info *private = table->private; | 955 | const struct xt_table_info *private = table->private; |
956 | 956 | ||
957 | /* We need atomic snapshot of counters: rest doesn't change | 957 | /* We need atomic snapshot of counters: rest doesn't change |
958 | (other than comefrom, which userspace doesn't care | 958 | (other than comefrom, which userspace doesn't care |
@@ -979,9 +979,9 @@ copy_entries_to_user(unsigned int total_size, | |||
979 | unsigned int off, num; | 979 | unsigned int off, num; |
980 | struct ip6t_entry *e; | 980 | struct ip6t_entry *e; |
981 | struct xt_counters *counters; | 981 | struct xt_counters *counters; |
982 | struct xt_table_info *private = table->private; | 982 | const struct xt_table_info *private = table->private; |
983 | int ret = 0; | 983 | int ret = 0; |
984 | void *loc_cpu_entry; | 984 | const void *loc_cpu_entry; |
985 | 985 | ||
986 | counters = alloc_counters(table); | 986 | counters = alloc_counters(table); |
987 | if (IS_ERR(counters)) | 987 | if (IS_ERR(counters)) |
@@ -1001,8 +1001,8 @@ copy_entries_to_user(unsigned int total_size, | |||
1001 | /* ... then go back and fix counters and names */ | 1001 | /* ... then go back and fix counters and names */ |
1002 | for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){ | 1002 | for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){ |
1003 | unsigned int i; | 1003 | unsigned int i; |
1004 | struct ip6t_entry_match *m; | 1004 | const struct ip6t_entry_match *m; |
1005 | struct ip6t_entry_target *t; | 1005 | const struct ip6t_entry_target *t; |
1006 | 1006 | ||
1007 | e = (struct ip6t_entry *)(loc_cpu_entry + off); | 1007 | e = (struct ip6t_entry *)(loc_cpu_entry + off); |
1008 | if (copy_to_user(userptr + off | 1008 | if (copy_to_user(userptr + off |
@@ -1142,7 +1142,7 @@ static int get_info(struct net *net, void __user *user, int *len, int compat) | |||
1142 | "ip6table_%s", name); | 1142 | "ip6table_%s", name); |
1143 | if (t && !IS_ERR(t)) { | 1143 | if (t && !IS_ERR(t)) { |
1144 | struct ip6t_getinfo info; | 1144 | struct ip6t_getinfo info; |
1145 | struct xt_table_info *private = t->private; | 1145 | const struct xt_table_info *private = t->private; |
1146 | 1146 | ||
1147 | #ifdef CONFIG_COMPAT | 1147 | #ifdef CONFIG_COMPAT |
1148 | if (compat) { | 1148 | if (compat) { |
@@ -1206,7 +1206,7 @@ get_entries(struct net *net, struct ip6t_get_entries __user *uptr, int *len) | |||
1206 | else { | 1206 | else { |
1207 | duprintf("get_entries: I've got %u not %u!\n", | 1207 | duprintf("get_entries: I've got %u not %u!\n", |
1208 | private->size, get.size); | 1208 | private->size, get.size); |
1209 | ret = -EINVAL; | 1209 | ret = -EAGAIN; |
1210 | } | 1210 | } |
1211 | module_put(t->me); | 1211 | module_put(t->me); |
1212 | xt_table_unlock(t); | 1212 | xt_table_unlock(t); |
@@ -1225,7 +1225,7 @@ __do_replace(struct net *net, const char *name, unsigned int valid_hooks, | |||
1225 | struct xt_table *t; | 1225 | struct xt_table *t; |
1226 | struct xt_table_info *oldinfo; | 1226 | struct xt_table_info *oldinfo; |
1227 | struct xt_counters *counters; | 1227 | struct xt_counters *counters; |
1228 | void *loc_cpu_old_entry; | 1228 | const void *loc_cpu_old_entry; |
1229 | 1229 | ||
1230 | ret = 0; | 1230 | ret = 0; |
1231 | counters = vmalloc_node(num_counters * sizeof(struct xt_counters), | 1231 | counters = vmalloc_node(num_counters * sizeof(struct xt_counters), |
@@ -1369,9 +1369,9 @@ do_add_counters(struct net *net, void __user *user, unsigned int len, | |||
1369 | int size; | 1369 | int size; |
1370 | void *ptmp; | 1370 | void *ptmp; |
1371 | struct xt_table *t; | 1371 | struct xt_table *t; |
1372 | struct xt_table_info *private; | 1372 | const struct xt_table_info *private; |
1373 | int ret = 0; | 1373 | int ret = 0; |
1374 | void *loc_cpu_entry; | 1374 | const void *loc_cpu_entry; |
1375 | #ifdef CONFIG_COMPAT | 1375 | #ifdef CONFIG_COMPAT |
1376 | struct compat_xt_counters_info compat_tmp; | 1376 | struct compat_xt_counters_info compat_tmp; |
1377 | 1377 | ||
@@ -1905,11 +1905,11 @@ compat_copy_entries_to_user(unsigned int total_size, struct xt_table *table, | |||
1905 | void __user *userptr) | 1905 | void __user *userptr) |
1906 | { | 1906 | { |
1907 | struct xt_counters *counters; | 1907 | struct xt_counters *counters; |
1908 | struct xt_table_info *private = table->private; | 1908 | const struct xt_table_info *private = table->private; |
1909 | void __user *pos; | 1909 | void __user *pos; |
1910 | unsigned int size; | 1910 | unsigned int size; |
1911 | int ret = 0; | 1911 | int ret = 0; |
1912 | void *loc_cpu_entry; | 1912 | const void *loc_cpu_entry; |
1913 | unsigned int i = 0; | 1913 | unsigned int i = 0; |
1914 | 1914 | ||
1915 | counters = alloc_counters(table); | 1915 | counters = alloc_counters(table); |
@@ -1956,7 +1956,7 @@ compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr, | |||
1956 | xt_compat_lock(AF_INET6); | 1956 | xt_compat_lock(AF_INET6); |
1957 | t = xt_find_table_lock(net, AF_INET6, get.name); | 1957 | t = xt_find_table_lock(net, AF_INET6, get.name); |
1958 | if (t && !IS_ERR(t)) { | 1958 | if (t && !IS_ERR(t)) { |
1959 | struct xt_table_info *private = t->private; | 1959 | const struct xt_table_info *private = t->private; |
1960 | struct xt_table_info info; | 1960 | struct xt_table_info info; |
1961 | duprintf("t->private->number = %u\n", private->number); | 1961 | duprintf("t->private->number = %u\n", private->number); |
1962 | ret = compat_table_info(private, &info); | 1962 | ret = compat_table_info(private, &info); |
@@ -1966,7 +1966,7 @@ compat_get_entries(struct net *net, struct compat_ip6t_get_entries __user *uptr, | |||
1966 | } else if (!ret) { | 1966 | } else if (!ret) { |
1967 | duprintf("compat_get_entries: I've got %u not %u!\n", | 1967 | duprintf("compat_get_entries: I've got %u not %u!\n", |
1968 | private->size, get.size); | 1968 | private->size, get.size); |
1969 | ret = -EINVAL; | 1969 | ret = -EAGAIN; |
1970 | } | 1970 | } |
1971 | xt_compat_flush_offsets(AF_INET6); | 1971 | xt_compat_flush_offsets(AF_INET6); |
1972 | module_put(t->me); | 1972 | module_put(t->me); |
@@ -2155,7 +2155,8 @@ icmp6_match(const struct sk_buff *skb, | |||
2155 | unsigned int protoff, | 2155 | unsigned int protoff, |
2156 | bool *hotdrop) | 2156 | bool *hotdrop) |
2157 | { | 2157 | { |
2158 | struct icmp6hdr _icmph, *ic; | 2158 | const struct icmp6hdr *ic; |
2159 | struct icmp6hdr _icmph; | ||
2159 | const struct ip6t_icmp *icmpinfo = matchinfo; | 2160 | const struct ip6t_icmp *icmpinfo = matchinfo; |
2160 | 2161 | ||
2161 | /* Must not be a fragment. */ | 2162 | /* Must not be a fragment. */ |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 86a613810b69..3a2316974f83 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -363,11 +363,15 @@ static void dump_packet(const struct nf_loginfo *info, | |||
363 | if ((logflags & IP6T_LOG_UID) && recurse && skb->sk) { | 363 | if ((logflags & IP6T_LOG_UID) && recurse && skb->sk) { |
364 | read_lock_bh(&skb->sk->sk_callback_lock); | 364 | read_lock_bh(&skb->sk->sk_callback_lock); |
365 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) | 365 | if (skb->sk->sk_socket && skb->sk->sk_socket->file) |
366 | printk("UID=%u GID=%u", | 366 | printk("UID=%u GID=%u ", |
367 | skb->sk->sk_socket->file->f_uid, | 367 | skb->sk->sk_socket->file->f_uid, |
368 | skb->sk->sk_socket->file->f_gid); | 368 | skb->sk->sk_socket->file->f_gid); |
369 | read_unlock_bh(&skb->sk->sk_callback_lock); | 369 | read_unlock_bh(&skb->sk->sk_callback_lock); |
370 | } | 370 | } |
371 | |||
372 | /* Max length: 16 "MARK=0xFFFFFFFF " */ | ||
373 | if (!recurse && skb->mark) | ||
374 | printk("MARK=0x%x ", skb->mark); | ||
371 | } | 375 | } |
372 | 376 | ||
373 | static struct nf_loginfo default_loginfo = { | 377 | static struct nf_loginfo default_loginfo = { |
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c index baf829075f6f..44c8d65a2431 100644 --- a/net/ipv6/netfilter/ip6t_REJECT.c +++ b/net/ipv6/netfilter/ip6t_REJECT.c | |||
@@ -41,7 +41,8 @@ static void send_reset(struct sk_buff *oldskb) | |||
41 | struct tcphdr otcph, *tcph; | 41 | struct tcphdr otcph, *tcph; |
42 | unsigned int otcplen, hh_len; | 42 | unsigned int otcplen, hh_len; |
43 | int tcphoff, needs_ack; | 43 | int tcphoff, needs_ack; |
44 | struct ipv6hdr *oip6h = ipv6_hdr(oldskb), *ip6h; | 44 | const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); |
45 | struct ipv6hdr *ip6h; | ||
45 | struct dst_entry *dst = NULL; | 46 | struct dst_entry *dst = NULL; |
46 | u8 proto; | 47 | u8 proto; |
47 | struct flowi fl; | 48 | struct flowi fl; |
diff --git a/net/ipv6/netfilter/ip6t_ipv6header.c b/net/ipv6/netfilter/ip6t_ipv6header.c index 3a940171f829..317a8960a757 100644 --- a/net/ipv6/netfilter/ip6t_ipv6header.c +++ b/net/ipv6/netfilter/ip6t_ipv6header.c | |||
@@ -49,7 +49,8 @@ ipv6header_mt6(const struct sk_buff *skb, const struct net_device *in, | |||
49 | temp = 0; | 49 | temp = 0; |
50 | 50 | ||
51 | while (ip6t_ext_hdr(nexthdr)) { | 51 | while (ip6t_ext_hdr(nexthdr)) { |
52 | struct ipv6_opt_hdr _hdr, *hp; | 52 | const struct ipv6_opt_hdr *hp; |
53 | struct ipv6_opt_hdr _hdr; | ||
53 | int hdrlen; | 54 | int hdrlen; |
54 | 55 | ||
55 | /* Is there enough space for the next ext header? */ | 56 | /* Is there enough space for the next ext header? */ |
diff --git a/net/ipv6/netfilter/ip6t_rt.c b/net/ipv6/netfilter/ip6t_rt.c index 12a9efe9886e..81aaf7aaaabf 100644 --- a/net/ipv6/netfilter/ip6t_rt.c +++ b/net/ipv6/netfilter/ip6t_rt.c | |||
@@ -110,7 +110,8 @@ rt_mt6(const struct sk_buff *skb, const struct net_device *in, | |||
110 | !!(rtinfo->invflags & IP6T_RT_INV_TYP))); | 110 | !!(rtinfo->invflags & IP6T_RT_INV_TYP))); |
111 | 111 | ||
112 | if (ret && (rtinfo->flags & IP6T_RT_RES)) { | 112 | if (ret && (rtinfo->flags & IP6T_RT_RES)) { |
113 | u_int32_t *rp, _reserved; | 113 | const u_int32_t *rp; |
114 | u_int32_t _reserved; | ||
114 | rp = skb_header_pointer(skb, | 115 | rp = skb_header_pointer(skb, |
115 | ptr + offsetof(struct rt0_hdr, | 116 | ptr + offsetof(struct rt0_hdr, |
116 | reserved), | 117 | reserved), |
diff --git a/net/ipv6/netfilter/ip6table_filter.c b/net/ipv6/netfilter/ip6table_filter.c index 2d9cd095a72c..f979e48b469b 100644 --- a/net/ipv6/netfilter/ip6table_filter.c +++ b/net/ipv6/netfilter/ip6table_filter.c | |||
@@ -54,7 +54,7 @@ static struct | |||
54 | static struct xt_table packet_filter = { | 54 | static struct xt_table packet_filter = { |
55 | .name = "filter", | 55 | .name = "filter", |
56 | .valid_hooks = FILTER_VALID_HOOKS, | 56 | .valid_hooks = FILTER_VALID_HOOKS, |
57 | .lock = RW_LOCK_UNLOCKED, | 57 | .lock = __RW_LOCK_UNLOCKED(packet_filter.lock), |
58 | .me = THIS_MODULE, | 58 | .me = THIS_MODULE, |
59 | .af = AF_INET6, | 59 | .af = AF_INET6, |
60 | }; | 60 | }; |
diff --git a/net/ipv6/netfilter/ip6table_mangle.c b/net/ipv6/netfilter/ip6table_mangle.c index 035343a90ffe..27a5e8b48d93 100644 --- a/net/ipv6/netfilter/ip6table_mangle.c +++ b/net/ipv6/netfilter/ip6table_mangle.c | |||
@@ -60,7 +60,7 @@ static struct | |||
60 | static struct xt_table packet_mangler = { | 60 | static struct xt_table packet_mangler = { |
61 | .name = "mangle", | 61 | .name = "mangle", |
62 | .valid_hooks = MANGLE_VALID_HOOKS, | 62 | .valid_hooks = MANGLE_VALID_HOOKS, |
63 | .lock = RW_LOCK_UNLOCKED, | 63 | .lock = __RW_LOCK_UNLOCKED(packet_mangler.lock), |
64 | .me = THIS_MODULE, | 64 | .me = THIS_MODULE, |
65 | .af = AF_INET6, | 65 | .af = AF_INET6, |
66 | }; | 66 | }; |
diff --git a/net/ipv6/netfilter/ip6table_raw.c b/net/ipv6/netfilter/ip6table_raw.c index 5cd84203abfe..92b91077ac29 100644 --- a/net/ipv6/netfilter/ip6table_raw.c +++ b/net/ipv6/netfilter/ip6table_raw.c | |||
@@ -38,7 +38,7 @@ static struct | |||
38 | static struct xt_table packet_raw = { | 38 | static struct xt_table packet_raw = { |
39 | .name = "raw", | 39 | .name = "raw", |
40 | .valid_hooks = RAW_VALID_HOOKS, | 40 | .valid_hooks = RAW_VALID_HOOKS, |
41 | .lock = RW_LOCK_UNLOCKED, | 41 | .lock = __RW_LOCK_UNLOCKED(packet_raw.lock), |
42 | .me = THIS_MODULE, | 42 | .me = THIS_MODULE, |
43 | .af = AF_INET6, | 43 | .af = AF_INET6, |
44 | }; | 44 | }; |
diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c index 3717bdf34f6e..85050c072abd 100644 --- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c +++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <net/netfilter/nf_conntrack_l3proto.h> | 27 | #include <net/netfilter/nf_conntrack_l3proto.h> |
28 | #include <net/netfilter/nf_conntrack_core.h> | 28 | #include <net/netfilter/nf_conntrack_core.h> |
29 | 29 | ||
30 | static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, | 30 | static bool ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, |
31 | struct nf_conntrack_tuple *tuple) | 31 | struct nf_conntrack_tuple *tuple) |
32 | { | 32 | { |
33 | const u_int32_t *ap; | 33 | const u_int32_t *ap; |
34 | u_int32_t _addrs[8]; | 34 | u_int32_t _addrs[8]; |
@@ -36,21 +36,21 @@ static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, | |||
36 | ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), | 36 | ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), |
37 | sizeof(_addrs), _addrs); | 37 | sizeof(_addrs), _addrs); |
38 | if (ap == NULL) | 38 | if (ap == NULL) |
39 | return 0; | 39 | return false; |
40 | 40 | ||
41 | memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); | 41 | memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); |
42 | memcpy(tuple->dst.u3.ip6, ap + 4, sizeof(tuple->dst.u3.ip6)); | 42 | memcpy(tuple->dst.u3.ip6, ap + 4, sizeof(tuple->dst.u3.ip6)); |
43 | 43 | ||
44 | return 1; | 44 | return true; |
45 | } | 45 | } |
46 | 46 | ||
47 | static int ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, | 47 | static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, |
48 | const struct nf_conntrack_tuple *orig) | 48 | const struct nf_conntrack_tuple *orig) |
49 | { | 49 | { |
50 | memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6)); | 50 | memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6)); |
51 | memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6)); | 51 | memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6)); |
52 | 52 | ||
53 | return 1; | 53 | return true; |
54 | } | 54 | } |
55 | 55 | ||
56 | static int ipv6_print_tuple(struct seq_file *s, | 56 | static int ipv6_print_tuple(struct seq_file *s, |
diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c index 0897d0f4c4a2..ee713b03e9ec 100644 --- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c +++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c | |||
@@ -28,21 +28,21 @@ | |||
28 | 28 | ||
29 | static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; | 29 | static unsigned long nf_ct_icmpv6_timeout __read_mostly = 30*HZ; |
30 | 30 | ||
31 | static int icmpv6_pkt_to_tuple(const struct sk_buff *skb, | 31 | static bool icmpv6_pkt_to_tuple(const struct sk_buff *skb, |
32 | unsigned int dataoff, | 32 | unsigned int dataoff, |
33 | struct nf_conntrack_tuple *tuple) | 33 | struct nf_conntrack_tuple *tuple) |
34 | { | 34 | { |
35 | const struct icmp6hdr *hp; | 35 | const struct icmp6hdr *hp; |
36 | struct icmp6hdr _hdr; | 36 | struct icmp6hdr _hdr; |
37 | 37 | ||
38 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 38 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
39 | if (hp == NULL) | 39 | if (hp == NULL) |
40 | return 0; | 40 | return false; |
41 | tuple->dst.u.icmp.type = hp->icmp6_type; | 41 | tuple->dst.u.icmp.type = hp->icmp6_type; |
42 | tuple->src.u.icmp.id = hp->icmp6_identifier; | 42 | tuple->src.u.icmp.id = hp->icmp6_identifier; |
43 | tuple->dst.u.icmp.code = hp->icmp6_code; | 43 | tuple->dst.u.icmp.code = hp->icmp6_code; |
44 | 44 | ||
45 | return 1; | 45 | return true; |
46 | } | 46 | } |
47 | 47 | ||
48 | /* Add 1; spaces filled with 0. */ | 48 | /* Add 1; spaces filled with 0. */ |
@@ -53,17 +53,17 @@ static const u_int8_t invmap[] = { | |||
53 | [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1 | 53 | [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1 |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static int icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, | 56 | static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, |
57 | const struct nf_conntrack_tuple *orig) | 57 | const struct nf_conntrack_tuple *orig) |
58 | { | 58 | { |
59 | int type = orig->dst.u.icmp.type - 128; | 59 | int type = orig->dst.u.icmp.type - 128; |
60 | if (type < 0 || type >= sizeof(invmap) || !invmap[type]) | 60 | if (type < 0 || type >= sizeof(invmap) || !invmap[type]) |
61 | return 0; | 61 | return false; |
62 | 62 | ||
63 | tuple->src.u.icmp.id = orig->src.u.icmp.id; | 63 | tuple->src.u.icmp.id = orig->src.u.icmp.id; |
64 | tuple->dst.u.icmp.type = invmap[type] - 1; | 64 | tuple->dst.u.icmp.type = invmap[type] - 1; |
65 | tuple->dst.u.icmp.code = orig->dst.u.icmp.code; | 65 | tuple->dst.u.icmp.code = orig->dst.u.icmp.code; |
66 | return 1; | 66 | return true; |
67 | } | 67 | } |
68 | 68 | ||
69 | /* Print out the per-protocol part of the tuple. */ | 69 | /* Print out the per-protocol part of the tuple. */ |
@@ -102,9 +102,8 @@ static int icmpv6_packet(struct nf_conn *ct, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* Called when a new connection for this protocol found. */ | 104 | /* Called when a new connection for this protocol found. */ |
105 | static int icmpv6_new(struct nf_conn *ct, | 105 | static bool icmpv6_new(struct nf_conn *ct, const struct sk_buff *skb, |
106 | const struct sk_buff *skb, | 106 | unsigned int dataoff) |
107 | unsigned int dataoff) | ||
108 | { | 107 | { |
109 | static const u_int8_t valid_new[] = { | 108 | static const u_int8_t valid_new[] = { |
110 | [ICMPV6_ECHO_REQUEST - 128] = 1, | 109 | [ICMPV6_ECHO_REQUEST - 128] = 1, |
@@ -116,11 +115,11 @@ static int icmpv6_new(struct nf_conn *ct, | |||
116 | /* Can't create a new ICMPv6 `conn' with this. */ | 115 | /* Can't create a new ICMPv6 `conn' with this. */ |
117 | pr_debug("icmpv6: can't create new conn with type %u\n", | 116 | pr_debug("icmpv6: can't create new conn with type %u\n", |
118 | type + 128); | 117 | type + 128); |
119 | NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); | 118 | nf_ct_dump_tuple_ipv6(&ct->tuplehash[0].tuple); |
120 | return 0; | 119 | return false; |
121 | } | 120 | } |
122 | atomic_set(&ct->proto.icmp.count, 0); | 121 | atomic_set(&ct->proto.icmp.count, 0); |
123 | return 1; | 122 | return true; |
124 | } | 123 | } |
125 | 124 | ||
126 | static int | 125 | static int |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 9e5f305b2022..2dccad48058c 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -103,8 +103,8 @@ struct ctl_table nf_ct_ipv6_sysctl_table[] = { | |||
103 | }; | 103 | }; |
104 | #endif | 104 | #endif |
105 | 105 | ||
106 | static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr, | 106 | static unsigned int ip6qhashfn(__be32 id, const struct in6_addr *saddr, |
107 | struct in6_addr *daddr) | 107 | const struct in6_addr *daddr) |
108 | { | 108 | { |
109 | u32 a, b, c; | 109 | u32 a, b, c; |
110 | 110 | ||
@@ -132,7 +132,7 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr, | |||
132 | 132 | ||
133 | static unsigned int nf_hashfn(struct inet_frag_queue *q) | 133 | static unsigned int nf_hashfn(struct inet_frag_queue *q) |
134 | { | 134 | { |
135 | struct nf_ct_frag6_queue *nq; | 135 | const struct nf_ct_frag6_queue *nq; |
136 | 136 | ||
137 | nq = container_of(q, struct nf_ct_frag6_queue, q); | 137 | nq = container_of(q, struct nf_ct_frag6_queue, q); |
138 | return ip6qhashfn(nq->id, &nq->saddr, &nq->daddr); | 138 | return ip6qhashfn(nq->id, &nq->saddr, &nq->daddr); |
@@ -222,7 +222,7 @@ oom: | |||
222 | 222 | ||
223 | 223 | ||
224 | static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, | 224 | static int nf_ct_frag6_queue(struct nf_ct_frag6_queue *fq, struct sk_buff *skb, |
225 | struct frag_hdr *fhdr, int nhoff) | 225 | const struct frag_hdr *fhdr, int nhoff) |
226 | { | 226 | { |
227 | struct sk_buff *prev, *next; | 227 | struct sk_buff *prev, *next; |
228 | int offset, end; | 228 | int offset, end; |