summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-13 19:48:52 +0200
committersven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-13 19:48:52 +0200
commitbc06ff816f8dde2648f6efe5ebe80c3c7a8c6825 (patch)
treefca4cc52cb3a3b3cda9335a0b7db92580385dec1
parent33e74904a7b7613a27603c4df96fe2387e2d0595 (diff)
downloadNPTv6-bc06ff816f8dde2648f6efe5ebe80c3c7a8c6825.tar
NPTv6-bc06ff816f8dde2648f6efe5ebe80c3c7a8c6825.zip
fix
git-svn-id: https://map66.svn.sourceforge.net/svnroot/map66@25 3484d885-4da6-438d-b19d-107d078dd756
-rw-r--r--ip6t_MAP66.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/ip6t_MAP66.c b/ip6t_MAP66.c
index ca0e559..b00c818 100644
--- a/ip6t_MAP66.c
+++ b/ip6t_MAP66.c
@@ -126,10 +126,22 @@ static unsigned int MAP66_tg6(
&hdr->saddr, &hdr->daddr);
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
+ if (skb_cloned(skb) && !skb->sk) {
+ struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC);
+ if (!nskb) {
+ pr_devel("MAP66: cannot copy, dropped\n");
+ return NF_DROP;
+ }
+ kfree_skb(skb);
+ skb = nskb;
+ }
+#else
if (!skb_make_writable(skb, sizeof(struct ipv6hdr))) {
pr_devel("MAP66: unwriteable, dropped\n");
return NF_DROP;
}
+#endif
hdr = ipv6_hdr(skb);
if (0 != (IP6T_MAP66_OPT_DST_TO & info->mapflags)) {
@@ -148,7 +160,12 @@ static unsigned int MAP66_tg6(
if (0 != (IP6T_MAP66_OPT_SRC_TO & info->mapflags)) {
pr_devel("MAP66 SRC, nocheck=%d, ip_summed=%d\n", 0 != (IP6T_MAP66_OPT_NOCHECK & info->mapflags), skb->ip_summed);
- map16(&hdr->saddr, &info->pfix_src_to, info->pfix_src_len, info->pfix_src_csum);
+ if (0 != (IP6T_MAP66_OPT_UNBALANCED & info->mapflags)) {
+ memcpy(&hdr->saddr, &info->pfix_src_to, sizeof(u_int16_t) * info->pfix_src_len);
+ }
+ else {
+ map16(&hdr->saddr, &info->pfix_src_to, info->pfix_src_len, info->pfix_src_csum);
+ }
if (0 == (IP6T_MAP66_OPT_NOCHECK & info->mapflags) &&
is_my_ipv6_addr(par->out, &hdr->saddr))
{