RE: changing ip addr of skbuff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sandip,

In one of my modifications that I had tried, I did change the dst. What
I have done looks like this:

	src | dst			src | dst
	 A  |  B			 A  |  B
	ip6_output_finish		ip6_rcv
	 C  |  D			 C  |  D
	    +------------->---------+

As you can see, I reverted the addresses back to the original before any
checksum calculation is done on the opposite host. Hence, I didn't see
the need to recalculate the header which, anyway, makes things way too
messy.
I even toyed around with the udp and tcp, but it gets murkier as I
trudged deeper into the codes.

Is the checksum calculation dependent on dst? Where exactly is the dst
information (physically) in the skbuff?
Does the skbuff contains any dst information after it is being sent out
onto the wires?

regards,
jonathan


-----Original Message-----
From: kernelnewbies-bounce@nl.linux.org
[mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Sandip
Bhattacharya
Sent: Tuesday, May 28, 2002 4:34 PM
To: kernelnewbies@nl.linux.org
Subject: Re: changing ip addr of skbuff


On Tue, May 28, 2002 at 04:19:46PM +0900, Jonathan Khoo spoke out thus:
> Thanks for your comments.
> Well, actually I am working on IPv6 packets. I used tcpdump along the
> route, seems okay. The packets did actually arrive at the other host.
> However, it failed the checksum. Eg. icmp or udp checksum. I only
> changed the addr in the skbuff header and didn't do anything with
> skb->dst. Should I change that too? Well, I did meddle with that as

If you change the destination IP address, you do have to lookup the
routing entry again(ip_route_output) and set skb->dst accordingly. If
you change the source, then lookup the route only if you feel that
source routing maybe in place.

But in all cases, do remember to do an ip_send_check and recalculate
the IP checksum. TCP/UDP packets use parts of the IP header to
calculate the checksum. So you have to recalculate them to.

- Sandip


> well. However, it seems to have pretty weird effect on the neighbour
> discovery table for both cases.
> 
> Arghh....
> 
> 
> -----Original Message-----
> From: kernelnewbies-bounce@nl.linux.org
> [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Olle Ollesson
> Sent: Monday, May 27, 2002 4:03 PM
> To: kernelnewbies@nl.linux.org
> Cc: Jonathan Khoo
> Subject: Re: changing ip addr of skbuff 
> 
> You can look at the second part of one of my older (14
> May 2002, Subject: Big/Little-endian confusion)
> posting to this list about my problems when changing
> the IP addr in an sk_buff. Maybe your problem is
> related to this. It may be, that when you change the
> IP addr, you actually change the two last octets of
> the IP addr and the two following octets.
> 
> To rule out that this is the problem, ensure that the
> IP addr is changed correctly in the sk_buff sent out.
> I used a network sniffer on another computer in the
> network to do this.
> 
> I haven't yet been able to find an explanation about
> what causes this.
> 
> 
> /
>   h_e_w_i
> 
> 
> 
> --- Jonathan Khoo <jonath-k@is.aist-nara.ac.jp> wrote:
> > Hi guys,
> > 
> > I changed the ip addr of the skbuff before it was
> > being sent to the
> > network device driver. However, I got checksum error
> > when the other side
> > received it. I did convert the addr back to the
> > original addr before
> > doing checksum. Why did I get the checksum error? Is
> > there anything that
> > I miss out?
> > 
> > Thanks for any advices.
> > jon
> > 
> > 
> > --
> > Kernelnewbies: Help each other learn about the Linux
> > kernel.
> > Archive:      
> > http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 
> 
> 
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/

-- 
Sandip Bhattacharya
Mindframe Software
Work: sandip @ mindsw.com, http://www.mindsw.com
Play: sandipb @ bigfoot.com, http://www.sandipb.net
-----------------------------------------------
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux