summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;