TritonDataCenter / illumos-joyent

Community developed and maintained version of the OS/Net consolidation
http://www.illumos.org/projects/illumos-gate
265 stars 111 forks source link

OS-4525 lxbrand implement getsockopt(TCP_INFO) #459

Closed cneira closed 5 months ago

cneira commented 7 months ago

Hi,

As discussed in the mailing list, this patch adds the TCP_INFO getsockopt to the LX brand. Tests where done in using LX image: 0bf06d4d-b62f-4b3b-b560-3cd258df2070. Applications tested where nginx , iperf and a simple C program exercising this TCP option. I used as reference the notes in https://smartos.org/bugview/OS-4525

Bests

danmcd commented 5 months ago

Oh damn, one last thing... please update your copyrights to 2024.

cneira commented 5 months ago

Found some more nits. Pity LX doesn't have stricter compilation flags; some of this might've been caught. If this was caused by me pressing "update branch", I apologize.

Done

cneira commented 5 months ago

Copyrights updated

cneira commented 5 months ago

You're going to need to put comments on every field from our tcp_t you assign to lx_tcp_info_t in the actual function. I'm seeing enough here to make me scratch my head.

I'll add comments on how I arrived to map those fields and remove the ones that don't have the same meaning as the ones expected by Linux conventions.

danmcd commented 5 months ago

Please make sure you re-run your tests and update any result changes here. Between that and maybe one other reviewer I'll mark IA and pull this in. Thank you for your efforts, time, and patience here.

cneira commented 5 months ago

Please make sure you re-run your tests and update any result changes here. Between that and maybe one other reviewer I'll mark IA and pull this in. Thank you for your efforts, time, and patience here.

Here are the tests I have done after the latest changes :

Linux Branded Zone

test_connect[SUCCESS] TCP state: LX_TCP_ESTABLISHED test_connect[SUCCESS] tcpi_rto 1125000 test_connect[SUCCESS] tcpi_last_data_recv 0 test_connect[SUCCESS] tcpi_rtt 4000000 test_connect[SUCCESS] tcpi_rttvar 500000 test_connect[SUCCESS] tcpi_snd_ssthresh 0 test_connect[SUCCESS] tcpi_snd_cwnd 16360 test_connect[SUCCESS] tcpi_snd_mss 8180 test_connect[SUCCESS] tcpi_unacked -74323462 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 0 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked -74323462 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 1056768 test_connect[SUCCESS]:SOCK_STREAM NOT_CONNECTED TCP state: LX_TCP_ESTABLISHED test_connect[SUCCESS] tcpi_rto 1125000 test_connect[SUCCESS] tcpi_last_data_recv 0 test_connect[SUCCESS] tcpi_rtt 4000000 test_connect[SUCCESS] tcpi_rttvar 500000 test_connect[SUCCESS] tcpi_snd_ssthresh 0 test_connect[SUCCESS] tcpi_snd_cwnd 0 test_connect[SUCCESS] tcpi_snd_mss 536 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 0 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 1048576 test_connect[SUCCESS]:SOCK_STREAM CONNECTED TCP state: LX_TCP_ESTABLISHED test_connect[SUCCESS] tcpi_rto 1125000 test_connect[SUCCESS] tcpi_last_data_recv 0 test_connect[SUCCESS] tcpi_rtt 4000000 test_connect[SUCCESS] tcpi_rttvar 500000 test_connect[SUCCESS] tcpi_snd_ssthresh 0 test_connect[SUCCESS] tcpi_snd_cwnd 16360 test_connect[SUCCESS] tcpi_snd_mss 8180 test_connect[SUCCESS] tcpi_unacked -1767823445 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 0 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked -1767823445 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 1056768 test_bound[SUCCESS] BOUND tcp state: LX_TCP_LISTEN test_bound[SUCCESS] tcpi_rto 1125000 test_bound[SUCCESS] tcpi_last_data_recv 0 test_bound[SUCCESS] tcpi_rtt 4000000 test_bound[SUCCESS] tcpi_rttvar 500000 test_bound[SUCCESS] tcpi_snd_ssthresh 0 test_bound[SUCCESS] tcpi_snd_cwnd 0 test_bound[SUCCESS] tcpi_snd_mss 536 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_pmtu 0 test_bound[SUCCESS] tcpi_total_retrans 0 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_rcv_space 1048576 test_bound[SUCCESS] LISTEN tcp state: LX_TCP_LISTEN test_bound[SUCCESS] tcpi_rto 1125000 test_bound[SUCCESS] tcpi_last_data_recv 0 test_bound[SUCCESS] tcpi_rtt 4000000 test_bound[SUCCESS] tcpi_rttvar 500000 test_bound[SUCCESS] tcpi_snd_ssthresh 0 test_bound[SUCCESS] tcpi_snd_cwnd 0 test_bound[SUCCESS] tcpi_snd_mss 536 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_pmtu 0 test_bound[SUCCESS] tcpi_total_retrans 0 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_rcv_space 1048576

Linux Native VM

test_connect[SUCCESS] TCP state: LX_TCP_ESTABLISHED test_connect[SUCCESS] tcpi_rto 204000 test_connect[SUCCESS] tcpi_last_data_recv 0 test_connect[SUCCESS] tcpi_rtt 50 test_connect[SUCCESS] tcpi_rttvar 25 test_connect[SUCCESS] tcpi_snd_ssthresh 2147483647 test_connect[SUCCESS] tcpi_snd_cwnd 10 test_connect[SUCCESS] tcpi_snd_mss 32732 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 65536 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 65476 test_connect[SUCCESS]:SOCK_STREAM NOT_CONNECTED TCP state: LX_TCP_CLOSE test_connect[SUCCESS] tcpi_rto 1000000 test_connect[SUCCESS] tcpi_last_data_recv 16758308 test_connect[SUCCESS] tcpi_rtt 0 test_connect[SUCCESS] tcpi_rttvar 250000 test_connect[SUCCESS] tcpi_snd_ssthresh 2147483647 test_connect[SUCCESS] tcpi_snd_cwnd 10 test_connect[SUCCESS] tcpi_snd_mss 536 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 0 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 0 test_connect[SUCCESS]:SOCK_STREAM CONNECTED TCP state: LX_TCP_ESTABLISHED test_connect[SUCCESS] tcpi_rto 204000 test_connect[SUCCESS] tcpi_last_data_recv 0 test_connect[SUCCESS] tcpi_rtt 40 test_connect[SUCCESS] tcpi_rttvar 20 test_connect[SUCCESS] tcpi_snd_ssthresh 2147483647 test_connect[SUCCESS] tcpi_snd_cwnd 10 test_connect[SUCCESS] tcpi_snd_mss 32741 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_pmtu 65535 test_connect[SUCCESS] tcpi_total_retrans 0 test_connect[SUCCESS] tcpi_unacked 0 test_connect[SUCCESS] tcpi_sacked 0 test_connect[SUCCESS] tcpi_rcv_space 65495 test_bound[SUCCESS] BOUND tcp state: LX_TCP_CLOSE test_bound[SUCCESS] tcpi_rto 1000000 test_bound[SUCCESS] tcpi_last_data_recv 16758308 test_bound[SUCCESS] tcpi_rtt 0 test_bound[SUCCESS] tcpi_rttvar 250000 test_bound[SUCCESS] tcpi_snd_ssthresh 2147483647 test_bound[SUCCESS] tcpi_snd_cwnd 10 test_bound[SUCCESS] tcpi_snd_mss 536 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_pmtu 0 test_bound[SUCCESS] tcpi_total_retrans 0 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 0 test_bound[SUCCESS] tcpi_rcv_space 0 test_bound[SUCCESS] LISTEN tcp state: LX_TCP_LISTEN test_bound[SUCCESS] tcpi_rto 0 test_bound[SUCCESS] tcpi_last_data_recv 0 test_bound[SUCCESS] tcpi_rtt 0 test_bound[SUCCESS] tcpi_rttvar 0 test_bound[SUCCESS] tcpi_snd_ssthresh 0 test_bound[SUCCESS] tcpi_snd_cwnd 10 test_bound[SUCCESS] tcpi_snd_mss 0 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 10 test_bound[SUCCESS] tcpi_pmtu 0 test_bound[SUCCESS] tcpi_total_retrans 0 test_bound[SUCCESS] tcpi_unacked 0 test_bound[SUCCESS] tcpi_sacked 10 test_bound[SUCCESS] tcpi_rcv_space 0

There are still differences for example in tcpi_unacked we return a negative value, Linux returns 0.