Re: Entirely ignoring TCP and UDP checksum in kernel level

Brad Campbell
2004-08-22T08:33:53Z

Josan Kadett wrote:
> Linux Kernel 2.4.18-14 [Redhat 8 standard installation]
>
> As I underlined, I have been able to disable IP header checksumming for the
> received packets, so the system will not drop the packets even after CRC
> becomes invalid when the source address changes.
>
> I have been asking this question over ten different mailing list and forums
> and no one has come up with a "solid" solution. I would be exteremely glad
> if I get a working source code.
>
> I know the application will be so very simple, just changing some bits with
> another and putting it back to userspace, but it requires some low-level
> libraries and the knowledge to use them...

This *MAY* do what you want.. (Compiled and tested on 2.4.26)

--- /usr/src/linux-2.4.26/net/ipv4/ip_input.c 2002-08-03 04:39:46.000000000 +0400
+++ net/ipv4/ip_input.c 2004-08-22 12:22:41.000000000 +0400
@@ -417,6 +417,10 @@

if (ip_fast_csum((u8 *)iph, iph->ihl) != 0)
goto inhdr_error;
+ printk("Ip saddr %08x -- ",iph->saddr);
+ if (iph->saddr == 0x0101a8c0) // 192.168.1.1
+ iph->saddr = 0x014da8c0; // 192.168.77.1
+ printk("Ip saddr %08x\n",iph->saddr);

{
__u32 len = ntohs(iph->tot_len);

When you verify what it's doing, just remove the printk's.

I did it here using one of my local addresses (uml == 192.168.2.84)
And had the above addresses convert 192.168.2.85 to 192.168.77.1

bklaptop:/home/brad# tcpdump -i tap0
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on tap0, link-type EN10MB (Ethernet), capture size 96 bytes
12:24:16.723748 IP 192.168.2.85 > uml: icmp 64: echo request seq 0
12:24:16.725119 arp who-has gateway tell uml
12:24:17.289458 arp reply gateway is-at 00:ff:14:7a:fe:66
12:24:17.290282 IP uml > 192.168.77.1: icmp 64: echo reply seq 0
12:24:17.720057 IP 192.168.2.85 > uml: icmp 64: echo request seq 256
12:24:17.723690 IP uml > 192.168.77.1: icmp 64: echo reply seq 256
12:24:18.720632 IP 192.168.2.85 > uml: icmp 64: echo request seq 512
12:24:18.724369 IP uml > 192.168.77.1: icmp 64: echo reply seq 512

Good luck.

Regards,
Brad