Re: checksum calulation in packet forwarding

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

 



On Sun, 30 Jan 2005, cranium 2003 wrote:

> 1) How Router knows destinations mtu. In IP forwarding case following
> function is used that checks pmtu value to decide whether outgoing
> packet is required to fragment a packet or not?

There is specific ICMP message for getting the MTU of the path. The PTMU 
stands for Path MTU discovery (see RFC 1191).

> 2) Can anybody help me how following function works in calcualting checksum?
> static inline int ip_decrease_ttl(struct iphdr *iph)
> {
> 	u32 check = iph->check;
> 	check += __constant_htons(0x0100);
> 	iph->check = check + (check>=0xFFFF);
> 	return --iph->ttl;
> }

This function just decreases the TTL of the IP packet and repairs the 
checksum to be valid even after subtracting 1 from the TTL field.

-- 
JiKos.

--
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