Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle TTL field from IP header. #15

Open
sbernard31 opened this issue Aug 21, 2019 · 3 comments
Open

Handle TTL field from IP header. #15

sbernard31 opened this issue Aug 21, 2019 · 3 comments

Comments

@sbernard31
Copy link
Contributor

The IP header contains a TTL field (see RFC 791):

This field indicates the maximum time the datagram is allowed to
remain in the internet system. If this field contains the value
zero, then the datagram must be destroyed. This field is modified
in internet header processing. The time is measured in units of
seconds, but since every module that processes a datagram must
decrease the TTL by at least one even if it process the datagram in
less than a second, the TTL must be thought of only as an upper
bound on the time a datagram may exist. The intention is to cause
undeliverable datagrams to be discarded, and to bound the maximum
datagram lifetime.

The wikipedia explanation is maybe better :

The time-to-live value can be thought of as an upper bound on the time that an IP datagram can exist in an Internet system. The TTL field is set by the sender of the datagram, and reduced by every router on the route to its destination. If the TTL field reaches zero before the datagram arrives at its destination, then the datagram is discarded and an Internet Control Message Protocol (ICMP) error datagram (11 - Time Exceeded) is sent back to the sender. The purpose of the TTL field is to avoid a situation in which an undeliverable datagram keeps circulating on an Internet system, and such a system eventually becoming swamped by such "immortals".

We can consider sbulb as a router, so If we want to be a good internet citizen we should update TTL field and discard packet if needed. This part should be easy to implement.

About sending an ICMP packet, I don't know if this is easy maybe we can just let the Linux kernel do that ? (return XDP_PASS)

@sbernard31
Copy link
Contributor Author

It seems this is possible to send ICMP packet from XDP, katran seems to do that.

@sbernard31
Copy link
Contributor Author

some example about decrease TTL : https://github.com/torvalds/linux/blob/master/samples/bpf/xdp_fwd_kern.c

@sbernard31
Copy link
Contributor Author

Partially done by #33 but we don't send ICMP packet for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant