This code is based on revision 15 of draft-boucadair-tcpm-rst-diagnostic-payload.
Right now, only the IPPROTO_TCP-level socket option with name TCP_RST_REASON_CODE is implemented.
It is planned to implement also the socket option with name TCP_RST_REASON_CODE, but it is NOT planned to implement the socket option with name TCP_RST_REASON_DESC.
Details
- Use {F145514417} and {F145514426} in combination with {F145514432}.
- Extend packetdrill to support these socket options and write tests.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Allow socket option processing on inps with the INP_DROPPED flag set only for getsockopt() of the IPPROTO_TCP-level socket option with name TCP_RST_REASON_CODE, as glebius suggested.
Fix sender side stats counter and teach netstat how to print the stats counters added in this patch.
Update names of structure and provide a way that setsocktion SO_LINGER is not required anymore.
| sys/netinet/tcp_output.c | ||
|---|---|---|
| 1336 | Let's use char * cast here. | |
| sys/netinet/tcp_var.h | ||
| 484–487 | tcpcb is a mix of members prefixed with t_ and non-prefixed. Neither is great, imho. May be using a meaningful prefix for new members that are dedicated for a certain facility is going to be better? For these new I can suggest: /* draft-rst-reason/RFCXXXX support */ uint16_t trr_snd_code; /* Reason code to be sent in RST */ uint16_t trr_rcv_code; /* Reason code received in RST */ uint32_t trr_snd_pen; /* PEN to be sent in RST */ uint32_t trr_rcv_pen; /* PEN received in RST */ Just suggesting, not insisting at all. | |
| sys/netinet/tcp_output.c | ||
|---|---|---|
| 1336 |
Willing to do that, but I have chosen caddr_t since it is used in line 1181, 1166 and other places in the file. I wanted to be consistent. | |
| sys/netinet/tcp_var.h | ||
| 484–487 | Done. I like that. Thanks for suggesting. | |
| sys/netinet/tcp_output.c | ||
|---|---|---|
| 207 | IMHO, would be better to declare *dp in the only small block of code, where it is used. The top level declarations are no longer dictated by the style(9), thanks. Same suggestion applies to rack_output(). | |
| sys/netinet/tcp_output.c | ||
|---|---|---|
| 1336 | caddr_t is a pre-C89 type invented for the lack of void * [1]. We should avoid it in any new code resorting only when there is a documented prototype, that we should match, e.g. ioctl handlers. In this particular case we want to achieve pointer arithmetic where pointed type is sized by one byte. This doesn't even match original purpose of caddr_t. Any reader of the code without historical context will be puzzled to read this line and won't be able to answer right away the question of "how much do we actually add here with + optlen?". Contrary, with (char *) cast any reader coming from Linux, Windows or any other world will right away read the line of code and understand what it does. [1] In the past I had always had a hard time proving the point. Now, thanks to LLM it is easier. Took LLM 2 minutes to come up with the summary and all links: https://grok.com/share/c2hhcmQtMg_de591786-ba8b-4215-a4a3-d665de24d727 | |