Remix.run Logo
fc417fc802 4 days ago

What is the reasoning behind TTL counting down instead of up, anyway? Wouldn't we generally expect those routing the traffic to determine if and how to do so?

therealcamino 3 days ago | parent | next [-]

To allow the sender to set the TTL, right? Without adding another field to the packet header.

If you count up from zero, then you'd also have to include in every packet how high it can go, so that a router has enough info to decide if the packet is still live. Otherwise every connection in the network would have to share the same fixed TTL, or obey the TTL set in whatever random routers it goes through. If you count down, you're always checking against zero.

sadjad 4 days ago | parent | prev | next [-]

The primary purpose of TTL is to prevent packets from looping endlessly during routing. If a packet gets stuck in a loop, its TTL will eventually reach zero, and then it will be dropped.

fc417fc802 4 days ago | parent [-]

That doesn't answer my question. If it counted up then it would be up to each hop to set its own policy. Things wouldn't loop endlessly in that scenario either.

ryao 3 days ago | parent | next [-]

Then random internet routers could break internet traffic by setting it really low and the user could not do a thing about it. They technically still can by discarding all traffic whose value is less than some value, but they don’t. The idea that they should set their own policy could fundamentally break network traffic flows if it ever became practiced.

burnished 4 days ago | parent | prev | next [-]

This is a wild guess but: I am under the impression that the early internet was built somewhat naively so I guess that the sender sets it because they know best how long it stays relevant for/when it makes sense to restart or fail rather than wait.

knome 4 days ago | parent | prev [-]

It does make traceroute, where each packet is fired with one more available step than the last, feasible, whereas 'up' wouldn't. Of course, then we'd just start with max-hops and walk the number down I suppose. I still expect it would be inconvenient during debugging for various devices to have various ceilings.

ryao 3 days ago | parent | prev [-]

If your doctor says you have only 128 days to live, you count down, not up. TTL is time to live, which is the same thing.

kevindamm 3 days ago | parent [-]

Although, more accurately it's like "transmissions to live" since it doesn't have anything to do with time, regardless of its original naming.