Subject: Re: [PATCH] ipv4/ipv6: check hop limit field on input

From: Nicolas Dichtel <[email-masked]>
Date: Tue, 02 Jun 2009 11:30:08 +0200

Florian Westphal wrote:
> Nicolas Dichtel <[email-masked]> wrote:
>>> Whats wrong with the checks in ip(6)_forward?
>> It's on forward, not on input. Router must not process it.
>> For example, if you try to ping (with ttl set to 0) the router, you will 
>> receive a reply.
> 
> Ah.  That makes more sense.
> However, I'd argue that this is sane behaviour.
> 
> The datagram did reach its intended destination and the TTL did not
> "exceed in transit" (if it had, the datagram would not have been
> received).  Why discard an otherwise perfectly legal packet?
Because RFC requires this:

RFC792 Page 6:
   If the gateway processing a datagram finds the time to live field
   is zero it must discard the datagram.  The gateway may also notify
   the source host via the time exceeded message.

RFC4443 Section 3.3:
    If a router receives a packet with a Hop Limit of zero, or if a
    router decrements a packet's Hop Limit to zero, it MUST discard the
    packet and originate an ICMPv6 Time Exceeded message with Code 0 to
    the source of the packet.

Nicolas