capsule-rs / capsule-rs/capsule

Add support for variable TCP-header options

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
443
Forks
42
PR merge metrics
No merged PRs in 30d

Description

## Background

As per [IETF RFC #793](https://tools.ietf.org/html/rfc793#section-3.1)'s *Options* field:

> Options may occupy space at the end of the TCP header and are a multiple of 8 bits in length. All options are included in the checksum. An option may begin on any octet boundary. There are two cases for the format of an option:
> * Case 1: A single octet of option-kind.
> * Case 2: An octet of option-kind, an octet of option-length, and the actual option-data octets.
>
> The option-length counts the two octets of option-kind and option-length as well as the option-data octets.
>
> Note that the list of options may be shorter than the data offset field might imply. The content of the header beyond the End-of-Option option must be header padding (i.e., zero).

> Currently defined options include (kind indicated in octal):

> | Kind | Length | Meaning |
> | -----|:-------:| -----:|
> | 0 | - | End of option list |
> | 1 | - | No-Operation |
> | 2 | 4 | Maximum Segment Size |

More about these definitions can be found in the spec linked.

Currently, we've left this as a [*TODO*](https://github.com/capsule-rs/capsule/blob/master/core/src/packets/tcp.rs#L179) in working with the data offset portion of the TCP header.

## Solution?

In dealing with parsing dynamic options, we've done similar work w/ [NDP options](https://github.com/capsule-rs/capsule/blob/426670213b6259ac1fd774023f7919437baa21f0/core/src/packets/icmp/v6/ndp/options/mod.rs), but we need to figure out what the best fit is here for handling these specific options from the spec.

Contributor guide

Open the contributing guide

Research direction

Start in core/src/packets/tcp.rs at the TODO around the data-offset handling, then compare the dynamic parsing approach in core/src/packets/icmp/v6/ndp/options/mod.rs. Use RFC 793 to define the supported TCP option forms and padding behavior; done means variable-length options are parsed consistently with the header's data offset.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
networking
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.