netdev
[Top] [All Lists]

checksum calculation in ip packet forwarding

To: netdev@xxxxxxxxxxx
Subject: checksum calculation in ip packet forwarding
From: cranium 2003 <cranium.2003@xxxxxxxxx>
Date: Sun, 30 Jan 2005 18:39:07 +0530
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=of8VBwaY6S/BcoEOCjp+hpI7jHiIHevydhdFbTeeaFPnG5/5N6YJijRID9Ph9UUQhvYh3DyftS4W/HJNlu2KlTuYjFkSqo8oViF3cSuW4VH5BKjpWE1ybbLOFDAGbGpH3lagRG2ZFPDwT0mTGoqqWEaj2hiYb1uHoUcWGaKGgtc=
Reply-to: cranium 2003 <cranium.2003@xxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
Hello,
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?
static inline int ip_send(struct sk_buff *skb)
{
        if (skb->len > skb->dst->pmtu)
                return ip_fragment(skb, ip_finish_output);
        else
                return ip_finish_output(skb);
}

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;
}
regards,
cranium

<Prev in Thread] Current Thread [Next in Thread>
  • checksum calculation in ip packet forwarding, cranium 2003 <=