summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-15 18:40:48 +0200
committersven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-15 18:40:48 +0200
commitf1c78fedfe90d593dd1bf6179e103af502533d3e (patch)
treee64aa52835d28acfc1ee9278b2532ec644b4f78b
parentbb6207bfd8f99b1042261f29a8de1f968e8ee504 (diff)
downloadNPTv6-f1c78fedfe90d593dd1bf6179e103af502533d3e.tar
NPTv6-f1c78fedfe90d593dd1bf6179e103af502533d3e.zip
git-svn-id: https://map66.svn.sourceforge.net/svnroot/map66@45 3484d885-4da6-438d-b19d-107d078dd756
-rw-r--r--ip6t_MAP66.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/ip6t_MAP66.c b/ip6t_MAP66.c
index 18765b5..433586d 100644
--- a/ip6t_MAP66.c
+++ b/ip6t_MAP66.c
@@ -66,21 +66,14 @@ static void map_csum(
u_int16_t csum_to,
u_int16_t* csum_transport)
{
- printk("SOT len=%d, csum = %04hx\n", len_to,
- ~add16(
- add16(
- ~(*csum_transport),
- ~csum16((u_int16_t *)&addr, len_to)
- ),
- csum16((u_int16_t *)&to, len_to)
- )
- );
-
*csum_transport = ~add16(
- ~csum_to,
- add16(~*csum_transport, ~csum16((u_int16_t *)&addr, len_to))
+ add16(
+ ~(*csum_transport),
+ ~csum16((u_int16_t *)addr, len_to)
+ ),
+ ~csum_to
);
- memcpy(addr, to, sizeof(u_int16_t) * len_to);
+ memcpy(addr, to, len_to * 2);
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -260,6 +253,17 @@ static unsigned int MAP66_tg6(
pr_devel("MAP66: SRC_TO, ip_summed=%d\n", skb->ip_summed);
if (0 != (IP6T_MAP66_OPT_CSUM & info->mapflags)) {
map_csum(&hdr->saddr, &info->pfix_src_to, info->pfix_src_len, info->pfix_src_csum, csum_transport);
+#if 0
+ *csum_transport = ~add16(
+ add16(
+ ~(*csum_transport),
+ ~csum16((u_int16_t *)&hdr->saddr, info->pfix_src_len)
+ ),
+ ~info->pfix_src_csum
+ );
+ memcpy(&hdr->saddr, &info->pfix_src_to, info->pfix_src_len * 2);
+#endif
+
pr_devel("SOT src: cksum=%p(%04hx)\n", csum_transport, *csum_transport);
{
u_int16_t csum = 0;