diff options
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r-- | net/ipv6/raw.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index a22c9c93d931..aac6aeb8de8c 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include <net/udp.h> | 49 | #include <net/udp.h> |
50 | #include <net/inet_common.h> | 50 | #include <net/inet_common.h> |
51 | #include <net/tcp_states.h> | 51 | #include <net/tcp_states.h> |
52 | #ifdef CONFIG_IPV6_MIP6 | 52 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
53 | #include <net/mip6.h> | 53 | #include <net/mip6.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
@@ -137,6 +137,28 @@ static __inline__ int icmpv6_filter(struct sock *sk, struct sk_buff *skb) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | ||
141 | static int (*mh_filter)(struct sock *sock, struct sk_buff *skb); | ||
142 | |||
143 | int rawv6_mh_filter_register(int (*filter)(struct sock *sock, | ||
144 | struct sk_buff *skb)) | ||
145 | { | ||
146 | rcu_assign_pointer(mh_filter, filter); | ||
147 | return 0; | ||
148 | } | ||
149 | EXPORT_SYMBOL(rawv6_mh_filter_register); | ||
150 | |||
151 | int rawv6_mh_filter_unregister(int (*filter)(struct sock *sock, | ||
152 | struct sk_buff *skb)) | ||
153 | { | ||
154 | rcu_assign_pointer(mh_filter, NULL); | ||
155 | synchronize_rcu(); | ||
156 | return 0; | ||
157 | } | ||
158 | EXPORT_SYMBOL(rawv6_mh_filter_unregister); | ||
159 | |||
160 | #endif | ||
161 | |||
140 | /* | 162 | /* |
141 | * demultiplex raw sockets. | 163 | * demultiplex raw sockets. |
142 | * (should consider queueing the skb in the sock receive_queue | 164 | * (should consider queueing the skb in the sock receive_queue |
@@ -178,16 +200,22 @@ int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr) | |||
178 | case IPPROTO_ICMPV6: | 200 | case IPPROTO_ICMPV6: |
179 | filtered = icmpv6_filter(sk, skb); | 201 | filtered = icmpv6_filter(sk, skb); |
180 | break; | 202 | break; |
181 | #ifdef CONFIG_IPV6_MIP6 | 203 | |
204 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | ||
182 | case IPPROTO_MH: | 205 | case IPPROTO_MH: |
206 | { | ||
183 | /* XXX: To validate MH only once for each packet, | 207 | /* XXX: To validate MH only once for each packet, |
184 | * this is placed here. It should be after checking | 208 | * this is placed here. It should be after checking |
185 | * xfrm policy, however it doesn't. The checking xfrm | 209 | * xfrm policy, however it doesn't. The checking xfrm |
186 | * policy is placed in rawv6_rcv() because it is | 210 | * policy is placed in rawv6_rcv() because it is |
187 | * required for each socket. | 211 | * required for each socket. |
188 | */ | 212 | */ |
189 | filtered = mip6_mh_filter(sk, skb); | 213 | int (*filter)(struct sock *sock, struct sk_buff *skb); |
214 | |||
215 | filter = rcu_dereference(mh_filter); | ||
216 | filtered = filter ? filter(sk, skb) : 0; | ||
190 | break; | 217 | break; |
218 | } | ||
191 | #endif | 219 | #endif |
192 | default: | 220 | default: |
193 | filtered = 0; | 221 | filtered = 0; |