summaryrefslogtreecommitdiffstats
path: root/ip6t_MAP66.c
diff options
context:
space:
mode:
authorsven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-15 18:43:35 +0200
committersven-ola <sven-ola@3484d885-4da6-438d-b19d-107d078dd756>2010-10-15 18:43:35 +0200
commit5e42936c6035519cc1d41c637a02939726c87a71 (patch)
tree91206ced7da3c5e6395b2bfaa806fb90037956a7 /ip6t_MAP66.c
parentf1c78fedfe90d593dd1bf6179e103af502533d3e (diff)
downloadNPTv6-5e42936c6035519cc1d41c637a02939726c87a71.tar
NPTv6-5e42936c6035519cc1d41c637a02939726c87a71.zip
--csum works
git-svn-id: https://map66.svn.sourceforge.net/svnroot/map66@46 3484d885-4da6-438d-b19d-107d078dd756
Diffstat (limited to 'ip6t_MAP66.c')
-rw-r--r--ip6t_MAP66.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/ip6t_MAP66.c b/ip6t_MAP66.c
index 433586d..28e7e80 100644
--- a/ip6t_MAP66.c
+++ b/ip6t_MAP66.c
@@ -16,9 +16,6 @@
# include <linux/dccp.h>
#endif
-// SOT
-#include <net/checksum.h>
-
#include "ip6t_MAP66.h"
MODULE_AUTHOR("Sven-Ola <sven-ola()gmx.de>");
@@ -183,7 +180,6 @@ static unsigned int MAP66_tg6(
if (0 != (IP6T_MAP66_OPT_CSUM & info->mapflags)) {
u8 nexthdr = hdr->nexthdr;
unsigned char* transport = (unsigned char* )hdr + sizeof(struct ipv6hdr);
- pr_devel("SOT: hdr=%p, nexthdr=%d, transport=%p\n", hdr, nexthdr, transport);
if (ipv6_ext_hdr(nexthdr)) {
int hoff = ipv6_skip_exthdr(skb, sizeof(struct ipv6hdr), &nexthdr
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
@@ -195,7 +191,6 @@ static unsigned int MAP66_tg6(
return NF_DROP;
}
transport += hoff;
- pr_devel("SOT: nexthdr=%d, transport%p\n", nexthdr, transport);
}
switch(nexthdr) {
case IPPROTO_TCP:
@@ -214,19 +209,6 @@ static unsigned int MAP66_tg6(
#endif
case IPPROTO_ICMPV6:
csum_transport = &((struct icmp6hdr*)transport)->icmp6_cksum;
- pr_devel("SOT icmpv6:, transport=%p, cksum=%p(%04hx)\n", transport, csum_transport, *csum_transport);
- {
- u_int16_t csum = 0;
- u_int16_t old_csum = *csum_transport;
- *csum_transport = 0;
- csum = add16(csum, csum16((u_int16_t*)&hdr->saddr, sizeof(hdr->saddr) / 2));
- csum = add16(csum, csum16((u_int16_t*)&hdr->daddr, sizeof(hdr->daddr) / 2));
- csum = add16(csum, hdr->payload_len);
- csum = add16(csum, ntohs(hdr->nexthdr));
- csum = add16(csum, csum16((u_int16_t*)transport, ntohs(hdr->payload_len) / 2));
- pr_devel("SOT: csum should=%04hx\n", ~csum);
- *csum_transport = old_csum;
- }
break;
default:
pr_devel("MAP66: Unsupported protocol %d\n", nexthdr);
@@ -241,7 +223,6 @@ static unsigned int MAP66_tg6(
{
if (0 != (IP6T_MAP66_OPT_CSUM & info->mapflags)) {
map_csum(&hdr->daddr, &info->pfix_dst_to, info->pfix_dst_len, info->pfix_dst_csum, csum_transport);
- pr_devel("SOT dst: cksum=%p(%04hx)\n", csum_transport, *csum_transport);
}
else {
map16(&hdr->daddr, &info->pfix_dst_to, info->pfix_dst_len, info->pfix_dst_csum);
@@ -253,30 +234,6 @@ 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;
- u_int16_t old_csum = *csum_transport;
- *csum_transport = 0;
- csum = add16(csum, csum16((u_int16_t*)&hdr->saddr, sizeof(hdr->saddr) / 2));
- csum = add16(csum, csum16((u_int16_t*)&hdr->daddr, sizeof(hdr->daddr) / 2));
- csum = add16(csum, hdr->payload_len);
- csum = add16(csum, ntohs(hdr->nexthdr));
- csum = add16(csum, csum16(((u_int16_t*)hdr) + 20, ntohs(hdr->payload_len) / 2));
- pr_devel("SOT: csum should=%04hx\n", ~csum);
- *csum_transport = old_csum;
- }
}
else {
map16(&hdr->saddr, &info->pfix_src_to, info->pfix_src_len, info->pfix_src_csum);